diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 933bd08bf..189d8069b 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -38,7 +38,7 @@ CFBundleVersion - 2.28.1.1 + 2.28.1.5 ITSAppUsesNonExemptEncryption LOGS_EMAIL diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 4d0fe7a37..8d0be3f44 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -814,6 +814,7 @@ typedef enum : NSUInteger { { // Avoid layout corrupt issues and out-of-date message subtitles. self.lastReloadDate = [NSDate new]; + self.collapseCutoffDate = [NSDate new]; [self reloadViewItems]; [self.collectionView.collectionViewLayout invalidateLayout]; [self.collectionView reloadData]; @@ -1770,6 +1771,7 @@ typedef enum : NSUInteger { [self.messageMappings setRangeOptions:rangeOptions forGroup:self.thread.uniqueId]; [self updateShowLoadMoreHeader]; + self.collapseCutoffDate = [NSDate new]; [self reloadViewItems]; } @@ -4801,6 +4803,7 @@ typedef enum : NSUInteger { }]; [self updateMessageMappingRangeOptions]; } + self.collapseCutoffDate = [NSDate new]; [self reloadViewItems]; [self resetContentAndLayout]; @@ -4838,8 +4841,6 @@ typedef enum : NSUInteger { // cell view models. - (void)reloadViewItems { - self.collapseCutoffDate = [NSDate new]; - NSMutableArray *viewItems = [NSMutableArray new]; NSMutableDictionary *viewItemCache = [NSMutableDictionary new]; diff --git a/Signal/src/util/MainAppContext.m b/Signal/src/util/MainAppContext.m index 03d0e61bb..90c51faab 100644 --- a/Signal/src/util/MainAppContext.m +++ b/Signal/src/util/MainAppContext.m @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation MainAppContext @synthesize mainWindow = _mainWindow; +@synthesize appLaunchTime = _appLaunchTime; - (instancetype)init { @@ -36,6 +37,8 @@ NS_ASSUME_NONNULL_BEGIN self.reportedApplicationState = UIApplicationStateInactive; + _appLaunchTime = [NSDate new]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification diff --git a/SignalServiceKit/src/Messages/OWSIncompleteCallsJob.m b/SignalServiceKit/src/Messages/OWSIncompleteCallsJob.m index 5592bf8d1..3d9ce0d92 100644 --- a/SignalServiceKit/src/Messages/OWSIncompleteCallsJob.m +++ b/SignalServiceKit/src/Messages/OWSIncompleteCallsJob.m @@ -3,6 +3,8 @@ // #import "OWSIncompleteCallsJob.h" +#import "AppContext.h" +#import "NSDate+OWS.h" #import "OWSPrimaryStorage.h" #import "TSCall.h" #import @@ -78,9 +80,17 @@ static NSString *const OWSIncompleteCallsJobCallTypeIndex = @"index_calls_on_cal { __block uint count = 0; + OWSAssert(CurrentAppContext().appLaunchTime); + uint64_t cutoffTimestamp = [NSDate ows_millisecondsSince1970ForDate:CurrentAppContext().appLaunchTime]; + [[self.primaryStorage newDatabaseConnection] readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [self enumerateIncompleteCallsWithBlock:^(TSCall *call) { + if (call.timestamp <= cutoffTimestamp) { + DDLogInfo(@"%@ ignoring new call: %@", self.logTag, call.uniqueId); + return; + } + if (call.callType == RPRecentCallTypeOutgoingIncomplete) { DDLogDebug(@"%@ marking call as missed: %@", self.logTag, call.uniqueId); [call updateCallType:RPRecentCallTypeOutgoingMissed transaction:transaction]; @@ -99,7 +109,7 @@ static NSString *const OWSIncompleteCallsJobCallTypeIndex = @"index_calls_on_cal transaction:transaction]; }]; - DDLogDebug(@"%@ Marked %u calls as missed", self.logTag, count); + DDLogInfo(@"%@ Marked %u calls as missed", self.logTag, count); } #pragma mark - YapDatabaseExtension diff --git a/SignalServiceKit/src/Util/AppContext.h b/SignalServiceKit/src/Util/AppContext.h index 6ec9baa26..43a111d55 100755 --- a/SignalServiceKit/src/Util/AppContext.h +++ b/SignalServiceKit/src/Util/AppContext.h @@ -94,6 +94,8 @@ NSString *NSStringForUIApplicationState(UIApplicationState value); - (void)runNowOrWhenMainAppIsActive:(AppActiveBlock)block; +@property (atomic, readonly) NSDate *appLaunchTime; + @end id CurrentAppContext(void); diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index aa027eadc..cc5fdfd3c 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 2.28.1 CFBundleVersion - 2.28.1.1 + 2.28.1.5 ITSAppUsesNonExemptEncryption NSAppTransportSecurity diff --git a/SignalShareExtension/utils/ShareAppExtensionContext.m b/SignalShareExtension/utils/ShareAppExtensionContext.m index 0fcf69175..92ea28980 100644 --- a/SignalShareExtension/utils/ShareAppExtensionContext.m +++ b/SignalShareExtension/utils/ShareAppExtensionContext.m @@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation ShareAppExtensionContext @synthesize mainWindow = _mainWindow; +@synthesize appLaunchTime = _appLaunchTime; - (instancetype)initWithRootViewController:(UIViewController *)rootViewController { @@ -36,6 +37,8 @@ NS_ASSUME_NONNULL_BEGIN self.reportedApplicationState = UIApplicationStateActive; + _appLaunchTime = [NSDate new]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(extensionHostDidBecomeActive:) name:NSExtensionHostDidBecomeActiveNotification