Marino Faggiana il y a 1 an
Parent
commit
a73a435098
2 fichiers modifiés avec 21 ajouts et 2 suppressions
  1. 2 1
      ExternalResources/NCApplicationHandle.swift
  2. 19 1
      iOSClient/AppDelegate.swift

+ 2 - 1
ExternalResources/NCApplicationHandle.swift

@@ -32,7 +32,8 @@ class NCApplicationHandle: NSObject {
 
     // class: AppDelegate
     // func nextcloudPushNotificationAction(data: [String: AnyObject])
-    func nextcloudPushNotificationAction(data: [String: AnyObject]) {
+    func nextcloudPushNotificationAction(data: [String: AnyObject], completion: @escaping (_ detected: Bool) -> Void) {
+        completion(false)
     }
 
     // class: AppDelegate

+ 19 - 1
iOSClient/AppDelegate.swift

@@ -440,7 +440,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     }
 
     func nextcloudPushNotificationAction(data: [String: AnyObject]) {
-        NCApplicationHandle().nextcloudPushNotificationAction(data: data)
+        NCApplicationHandle().nextcloudPushNotificationAction(data: data) { detected in
+            if !detected {
+                let accounts = NCManageDatabase.shared.getAllAccount()
+                for account in accounts {
+                    /*
+                    let urlBase = URL(string: account.urlBase)
+                    if url.contains(urlBase?.host ?? "") && userId == account.userId {
+                        changeAccount(account.account)
+                        return account
+                    }
+                    */
+                }
+                if let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification {
+                    let navigationController = UINavigationController(rootViewController: viewController)
+                    navigationController.modalPresentationStyle = .fullScreen
+                    self.window?.rootViewController?.present(navigationController, animated: true)
+                }
+            }
+        }
     }
 
     // MARK: - Login & checkErrorNetworking