Parcourir la source

Merge pull request #155 from deltachat/notification_permission_alert

Notification permission alert
björn petersen il y a 5 ans
Parent
commit
65664747e8

+ 1 - 2
deltachat-ios/AppDelegate.swift

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

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

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