diff --git a/matrixConsole/matrixConsole.xcodeproj/project.pbxproj b/matrixConsole/matrixConsole.xcodeproj/project.pbxproj index 861427540..57e26a209 100644 --- a/matrixConsole/matrixConsole.xcodeproj/project.pbxproj +++ b/matrixConsole/matrixConsole.xcodeproj/project.pbxproj @@ -44,11 +44,11 @@ F0465AFA1A251F85003639F9 /* RoomMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = F0465AF91A251F85003639F9 /* RoomMessage.m */; }; F04A8AD81A3B3DF4008AC915 /* RoomTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = F04A8AD71A3B3DF4008AC915 /* RoomTitleView.m */; }; F052377C1A7289F00079F3E0 /* APNSHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F05237791A7289F00079F3E0 /* APNSHandler.m */; }; - F052377D1A7289F00079F3E0 /* MatrixHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F052377B1A7289F00079F3E0 /* MatrixHandler.m */; }; F05237801A728A010079F3E0 /* MXCAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = F052377F1A728A010079F3E0 /* MXCAlert.m */; }; F05237831A728A0A0079F3E0 /* MXCGrowingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = F05237821A728A0A0079F3E0 /* MXCGrowingTextView.m */; }; F05C3A3E1A3F3D7F002B698E /* icon_users.png in Resources */ = {isa = PBXBuildFile; fileRef = F05C3A3C1A3F3D7F002B698E /* icon_users.png */; }; F05C3A3F1A3F3D7F002B698E /* icon_users@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F05C3A3D1A3F3D7F002B698E /* icon_users@2x.png */; }; + F077E6491A72966F008D5AD5 /* MatrixSDKHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F077E6481A72966F008D5AD5 /* MatrixSDKHandler.m */; }; F07A80D819DD9DE700B621A1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F07A80D719DD9DE700B621A1 /* main.m */; }; F07A80DB19DD9DE700B621A1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F07A80DA19DD9DE700B621A1 /* AppDelegate.m */; }; F07A80E419DD9DE700B621A1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F07A80E219DD9DE700B621A1 /* Main.storyboard */; }; @@ -145,14 +145,14 @@ F04A8AD71A3B3DF4008AC915 /* RoomTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomTitleView.m; sourceTree = ""; }; F05237781A7289F00079F3E0 /* APNSHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APNSHandler.h; sourceTree = ""; }; F05237791A7289F00079F3E0 /* APNSHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APNSHandler.m; sourceTree = ""; }; - F052377A1A7289F00079F3E0 /* MatrixHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatrixHandler.h; sourceTree = ""; }; - F052377B1A7289F00079F3E0 /* MatrixHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MatrixHandler.m; sourceTree = ""; }; F052377E1A728A010079F3E0 /* MXCAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCAlert.h; sourceTree = ""; }; F052377F1A728A010079F3E0 /* MXCAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCAlert.m; sourceTree = ""; }; F05237811A728A0A0079F3E0 /* MXCGrowingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCGrowingTextView.h; sourceTree = ""; }; F05237821A728A0A0079F3E0 /* MXCGrowingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCGrowingTextView.m; sourceTree = ""; }; F05C3A3C1A3F3D7F002B698E /* icon_users.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_users.png; sourceTree = ""; }; F05C3A3D1A3F3D7F002B698E /* icon_users@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_users@2x.png"; sourceTree = ""; }; + F077E6471A72966F008D5AD5 /* MatrixSDKHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatrixSDKHandler.h; sourceTree = ""; }; + F077E6481A72966F008D5AD5 /* MatrixSDKHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MatrixSDKHandler.m; sourceTree = ""; }; F07A80D219DD9DE700B621A1 /* matrixConsole.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = matrixConsole.app; sourceTree = BUILT_PRODUCTS_DIR; }; F07A80D619DD9DE700B621A1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; F07A80D719DD9DE700B621A1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -246,12 +246,12 @@ F021FBEC1A5EF57300EA3AE6 /* API */ = { isa = PBXGroup; children = ( + F077E6471A72966F008D5AD5 /* MatrixSDKHandler.h */, + F077E6481A72966F008D5AD5 /* MatrixSDKHandler.m */, F05237781A7289F00079F3E0 /* APNSHandler.h */, F05237791A7289F00079F3E0 /* APNSHandler.m */, 71193D391A6E50EC00E59A9E /* ContactManager.h */, 71193D3A1A6E50EC00E59A9E /* ContactManager.m */, - F052377A1A7289F00079F3E0 /* MatrixHandler.h */, - F052377B1A7289F00079F3E0 /* MatrixHandler.m */, F021FBED1A5EF57300EA3AE6 /* MediaLoader.h */, F021FBEE1A5EF57300EA3AE6 /* MediaLoader.m */, F021FBF01A5F1F8E00EA3AE6 /* MediaManager.h */, @@ -560,8 +560,8 @@ F052377C1A7289F00079F3E0 /* APNSHandler.m in Sources */, F03EF5FF19F1762000A0EE52 /* RoomMessageTableCell.m in Sources */, F07A80D819DD9DE700B621A1 /* main.m in Sources */, - F052377D1A7289F00079F3E0 /* MatrixHandler.m in Sources */, 71193D371A6E49F000E59A9E /* MXCEmail.m in Sources */, + F077E6491A72966F008D5AD5 /* MatrixSDKHandler.m in Sources */, 71193D3E1A6E61AD00E59A9E /* SectionedContacts.m in Sources */, F021FBEF1A5EF57300EA3AE6 /* MediaLoader.m in Sources */, F03EF5FB19F171EB00A0EE52 /* SettingsViewController.m in Sources */, diff --git a/matrixConsole/matrixConsole/API/APNSHandler.m b/matrixConsole/matrixConsole/API/APNSHandler.m index 59ed7575b..62811febe 100644 --- a/matrixConsole/matrixConsole/API/APNSHandler.m +++ b/matrixConsole/matrixConsole/API/APNSHandler.m @@ -16,7 +16,7 @@ #import "APNSHandler.h" #import "AppDelegate.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" NSString *const kAPNSHandlerHasBeenUpdated = @"kAPNSHandlerHasBeenUpdated"; @@ -91,7 +91,7 @@ static APNSHandler *sharedHandler = nil; - (void)setIsActive:(BOOL)isActive { // Refuse to try & turn push on if we're not logged in, it's nonsensical. - if ([MatrixHandler sharedHandler].status == MatrixHandlerStatusLoggedOut) { + if ([MatrixSDKHandler sharedHandler].status == MatrixSDKHandlerStatusLoggedOut) { NSLog(@"Not logged in: not setting push token because we're not logged in"); return; } diff --git a/matrixConsole/matrixConsole/API/ContactManager.m b/matrixConsole/matrixConsole/API/ContactManager.m index 6d740f5a7..109999ebf 100644 --- a/matrixConsole/matrixConsole/API/ContactManager.m +++ b/matrixConsole/matrixConsole/API/ContactManager.m @@ -20,7 +20,7 @@ #import "MXCPhoneNumber.h" #import "MXCEmail.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" // warn when there is a contacts list refresh NSString *const kContactManagerRefreshNotification = @"kContactManagerRefreshNotification"; @@ -155,7 +155,7 @@ static ContactManager* sharedContactManager = nil; // get some pids if (pids.count > 0) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; if (mxHandler.mxRestClient) { [mxHandler.mxRestClient lookup3pids:pids @@ -193,7 +193,7 @@ static ContactManager* sharedContactManager = nil; } // check if the some room users are not defined in the local contacts book - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // check if the user is already known NSArray* users = [mxHandler.mxSession users]; diff --git a/matrixConsole/matrixConsole/API/MatrixHandler.h b/matrixConsole/matrixConsole/API/MatrixSDKHandler.h similarity index 89% rename from matrixConsole/matrixConsole/API/MatrixHandler.h rename to matrixConsole/matrixConsole/API/MatrixSDKHandler.h index d7317f672..555e508b3 100644 --- a/matrixConsole/matrixConsole/API/MatrixHandler.h +++ b/matrixConsole/matrixConsole/API/MatrixSDKHandler.h @@ -16,16 +16,16 @@ #import -extern NSString *const kMatrixHandlerUnsupportedMessagePrefix; +extern NSString *const kMatrixSDKHandlerUnsupportedMessagePrefix; typedef enum : NSUInteger { - MatrixHandlerStatusLoggedOut = 0, - MatrixHandlerStatusLogged, - MatrixHandlerStatusStoreDataReady, - MatrixHandlerStatusServerSyncDone -} MatrixHandlerStatus; + MatrixSDKHandlerStatusLoggedOut = 0, + MatrixSDKHandlerStatusLogged, + MatrixSDKHandlerStatusStoreDataReady, + MatrixSDKHandlerStatusServerSyncDone +} MatrixSDKHandlerStatus; -@interface MatrixHandler : NSObject +@interface MatrixSDKHandler : NSObject @property (strong, nonatomic) dispatch_queue_t processingQueue; @@ -45,7 +45,7 @@ typedef enum : NSUInteger { // Matrix user's settings @property (nonatomic) MXPresence userPresence; -@property (nonatomic,readonly) MatrixHandlerStatus status; +@property (nonatomic,readonly) MatrixSDKHandlerStatus status; @property (nonatomic,readonly) BOOL isResumeDone; // return the MX cache size in bytes @property (nonatomic,readonly) NSUInteger MXCacheSize; @@ -58,7 +58,7 @@ typedef enum : NSUInteger { // defines the max allowed caches size in bytes @property (nonatomic,readonly) NSUInteger maxAllowedCachesSize; -+ (MatrixHandler *)sharedHandler; ++ (MatrixSDKHandler *)sharedHandler; - (void)pauseInBackgroundTask; - (void)resume; diff --git a/matrixConsole/matrixConsole/API/MatrixHandler.m b/matrixConsole/matrixConsole/API/MatrixSDKHandler.m similarity index 95% rename from matrixConsole/matrixConsole/API/MatrixHandler.m rename to matrixConsole/matrixConsole/API/MatrixSDKHandler.m index f7c27e310..44e5c4e82 100644 --- a/matrixConsole/matrixConsole/API/MatrixHandler.m +++ b/matrixConsole/matrixConsole/API/MatrixSDKHandler.m @@ -14,7 +14,7 @@ limitations under the License. */ -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "AppDelegate.h" #import "AppSettings.h" #import "MXCAlert.h" @@ -24,11 +24,11 @@ #import "MediaManager.h" -NSString *const kMatrixHandlerUnsupportedMessagePrefix = @"UNSUPPORTED MSG: "; +NSString *const kMatrixSDKHandlerUnsupportedMessagePrefix = @"UNSUPPORTED MSG: "; -static MatrixHandler *sharedHandler = nil; +static MatrixSDKHandler *sharedHandler = nil; -@interface MatrixHandler () { +@interface MatrixSDKHandler () { // We will notify user only once on session failure BOOL notifyOpenSessionFailure; @@ -39,17 +39,17 @@ static MatrixHandler *sharedHandler = nil; } @property (strong, nonatomic) MXFileStore *mxFileStore; -@property (nonatomic,readwrite) MatrixHandlerStatus status; +@property (nonatomic,readwrite) MatrixSDKHandlerStatus status; @property (nonatomic,readwrite) BOOL isResumeDone; @property (strong, nonatomic) MXCAlert *mxNotification; @property (nonatomic) UIBackgroundTaskIdentifier bgTask; @end -@implementation MatrixHandler +@implementation MatrixSDKHandler @synthesize homeServerURL, homeServer, userLogin, userId, accessToken; -+ (MatrixHandler *)sharedHandler { ++ (MatrixSDKHandler *)sharedHandler { @synchronized(self) { if(sharedHandler == nil) { @@ -61,14 +61,14 @@ static MatrixHandler *sharedHandler = nil; #pragma mark - --(MatrixHandler *)init { +-(MatrixSDKHandler *)init { if (self = [super init]) { - _status = (self.accessToken != nil) ? MatrixHandlerStatusLogged : MatrixHandlerStatusLoggedOut; + _status = (self.accessToken != nil) ? MatrixSDKHandlerStatusLogged : MatrixSDKHandlerStatusLoggedOut; _isResumeDone = NO; _userPresence = MXPresenceUnknown; notifyOpenSessionFailure = YES; - NSString *label = [NSString stringWithFormat:@"com.matrix.%@.MatrixHandler", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]]; + NSString *label = [NSString stringWithFormat:@"com.matrix.%@.MatrixSDKHandler", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]]; _processingQueue = dispatch_queue_create([label UTF8String], DISPATCH_QUEUE_SERIAL); // Read potential homeserver url in shared defaults object @@ -124,10 +124,10 @@ static MatrixHandler *sharedHandler = nil; // Launch mxSession [self.mxSession start:^{ - self.status = MatrixHandlerStatusStoreDataReady; + self.status = MatrixSDKHandlerStatusStoreDataReady; } onServerSyncDone:^{ _isResumeDone = YES; - self.status = MatrixHandlerStatusServerSyncDone; + self.status = MatrixSDKHandlerStatusServerSyncDone; [self setUserPresence:MXPresenceOnline andStatusMessage:nil completion:nil]; // Register listener to update user's information @@ -225,7 +225,7 @@ static MatrixHandler *sharedHandler = nil; #pragma mark - - (void)pauseInBackgroundTask { - if (self.mxSession && self.status == MatrixHandlerStatusServerSyncDone) { + if (self.mxSession && self.status == MatrixSDKHandlerStatusServerSyncDone) { _bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ [[UIApplication sharedApplication] endBackgroundTask:_bgTask]; _bgTask = UIBackgroundTaskInvalid; @@ -249,7 +249,7 @@ static MatrixHandler *sharedHandler = nil; } - (void)resume { - if (self.mxSession && self.status == MatrixHandlerStatusServerSyncDone) { + if (self.mxSession && self.status == MatrixSDKHandlerStatusServerSyncDone) { if (!self.isResumeDone) { // Resume SDK and update user presence [self.mxSession resume:^{ @@ -278,8 +278,8 @@ static MatrixHandler *sharedHandler = nil; } - (void)forceInitialSync:(BOOL)clearCache { - if (self.status == MatrixHandlerStatusServerSyncDone || self.status == MatrixHandlerStatusStoreDataReady) { - self.status = MatrixHandlerStatusLogged; + if (self.status == MatrixSDKHandlerStatusServerSyncDone || self.status == MatrixSDKHandlerStatusStoreDataReady) { + self.status = MatrixSDKHandlerStatusLogged; [self closeSession]; notifyOpenSessionFailure = NO; @@ -334,12 +334,12 @@ static MatrixHandler *sharedHandler = nil; self.mxNotification.cancelButtonIndex = [self.mxNotification addActionWithTitle:@"OK" style:MXCAlertActionStyleDefault handler:^(MXCAlert *alert) { - [MatrixHandler sharedHandler].mxNotification = nil; + [MatrixSDKHandler sharedHandler].mxNotification = nil; }]; [self.mxNotification addActionWithTitle:@"View" style:MXCAlertActionStyleDefault handler:^(MXCAlert *alert) { - [MatrixHandler sharedHandler].mxNotification = nil; + [MatrixSDKHandler sharedHandler].mxNotification = nil; // Show the room [[AppDelegate theDelegate].masterTabBarController showRoom:event.roomId]; }]; @@ -442,11 +442,11 @@ static MatrixHandler *sharedHandler = nil; if (inAccessToken.length) { [[NSUserDefaults standardUserDefaults] setObject:inAccessToken forKey:@"accesstoken"]; [[AppDelegate theDelegate] registerUserNotificationSettings]; - self.status = MatrixHandlerStatusLogged; + self.status = MatrixSDKHandlerStatusLogged; [self openSession]; } else { [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"accesstoken"]; - self.status = MatrixHandlerStatusLoggedOut; + self.status = MatrixSDKHandlerStatusLoggedOut; [self closeSession]; } [[NSUserDefaults standardUserDefaults] synchronize]; @@ -713,7 +713,7 @@ static MatrixHandler *sharedHandler = nil; displayText = @"invalid image attachment"; } else { // Display event content as unsupported message - displayText = [NSString stringWithFormat:@"%@%@", kMatrixHandlerUnsupportedMessagePrefix, event.description]; + displayText = [NSString stringWithFormat:@"%@%@", kMatrixSDKHandlerUnsupportedMessagePrefix, event.description]; } } } else if ([msgtype isEqualToString:kMXMessageTypeAudio]) { @@ -723,7 +723,7 @@ static MatrixHandler *sharedHandler = nil; if (isSubtitle || [AppSettings sharedSettings].hideUnsupportedMessages) { displayText = @"invalid audio attachment"; } else { - displayText = [NSString stringWithFormat:@"%@%@", kMatrixHandlerUnsupportedMessagePrefix, event.description]; + displayText = [NSString stringWithFormat:@"%@%@", kMatrixSDKHandlerUnsupportedMessagePrefix, event.description]; } } } else if ([msgtype isEqualToString:kMXMessageTypeVideo]) { @@ -733,7 +733,7 @@ static MatrixHandler *sharedHandler = nil; if (isSubtitle || [AppSettings sharedSettings].hideUnsupportedMessages) { displayText = @"invalid video attachment"; } else { - displayText = [NSString stringWithFormat:@"%@%@", kMatrixHandlerUnsupportedMessagePrefix, event.description]; + displayText = [NSString stringWithFormat:@"%@%@", kMatrixSDKHandlerUnsupportedMessagePrefix, event.description]; } } } else if ([msgtype isEqualToString:kMXMessageTypeLocation]) { @@ -743,7 +743,7 @@ static MatrixHandler *sharedHandler = nil; if (isSubtitle || [AppSettings sharedSettings].hideUnsupportedMessages) { displayText = @"invalid location attachment"; } else { - displayText = [NSString stringWithFormat:@"%@%@", kMatrixHandlerUnsupportedMessagePrefix, event.description]; + displayText = [NSString stringWithFormat:@"%@%@", kMatrixSDKHandlerUnsupportedMessagePrefix, event.description]; } } } @@ -773,7 +773,7 @@ static MatrixHandler *sharedHandler = nil; NSLog(@"ERROR: Unsupported event %@)", event.description); if (!isSubtitle && ![AppSettings sharedSettings].hideUnsupportedMessages) { // Return event content as unsupported event - displayText = [NSString stringWithFormat:@"%@%@", kMatrixHandlerUnsupportedMessagePrefix, event.description]; + displayText = [NSString stringWithFormat:@"%@%@", kMatrixSDKHandlerUnsupportedMessagePrefix, event.description]; } } @@ -894,7 +894,7 @@ static MatrixHandler *sharedHandler = nil; // return YES if the text contains a bing word - (BOOL)containsBingWord:(NSString*)text { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; NSMutableArray* wordsList = [[AppSettings sharedSettings].specificWordsToAlertOn mutableCopy]; diff --git a/matrixConsole/matrixConsole/API/MediaLoader.m b/matrixConsole/matrixConsole/API/MediaLoader.m index f91b59186..a82d71759 100644 --- a/matrixConsole/matrixConsole/API/MediaLoader.m +++ b/matrixConsole/matrixConsole/API/MediaLoader.m @@ -15,7 +15,7 @@ */ #import "MediaManager.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "MXCTools.h" NSString *const kMediaDownloadProgressNotification = @"kMediaDownloadProgressNotification"; @@ -81,7 +81,7 @@ NSString *const kMediaLoaderProgressDownloadRateKey = @"kMediaLoaderProgressDown lastProgressEventTimeStamp = -1; // Check provided url (it may be a matrix content uri, we use SDK to build absoluteURL) - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; NSString *absoluteMediaURL = [mxHandler.mxRestClient urlOfContent:aMediaURL]; if (nil == absoluteMediaURL) { // It was not a matrix content uri, we keep the provided url @@ -205,7 +205,7 @@ NSString *const kMediaLoaderProgressDownloadRateKey = @"kMediaLoaderProgressDown mimeType = aMimeType; statsStartTime = CFAbsoluteTimeGetCurrent(); - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; operation = [mxHandler.mxRestClient uploadContent:data mimeType:mimeType timeout:30 success:success failure:failure uploadProgress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) { [self updateUploadProgressWithBytesWritten:bytesWritten totalBytesWritten:totalBytesWritten andTotalBytesExpectedToWrite:totalBytesExpectedToWrite]; }]; diff --git a/matrixConsole/matrixConsole/AppDelegate.m b/matrixConsole/matrixConsole/AppDelegate.m index 4b1dcafed..b952ddffa 100644 --- a/matrixConsole/matrixConsole/AppDelegate.m +++ b/matrixConsole/matrixConsole/AppDelegate.m @@ -18,7 +18,7 @@ #import "APNSHandler.h" #import "AppSettings.h" #import "RoomViewController.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "MediaManager.h" #import "SettingsViewController.h" #import "ContactManager.h" @@ -77,7 +77,7 @@ [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; [[NSUserDefaults standardUserDefaults] synchronize]; - if ([MatrixHandler sharedHandler].status != MatrixHandlerStatusLoggedOut) { + if ([MatrixSDKHandler sharedHandler].status != MatrixSDKHandlerStatusLoggedOut) { [self registerUserNotificationSettings]; // When user is already logged, we launch the app on Recents [self.masterTabBarController setSelectedIndex:TABBAR_RECENTS_INDEX]; @@ -102,7 +102,7 @@ // check if some media msut be released to reduce the cache size [MediaManager reduceCacheSizeToInsert:0]; // Suspend Matrix handler - [[MatrixHandler sharedHandler] pauseInBackgroundTask]; + [[MatrixSDKHandler sharedHandler] pauseInBackgroundTask]; } - (void)applicationWillEnterForeground:(UIApplication *)application { @@ -112,7 +112,7 @@ - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. // Resume Matrix handler - [[MatrixHandler sharedHandler] resume]; + [[MatrixSDKHandler sharedHandler] resume]; // refresh the contacts list [[ContactManager sharedManager] refresh]; @@ -183,7 +183,7 @@ // Clear cache [MediaManager clearCache]; // Logout Matrix - [[MatrixHandler sharedHandler] logout]; + [[MatrixSDKHandler sharedHandler] logout]; [self.masterTabBarController showLoginScreen]; // Reset App settings [[AppSettings sharedSettings] reset]; diff --git a/matrixConsole/matrixConsole/AppSettings.m b/matrixConsole/matrixConsole/AppSettings.m index c439dde42..6ea84913a 100644 --- a/matrixConsole/matrixConsole/AppSettings.m +++ b/matrixConsole/matrixConsole/AppSettings.m @@ -15,7 +15,7 @@ */ #import "AppSettings.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" static AppSettings *sharedSettings = nil; @@ -60,7 +60,7 @@ static AppSettings *sharedSettings = nil; } - (void)setEnableInAppNotifications:(BOOL)notifications { - [[MatrixHandler sharedHandler] enableInAppNotifications:notifications]; + [[MatrixSDKHandler sharedHandler] enableInAppNotifications:notifications]; [[NSUserDefaults standardUserDefaults] setBool:notifications forKey:@"enableInAppNotifications"]; } @@ -91,7 +91,7 @@ static AppSettings *sharedSettings = nil; - (void)setDisplayAllEvents:(BOOL)displayAllEvents { [[NSUserDefaults standardUserDefaults] setBool:displayAllEvents forKey:@"displayAllEvents"]; // Flush and restore Matrix data - [[MatrixHandler sharedHandler] forceInitialSync:NO]; + [[MatrixSDKHandler sharedHandler] forceInitialSync:NO]; } - (BOOL)hideUnsupportedMessages { diff --git a/matrixConsole/matrixConsole/Model/MXCContactField.m b/matrixConsole/matrixConsole/Model/MXCContactField.m index be6023e4d..0ab66828e 100644 --- a/matrixConsole/matrixConsole/Model/MXCContactField.m +++ b/matrixConsole/matrixConsole/Model/MXCContactField.m @@ -20,7 +20,7 @@ #import "MXCContact.h" // image URL -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" // get the thumbnail #import "MediaManager.h" @@ -87,7 +87,7 @@ if (avatarURL.length > 0) { [self downloadAvatarImage]; } else { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // check if the user is already known MXUser* user = [mxHandler.mxSession userWithUserId:_matrixID]; diff --git a/matrixConsole/matrixConsole/Model/MXCEmail.m b/matrixConsole/matrixConsole/Model/MXCEmail.m index 57b9ef02a..98a008884 100644 --- a/matrixConsole/matrixConsole/Model/MXCEmail.m +++ b/matrixConsole/matrixConsole/Model/MXCEmail.m @@ -15,7 +15,7 @@ */ #import "MXCEmail.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "MXCContact.h" diff --git a/matrixConsole/matrixConsole/Model/RecentRoom.m b/matrixConsole/matrixConsole/Model/RecentRoom.m index 35a260019..062c449dc 100644 --- a/matrixConsole/matrixConsole/Model/RecentRoom.m +++ b/matrixConsole/matrixConsole/Model/RecentRoom.m @@ -15,7 +15,7 @@ */ #import "RecentRoom.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" NSString *const kRecentRoomUpdatedByBackPagination = @"kRecentRoomUpdatedByBackPagination"; @@ -30,7 +30,7 @@ NSString *const kRecentRoomUpdatedByBackPagination = @"kRecentRoomUpdatedByBackP - (id)initWithLastEvent:(MXEvent*)event andRoomState:(MXRoomState*)roomState markAsUnread:(BOOL)isUnread { if (self = [super init]) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; _roomId = event.roomId; _lastEventDescription = [mxHandler displayTextForEvent:event withRoomState:roomState inSubtitleMode:YES]; _lastEventOriginServerTs = event.originServerTs; @@ -61,7 +61,7 @@ NSString *const kRecentRoomUpdatedByBackPagination = @"kRecentRoomUpdatedByBackP - (BOOL)updateWithLastEvent:(MXEvent*)event andRoomState:(MXRoomState*)roomState markAsUnread:(BOOL)isUnread { // Check whether the description of the provided event is not empty - NSString *description = [[MatrixHandler sharedHandler] displayTextForEvent:event withRoomState:roomState inSubtitleMode:YES]; + NSString *description = [[MatrixSDKHandler sharedHandler] displayTextForEvent:event withRoomState:roomState inSubtitleMode:YES]; if (description.length) { [self cancelBackPagination]; // Update current last event diff --git a/matrixConsole/matrixConsole/Model/RoomMessage.m b/matrixConsole/matrixConsole/Model/RoomMessage.m index 8c43225d6..e72fdbf16 100644 --- a/matrixConsole/matrixConsole/Model/RoomMessage.m +++ b/matrixConsole/matrixConsole/Model/RoomMessage.m @@ -16,7 +16,7 @@ #import "RoomMessage.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "AppSettings.h" NSString *const kRoomMessageLocalPreviewKey = @"kRoomMessageLocalPreviewKey"; @@ -41,7 +41,7 @@ static NSAttributedString *messageSeparator = nil; - (id)initWithEvent:(MXEvent*)event andRoomState:(MXRoomState*)roomState { if (self = [super init]) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; _senderId = event.userId; _senderName = [mxHandler senderDisplayNameForEvent:event withRoomState:roomState]; @@ -120,7 +120,7 @@ static NSAttributedString *messageSeparator = nil; // We group together text messages from the same user if ([event.userId isEqualToString:_senderId] && (_messageType == RoomMessageTypeText)) { // Attachments (image, video ...) cannot be added here - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; if ([mxHandler isSupportedAttachment:event]) { return NO; } diff --git a/matrixConsole/matrixConsole/Model/RoomMessageComponent.m b/matrixConsole/matrixConsole/Model/RoomMessageComponent.m index afa795b16..03dfc1dcb 100644 --- a/matrixConsole/matrixConsole/Model/RoomMessageComponent.m +++ b/matrixConsole/matrixConsole/Model/RoomMessageComponent.m @@ -15,7 +15,7 @@ */ #import "RoomMessageComponent.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" NSString *const kLocalEchoEventIdPrefix = @"localEcho-"; NSString *const kFailedEventIdPrefix = @"failedEventId-"; @@ -24,7 +24,7 @@ NSString *const kFailedEventIdPrefix = @"failedEventId-"; - (id)initWithEvent:(MXEvent*)event andRoomState:(MXRoomState*)roomState { if (self = [super init]) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // Build text component related to this event NSString* textMessage = [mxHandler displayTextForEvent:event withRoomState:roomState inSubtitleMode:NO]; @@ -59,8 +59,8 @@ NSString *const kFailedEventIdPrefix = @"failedEventId-"; _eventId = eventId; // Update component style - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; - if ([_textMessage hasPrefix:kMatrixHandlerUnsupportedMessagePrefix]) { + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; + if ([_textMessage hasPrefix:kMatrixSDKHandlerUnsupportedMessagePrefix]) { _style = RoomMessageComponentStyleUnsupported; } else if ([_eventId hasPrefix:kFailedEventIdPrefix]) { _style = RoomMessageComponentStyleFailed; diff --git a/matrixConsole/matrixConsole/View/ContactTableCell.m b/matrixConsole/matrixConsole/View/ContactTableCell.m index ad89dd6ee..c3561e53b 100644 --- a/matrixConsole/matrixConsole/View/ContactTableCell.m +++ b/matrixConsole/matrixConsole/View/ContactTableCell.m @@ -16,7 +16,7 @@ #import "ContactTableCell.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "MXTools.h" @@ -31,13 +31,13 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; if (membersListener) { - [[MatrixHandler sharedHandler].mxSession removeListener:membersListener]; + [[MatrixSDKHandler sharedHandler].mxSession removeListener:membersListener]; membersListener = nil; } } - (void)setContact:(MXCContact *)aContact { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; _contact = aContact; @@ -86,7 +86,7 @@ - (void)refreshUserPresence { // search the linked mxUser - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // get the matrix identifiers NSArray* matrixIdentifiers = self.contact.matrixIdentifiers; @@ -124,7 +124,7 @@ } - (void)refreshPresenceUserRing:(MXPresence)presenceStatus { - UIColor* ringColor = [[MatrixHandler sharedHandler] getPresenceRingColor:presenceStatus]; + UIColor* ringColor = [[MatrixSDKHandler sharedHandler] getPresenceRingColor:presenceStatus]; // if the thumbnail is defined if (ringColor) { diff --git a/matrixConsole/matrixConsole/View/RoomMemberTableCell.m b/matrixConsole/matrixConsole/View/RoomMemberTableCell.m index 459f7fa3b..027ea93ac 100644 --- a/matrixConsole/matrixConsole/View/RoomMemberTableCell.m +++ b/matrixConsole/matrixConsole/View/RoomMemberTableCell.m @@ -15,7 +15,7 @@ */ #import "RoomMemberTableCell.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "MediaManager.h" @interface RoomMemberTableCell () { @@ -39,7 +39,7 @@ // nil if there is no valid one - (UIColor*)getUserPresenceColor:(MXUser*)user { if (user) { - return [[MatrixHandler sharedHandler] getPresenceRingColor:user.presence]; + return [[MatrixSDKHandler sharedHandler] getPresenceRingColor:user.presence]; } return nil; @@ -114,7 +114,7 @@ NSString *thumbnailURL = nil; if (roomMember.avatarUrl) { // Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; thumbnailURL = [mxHandler thumbnailURLForContent:roomMember.avatarUrl inViewSize:self.pictureView.frame.size withMethod:MXThumbnailingMethodCrop]; } self.pictureView.mediaFolder = kMediaManagerThumbnailFolder; @@ -147,7 +147,7 @@ } else { self.backgroundColor = [UIColor whiteColor]; - powerLevel = [[MatrixHandler sharedHandler] getPowerLevel:roomMember inRoom:room]; + powerLevel = [[MatrixSDKHandler sharedHandler] getPowerLevel:roomMember inRoom:room]; // get the user presence and his thumbnail border color if (roomMember.membership == MXMembershipInvite) { @@ -157,7 +157,7 @@ roomMemberUserId = roomMember.userId; // Get the user that corresponds to this member - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; MXUser *user = [mxHandler.mxSession userWithUserId:roomMemberUserId]; // existing user ? @@ -218,7 +218,7 @@ lastSeenTimer = nil; // Get the user that corresponds to this member - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; MXUser *user = [mxHandler.mxSession userWithUserId:roomMemberUserId]; // existing user ? diff --git a/matrixConsole/matrixConsole/View/RoomTitleView.m b/matrixConsole/matrixConsole/View/RoomTitleView.m index 84968ad1c..199af9024 100644 --- a/matrixConsole/matrixConsole/View/RoomTitleView.m +++ b/matrixConsole/matrixConsole/View/RoomTitleView.m @@ -15,7 +15,7 @@ */ #import "RoomTitleView.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" @interface RoomTitleView () { id messagesListener; diff --git a/matrixConsole/matrixConsole/ViewController/ContactsViewController.m b/matrixConsole/matrixConsole/ViewController/ContactsViewController.m index 36c868b32..39d3d0884 100644 --- a/matrixConsole/matrixConsole/ViewController/ContactsViewController.m +++ b/matrixConsole/matrixConsole/ViewController/ContactsViewController.m @@ -17,7 +17,7 @@ #import "ContactsViewController.h" // SDK api -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" // application info #import "AppDelegate.h" @@ -175,7 +175,7 @@ NSString *const kInvitationMessage = @"I'd like to chat with you with matrix. Pl [self.startChatMenu addActionWithTitle:@"OK" style:MXCAlertActionStyleDefault handler:^(MXCAlert *alert) { weakSelf.startChatMenu = nil; - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // else create new room [mxHandler.mxRestClient createRoom:nil diff --git a/matrixConsole/matrixConsole/ViewController/HomeViewController.m b/matrixConsole/matrixConsole/ViewController/HomeViewController.m index f2fdce2e7..7d361f941 100644 --- a/matrixConsole/matrixConsole/ViewController/HomeViewController.m +++ b/matrixConsole/matrixConsole/ViewController/HomeViewController.m @@ -16,7 +16,7 @@ #import "HomeViewController.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "AppDelegate.h" @interface HomeViewController () { @@ -83,8 +83,8 @@ // Ensure to display room creation section [self.tableView scrollRectToVisible:_roomCreationLabel.frame animated:NO]; - if ([MatrixHandler sharedHandler].status != MatrixHandlerStatusLoggedOut) { - homeServerSuffix = [NSString stringWithFormat:@":%@",[MatrixHandler sharedHandler].homeServer]; + if ([MatrixSDKHandler sharedHandler].status != MatrixSDKHandlerStatusLoggedOut) { + homeServerSuffix = [NSString stringWithFormat:@":%@",[MatrixSDKHandler sharedHandler].homeServer]; // Update alias placeholder _roomAliasTextField.placeholder = [NSString stringWithFormat:@"(e.g. #foo%@)", homeServerSuffix]; // Refresh listed public rooms @@ -108,7 +108,7 @@ - (void)refreshPublicRooms { // Retrieve public rooms - [[MatrixHandler sharedHandler].mxRestClient publicRooms:^(NSArray *rooms){ + [[MatrixSDKHandler sharedHandler].mxRestClient publicRooms:^(NSArray *rooms){ publicRooms = [rooms sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { MXPublicRoom *firstRoom = (MXPublicRoom*)a; @@ -310,7 +310,7 @@ } // Create new room - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; [mxHandler.mxRestClient createRoom:roomName visibility:(_roomVisibilityControl.selectedSegmentIndex == 0) ? kMXRoomVisibilityPublic : kMXRoomVisibilityPrivate roomAlias:self.alias @@ -372,7 +372,7 @@ [sectionHeader addSubview:sectionLabel]; if (publicRooms) { - NSString *homeserver = [MatrixHandler sharedHandler].homeServerURL; + NSString *homeserver = [MatrixSDKHandler sharedHandler].homeServerURL; if (homeserver.length) { sectionLabel.text = [NSString stringWithFormat:@" Public Rooms (at %@):", homeserver]; } else { @@ -457,7 +457,7 @@ } // Check whether the user has already joined the selected public room - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; if ([mxHandler.mxSession roomWithRoomId:publicRoom.roomId]) { // Open selected room [[AppDelegate theDelegate].masterTabBarController showRoom:publicRoom.roomId]; diff --git a/matrixConsole/matrixConsole/ViewController/LoginViewController.m b/matrixConsole/matrixConsole/ViewController/LoginViewController.m index 225501059..da4f73bf8 100644 --- a/matrixConsole/matrixConsole/ViewController/LoginViewController.m +++ b/matrixConsole/matrixConsole/ViewController/LoginViewController.m @@ -16,7 +16,7 @@ #import "LoginViewController.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "AppDelegate.h" #import "MXCAlert.h" @@ -70,8 +70,8 @@ [self.view addConstraint:rightConstraint]; // Prefill text field - _userLoginTextField.text = [[MatrixHandler sharedHandler] userLogin]; - _homeServerTextField.text = [[MatrixHandler sharedHandler] homeServerURL]; + _userLoginTextField.text = [[MatrixSDKHandler sharedHandler] userLogin]; + _homeServerTextField.text = [[MatrixSDKHandler sharedHandler] homeServerURL]; _passWordTextField.text = nil; _loginBtn.enabled = NO; _loginBtn.alpha = 0.5; @@ -153,7 +153,7 @@ } - (void)textFieldDidEndEditing:(UITextField *)textField { - MatrixHandler *matrix = [MatrixHandler sharedHandler]; + MatrixSDKHandler *matrix = [MatrixSDKHandler sharedHandler]; if (textField == _userLoginTextField) { [matrix setUserLogin:textField.text]; @@ -162,7 +162,7 @@ [matrix setHomeServerURL:textField.text]; if (!textField.text.length) { // Force refresh with default value - textField.text = [[MatrixHandler sharedHandler] homeServerURL]; + textField.text = [[MatrixSDKHandler sharedHandler] homeServerURL]; } } } @@ -191,7 +191,7 @@ [self dismissKeyboard]; if (sender == _loginBtn) { - MatrixHandler *matrix = [MatrixHandler sharedHandler]; + MatrixSDKHandler *matrix = [MatrixSDKHandler sharedHandler]; if (matrix.mxRestClient) { diff --git a/matrixConsole/matrixConsole/ViewController/MasterTabBarController.m b/matrixConsole/matrixConsole/ViewController/MasterTabBarController.m index 31a8268ea..2a8041160 100644 --- a/matrixConsole/matrixConsole/ViewController/MasterTabBarController.m +++ b/matrixConsole/matrixConsole/ViewController/MasterTabBarController.m @@ -15,7 +15,7 @@ */ #import "MasterTabBarController.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "RecentsViewController.h" @@ -60,7 +60,7 @@ - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - if ([MatrixHandler sharedHandler].status == MatrixHandlerStatusLoggedOut) { + if ([MatrixSDKHandler sharedHandler].status == MatrixSDKHandlerStatusLoggedOut) { [self showLoginScreen]; } } diff --git a/matrixConsole/matrixConsole/ViewController/MemberViewController.h b/matrixConsole/matrixConsole/ViewController/MemberViewController.h index d16084a20..dd3cddc02 100644 --- a/matrixConsole/matrixConsole/ViewController/MemberViewController.h +++ b/matrixConsole/matrixConsole/ViewController/MemberViewController.h @@ -16,7 +16,7 @@ #import -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" @interface MemberViewController : UITableViewController diff --git a/matrixConsole/matrixConsole/ViewController/MemberViewController.m b/matrixConsole/matrixConsole/ViewController/MemberViewController.m index 20934e5b0..f0bf1e4bf 100644 --- a/matrixConsole/matrixConsole/ViewController/MemberViewController.m +++ b/matrixConsole/matrixConsole/ViewController/MemberViewController.m @@ -61,7 +61,7 @@ } if (membersListener) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; [mxHandler.mxSession removeListener:membersListener]; membersListener = nil; } @@ -86,7 +86,7 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; NSArray *mxMembersEvents = @[ kMXEventTypeStringRoomMember, @@ -148,7 +148,7 @@ } if (membersListener) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; [mxHandler.mxSession removeListener:membersListener]; membersListener = nil; } @@ -166,7 +166,7 @@ if (_mxRoomMember.avatarUrl) { // Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; thumbnailURL = [mxHandler thumbnailURLForContent:_mxRoomMember.avatarUrl inViewSize:self.memberThumbnailButton.frame.size withMethod:MXThumbnailingMethodCrop]; // Check whether the image download is in progress @@ -239,7 +239,7 @@ } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // Check user's power level before allowing an action (kick, ban, ...) MXRoomPowerLevels *powerLevels = [mxRoom.state powerLevels]; @@ -367,7 +367,7 @@ } - (void) setUserPowerLevel:(MXRoomMember*)roomMember to:(int)value { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; int currentPowerLevel = (int)([mxHandler getPowerLevel:roomMember inRoom:self.mxRoom] * 100); // check if the power level has not yet been set to 0 @@ -389,7 +389,7 @@ } - (void) updateUserPowerLevel:(MXRoomMember*)roomMember { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; __weak typeof(self) weakSelf = self; // Ask for userId to invite @@ -500,7 +500,7 @@ } else if ([text isEqualToString:@"Start chat"]) { [self addPendingActionMask]; - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; NSString* roomId = [mxHandler getRoomStartedWithMember:_mxRoomMember]; // if the room has already been started diff --git a/matrixConsole/matrixConsole/ViewController/RecentsViewController.m b/matrixConsole/matrixConsole/ViewController/RecentsViewController.m index b5ea794c2..31dde3f78 100644 --- a/matrixConsole/matrixConsole/ViewController/RecentsViewController.m +++ b/matrixConsole/matrixConsole/ViewController/RecentsViewController.m @@ -21,7 +21,7 @@ #import "RecentsTableViewCell.h" #import "AppDelegate.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "MediaManager.h" @@ -85,7 +85,7 @@ [dateFormatter setTimeStyle:NSDateFormatterNoStyle]; [dateFormatter setDateFormat:dateFormat]; - [[MatrixHandler sharedHandler] addObserver:self forKeyPath:@"status" options:0 context:nil]; + [[MatrixSDKHandler sharedHandler] addObserver:self forKeyPath:@"status" options:0 context:nil]; } - (void)dealloc { @@ -94,7 +94,7 @@ currentRoomViewController = nil; } if (recentsListener) { - [[MatrixHandler sharedHandler].mxSession removeListener:recentsListener]; + [[MatrixSDKHandler sharedHandler].mxSession removeListener:recentsListener]; recentsListener = nil; } recents = nil; @@ -105,7 +105,7 @@ if (dateFormatter) { dateFormatter = nil; } - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; } - (void)didReceiveMemoryWarning { @@ -118,7 +118,7 @@ // Refresh display [self configureView]; - [[MatrixHandler sharedHandler] addObserver:self forKeyPath:@"isResumeDone" options:0 context:nil]; + [[MatrixSDKHandler sharedHandler] addObserver:self forKeyPath:@"isResumeDone" options:0 context:nil]; } - (void)viewWillDisappear:(BOOL)animated { @@ -134,7 +134,7 @@ [self stopActivityIndicator]; _preSelectedRoomId = nil; - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; } - (void)viewDidAppear:(BOOL)animated { @@ -202,7 +202,7 @@ - (void)refreshRecentsDisplay { // Check whether the current selected room has not been left if (currentRoomViewController.roomId) { - MXRoom *mxRoom = [[MatrixHandler sharedHandler].mxSession roomWithRoomId:currentRoomViewController.roomId]; + MXRoom *mxRoom = [[MatrixSDKHandler sharedHandler].mxSession roomWithRoomId:currentRoomViewController.roomId]; if (mxRoom == nil || mxRoom.state.membership == MXMembershipLeave || mxRoom.state.membership == MXMembershipBan) { // release the room viewController currentRoomViewController.roomId = nil; @@ -214,14 +214,14 @@ } - (void)configureView { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; [self startActivityIndicator]; [[NSNotificationCenter defaultCenter] removeObserver:self name:kRecentRoomUpdatedByBackPagination object:nil]; if (mxHandler.mxSession) { // Check matrix handler status - if (mxHandler.status == MatrixHandlerStatusStoreDataReady) { + if (mxHandler.status == MatrixSDKHandlerStatusStoreDataReady) { // Server sync is not complete yet if (!recents) { // Retrieve recents from local storage (some data may not be up-to-date) @@ -236,7 +236,7 @@ } unreadCount = 0; } - } else if (mxHandler.status == MatrixHandlerStatusServerSyncDone) { + } else if (mxHandler.status == MatrixSDKHandlerStatusServerSyncDone) { // Force recents refresh and add listener to update them (if it is not already done) if (!recentsListener) { NSArray *recentEvents = [NSMutableArray arrayWithArray:[mxHandler.mxSession recentsWithTypeIn:mxHandler.eventsFilterForMessages]]; @@ -343,7 +343,7 @@ self.preSelectedRoomId = _preSelectedRoomId; } } else { - if (mxHandler.status == MatrixHandlerStatusLoggedOut) { + if (mxHandler.status == MatrixSDKHandlerStatusLoggedOut) { [self stopActivityIndicator]; // Update title unreadCount = 0; @@ -445,7 +445,7 @@ } }); } else if ([@"isResumeDone" isEqualToString:keyPath]) { - if ([[MatrixHandler sharedHandler] isResumeDone]) { + if ([[MatrixSDKHandler sharedHandler] isResumeDone]) { [self stopActivityIndicator]; } else { [self startActivityIndicator]; @@ -537,7 +537,7 @@ recentRoom = recents[indexPath.row]; } - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; MXRoom *mxRoom = [mxHandler.mxSession roomWithRoomId:recentRoom.roomId]; cell.roomTitle.text = [mxRoom.state displayname]; @@ -582,7 +582,7 @@ selectedRoom = recents[indexPath.row]; } - MXRoom *mxRoom = [[MatrixHandler sharedHandler].mxSession roomWithRoomId:selectedRoom.roomId]; + MXRoom *mxRoom = [[MatrixSDKHandler sharedHandler].mxSession roomWithRoomId:selectedRoom.roomId]; // cancel pending uploads/downloads // they are useless by now @@ -633,7 +633,7 @@ } else { filteredRecents = [NSMutableArray arrayWithCapacity:recents.count]; } - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; for (RecentRoom *recentRoom in recents) { MXRoom *mxRoom = [mxHandler.mxSession roomWithRoomId:recentRoom.roomId]; if ([[mxRoom.state displayname] rangeOfString:searchText options:NSCaseInsensitiveSearch].location != NSNotFound) { diff --git a/matrixConsole/matrixConsole/ViewController/RoomViewController.m b/matrixConsole/matrixConsole/ViewController/RoomViewController.m index b7c5bfdfc..b5e15949d 100644 --- a/matrixConsole/matrixConsole/ViewController/RoomViewController.m +++ b/matrixConsole/matrixConsole/ViewController/RoomViewController.m @@ -24,7 +24,7 @@ #import "RoomMemberTableCell.h" #import "RoomTitleView.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "AppDelegate.h" #import "AppSettings.h" @@ -212,8 +212,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; [self.mxRoom removeListener:messagesListener]; messagesListener = nil; [[AppSettings sharedSettings] removeObserver:self forKeyPath:@"hideUnsupportedMessages"]; - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; } self.mxRoom = nil; @@ -258,7 +258,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; } // Register a listener for events that concern room members - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; NSArray *mxMembersEvents = @[ kMXEventTypeStringRoomMember, kMXEventTypeStringRoomPowerLevels, @@ -320,7 +320,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; [self dismissAttachmentImageViews]; if (membersListener) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; [mxHandler.mxSession removeListener:membersListener]; membersListener = nil; } @@ -483,8 +483,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; [self.mxRoom removeListener:messagesListener]; messagesListener = nil; [[AppSettings sharedSettings] removeObserver:self forKeyPath:@"hideUnsupportedMessages"]; - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; } currentTypingUsers = nil; if (typingNotifListener) { @@ -500,7 +500,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; self.roomTitleView.editable = NO; // Update room data - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; self.mxRoom = nil; if (self.roomId) { self.mxRoom = [mxHandler.mxSession roomWithRoomId:self.roomId]; @@ -745,8 +745,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; - (void)stopActivityIndicator { // Check whether all conditions are satisfied before stopping loading wheel - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; - if (mxHandler.status == MatrixHandlerStatusServerSyncDone && mxHandler.isResumeDone && !isBackPaginationInProgress && !isJoinRequestInProgress) { + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; + if (mxHandler.status == MatrixSDKHandlerStatusServerSyncDone && mxHandler.isResumeDone && !isBackPaginationInProgress && !isJoinRequestInProgress) { [_activityIndicator stopAnimating]; } } @@ -770,13 +770,13 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; [self configureView]; }); } else if ([@"status" isEqualToString:keyPath]) { - if ([MatrixHandler sharedHandler].status == MatrixHandlerStatusServerSyncDone) { + if ([MatrixSDKHandler sharedHandler].status == MatrixSDKHandlerStatusServerSyncDone) { [self stopActivityIndicator]; } else { [self startActivityIndicator]; } } else if ([@"isResumeDone" isEqualToString:keyPath]) { - if ([[MatrixHandler sharedHandler] isResumeDone]) { + if ([[MatrixSDKHandler sharedHandler] isResumeDone]) { [self stopActivityIndicator]; } else { [self startActivityIndicator]; @@ -899,7 +899,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; backPaginationSavedFirstMsgHeight = [self tableView:self.messagesTableView heightForRowAtIndexPath:indexPath]; } - dispatch_async([MatrixHandler sharedHandler].processingQueue, ^{ + dispatch_async([MatrixSDKHandler sharedHandler].processingQueue, ^{ [self paginateBackMessages:requestedItemsNb]; }); } @@ -915,7 +915,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; // Check whether we received less items than expected, and check condition to be able to ask more. // This operation must be done on processing queue to be sync with the events reception - dispatch_async([MatrixHandler sharedHandler].processingQueue, ^{ + dispatch_async([MatrixSDKHandler sharedHandler].processingQueue, ^{ BOOL shouldLoop = ((backPaginationHandledEventsNb < requestedItemsNb) && self.mxRoom.canPaginate); if (shouldLoop) { NSUInteger missingItemsNb = requestedItemsNb - backPaginationHandledEventsNb; @@ -938,7 +938,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; }); } failure:^(NSError *error) { NSLog(@"Failed to paginate back: %@", error); - dispatch_async([MatrixHandler sharedHandler].processingQueue, ^{ + dispatch_async([MatrixSDKHandler sharedHandler].processingQueue, ^{ [self onBackPaginationComplete]; }); //Alert user @@ -1041,7 +1041,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; if ([[AppSettings sharedSettings] sortMembersUsingLastSeenTime]) { // Get the users that correspond to these members - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; MXUser *user1 = [mxHandler.mxSession userWithUserId:member1.userId]; MXUser *user2 = [mxHandler.mxSession userWithUserId:member2.userId]; @@ -1614,7 +1614,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // Check table view members vs messages if (tableView == self.membersTableView) { @@ -2020,7 +2020,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; if (textField == _roomTitleView.displayNameTextField) { // Check whether the user has enough power to rename the room MXRoomPowerLevels *powerLevels = [self.mxRoom.state powerLevels]; - NSUInteger userPowerLevel = [powerLevels powerLevelOfUserWithUserID:[MatrixHandler sharedHandler].userId]; + NSUInteger userPowerLevel = [powerLevels powerLevelOfUserWithUserID:[MatrixSDKHandler sharedHandler].userId]; if (userPowerLevel >= [powerLevels minimumPowerLevelForSendingEventAsStateEvent:kMXEventTypeStringRoomName]) { // Only the room name is edited here, update the text field with the room name textField.text = self.mxRoom.state.name; @@ -2043,7 +2043,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; } else if (textField == _roomTitleView.topicTextField) { // Check whether the user has enough power to edit room topic MXRoomPowerLevels *powerLevels = [self.mxRoom.state powerLevels]; - NSUInteger userPowerLevel = [powerLevels powerLevelOfUserWithUserID:[MatrixHandler sharedHandler].userId]; + NSUInteger userPowerLevel = [powerLevels powerLevelOfUserWithUserID:[MatrixSDKHandler sharedHandler].userId]; if (userPowerLevel >= [powerLevels minimumPowerLevelForSendingEventAsStateEvent:kMXEventTypeStringRoomTopic]) { textField.backgroundColor = [UIColor whiteColor]; [self.roomTitleView stopTopicAnimation]; @@ -2451,7 +2451,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; // Send message to the room [self.mxRoom sendMessageOfType:msgType content:msgContent success:^(NSString *eventId) { // Switch on processing queue - dispatch_async([MatrixHandler sharedHandler].processingQueue, ^{ + dispatch_async([MatrixSDKHandler sharedHandler].processingQueue, ^{ // Check whether the event is still pending (It may be received from event stream) NSUInteger index; MXEvent *pendingEvent = nil; @@ -2479,7 +2479,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; }); } failure:^(NSError *error) { // Switch on processing queue to serialize this operation with the message handling - dispatch_async([MatrixHandler sharedHandler].processingQueue, ^{ + dispatch_async([MatrixSDKHandler sharedHandler].processingQueue, ^{ // Check whether the event is still pending (It may be received from event stream) NSUInteger index; MXEvent *pendingEvent = nil; @@ -2528,7 +2528,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; localEvent.type = kMXEventTypeStringRoomMessage; localEvent.originServerTs = (uint64_t) ([[NSDate date] timeIntervalSince1970] * 1000); - localEvent.userId = [MatrixHandler sharedHandler].userId; + localEvent.userId = [MatrixSDKHandler sharedHandler].userId; return localEvent; } @@ -2639,7 +2639,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; [[AppDelegate theDelegate] showErrorAsAlert:error]; } - dispatch_async([MatrixHandler sharedHandler].processingQueue, ^{ + dispatch_async([MatrixSDKHandler sharedHandler].processingQueue, ^{ // Update the temporary event with this local event id RoomMessage *message = [self messageWithEventId:localEvent.eventId]; if (message) { @@ -2712,7 +2712,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; displayName = [displayName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; if (displayName.length) { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; [mxHandler.mxRestClient setDisplayName:displayName success:^{ } failure:^(NSError *error) { NSLog(@"Set displayName failed: %@", error); @@ -2731,7 +2731,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; // Check if (roomAlias.length) { - [[MatrixHandler sharedHandler].mxSession joinRoom:roomAlias success:^(MXRoom *room) { + [[MatrixSDKHandler sharedHandler].mxSession joinRoom:roomAlias success:^(MXRoom *room) { // Show the room [[AppDelegate theDelegate].masterTabBarController showRoom:room.state.roomId]; } failure:^(NSError *error) { diff --git a/matrixConsole/matrixConsole/ViewController/SettingsViewController.m b/matrixConsole/matrixConsole/ViewController/SettingsViewController.m index 04a9ba09a..bddeed228 100644 --- a/matrixConsole/matrixConsole/ViewController/SettingsViewController.m +++ b/matrixConsole/matrixConsole/ViewController/SettingsViewController.m @@ -19,7 +19,7 @@ #import "AppDelegate.h" #import "AppSettings.h" #import "APNSHandler.h" -#import "MatrixHandler.h" +#import "MatrixSDKHandler.h" #import "MediaManager.h" #import "SettingsTableViewCell.h" @@ -114,7 +114,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl [[self.userPicture imageView] setClipsToBounds:YES]; errorAlerts = [NSMutableArray array]; - [[MatrixHandler sharedHandler] addObserver:self forKeyPath:@"status" options:0 context:nil]; + [[MatrixSDKHandler sharedHandler] addObserver:self forKeyPath:@"status" options:0 context:nil]; isAvatarUpdated = NO; isDisplayNameUpdated = NO; @@ -148,7 +148,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl unsupportedMsgSwitch = nil; sortMembersSwitch = nil; displayLeftMembersSwitch = nil; - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"status"]; } - (void)viewWillAppear:(BOOL)animated { @@ -157,14 +157,14 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl // Refresh display [self startUserInfoUploadAnimation]; [self configureView]; - [[MatrixHandler sharedHandler] addObserver:self forKeyPath:@"isResumeDone" options:0 context:nil]; + [[MatrixSDKHandler sharedHandler] addObserver:self forKeyPath:@"isResumeDone" options:0 context:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAPNSHandlerHasBeenUpdated) name:kAPNSHandlerHasBeenUpdated object:nil]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - [[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; + [[MatrixSDKHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"]; [[NSNotificationCenter defaultCenter] removeObserver:self name:kAPNSHandlerHasBeenUpdated object:nil]; } @@ -225,7 +225,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl // Remove listener if (userUpdateListener) { - [[MatrixHandler sharedHandler].mxSession.myUser removeListener:userUpdateListener]; + [[MatrixSDKHandler sharedHandler].mxSession.myUser removeListener:userUpdateListener]; userUpdateListener = nil; } @@ -261,13 +261,13 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl return; } - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // Disable user's interactions _userPicture.enabled = NO; _userDisplayName.enabled = NO; - if (mxHandler.status == MatrixHandlerStatusServerSyncDone) { + if (mxHandler.status == MatrixSDKHandlerStatusServerSyncDone) { if (!userUpdateListener) { // Set current user's information and add observers [self updateUserPicture:mxHandler.mxSession.myUser.avatarUrl]; @@ -293,12 +293,12 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl // TODO display user's presence }]; } - } else if (mxHandler.status == MatrixHandlerStatusStoreDataReady) { + } else if (mxHandler.status == MatrixSDKHandlerStatusStoreDataReady) { // Set local user's information (the data may not be up-to-date) [self updateUserPicture:mxHandler.mxSession.myUser.avatarUrl]; currentDisplayName = mxHandler.mxSession.myUser.displayname; self.userDisplayName.text = currentDisplayName; - } else if (mxHandler.status == MatrixHandlerStatusLoggedOut) { + } else if (mxHandler.status == MatrixSDKHandlerStatusLoggedOut) { [self reset]; } @@ -319,7 +319,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl _userDisplayName.enabled = NO; isDisplayNameUploading = YES; - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; [mxHandler.mxSession.myUser setDisplayName:displayname success:^{ // save the current displayname currentDisplayName = displayname; @@ -365,7 +365,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl } - (void)savePicture { - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // Save picture [self startUserInfoUploadAnimation]; @@ -434,7 +434,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl [errorAlerts removeObject:alert]; // Remove change uploadedPictureURL = nil; - [self updateUserPicture:[MatrixHandler sharedHandler].mxSession.myUser.avatarUrl]; + [self updateUserPicture:[MatrixSDKHandler sharedHandler].mxSession.myUser.avatarUrl]; }]; [alert addActionWithTitle:@"Retry" style:MXCAlertActionStyleDefault handler:^(MXCAlert *alert) { [errorAlerts removeObject:alert]; @@ -457,7 +457,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl currentPictureURL = [avatar_url isEqual:[NSNull null]] ? nil : avatar_url; if (currentPictureURL) { // Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; currentPictureThumbURL = [mxHandler thumbnailURLForContent:currentPictureURL inViewSize:self.userPicture.frame.size withMethod:MXThumbnailingMethodCrop]; // Check whether the image download is in progress @@ -522,7 +522,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl [self configureView]; }); } else if ([@"isResumeDone" isEqualToString:keyPath]) { - if ([[MatrixHandler sharedHandler] isResumeDone]) { + if ([[MatrixSDKHandler sharedHandler] isResumeDone]) { [self stopUserInfoUploadAnimation]; _userPicture.enabled = YES; _userDisplayName.enabled = YES; @@ -575,7 +575,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl - (IBAction)onSliderValueChange:(id)sender { if (sender == maxCacheSizeCell.settingSlider) { - MatrixHandler* mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler* mxHandler = [MatrixSDKHandler sharedHandler]; UISlider* slider = maxCacheSizeCell.settingSlider; // check if the upper bounds have been updated @@ -588,7 +588,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl slider.value = mxHandler.minCachesSize; } - [[MatrixHandler sharedHandler] setCurrentMaxCachesSize:slider.value]; + [[MatrixSDKHandler sharedHandler] setCurrentMaxCachesSize:slider.value]; maxCacheSizeCell.settingLabel.text = [NSString stringWithFormat:@"Maximum cache size (%@)", [NSByteCountFormatter stringFromByteCount:mxHandler.currentMaxCachesSize countStyle:NSByteCountFormatterCountStyleFile]]; } @@ -624,7 +624,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl - (void)manageWordsList { NSArray* words = [wordsListTextField.text componentsSeparatedByString:@","]; NSMutableArray* fiteredWords = [[NSMutableArray alloc] init]; - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; // theses both items are implicitly checked NSString* displayname = nil; @@ -687,7 +687,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl // tap on clear application cache if ((indexPath.section == SETTINGS_SECTION_ROOMS_INDEX) && (indexPath.row == SETTINGS_SECTION_ROOMS_CLEAR_CACHE_INDEX)) { // clear caches - [[MatrixHandler sharedHandler] forceInitialSync:YES]; + [[MatrixSDKHandler sharedHandler] forceInitialSync:YES]; } [aTableView deselectRowAtIndexPath:indexPath animated:YES]; @@ -743,7 +743,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, MAXFLOAT)]; textView.font = [UIFont systemFontOfSize:14]; NSString* appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; textView.text = [NSString stringWithFormat:kConfigurationFormatText, appVersion, MatrixSDKVersion, mxHandler.homeServerURL, nil, mxHandler.userId, mxHandler.accessToken]; CGSize contentSize = [textView sizeThatFits:textView.frame.size]; return contentSize.height + 1; @@ -839,7 +839,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ClearCacheCell"]; } - cell.textLabel.text = [NSString stringWithFormat:@"Clear cache (%@)", [NSByteCountFormatter stringFromByteCount:[MatrixHandler sharedHandler].cachesSize countStyle:NSByteCountFormatterCountStyleFile]]; + cell.textLabel.text = [NSString stringWithFormat:@"Clear cache (%@)", [NSByteCountFormatter stringFromByteCount:[MatrixSDKHandler sharedHandler].cachesSize countStyle:NSByteCountFormatterCountStyleFile]]; cell.textLabel.textAlignment = NSTextAlignmentCenter; cell.textLabel.textColor = [AppDelegate theDelegate].masterTabBarController.tabBar.tintColor; } else if (indexPath.row == SETTINGS_SECTION_ROOMS_SET_CACHE_SIZE_INDEX) { @@ -848,7 +848,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl maxCacheSizeCell = (SettingsCellWithLabelAndSlider*)cell; maxCacheSizeCell.settingSlider.minimumValue = 0; - maxCacheSizeCell.settingSlider.value = [MatrixHandler sharedHandler].currentMaxCachesSize; + maxCacheSizeCell.settingSlider.value = [MatrixSDKHandler sharedHandler].currentMaxCachesSize; [self onSliderValueChange:maxCacheSizeCell.settingSlider]; @@ -878,7 +878,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl } else if (indexPath.section == SETTINGS_SECTION_CONFIGURATION_INDEX) { SettingsTableCellWithTextView *configCell = [tableView dequeueReusableCellWithIdentifier:@"SettingsCellWithTextView" forIndexPath:indexPath]; NSString* appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; - MatrixHandler *mxHandler = [MatrixHandler sharedHandler]; + MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; configCell.settingTextView.text = [NSString stringWithFormat:kConfigurationFormatText, appVersion, MatrixSDKVersion, mxHandler.homeServerURL, nil, mxHandler.userId, mxHandler.accessToken]; cell = configCell; } else if (indexPath.section == SETTINGS_SECTION_COMMANDS_INDEX) {