Ver código fonte

register for push notifications when notifications are enabled in settings

B. Petersen 4 anos atrás
pai
commit
d124ca864c
1 arquivos alterados com 5 adições e 0 exclusões
  1. 5 0
      deltachat-ios/Controller/SettingsController.swift

+ 5 - 0
deltachat-ios/Controller/SettingsController.swift

@@ -319,6 +319,11 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
 
     @objc private func handleNotificationToggle(_ sender: UISwitch) {
         UserDefaults.standard.set(!sender.isOn, forKey: "notifications_disabled")
+        if sender.isOn {
+            if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
+                appDelegate.registerForNotifications()
+            }
+        }
         UserDefaults.standard.synchronize()
     }