parent
5a7ed605e3
commit
73db16e068
|
@ -157,10 +157,10 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
accountManager:[Environment getCurrent].accountManager
|
||||
preferences:[Environment preferences]]
|
||||
.then(^{
|
||||
DDLogDebug(@"%@ Successfully ran syncPushTokensJob.", self.tag);
|
||||
DDLogWarn(@"%@ Successfully ran syncPushTokensJob.", self.tag);
|
||||
})
|
||||
.catch(^(NSError *_Nonnull error) {
|
||||
DDLogDebug(@"%@ Failed to run syncPushTokensJob with error: %@", self.tag, error);
|
||||
DDLogError(@"%@ Failed to run syncPushTokensJob with error: %@", self.tag, error);
|
||||
});
|
||||
|
||||
// Clean up any messages that expired since last launch.
|
||||
|
|
|
@ -43,13 +43,12 @@ class SyncPushTokensJob: NSObject {
|
|||
}
|
||||
|
||||
guard shouldUploadTokens else {
|
||||
Logger.info("\(self.TAG) skipping push token upload")
|
||||
Logger.warn("\(self.TAG) Skipping push token upload. pushToken: \(pushToken), voipToken: \(voipToken)")
|
||||
return Promise(value: ())
|
||||
}
|
||||
|
||||
Logger.info("\(self.TAG) Sending new tokens to account servers.")
|
||||
Logger.warn("\(self.TAG) Sending new tokens to account servers. pushToken: \(pushToken), voipToken: \(voipToken)")
|
||||
return self.accountManager.updatePushTokens(pushToken:pushToken, voipToken:voipToken).then {
|
||||
Logger.info("\(self.TAG) Recording tokens locally.")
|
||||
return self.recordNewPushTokens(pushToken:pushToken, voipToken:voipToken)
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +69,7 @@ class SyncPushTokensJob: NSObject {
|
|||
}
|
||||
|
||||
private func recordNewPushTokens(pushToken: String, voipToken: String) -> Promise<Void> {
|
||||
Logger.info("\(TAG) Recording new push tokens.")
|
||||
Logger.warn("\(self.TAG) Recording new push tokens. pushToken: \(pushToken), voipToken: \(voipToken)")
|
||||
|
||||
if (pushToken != self.preferences.getPushToken()) {
|
||||
Logger.info("\(TAG) Recording new plain push token")
|
||||
|
|
|
@ -137,9 +137,11 @@ typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
|
|||
syncJob.uploadOnlyIfStale = NO;
|
||||
[syncJob run]
|
||||
.then(^{
|
||||
DDLogWarn(@"%@ Successfully ran syncPushTokensJob.", self.tag);
|
||||
SignalAlertView(NSLocalizedString(@"PUSH_REGISTER_SUCCESS", @"Alert title"), nil);
|
||||
})
|
||||
.catch(^(NSError *error) {
|
||||
DDLogError(@"%@ Failed to run syncPushTokensJob with error: %@", self.tag, error);
|
||||
SignalAlertView(NSLocalizedString(@"REGISTRATION_BODY", @"Alert title"), error.localizedDescription);
|
||||
});
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#import "TSStorageManager.h"
|
||||
#import "UIUtil.h"
|
||||
#import "VersionMigrations.h"
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <SignalServiceKit/OWSBlockingManager.h>
|
||||
#import <SignalServiceKit/OWSMessageSender.h>
|
||||
#import <SignalServiceKit/TSMessagesManager.h>
|
||||
|
@ -350,7 +351,13 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS
|
|||
[[OWSSyncPushTokensJob alloc] initWithPushManager:[PushManager sharedManager]
|
||||
accountManager:self.accountManager
|
||||
preferences:[Environment preferences]];
|
||||
[syncPushTokensJob run];
|
||||
[syncPushTokensJob run]
|
||||
.then(^{
|
||||
DDLogWarn(@"%@ Successfully ran syncPushTokensJob.", self.tag);
|
||||
})
|
||||
.catch(^(NSError *_Nonnull error) {
|
||||
DDLogError(@"%@ Failed to run syncPushTokensJob with error: %@", self.tag, error);
|
||||
});
|
||||
}
|
||||
|
||||
- (void)tableViewSetUp {
|
||||
|
|
Loading…
Reference in New Issue