Re-enable notifications

pull/12/head
Niels Andriesse 6 years ago
parent 2092df955a
commit aeea6f26de

@ -732,12 +732,9 @@ static NSTimeInterval launchStartedAt;
// usually sufficient, but e.g. on iOS11, users who have disabled "Allow Notifications" and disabled // usually sufficient, but e.g. on iOS11, users who have disabled "Allow Notifications" and disabled
// "Background App Refresh" will not be able to obtain an APN token. Enabling those settings does not // "Background App Refresh" will not be able to obtain an APN token. Enabling those settings does not
// restart the app, so we check every activation for users who haven't yet registered. // restart the app, so we check every activation for users who haven't yet registered.
// Loki: Original code __unused AnyPromise *promise =
// ======== [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// __unused AnyPromise *promise = preferences:Environment.shared.preferences];
// [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// preferences:Environment.shared.preferences];
// ========
} }
if ([OWS2FAManager sharedManager].isDueForReminder) { if ([OWS2FAManager sharedManager].isDueForReminder) {
@ -1249,12 +1246,9 @@ static NSTimeInterval launchStartedAt;
[[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete]; [[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete];
// This should happen at any launch, background or foreground. // This should happen at any launch, background or foreground.
// Loki: Original code __unused AnyPromise *pushTokenpromise =
// ======== [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// __unused AnyPromise *pushTokenpromise = preferences:Environment.shared.preferences];
// [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// preferences:Environment.shared.preferences];
// ========
} }
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self]; [DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];

@ -59,25 +59,20 @@ public class AccountManager: NSObject {
Logger.debug("registering with signal server") Logger.debug("registering with signal server")
let registrationPromise: Promise<Void> = firstly { let registrationPromise: Promise<Void> = firstly {
return self.registerForTextSecure(verificationCode: verificationCode, pin: pin) return self.registerForTextSecure(verificationCode: verificationCode, pin: pin)
} }.then { _ -> Promise<Void> in
// Loki: Original code return self.syncPushTokens().recover { (error) -> Promise<Void> in
// ======== switch error {
// .then { _ -> Promise<Void> in case PushRegistrationError.pushNotSupported(let description):
// return self.syncPushTokens().recover { (error) -> Promise<Void> in // This can happen with:
// switch error { // - simulators, none of which support receiving push notifications
// case PushRegistrationError.pushNotSupported(let description): // - on iOS11 devices which have disabled "Allow Notifications" and disabled "Enable Background Refresh" in the system settings.
// // This can happen with: Logger.info("Recovered push registration error. Registering for manual message fetcher because push not supported: \(description)")
// // - simulators, none of which support receiving push notifications return self.enableManualMessageFetching()
// // - on iOS11 devices which have disabled "Allow Notifications" and disabled "Enable Background Refresh" in the system settings. default:
// Logger.info("Recovered push registration error. Registering for manual message fetcher because push not supported: \(description)") throw error
// return self.enableManualMessageFetching() }
// default: }
// throw error }.done { (_) -> Void in
// }
// }
// }
// ========
.done { (_) -> Void in
self.completeRegistration() self.completeRegistration()
} }

@ -113,19 +113,16 @@ NS_ASSUME_NONNULL_BEGIN
[contents addSection:loggingSection]; [contents addSection:loggingSection];
// Loki: Original code OWSTableSection *pushNotificationsSection = [OWSTableSection new];
// ======== pushNotificationsSection.headerTitle
// OWSTableSection *pushNotificationsSection = [OWSTableSection new]; = NSLocalizedString(@"PUSH_REGISTER_TITLE", @"Used in table section header and alert view title contexts");
// pushNotificationsSection.headerTitle [pushNotificationsSection addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"REREGISTER_FOR_PUSH", nil)
// = NSLocalizedString(@"PUSH_REGISTER_TITLE", @"Used in table section header and alert view title contexts"); accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
// [pushNotificationsSection addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"REREGISTER_FOR_PUSH", nil) self, @"reregister_push_notifications")
// accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME( actionBlock:^{
// self, @"reregister_push_notifications") [weakSelf syncPushTokens];
// actionBlock:^{ }]];
// [weakSelf syncPushTokens]; [contents addSection:pushNotificationsSection];
// }]];
// [contents addSection:pushNotificationsSection];
// ========
// Censorship circumvention has certain disadvantages so it should only be // Censorship circumvention has certain disadvantages so it should only be
// used if necessary. Therefore: // used if necessary. Therefore:

Loading…
Cancel
Save