Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
Should fix - Sync has got stuck while the app was backgrounded
Browse files Browse the repository at this point in the history
element-hq/element-ios#506

According to the logs (attached to the emailed report), the applicationDidEnterBackground was ignored during the session state handling. The session was running whereas the app was backgrounded.
  • Loading branch information
giomfo committed Aug 25, 2016
1 parent 6dac73d commit bf09b55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MatrixKit/Models/Account/MXKAccount.m
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,9 @@ - (void)pauseInBackgroundTask
[initialServerSyncTimer invalidate];
initialServerSyncTimer = nil;

if (mxSession.state == MXSessionStateSyncInProgress)
if (mxSession.state == MXSessionStateSyncInProgress || mxSession.state == MXSessionStateInitialised || mxSession.state == MXSessionStateStoreDataReady)
{
NSLog(@"[MXKAccount] Pause is delayed at the end of sync (current state %tu)", mxSession.state);
isPauseRequested = YES;
}
}
Expand Down Expand Up @@ -984,6 +985,7 @@ - (void)onMatrixSessionStateChange
// Check if pause has been requested
if (isPauseRequested)
{
NSLog(@"[MXKAccount] Apply the pending pause.");
[self pauseInBackgroundTask];
return;
}
Expand Down

0 comments on commit bf09b55

Please # to comment.