|
@@ -443,28 +443,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
NCApplicationHandle().nextcloudPushNotificationAction(data: data) { detected in
|
|
|
if !detected {
|
|
|
|
|
|
- var openNotification: Bool = false
|
|
|
+ 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 {
|
|
|
- openNotification = true
|
|
|
+ findAccount = true
|
|
|
} else {
|
|
|
let accounts = NCManageDatabase.shared.getAllAccount()
|
|
|
for account in accounts {
|
|
|
if account.account == accountPush {
|
|
|
self.changeAccount(account.account)
|
|
|
- openNotification = true
|
|
|
+ findAccount = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if openNotification, let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification {
|
|
|
+ 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: { })
|
|
|
}
|
|
|
}
|
|
|
}
|