diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index 1b06d8cbe..2a2226650 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -241,21 +241,6 @@ UINavigationControllerDelegate */ - (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL; -#pragma mark - Jitsi call - -/** - Open the Jitsi view controller from a widget. - - @param jitsiWidget the jitsi widget. - @param video to indicate voice or video call. - */ -- (void)displayJitsiViewControllerWithWidget:(Widget*)jitsiWidget andVideo:(BOOL)video; - -/** - The current Jitsi view controller being displayed. - */ -@property (nonatomic, readonly) JitsiViewController *jitsiViewController; - #pragma mark - App version management /** diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 478c0bc7c..f53cd4373 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -234,6 +234,11 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni */ @property (nonatomic, assign, getter=isRoomListDataReady) BOOL roomListDataReady; +/** + Flag to indicate whether a cache clear is being performed. + */ +@property (nonatomic, assign, getter=isClearingCache) BOOL clearingCache; + @end @implementation LegacyAppDelegate @@ -378,6 +383,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni MXLogDebug(@"[AppDelegate] didFinishLaunchingWithOptions: isProtectedDataAvailable: %@", @([application isProtectedDataAvailable])); _configuration = [AppConfiguration new]; + self.clearingCache = NO; // Log app information NSString *appDisplayName = self.appInfo.displayName; @@ -2045,6 +2051,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (clearCache) { + self.clearingCache = YES; [self clearCache]; } } @@ -2233,6 +2240,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { case MXSessionStateClosed: case MXSessionStateInitialised: + case MXSessionStateBackgroundSyncInProgress: + self.roomListDataReady = NO; isLaunching = YES; break; case MXSessionStateStoreDataReady: @@ -2245,6 +2254,10 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [mainSession.crypto setOutgoingKeyRequestsEnabled:NO onComplete:nil]; } break; + case MXSessionStateRunning: + self.clearingCache = NO; + isLaunching = NO; + break; default: isLaunching = NO; break; @@ -2260,6 +2273,12 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni return; } + if (self.isClearingCache) + { + // wait for another session state change to check room list data is ready + return; + } + [self ensureRoomListDataReadyWithCompletion:^{ [self hideLaunchAnimation]; diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 5e1bbf95e..941aed1ac 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -977,11 +977,8 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro if (dataSource.state == MXKDataSourceStateReady) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:RecentsViewControllerDataReadyNotification - object:self]; - }); + [[NSNotificationCenter defaultCenter] postNotificationName:RecentsViewControllerDataReadyNotification + object:self]; } } diff --git a/changelog.d/4801.bugfix b/changelog.d/4801.bugfix new file mode 100644 index 000000000..cb6452009 --- /dev/null +++ b/changelog.d/4801.bugfix @@ -0,0 +1 @@ +AppDelegate: Wait for sync response when clearing cache.