mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
Add savingAccountsEnabled property to MXKAccountManager
This commit is contained in:
@@ -48,6 +48,9 @@ extern NSString *const MXKAccountManagerDataType;
|
||||
*/
|
||||
@interface MXKAccountManager : NSObject
|
||||
|
||||
/// Flag indicating that saving accounts enabled. Defaults to `YES`.
|
||||
@property (nonatomic, assign, getter=isSavingAccountsEnabled) BOOL savingAccountsEnabled;
|
||||
|
||||
/**
|
||||
The class of store used to open matrix session for the accounts. This class must be conformed to MXStore protocol.
|
||||
By default this class is MXFileStore.
|
||||
|
||||
@@ -72,6 +72,7 @@ NSString *const MXKAccountManagerDataType = @"org.matrix.kit.MXKAccountManagerDa
|
||||
{
|
||||
_storeClass = [MXFileStore class];
|
||||
_dehydrationService = [MXDehydrationService new];
|
||||
_savingAccountsEnabled = YES;
|
||||
|
||||
// Migrate old account file to new format
|
||||
[self migrateAccounts];
|
||||
@@ -108,10 +109,15 @@ NSString *const MXKAccountManagerDataType = @"org.matrix.kit.MXKAccountManagerDa
|
||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
||||
- (void)saveAccounts
|
||||
{
|
||||
NSDate *startDate = [NSDate date];
|
||||
|
||||
MXLogDebug(@"[MXKAccountManager] saveAccounts...");
|
||||
|
||||
|
||||
if (!self.isSavingAccountsEnabled)
|
||||
{
|
||||
MXLogDebug(@"[MXKAccountManager] saveAccounts: saving disabled.");
|
||||
return;
|
||||
}
|
||||
NSDate *startDate = [NSDate date];
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
NSKeyedArchiver *encoder = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user