[SSK] Migrating changes from obsolete SSK repo.
// FREEBIE
This commit is contained in:
parent
14621e1288
commit
4f5b2993b0
|
@ -124,7 +124,7 @@ EXTERNAL SOURCES:
|
|||
:branch: signal-master
|
||||
:git: https://github.com/WhisperSystems/JSQMessagesViewController.git
|
||||
SignalServiceKit:
|
||||
:path: "."
|
||||
:path: .
|
||||
SocketRocket:
|
||||
:git: https://github.com/facebook/SocketRocket.git
|
||||
|
||||
|
|
|
@ -350,6 +350,7 @@ static const CGFloat kSignedPreKeyUpdateFailureMaxFailureDuration = 10 * 24 * 60
|
|||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
dateFormatter.dateStyle = NSDateFormatterMediumStyle;
|
||||
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
|
||||
dateFormatter.locale = [NSLocale systemLocale];
|
||||
|
||||
// Sort the signed prekeys in ascending order of generation time.
|
||||
oldSignedPrekeys = [oldSignedPrekeys sortedArrayUsingComparator:^NSComparisonResult(
|
||||
|
|
|
@ -70,60 +70,61 @@ const uint32_t OWSDisappearingMessagesConfigurationDefaultExpirationDuration = 6
|
|||
uint32_t secondsPerWeek = secondsPerDay * 7;
|
||||
|
||||
if (durationSeconds < secondsPerMinute) { // XX Seconds
|
||||
amountFormat = NSLocalizedString(@"SECONDS_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SECONDS",
|
||||
@"{{number of seconds}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{5 seconds}}'. See other *_TIME_AMOUNT strings");
|
||||
duration = durationSeconds;
|
||||
} else if (durationSeconds < secondsPerMinute * 1.5) { // 1 Minute
|
||||
amountFormat = NSLocalizedString(@"SINGLE_MINUTE_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_MINUTE",
|
||||
@"{{1 minute}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{1 minute}}'. See other *_TIME_AMOUNT strings");
|
||||
duration = durationSeconds / secondsPerMinute;
|
||||
} else if (durationSeconds < secondsPerHour) { // Multiple Minutes
|
||||
amountFormat = NSLocalizedString(@"MINUTES_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_MINUTES",
|
||||
@"{{number of minutes}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{5 minutes}}'. See other *_TIME_AMOUNT strings");
|
||||
|
||||
duration = durationSeconds / secondsPerMinute;
|
||||
} else if (durationSeconds < secondsPerHour * 1.5) { // 1 Hour
|
||||
amountFormat = NSLocalizedString(@"SINGLE_HOUR_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_HOUR",
|
||||
@"{{1 hour}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{1 hour}}'. See other *_TIME_AMOUNT strings");
|
||||
|
||||
duration = durationSeconds / secondsPerHour;
|
||||
} else if (durationSeconds < secondsPerDay) { // Multiple Hours
|
||||
amountFormat = NSLocalizedString(@"HOURS_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_HOURS",
|
||||
@"{{number of hours}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{5 hours}}'. See other *_TIME_AMOUNT strings");
|
||||
|
||||
duration = durationSeconds / secondsPerHour;
|
||||
} else if (durationSeconds < secondsPerDay * 1.5) { // 1 Day
|
||||
amountFormat = NSLocalizedString(@"SINGLE_DAY_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_DAY",
|
||||
@"{{1 day}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{1 day}}'. See other *_TIME_AMOUNT strings");
|
||||
|
||||
duration = durationSeconds / secondsPerDay;
|
||||
} else if (durationSeconds < secondsPerWeek) { // Multiple Days
|
||||
amountFormat = NSLocalizedString(@"DAYS_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_DAYS",
|
||||
@"{{number of days}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{5 days}}'. See other *_TIME_AMOUNT strings");
|
||||
|
||||
duration = durationSeconds / secondsPerDay;
|
||||
} else if (durationSeconds < secondsPerWeek * 1.5) { // 1 Week
|
||||
amountFormat = NSLocalizedString(@"SINGLE_WEEK_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_WEEK",
|
||||
@"{{1 week}} embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{1 week}}'. See other *_TIME_AMOUNT strings");
|
||||
|
||||
duration = durationSeconds / secondsPerWeek;
|
||||
} else { // Multiple weeks
|
||||
amountFormat = NSLocalizedString(@"WEEKS_TIME_AMOUNT",
|
||||
amountFormat = NSLocalizedString(@"TIME_AMOUNT_WEEKS",
|
||||
@"{{number of weeks}}, embedded in strings, e.g. 'Alice updated disappearing messages "
|
||||
@"expiration to {{5 weeks}}'. See other *_TIME_AMOUNT strings");
|
||||
|
||||
duration = durationSeconds / secondsPerWeek;
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:amountFormat, duration];
|
||||
return [NSString stringWithFormat:amountFormat, [NSNumberFormatter localizedStringFromNumber:@(duration)
|
||||
numberStyle:NSNumberFormatterNoStyle]];
|
||||
}
|
||||
|
||||
+ (NSArray<NSNumber *> *)validDurationsSeconds
|
||||
|
|
|
@ -409,10 +409,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
// Ignore "invalid audio file" errors.
|
||||
return 0.f;
|
||||
}
|
||||
OWSAssert(!error);
|
||||
if (!error) {
|
||||
return (CGFloat)[audioPlayer duration];
|
||||
} else {
|
||||
OWSFail(@"Could not find audio duration: %@", self.mediaURL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
#pragma mark Utility Method
|
||||
|
||||
+ (NSString *)stringFromTimeStamp:(uint64_t)timestamp;
|
||||
+ (uint64_t)timeStampFromString:(NSString *)string;
|
||||
|
||||
+ (instancetype)interactionForTimestamp:(uint64_t)timestamp
|
||||
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
|
|
|
@ -72,17 +72,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self.timestamp;
|
||||
}
|
||||
|
||||
+ (NSString *)stringFromTimeStamp:(uint64_t)timestamp {
|
||||
return [[NSNumber numberWithUnsignedLongLong:timestamp] stringValue];
|
||||
}
|
||||
|
||||
+ (uint64_t)timeStampFromString:(NSString *)string {
|
||||
NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
|
||||
[f setNumberStyle:NSNumberFormatterNoStyle];
|
||||
NSNumber *myNumber = [f numberFromString:string];
|
||||
return [myNumber unsignedLongLongValue];
|
||||
}
|
||||
|
||||
- (NSDate *)dateForSorting
|
||||
{
|
||||
return [NSDate ows_dateWithMillisecondsSince1970:self.timestampForSorting];
|
||||
|
|
|
@ -327,6 +327,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSDateFormatter *dateFormatter = [NSDateFormatter new];
|
||||
dateFormatter.dateStyle = NSDateFormatterNoStyle;
|
||||
dateFormatter.timeStyle = kCFDateFormatterMediumStyle;
|
||||
dateFormatter.locale = [NSLocale systemLocale];
|
||||
|
||||
// Don't run more often than once per second.
|
||||
const NSTimeInterval kMinDelaySeconds = ignoreMinDelay ? 0.f : 1.f;
|
||||
|
|
Loading…
Reference in New Issue