Add missing PN token sync

This commit is contained in:
nielsandriesse 2020-04-15 14:39:55 +10:00
parent 9c17bd9aa5
commit 47325b2a41
2 changed files with 3 additions and 5 deletions

View file

@ -3,7 +3,7 @@ import PromiseKit
final class PNModeVC : BaseVC, OptionViewDelegate {
private var optionViews: [OptionView] {
[ apnsOptionView, backgroundPollingOptionView, noPNsOptionView ]
[ apnsOptionView, backgroundPollingOptionView ]
}
private var selectedOptionView: OptionView? {
@ -13,7 +13,6 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
// MARK: Components
private lazy var apnsOptionView = OptionView(title: "Apple Push Notification Service", explanation: "The app will use the Apple Push Notification Service. You'll be notified of new messages immediately. This mode entails a slight privacy sacrifice as Apple will know your IP. The contents of your messages will still be fully encrypted, your data will still be stored in a decentralized manner and your messages will still be onion routed.", delegate: self, isRecommended: true)
private lazy var backgroundPollingOptionView = OptionView(title: "Background Polling", explanation: "The app will occassionally check for new messages when it's in the background. This provides full privacy but notifications may be significantly delayed.", delegate: self)
private lazy var noPNsOptionView = OptionView(title: "No Push Notifications", explanation: "You will not be notified of new messages when the app is closed. This provides full privacy.", delegate: self)
// MARK: Lifecycle
override func viewDidLoad() {
@ -98,9 +97,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
TSAccountManager.sharedInstance().didRegister()
let homeVC = HomeVC()
navigationController!.setViewControllers([ homeVC ], animated: true)
if (selectedOptionView == apnsOptionView || selectedOptionView == backgroundPollingOptionView) {
let _: Promise<Void> = SyncPushTokensJob.run(accountManager: AppEnvironment.shared.accountManager, preferences: Environment.shared.preferences)
}
let _: Promise<Void> = SyncPushTokensJob.run(accountManager: AppEnvironment.shared.accountManager, preferences: Environment.shared.preferences)
}
}

View file

@ -137,6 +137,7 @@
- (void)didToggleAPNsSwitch:(UISwitch *)sender
{
[NSUserDefaults.standardUserDefaults setBool:sender.on forKey:@"isUsingFullAPNs"];
__unused AnyPromise *promise = [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager preferences:Environment.shared.preferences];
}
@end