Browse Source

clear code

Signed-off-by: Marino Faggiana <96728420+MarinoFaggianaAstraIridium@users.noreply.github.com>
Marino Faggiana 2 years ago
parent
commit
c8a8779bc1
2 changed files with 11 additions and 8 deletions
  1. 6 8
      iOSClient/AppDelegate.swift
  2. 5 0
      iOSClient/Login/NCLogin.swift

+ 6 - 8
iOSClient/AppDelegate.swift

@@ -226,19 +226,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
     // L' applicazione si dimetterà dallo stato di attivo
     func applicationWillResignActive(_ application: UIApplication) {
-        guard !account.isEmpty else { return }
-
+        // Nextcloud share accounts
+        if let error = shareAccounts() {
+            NKCommon.shared.writeLog("[ERROR] Create share accounts \(error.localizedDescription)")
+        }
         NKCommon.shared.writeLog("[INFO] Application will resign active")
+        guard !account.isEmpty else { return }
 
         // STOP OBSERVE/TIMER UPLOAD PROCESS
         NCNetworkingProcessUpload.shared.invalidateObserveTableMetadata()
         NCNetworkingProcessUpload.shared.stopTimer()
 
-        // Nextcloud share accounts
-        if let error = shareAccounts() {
-            NKCommon.shared.writeLog("[ERROR] Create share accounts \(error.localizedDescription)")
-        }
-
         if CCUtility.getPrivacyScreenEnabled() {
             // Privacy
             showPrivacyProtectionWindow()
@@ -627,7 +625,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     }
 
     func shareAccounts() -> Error? {
-        guard !account.isEmpty, let dirGroupApps = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps) else { return nil }
+        guard let dirGroupApps = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps) else { return nil }
 
         let tableAccount = NCManageDatabase.shared.getAllAccount()
         var accounts = [NKShareAccounts.DataAccounts]()

+ 5 - 0
iOSClient/Login/NCLogin.swift

@@ -116,6 +116,11 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
         }
 
         if NCBrandOptions.shared.use_GroupApps, let dirGroupApps = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps) {
+            // Nextcloud update share accounts
+            if let error = appDelegate.shareAccounts() {
+                NKCommon.shared.writeLog("[ERROR] Create share accounts \(error.localizedDescription)")
+            }
+            // Nextcloud get share accounts
             if let shareAccounts = NKShareAccounts().getShareAccount(at: dirGroupApps, application: UIApplication.shared) {
                 var accountTemp = [NKShareAccounts.DataAccounts]()
                 for shareAccount in shareAccounts {