Jelajahi Sumber

set tile as alias

marinofaggiana 3 tahun lalu
induk
melakukan
f569601f9c
2 mengubah file dengan 15 tambahan dan 0 penghapusan
  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?) {
         
         let realm = try! Realm()
+        let alias = alias?.trimmingCharacters(in: .whitespacesAndNewlines)
 
         do {
             try realm.safeWrite {

+ 14 - 0
iOSClient/Files/NCFiles.swift

@@ -46,6 +46,7 @@ class NCFiles: NCCollectionViewCommon  {
         
         if isRoot {
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
+            titleForHome()
         }
         
         super.viewWillAppear(animated)
@@ -57,12 +58,25 @@ class NCFiles: NCCollectionViewCommon  {
         
         if isRoot {
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
+            titleForHome()
             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() {