Move post-registration work from view to app delegate.
// FREEBIE
This commit is contained in:
parent
b39aa3b914
commit
0b772b3a37
@ -159,6 +159,10 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
||||
selector:@selector(databaseViewRegistrationComplete)
|
||||
name:kNSNotificationName_DatabaseViewRegistrationComplete
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(registrationStateDidChange)
|
||||
name:kNSNotificationName_RegistrationStateDidChange
|
||||
object:nil];
|
||||
|
||||
DDLogInfo(@"%@ application: didFinishLaunchingWithOptions completed.", self.tag);
|
||||
|
||||
@ -792,6 +796,26 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
||||
[OWSProfileManager.sharedManager fetchLocalUsersProfile];
|
||||
}
|
||||
|
||||
- (void)registrationStateDidChange
|
||||
{
|
||||
OWSAssert([NSThread isMainThread]);
|
||||
|
||||
DDLogInfo(@"registrationStateDidChange");
|
||||
|
||||
if ([TSAccountManager isRegistered]) {
|
||||
DDLogInfo(@"localNumber: %@", [TSAccountManager localNumber]);
|
||||
|
||||
[[TSStorageManager sharedManager].newDatabaseConnection
|
||||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[[ExperienceUpgradeFinder new] markAllAsSeenWithTransaction:transaction];
|
||||
}];
|
||||
// Start running the disappearing messages job in case the newly registered user
|
||||
// enables this feature
|
||||
[[OWSDisappearingMessagesJob sharedJob] startIfNecessary];
|
||||
[[OWSProfileManager sharedManager] ensureLocalProfileCached];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)ensureRootViewController
|
||||
{
|
||||
DDLogInfo(@"ensureRootViewController");
|
||||
|
||||
@ -492,15 +492,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
|
||||
{
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
if (self.newlyRegisteredUser) {
|
||||
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[self.experienceUpgradeFinder markAllAsSeenWithTransaction:transaction];
|
||||
}];
|
||||
// Start running the disappearing messages job in case the newly registered user
|
||||
// enables this feature
|
||||
[[OWSDisappearingMessagesJob sharedJob] startIfNecessary];
|
||||
[[OWSProfileManager sharedManager] ensureLocalProfileCached];
|
||||
} else if (!self.viewHasEverAppeared) {
|
||||
if (!self.newlyRegisteredUser && !self.viewHasEverAppeared) {
|
||||
[self displayAnyUnseenUpgradeExperience];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user