Console: BugFix in Settings - Restore correctly user's display name after cache clearing.

This commit is contained in:
giomfo 2015-02-12 14:39:08 +01:00
parent 23f80689ff
commit b810d71c89
4 changed files with 10 additions and 5 deletions

View file

@ -22,7 +22,7 @@ typedef enum : NSUInteger {
MatrixSDKHandlerStatusLoggedOut = 0,
MatrixSDKHandlerStatusLogged,
MatrixSDKHandlerStatusStoreDataReady,
MatrixSDKHandlerStatusServerSyncInProgress,
MatrixSDKHandlerStatusInitialServerSyncInProgress,
MatrixSDKHandlerStatusServerSyncDone,
MatrixSDKHandlerStatusPaused
} MatrixSDKHandlerStatus;

View file

@ -186,7 +186,7 @@ static MatrixSDKHandler *sharedHandler = nil;
}
// Launch mxSession
self.status = MatrixSDKHandlerStatusServerSyncInProgress;
self.status = MatrixSDKHandlerStatusInitialServerSyncInProgress;
[self.mxSession start:^{
self.status = MatrixSDKHandlerStatusServerSyncDone;
[self setUserPresence:MXPresenceOnline andStatusMessage:nil completion:nil];
@ -458,7 +458,7 @@ static MatrixSDKHandler *sharedHandler = nil;
break;
}
case MatrixSDKHandlerStatusLogged:
case MatrixSDKHandlerStatusServerSyncInProgress: {
case MatrixSDKHandlerStatusInitialServerSyncInProgress: {
self.isActivityInProgress = YES;
break;
}

View file

@ -222,7 +222,7 @@
if (mxHandler.mxSession) {
// Check matrix handler status
if (mxHandler.status == MatrixSDKHandlerStatusStoreDataReady || mxHandler.status == MatrixSDKHandlerStatusServerSyncInProgress) {
if (mxHandler.status == MatrixSDKHandlerStatusStoreDataReady || mxHandler.status == MatrixSDKHandlerStatusInitialServerSyncInProgress) {
// Server sync is not complete yet
if (!recents) {
// Retrieve recents from local storage (some data may not be up-to-date)

View file

@ -350,7 +350,12 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
// TODO display user's presence
}];
}
} else if (mxHandler.status == MatrixSDKHandlerStatusStoreDataReady || mxHandler.status == MatrixSDKHandlerStatusServerSyncInProgress) {
} else if (mxHandler.status == MatrixSDKHandlerStatusStoreDataReady || mxHandler.status == MatrixSDKHandlerStatusInitialServerSyncInProgress) {
// Remove listener (if any), this action is required to handle correctly matrix sdk handler reload (see clear cache)
if (userUpdateListener) {
[mxHandler.mxSession.myUser removeListener:userUpdateListener];
userUpdateListener = nil;
}
// Set local user's information (the data may not be up-to-date)
[self updateUserPicture:mxHandler.mxSession.myUser.avatarUrl force:NO];
currentDisplayName = mxHandler.mxSession.myUser.displayname;