mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Merge pull request #4802 from vector-im/ismail/4801_clear_cache_spinner
Wait for sync response when clearing cache
This commit is contained in:
commit
53aeb8c378
4 changed files with 22 additions and 20 deletions
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
1
changelog.d/4801.bugfix
Normal file
1
changelog.d/4801.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
AppDelegate: Wait for sync response when clearing cache.
|
Loading…
Reference in a new issue