Просмотр исходного кода

Merge pull request #155 from deltachat/notification_permission_alert

Notification permission alert
björn petersen 5 лет назад
Родитель
Сommit
65664747e8

+ 1 - 2
deltachat-ios/AppDelegate.swift

@@ -71,7 +71,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         appCoordinator.start()
         UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum)
         start()
-        registerForPushNotifications()
         if !isConfigured {
             appCoordinator.presentLoginController()
         }
@@ -268,7 +267,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
     // MARK: - PushNotifications
 
-    private func registerForPushNotifications() {
+	func registerForPushNotifications() {
         UNUserNotificationCenter.current().delegate = self
 
         UNUserNotificationCenter.current()

+ 2 - 0
deltachat-ios/Controller/AccountSetupController.swift

@@ -537,6 +537,8 @@ class AccountSetupController: UITableViewController {
     private func handleLoginSuccess() {
         // used when login hud successfully went trough
         dismiss(animated: true, completion: nil)
+        let appDelegate = UIApplication.shared.delegate as! AppDelegate
+        appDelegate.registerForPushNotifications()
     }
 
     private func resignFirstResponderOnAllCells() {