marinofaggiana 4 năm trước cách đây
mục cha
commit
98b85cba9d

+ 9 - 3
iOSClient/Account Request/NCAccountRequest.swift

@@ -35,6 +35,7 @@ class NCAccountRequest: UIViewController {
     public var enableTimerProgress: Bool = true
     public var enableAddAccount: Bool = false
     public var viewController: UIViewController?
+    public var dismissDidEnterBackground: Bool = false
 
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     private var timer: Timer?
@@ -61,6 +62,7 @@ class NCAccountRequest: UIViewController {
         
         NotificationCenter.default.addObserver(self, selector: #selector(startTimer), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidEnterBackground), object: nil)
         
         changeTheming()        
     }
@@ -77,9 +79,6 @@ class NCAccountRequest: UIViewController {
         super.viewWillDisappear(animated)
         
         timer?.invalidate()
-        if enableAddAccount {
-            dismiss(animated: false)
-        }
     }
     
     // MARK: - NotificationCenter
@@ -90,6 +89,13 @@ class NCAccountRequest: UIViewController {
         tableView.backgroundColor = NCBrandColor.shared.backgroundForm
         tableView.reloadData()
     }
+    
+    @objc func applicationDidEnterBackground() {
+        
+        if dismissDidEnterBackground {
+            dismiss(animated: false)
+        }
+    }
 
     // MARK: - Progress
     

+ 1 - 0
iOSClient/AppDelegate.swift

@@ -612,6 +612,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
                 vcAccountRequest.accounts = accounts
                 vcAccountRequest.enableTimerProgress = true
                 vcAccountRequest.enableAddAccount = false
+                vcAccountRequest.dismissDidEnterBackground = false
                 
                 let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
                 let numberCell = accounts.count

+ 1 - 0
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -661,6 +661,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 vcAccountRequest.enableTimerProgress = false
                 vcAccountRequest.enableAddAccount = true
                 vcAccountRequest.viewController = self
+                vcAccountRequest.dismissDidEnterBackground = true
 
                 let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
                 let numberCell = accounts.count + 1