|
@@ -439,36 +439,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
}
|
|
|
|
|
|
func nextcloudPushNotificationAction(data: [String: AnyObject]) {
|
|
|
- NCApplicationHandle().nextcloudPushNotificationAction(data: data) {
|
|
|
|
|
|
- var findAccount: Bool = false
|
|
|
+ guard let data = NCApplicationHandle().nextcloudPushNotificationAction(data: data) else { return }
|
|
|
+ var findAccount: Bool = false
|
|
|
|
|
|
- if let accountPush = data["account"] as? String,
|
|
|
- let app = data["app"] as? String,
|
|
|
- app == NCGlobal.shared.twoFactorNotificatioName {
|
|
|
- if accountPush == self.account {
|
|
|
- findAccount = true
|
|
|
- } else {
|
|
|
- let accounts = NCManageDatabase.shared.getAllAccount()
|
|
|
- for account in accounts {
|
|
|
- if account.account == accountPush {
|
|
|
- self.changeAccount(account.account)
|
|
|
- findAccount = true
|
|
|
- }
|
|
|
+ if let accountPush = data["account"] as? String {
|
|
|
+ if accountPush == self.account {
|
|
|
+ findAccount = true
|
|
|
+ } else {
|
|
|
+ let accounts = NCManageDatabase.shared.getAllAccount()
|
|
|
+ for account in accounts {
|
|
|
+ if account.account == accountPush {
|
|
|
+ self.changeAccount(account.account)
|
|
|
+ findAccount = true
|
|
|
}
|
|
|
}
|
|
|
- if findAccount, let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification {
|
|
|
- DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
|
- let navigationController = UINavigationController(rootViewController: viewController)
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
- self.window?.rootViewController?.present(navigationController, animated: true)
|
|
|
- }
|
|
|
- } else if !findAccount {
|
|
|
- let message = NSLocalizedString("_the_account_", comment: "") + " " + accountPush + " " + NSLocalizedString("_does_not_exist_", comment: "")
|
|
|
- let alertController = UIAlertController(title: NSLocalizedString("_info_", comment: ""), message: message, preferredStyle: .alert)
|
|
|
- alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in }))
|
|
|
- self.window?.rootViewController?.present(alertController, animated: true, completion: { })
|
|
|
+ }
|
|
|
+ if findAccount, let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification {
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
|
+ let navigationController = UINavigationController(rootViewController: viewController)
|
|
|
+ navigationController.modalPresentationStyle = .fullScreen
|
|
|
+ self.window?.rootViewController?.present(navigationController, animated: true)
|
|
|
}
|
|
|
+ } else if !findAccount {
|
|
|
+ let message = NSLocalizedString("_the_account_", comment: "") + " " + accountPush + " " + NSLocalizedString("_does_not_exist_", comment: "")
|
|
|
+ let alertController = UIAlertController(title: NSLocalizedString("_info_", comment: ""), message: message, preferredStyle: .alert)
|
|
|
+ alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in }))
|
|
|
+ self.window?.rootViewController?.present(alertController, animated: true, completion: { })
|
|
|
}
|
|
|
}
|
|
|
}
|