vector-im/element-ios/issues/4578 - Added generic `others` storage dictionary on MXKAccount.
MODIFY
MatrixKit/Models/Account/MXKAccount.h
MatrixKit/Models/Account/MXKAccount.h
@@ -148,6 +148,11 @@ typedef BOOL (^MXKAccountOnCertificateChange)(MXKAccount *mxAccount, NSData *cer
*/
@property (nonatomic, readonly) BOOL pushNotificationServiceIsActive;
+/**
+ Transient information storage.
+ */
+@property (nonatomic, strong, readonly) NSMutableDictionary<NSString *, id<NSCoding>> *others;
+
/**
Enable Push notification based on Apple Push Notification Service (APNS).

MODIFY
MatrixKit/Models/Account/MXKAccount.m
MatrixKit/Models/Account/MXKAccount.m
@@ -76,7 +76,7 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
// Background sync management
MXOnBackgroundSyncDone backgroundSyncDone;
- MXOnBackgroundSyncFail backgroundSyncfails;
+ MXOnBackgroundSyncFail backgroundSyncFails;
NSTimer* backgroundSyncTimer;
// Observe UIApplicationSignificantTimeChangeNotification to refresh MXRoomSummaries on time formatting change.
@@ -89,6 +89,8 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
@property (nonatomic, strong) id<MXBackgroundTask> backgroundTask;
@property (nonatomic, strong) id<MXBackgroundTask> backgroundSyncBgTask;
+@property (nonatomic, strong) NSMutableDictionary<NSString *, id<NSCoding>> *others;
+
@end
@implementation MXKAccount
@@ -225,6 +227,8 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
_showDecryptedContentInNotifications = [coder decodeBoolForKey:@"showDecryptedContentInNotifications"];
+ _others = [coder decodeObjectForKey:@"others"];
+
// Refresh device information
[self loadDeviceInformation:nil failure:nil];
}
@@ -284,6 +288,8 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
[coder encodeBool:_warnedAboutEncryption forKey:@"warnedAboutEncryption"];
[coder encodeBool:_showDecryptedContentInNotifications forKey:@"showDecryptedContentInNotifications"];
+
+ [coder encodeObject:_others forKey:@"others"];
}
#pragma mark - Properties
@@ -614,6 +620,15 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
[[MXKAccountManager sharedManager] saveAccounts];
}
+- (NSMutableDictionary<NSString *, id<NSCoding>> *)others
+{
+ if(_others == nil) {
+ _others = [NSMutableDictionary dictionary];
+ }
+
+ return _others;
+}
+
#pragma mark - Matrix user's profile
- (void)setUserDisplayName:(NSString*)displayname success:(void (^)(void))success failure:(void (^)(NSError *error))failure
@@ -1835,9 +1850,9 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
backgroundSyncTimer = nil;
}
- if (backgroundSyncfails && error)
+ if (backgroundSyncFails && error)
{
- backgroundSyncfails(error);
+ backgroundSyncFails(error);
}
if (backgroundSyncDone && !error)
@@ -1846,7 +1861,7 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
}
backgroundSyncDone = nil;
- backgroundSyncfails = nil;
+ backgroundSyncFails = nil;
// End background task
if (self.backgroundSyncBgTask.isRunning)
@@ -1874,7 +1889,7 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
MXLogDebug(@"[MXKAccount] starts a background Sync");
backgroundSyncDone = success;
- backgroundSyncfails = failure;
+ backgroundSyncFails = failure;
MXWeakify(self);

vector-im/element-ios/issues/4578 - Added generic `others` storage dictionary on MXKAccount.