marinofaggiana há 4 anos atrás
pai
commit
3d45229ea4

+ 11 - 5
iOSClient/Account Request/NCAccountRequest.swift

@@ -33,7 +33,8 @@ class NCAccountRequest: UIViewController {
     public var accounts: [tableAccount] = []
     public let heightCell: CGFloat = 80
     public var enableTimerProgress: Bool = true
-    
+    public var enableAddAccount: Bool = false
+
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     private var timer: Timer?
     private var time: Float = 0
@@ -156,12 +157,15 @@ extension NCAccountRequest: UITableViewDelegate {
 extension NCAccountRequest: UITableViewDataSource {
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return accounts.count
+        if enableAddAccount {
+            return accounts.count + 1
+        } else {
+            return accounts.count
+        }
     }
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-       
-        let account = accounts[indexPath.row]
+               
         let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
         cell.backgroundColor = NCBrandColor.shared.backgroundForm
        
@@ -169,7 +173,9 @@ extension NCAccountRequest: UITableViewDataSource {
         let userLabel = cell.viewWithTag(20) as? UILabel
         let urlLabel = cell.viewWithTag(30) as? UILabel
         let activeImage = cell.viewWithTag(40) as? UIImageView
-        
+
+        let account = accounts[indexPath.row]
+
         avatarImage?.image = NCUtility.shared.loadImage(named: "person.crop.circle")
     
         let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getStringUser(account.user, urlBase: account.urlBase)) + "-" + account.user + ".png"

+ 1 - 0
iOSClient/AppDelegate.swift

@@ -611,6 +611,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
                
                 vcAccountRequest.accounts = accounts
                 vcAccountRequest.enableTimerProgress = true
+                vcAccountRequest.enableAddAccount = false
                 
                 let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
                 let height = min(CGFloat(accounts.count * Int(vcAccountRequest.heightCell) + 65), screenHeighMax)

+ 2 - 1
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -659,7 +659,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                
                 vcAccountRequest.accounts = accounts
                 vcAccountRequest.enableTimerProgress = false
-                
+                vcAccountRequest.enableAddAccount = true
+
                 let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
                 let height = min(CGFloat(accounts.count * Int(vcAccountRequest.heightCell) + 65), screenHeighMax)