Ensure we re-upload push tokens after re-registering.
// FREEBIE
This commit is contained in:
parent
2c5389d03f
commit
c0bcc40a6f
|
@ -76,7 +76,9 @@ class AccountManager: NSObject {
|
|||
|
||||
private func syncPushTokens() -> Promise<Void> {
|
||||
Logger.info("\(self.TAG) in \(#function)")
|
||||
return SyncPushTokensJob.run(accountManager: self, preferences: self.preferences)
|
||||
let job = SyncPushTokensJob(accountManager: self, preferences: self.preferences)
|
||||
job.uploadOnlyIfStale = false
|
||||
return job.run()
|
||||
}
|
||||
|
||||
private func completeRegistration() {
|
||||
|
|
|
@ -91,6 +91,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
{
|
||||
DDLogInfo(@"%@ re-registering.", self.tag);
|
||||
[[TSAccountManager sharedInstance] resetForRegistration];
|
||||
[[Environment getCurrent].preferences unsetRecordedAPNSTokens];
|
||||
|
||||
RegistrationViewController *viewController = [RegistrationViewController new];
|
||||
OWSNavigationController *navigationController =
|
||||
|
|
|
@ -79,6 +79,8 @@ extern NSString *const OWSPreferencesKeyEnableDebugLog;
|
|||
- (void)setVoipToken:(NSString *)value;
|
||||
- (nullable NSString *)getVoipToken;
|
||||
|
||||
- (void)unsetRecordedAPNSTokens;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -267,6 +267,25 @@ NSString *const OWSPreferencesKeyIOSUpgradeNagVersion = @"iOSUpgradeNagVersion";
|
|||
return [self tryGetValueForKey:OWSPreferencesKeyLastRecordedVoipToken];
|
||||
}
|
||||
|
||||
- (void)unsetRecordedAPNSTokens
|
||||
{
|
||||
DDLogWarn(@"%@ Forgetting recorded APNS tokens", self.tag);
|
||||
[self setValue:nil forKey:OWSPreferencesKeyLastRecordedPushToken];
|
||||
[self setValue:nil forKey:OWSPreferencesKeyLastRecordedVoipToken];
|
||||
}
|
||||
|
||||
#pragma mark - Logging
|
||||
|
||||
+ (NSString *)tag
|
||||
{
|
||||
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||
}
|
||||
|
||||
- (NSString *)tag
|
||||
{
|
||||
return self.class.tag;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
Loading…
Reference in New Issue