fix "last active" date

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent 5372173c4a
commit be0556f68a

@ -38,7 +38,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2.5.0.17</string>
<string>2.5.0.18</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LOGS_EMAIL</key>

@ -18,8 +18,19 @@ NS_ASSUME_NONNULL_BEGIN
NSString *lastSeenFormatString = NSLocalizedString(
@"DEVICE_LAST_ACTIVE_AT_LABEL", @"{{Short Date}} when device last communicated with Signal Server.");
NSDate *displayedLastSeenAt;
// lastSeenAt is stored at day granularity. At midnight UTC.
// Making it likely that when you first link a device it will
// be "last seen" the day before it was created, which looks broken.
if ([device.lastSeenAt compare:device.createdAt] == NSOrderedDescending) {
displayedLastSeenAt = device.lastSeenAt;
} else {
displayedLastSeenAt = device.createdAt;
}
self.lastSeenLabel.text =
[NSString stringWithFormat:lastSeenFormatString, [DateUtil.dateFormatter stringFromDate:device.createdAt]];
[NSString stringWithFormat:lastSeenFormatString, [DateUtil.dateFormatter stringFromDate:displayedLastSeenAt]];
}
@end

Loading…
Cancel
Save