validate push settings on main thread
// FREEBIE
This commit is contained in:
parent
58e6ab60d8
commit
6911c8047e
@ -27,11 +27,13 @@ class SyncPushTokensJob: NSObject {
|
||||
func run() -> Promise<Void> {
|
||||
Logger.info("\(TAG) Starting.")
|
||||
|
||||
// Required to potentially prompt user for notifications settings
|
||||
// before `requestPushTokens` will return.
|
||||
self.pushManager.validateUserNotificationSettings()
|
||||
let runPromise: Promise<Void> = DispatchQueue.main.promise {
|
||||
// Required to potentially prompt user for notifications settings
|
||||
// before `requestPushTokens` will return.
|
||||
self.pushManager.validateUserNotificationSettings()
|
||||
|
||||
let runPromise: Promise<Void> = self.requestPushTokens().then { (pushToken: String, voipToken: String) in
|
||||
return self.requestPushTokens()
|
||||
}.then { (pushToken: String, voipToken: String) in
|
||||
var shouldUploadTokens = false
|
||||
|
||||
if self.preferences.getPushToken() != pushToken || self.preferences.getVoipToken() != voipToken {
|
||||
|
||||
@ -290,6 +290,8 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
|
||||
}
|
||||
|
||||
- (void)requestPushTokenWithSuccess:(pushTokensSuccessBlock)success failure:(failedPushRegistrationBlock)failure {
|
||||
AssertIsOnMainThread();
|
||||
|
||||
if (!self.wantRemoteNotifications) {
|
||||
DDLogWarn(@"%@ Using fake push tokens", self.tag);
|
||||
success(@"fakePushToken", @"fakeVoipToken");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user