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 // 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.
__unused AnyPromise *promise = // Loki: Original code
[OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager // ========
preferences:Environment.shared.preferences]; // __unused AnyPromise *promise =
// [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// preferences:Environment.shared.preferences];
// ========
} }
if ([OWS2FAManager sharedManager].isDueForReminder) { if ([OWS2FAManager sharedManager].isDueForReminder) {
@ -1218,9 +1221,12 @@ 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.
__unused AnyPromise *pushTokenpromise = // Loki: Original code
[OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager // ========
preferences:Environment.shared.preferences]; // __unused AnyPromise *pushTokenpromise =
// [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager
// preferences:Environment.shared.preferences];
// ========
} }
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self]; [DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];

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

@ -113,16 +113,19 @@ NS_ASSUME_NONNULL_BEGIN
[contents addSection:loggingSection]; [contents addSection:loggingSection];
OWSTableSection *pushNotificationsSection = [OWSTableSection new]; // Loki: Original code
pushNotificationsSection.headerTitle // ========
= NSLocalizedString(@"PUSH_REGISTER_TITLE", @"Used in table section header and alert view title contexts"); // OWSTableSection *pushNotificationsSection = [OWSTableSection new];
[pushNotificationsSection addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"REREGISTER_FOR_PUSH", nil) // pushNotificationsSection.headerTitle
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME( // = NSLocalizedString(@"PUSH_REGISTER_TITLE", @"Used in table section header and alert view title contexts");
self, @"reregister_push_notifications") // [pushNotificationsSection addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"REREGISTER_FOR_PUSH", nil)
actionBlock:^{ // accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
[weakSelf syncPushTokens]; // self, @"reregister_push_notifications")
}]]; // actionBlock:^{
[contents addSection:pushNotificationsSection]; // [weakSelf syncPushTokens];
// }]];
// [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