marinofaggiana 6 年之前
父节点
当前提交
062b00842e
共有 2 个文件被更改,包括 7 次插入6 次删除
  1. 3 3
      iOSClient/Database/NCManageDatabase.swift
  2. 4 3
      iOSClient/Settings/HCEditProfile.swift

+ 3 - 3
iOSClient/Database/NCManageDatabase.swift

@@ -281,7 +281,7 @@ class NCManageDatabase: NSObject {
             return nil
         }
         
-        return result
+        return tableAccount.init(value: result)
     }
 
     @objc func getAccounts() -> [String]? {
@@ -378,7 +378,7 @@ class NCManageDatabase: NSObject {
                     if result.account == account {
                     
                         result.active = true
-                        activeAccount = result
+                        activeAccount = tableAccount.init(value: result)
                     
                     } else {
                     
@@ -517,7 +517,7 @@ class NCManageDatabase: NSObject {
             print("[LOG] Could not write to database: ", error)
         }
         
-        return activeAccount
+        return tableAccount.init(value: activeAccount)
     }
     
     @objc func setAccountHCFeatures(_ features: HCFeatures) -> tableAccount? {

+ 4 - 3
iOSClient/Settings/HCEditProfile.swift

@@ -26,6 +26,7 @@ import Foundation
 class HCEditProfile: XLFormViewController {
     
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    var tableAccount: tableAccount?
 
     required init(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
@@ -43,7 +44,7 @@ class HCEditProfile: XLFormViewController {
         var section : XLFormSectionDescriptor
         var row : XLFormRowDescriptor
 
-        let tableAccount = NCManageDatabase.sharedInstance.getAccountActive()
+        tableAccount = NCManageDatabase.sharedInstance.getAccountActive()
         
         section = XLFormSectionDescriptor.formSection()
         form.addFormSection(section)
@@ -140,7 +141,7 @@ class HCEditProfile: XLFormViewController {
         row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
         row.cellConfig["detailTextLabel.font"] = UIFont.systemFont(ofSize: 15.0)
         row.cellConfig["imageView.image"] = CCGraphics.changeThemingColorImage(UIImage.init(named: "businesstype"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)
-        row.selectorOptions = ["ARCHITECT","BRICKLAYER","CARPENTER","ELECTRICIAN","INSTALLER","PAINTER","PLUMBER","ROOFER","STOVEBUILDER","STUCCOER","WINDOWBUILDER","OTHER"]
+        row.selectorOptions = ["ARCHITECT", "BRICKLAYER", "CARPENTER", "ELECTRICIAN", "INSTALLER", "PAINTER", "PLUMBER", "ROOFER", "STOVEBUILDER","STUCCOER", "WINDOWBUILDER", "OTHER"]
         row.value = tableAccount?.businessType.components(separatedBy: ",")
         if row.value == nil { row.value = "" }
         section.addFormRow(row)
@@ -149,7 +150,7 @@ class HCEditProfile: XLFormViewController {
         row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
         row.cellConfig["detailTextLabel.font"] = UIFont.systemFont(ofSize: 15.0)
         row.cellConfig["imageView.image"] = CCGraphics.changeThemingColorImage(UIImage.init(named: "users"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)
-        row.selectorOptions = ["1-4","5-9","10-19","20-49","50-99","100-249","250-499","500-999","1000+"];
+        row.selectorOptions = ["1-4", "5-9", "10-19", "20-49", "50-99", "100-249", "250-499", "500-999", "1000+"];
         switch tableAccount?.businessSize {
         case 1: row.value = "1-4"
         case 5: row.value = "5-9"