Explorar el Código

set tile as alias

marinofaggiana hace 3 años
padre
commit
f569601f9c
Se han modificado 2 ficheros con 15 adiciones y 0 borrados
  1. 1 0
      iOSClient/Data/NCManageDatabase.swift
  2. 14 0
      iOSClient/Files/NCFiles.swift

+ 1 - 0
iOSClient/Data/NCManageDatabase.swift

@@ -708,6 +708,7 @@ class NCManageDatabase: NSObject {
     @objc func setAccountAlias(_ alias: String?) {
     @objc func setAccountAlias(_ alias: String?) {
         
         
         let realm = try! Realm()
         let realm = try! Realm()
+        let alias = alias?.trimmingCharacters(in: .whitespacesAndNewlines)
 
 
         do {
         do {
             try realm.safeWrite {
             try realm.safeWrite {

+ 14 - 0
iOSClient/Files/NCFiles.swift

@@ -46,6 +46,7 @@ class NCFiles: NCCollectionViewCommon  {
         
         
         if isRoot {
         if isRoot {
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
+            titleForHome()
         }
         }
         
         
         super.viewWillAppear(animated)
         super.viewWillAppear(animated)
@@ -57,12 +58,25 @@ class NCFiles: NCCollectionViewCommon  {
         
         
         if isRoot {
         if isRoot {
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
+            titleForHome()
             reloadDataSourceNetwork(forced: true)
             reloadDataSourceNetwork(forced: true)
         }
         }
         
         
         super.initialize()
         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
     // MARK: - DataSource + NC Endpoint
     
     
     override func reloadDataSource() {
     override func reloadDataSource() {