marinofaggiana 3 лет назад
Родитель
Сommit
79f040b496

+ 2 - 14
iOSClient/Files/NCFiles.swift

@@ -46,7 +46,7 @@ class NCFiles: NCCollectionViewCommon  {
         
         if isRoot {
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
-            titleForHome()
+            titleCurrentFolder = getNavigationTitle()
         }
         
         super.viewWillAppear(animated)
@@ -58,25 +58,13 @@ class NCFiles: NCCollectionViewCommon  {
         
         if isRoot {
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
-            titleForHome()
+            titleCurrentFolder = getNavigationTitle()
             reloadDataSourceNetwork(forced: true)
         }
         
         super.initialize()
     }
     
-    // MARK: - Title for home
-    
-    private func titleForHome() {
-        
-        let activeAccount = NCManageDatabase.shared.getActiveAccount()
-        if activeAccount?.alias == "" {
-            titleCurrentFolder = NCBrandOptions.shared.brand
-        } else {
-            titleCurrentFolder = activeAccount?.alias ?? NCBrandOptions.shared.brand
-        }
-    }
-    
     // MARK: - DataSource + NC Endpoint
     
     override func reloadDataSource() {

+ 19 - 4
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -632,14 +632,19 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 if serverUrl == NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account) {
                  
                     let activeAccount = NCManageDatabase.shared.getActiveAccount()
-                    var title = "  "
+                    var titleButton = "  "
+                    
                     if activeAccount?.alias == "" {
-                        title = title + (activeAccount?.user ?? "")
+                        titleButton = titleButton + (activeAccount?.user ?? "")
                     } else {
-                        title = title + (activeAccount?.alias ?? "")
+                        titleButton = titleButton + (activeAccount?.alias ?? "")
+                    }
+                    
+                    if getNavigationTitle() == activeAccount?.alias {
+                        titleButton = ""
                     }
                     
-                    button.setTitle(title, for: .normal)
+                    button.setTitle(titleButton, for: .normal)
                     button.setTitleColor(.systemBlue, for: .normal)
                 }
                 
@@ -653,6 +658,16 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         }
     }
     
+    func getNavigationTitle() -> String {
+        
+        let activeAccount = NCManageDatabase.shared.getActiveAccount()
+        if activeAccount?.alias == "" {
+            return NCBrandOptions.shared.brand
+        } else {
+            return activeAccount?.alias ?? NCBrandOptions.shared.brand
+        }
+    }
+    
     // MARK: - BackgroundImageColor Delegate
     
     func colorPickerCancel() {