Don't ask for notifications

pull/6/head
Niels Andriesse 5 years ago
parent adddec19ae
commit a284f3deb6

@ -719,9 +719,12 @@ static NSTimeInterval launchStartedAt;
// 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
// restart the app, so we check every activation for users who haven't yet registered.
__unused AnyPromise *promise =
[OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
preferences:Environment.shared.preferences];
// Loki: Original code
// ========
// __unused AnyPromise *promise =
// [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// preferences:Environment.shared.preferences];
// ========
}
if ([OWS2FAManager sharedManager].isDueForReminder) {
@ -1218,9 +1221,12 @@ static NSTimeInterval launchStartedAt;
[[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete];
// This should happen at any launch, background or foreground.
__unused AnyPromise *pushTokenpromise =
[OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
preferences:Environment.shared.preferences];
// Loki: Original code
// ========
// __unused AnyPromise *pushTokenpromise =
// [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// preferences:Environment.shared.preferences];
// ========
}
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];

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

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

Loading…
Cancel
Save