Merge branch 'charlesmchen/moreRetainUntilComplete'

pull/1/head
Matthew Chen 7 years ago
commit a29db6cb52

@ -107,7 +107,7 @@ NS_ASSUME_NONNULL_BEGIN
canCancel:NO canCancel:NO
backgroundBlock:^(ModalActivityIndicatorViewController *modalActivityIndicator) { backgroundBlock:^(ModalActivityIndicatorViewController *modalActivityIndicator) {
OWSProdInfo([OWSAnalyticsEvents registrationRegisteringCode]); OWSProdInfo([OWSAnalyticsEvents registrationRegisteringCode]);
[self.accountManager registerObjcWithVerificationCode:self.verificationCode pin:pinCode] [[self.accountManager registerObjcWithVerificationCode:self.verificationCode pin:pinCode]
.then(^{ .then(^{
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
OWSProdInfo([OWSAnalyticsEvents registrationRegisteringSubmittedCode]); OWSProdInfo([OWSAnalyticsEvents registrationRegisteringSubmittedCode]);
@ -130,7 +130,8 @@ NS_ASSUME_NONNULL_BEGIN
[modalActivityIndicator dismissWithCompletion:^{ [modalActivityIndicator dismissWithCompletion:^{
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
[OWSAlerts showAlertWithTitle:NSLocalizedString( [OWSAlerts
showAlertWithTitle:NSLocalizedString(
@"REGISTER_2FA_REGISTRATION_FAILED_ALERT_TITLE", @"REGISTER_2FA_REGISTRATION_FAILED_ALERT_TITLE",
@"Title for alert indicating that attempt to " @"Title for alert indicating that attempt to "
@"register with 'two-factor auth' failed.") @"register with 'two-factor auth' failed.")
@ -139,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN
[weakSelf.entryView makePinTextFieldFirstResponder]; [weakSelf.entryView makePinTextFieldFirstResponder];
}]; }];
}); });
}); }) retainUntilComplete];
}]; }];
} }

@ -187,8 +187,9 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
[OWSBackup.sharedManager setIsBackupEnabled:YES]; [OWSBackup.sharedManager setIsBackupEnabled:YES];
}) })
.thenInBackground(^{ .thenInBackground(^{
[self.tsAccountManager updateAccountAttributes]; return [self.tsAccountManager updateAccountAttributes];
})
.thenInBackground(^{
[self succeed]; [self succeed];
}); });
} }

@ -33,7 +33,7 @@ public class OWS111UDAttributesMigration: OWSDatabaseMigration {
} }
private func doMigration() { private func doMigration() {
tsAccountManager.updateAccountAttributes() tsAccountManager.updateAccountAttributes().retainUntilComplete()
self.dbReadWriteConnection().readWrite { transaction in self.dbReadWriteConnection().readWrite { transaction in
self.save(with: transaction) self.save(with: transaction)

@ -860,7 +860,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
{ {
OWSUserProfile *userProfile = self.localUserProfile; OWSUserProfile *userProfile = self.localUserProfile;
[userProfile clearWithProfileKey:[OWSAES256Key generateRandomKey] dbConnection:self.dbConnection completion:nil]; [userProfile clearWithProfileKey:[OWSAES256Key generateRandomKey] dbConnection:self.dbConnection completion:nil];
[self.tsAccountManager updateAccountAttributes]; [[self.tsAccountManager updateAccountAttributes] retainUntilComplete];
} }
- (void)addUserToProfileWhitelist:(NSString *)recipientId - (void)addUserToProfileWhitelist:(NSString *)recipientId

@ -86,7 +86,7 @@ NSString *const TSAccountManager_NeedsAccountAttributesUpdateKey = @"TSAccountMa
} }
[AppReadiness runNowOrWhenAppDidBecomeReady:^{ [AppReadiness runNowOrWhenAppDidBecomeReady:^{
[self updateAccountAttributesIfNecessary]; [[self updateAccountAttributesIfNecessary] retainUntilComplete];
}]; }];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
@ -721,7 +721,7 @@ NSString *const TSAccountManager_NeedsAccountAttributesUpdateKey = @"TSAccountMa
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
[AppReadiness runNowOrWhenAppDidBecomeReady:^{ [AppReadiness runNowOrWhenAppDidBecomeReady:^{
[self updateAccountAttributesIfNecessary]; [[self updateAccountAttributesIfNecessary] retainUntilComplete];
}]; }];
} }

@ -485,6 +485,6 @@ public class OWSUDManagerImpl: NSObject, OWSUDManager {
dbConnection.setBool(value, forKey: kUDUnrestrictedAccessKey, inCollection: kUDCollection) dbConnection.setBool(value, forKey: kUDUnrestrictedAccessKey, inCollection: kUDCollection)
// Try to update the account attributes to reflect this change. // Try to update the account attributes to reflect this change.
tsAccountManager.updateAccountAttributes() tsAccountManager.updateAccountAttributes().retainUntilComplete()
} }
} }

@ -10,6 +10,7 @@
#import "TSAccountManager.h" #import "TSAccountManager.h"
#import "TSNetworkManager.h" #import "TSNetworkManager.h"
#import "YapDatabaseConnection+OWS.h" #import "YapDatabaseConnection+OWS.h"
#import <SignalServiceKit/SignalServiceKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -89,7 +90,7 @@ const NSUInteger kDaySecs = kHourSecs * 24;
object:nil object:nil
userInfo:nil]; userInfo:nil];
[self.tsAccountManager updateAccountAttributes]; [[self.tsAccountManager updateAccountAttributes] retainUntilComplete];
} }
- (void)mark2FAAsEnabledWithPin:(NSString *)pin - (void)mark2FAAsEnabledWithPin:(NSString *)pin
@ -105,7 +106,7 @@ const NSUInteger kDaySecs = kHourSecs * 24;
object:nil object:nil
userInfo:nil]; userInfo:nil];
[self.tsAccountManager updateAccountAttributes]; [[self.tsAccountManager updateAccountAttributes] retainUntilComplete];
} }
- (void)requestEnable2FAWithPin:(NSString *)pin - (void)requestEnable2FAWithPin:(NSString *)pin

Loading…
Cancel
Save