Browse Source

improvements

Marino Faggiana 7 years ago
parent
commit
418a03df01
1 changed files with 18 additions and 23 deletions
  1. 18 23
      iOSClient/Main/CCMore.swift

+ 18 - 23
iOSClient/Main/CCMore.swift

@@ -195,32 +195,27 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
         }
         
         // Display Name user & Quota
-        tabAccount = NCManageDatabase.sharedInstance.getAccountActive()
-        if (tabAccount != nil) {
-            
-            if let displayName = tabAccount?.displayName {
-                if displayName.isEmpty {
-                    labelUsername.text = tabAccount!.user
-                }
-                else{
-                    labelUsername.text = tabAccount!.displayName
-                }
-            }
-            else{
-                labelUsername.text = tabAccount!.user
-            }
-            
-            // fix CCMore.swift line 208 Version 2.17.2 (00005)
-            if (tabAccount?.quotaRelative != nil && tabAccount?.quotaTotal != nil && tabAccount?.quotaUsed != nil) {
+        guard let tabAccount = NCManageDatabase.sharedInstance.getAccountActive() else {
+            return
+        }
+        
+        if tabAccount.displayName.isEmpty {
+            labelUsername.text = tabAccount.user
+        }
+        else{
+            labelUsername.text = tabAccount.displayName
+        }
+        
+        // fix CCMore.swift line 208 Version 2.17.2 (00005)
+        if (tabAccount.quotaRelative != 0 && tabAccount.quotaTotal != 0 && tabAccount.quotaUsed != 0) {
                 
-                progressQuota.progress = Float((tabAccount?.quotaRelative)!) / 100
-                progressQuota.progressTintColor = NCBrandColor.sharedInstance.brand
+            progressQuota.progress = Float(tabAccount.quotaRelative) / 100
+            progressQuota.progressTintColor = NCBrandColor.sharedInstance.brand
                 
-                let quota : String = CCUtility.transformedSize(Double((tabAccount?.quotaTotal)!))
-                let quotaUsed : String = CCUtility.transformedSize(Double((tabAccount?.quotaUsed)!))
+            let quota : String = CCUtility.transformedSize(Double(tabAccount.quotaTotal))
+            let quotaUsed : String = CCUtility.transformedSize(Double(tabAccount.quotaUsed))
                 
-                labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed, quota)
-            }
+            labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed, quota)
         }
     }