marinofaggiana 4 år sedan
förälder
incheckning
2da81ce694

+ 1 - 1
Cartfile

@@ -1,4 +1,4 @@
-github "nextcloud/ios-communication-library" "v0.70"
+github "nextcloud/ios-communication-library" "develop"
 github "tilltue/TLPhotoPicker" "2.0.11"
 github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
 github "MortimerGoro/MGSwipeTableCell" "1.6.8"

+ 1 - 1
Cartfile.resolved

@@ -20,7 +20,7 @@ github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
 github "marinofaggiana/TOPasscodeViewController" "0.0.7"
 github "marinofaggiana/XLForm" "eb9381ad8129f60402bf412250fb31b95a628a08"
-github "nextcloud/ios-communication-library" "v0.70"
+github "nextcloud/ios-communication-library" "fe6097b8a7c75ec96a7a6303cf55bfc60ee53ead"
 github "realm/realm-cocoa" "v5.0.3"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.5"

+ 16 - 20
iOSClient/Share/NCShare.swift

@@ -241,11 +241,11 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
     
     func unShareCompleted() { }
     
-    func updateShareWithError(idRemoteShared: Int) { }
+    func updateShareWithError(idShare: Int) { }
     
-    func getUserAndGroup(items: [OCShareUser]?) {
+    func getUserAndGroup(sharees: [NCCommunicationSharee]?) {
         
-        guard let items = items else { return }
+        guard let sharees = sharees else { return }
 
         dropDown = DropDown()
         let appearance = DropDown.appearance()
@@ -259,12 +259,8 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
         appearance.textColor = .darkGray
         appearance.setupMaskedCorners([.layerMaxXMaxYCorner, .layerMinXMaxYCorner])
         
-        for item in items {
-            if item.displayName != nil && item.displayName != "" {
-                dropDown.dataSource.append(item.displayName)
-            } else {
-                dropDown.dataSource.append(item.name)
-            }
+        for sharee in sharees {
+            dropDown.dataSource.append(sharee.label)
         }
         
         dropDown.anchorView = searchField
@@ -276,14 +272,14 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
         dropDown.customCellConfiguration = { (index: Index, item: String, cell: DropDownCell) -> Void in
             guard let cell = cell as? NCShareUserDropDownCell else { return }
             cell.imageItem.image = UIImage(named: "avatar")
-            let item = items[index]
+            let sharee = sharees[index]
 
-            let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(self.appDelegate.activeUser, activeUrl: self.appDelegate.activeUrl) + "-" + item.name + ".png"
+            let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(self.appDelegate.activeUser, activeUrl: self.appDelegate.activeUrl) + "-" + sharee.label + ".png"
             if FileManager.default.fileExists(atPath: fileNameLocalPath) {
                 if let image = UIImage(contentsOfFile: fileNameLocalPath) { cell.imageItem.image = image }
             } else {
                 DispatchQueue.global().async {
-                    NCCommunication.shared.downloadAvatar(userID: item.name, fileNameLocalPath: fileNameLocalPath, size: Int(k_avatar_size)) { (account, data, errorCode, errorMessage) in
+                    NCCommunication.shared.downloadAvatar(userID: sharee.label, fileNameLocalPath: fileNameLocalPath, size: Int(k_avatar_size)) { (account, data, errorCode, errorMessage) in
                         if errorCode == 0 && account == self.appDelegate.activeAccount && UIImage(data: data!) != nil {
                             if let image = UIImage(contentsOfFile: fileNameLocalPath) {
                                 cell.imageItem.image = image
@@ -295,17 +291,17 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
                 }
             }
 
-            if item.shareeType == 0 { cell.imageShareeType.image = UIImage(named: "shareTypeUser")}     // shareTypeUser
-            if item.shareeType == 1 { cell.imageShareeType.image = UIImage(named: "shareTypeGroup")}    // shareTypeGroup
-            if item.shareeType == 3 { cell.imageShareeType.image = UIImage(named: "shareTypeLink")}     // shareTypeLink
-            if item.shareeType == 4 { cell.imageShareeType.image = UIImage(named: "shareTypeEmail")}    // shareTypeEmail
-            if item.shareeType == 5 { cell.imageShareeType.image = UIImage(named: "shareTypeUser")}     // shareTypeContact
-            if item.shareeType == 6 { cell.imageShareeType.image = UIImage(named: "shareTypeLink")}     // shareTypeRemote
+            if sharee.shareType == 0 { cell.imageShareeType.image = UIImage(named: "shareTypeUser")}     // shareTypeUser
+            if sharee.shareType == 1 { cell.imageShareeType.image = UIImage(named: "shareTypeGroup")}    // shareTypeGroup
+            if sharee.shareType == 3 { cell.imageShareeType.image = UIImage(named: "shareTypeLink")}     // shareTypeLink
+            if sharee.shareType == 4 { cell.imageShareeType.image = UIImage(named: "shareTypeEmail")}    // shareTypeEmail
+            if sharee.shareType == 5 { cell.imageShareeType.image = UIImage(named: "shareTypeUser")}     // shareTypeContact
+            if sharee.shareType == 6 { cell.imageShareeType.image = UIImage(named: "shareTypeLink")}     // shareTypeRemote
         }
         
         dropDown.selectionAction = { [weak self] (index, item) in
-            let item = items[index]
-            self!.networking?.shareUserAndGroup(name: item.name, shareeType: item.shareeType, metadata: self!.metadata!)
+            let sharee = sharees[index]
+            self!.networking?.shareUserAndGroup(name: sharee.label, shareeType: sharee.shareType, metadata: self!.metadata!)
         }
         
         dropDown.show()

+ 2 - 1
iOSClient/Share/NCShareLinkMenuView.swift

@@ -22,6 +22,7 @@
 
 import Foundation
 import FSCalendar
+import NCCommunication
 
 class NCShareLinkMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkingDelegate, FSCalendarDelegate, FSCalendarDelegateAppearance {
     
@@ -393,7 +394,7 @@ class NCShareLinkMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkin
         reloadData(idShare: idShare)
     }
     
-    func getUserAndGroup(items: [OCShareUser]?) { }
+    func getUserAndGroup(sharees: [NCCommunicationSharee]?) { }
     
     // MARK: - Delegate calendar
     

+ 7 - 8
iOSClient/Share/NCShareNetworking.swift

@@ -65,7 +65,7 @@ class NCShareNetworking: NSObject {
                     NCUtility.sharedInstance.stopActivityIndicator()
                     if errorCode == 0 {
                         let itemsOCSharedDto = items as! [OCSharedDto]
-                        self.appDelegate.shares = NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, activeUrl: self.activeUrl, items: itemsOCSharedDto)
+//                        self.appDelegate.shares = NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, activeUrl: self.activeUrl, items: itemsOCSharedDto)
                         self.appDelegate.activeMain?.tableView?.reloadData()
                         self.appDelegate.activeFavorites?.tableView?.reloadData()
                     } else {
@@ -108,16 +108,15 @@ class NCShareNetworking: NSObject {
     
     func getUserAndGroup(searchString: String) {
         NCUtility.sharedInstance.startActivityIndicator(view: view)
-        OCNetworking.sharedManager()?.getUserGroup(withAccount: metadata.account, search: searchString, completion: { (account, items, message, errorCode) in
+        NCCommunication.shared.searchSharees(search: searchString) { (account, sharees, errorCode, errorDescription) in
             NCUtility.sharedInstance.stopActivityIndicator()
             if errorCode == 0 {
-                let itemsOCShareUser = items as! [OCShareUser]
-                self.delegate?.getUserAndGroup(items: itemsOCShareUser)
+                self.delegate?.getUserAndGroup(sharees: sharees)
             } else {
-                NCContentPresenter.shared.messageNotification("_share_", description: message, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: 0)
-                self.delegate?.getUserAndGroup(items: nil)
+                NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: 0)
+                self.delegate?.getUserAndGroup(sharees: nil)
             }
-        })
+        }
     }
     
     func shareUserAndGroup(name: String, shareeType: Int, metadata: tableMetadata) {
@@ -152,5 +151,5 @@ protocol NCShareNetworkingDelegate {
     func shareCompleted()
     func unShareCompleted()
     func updateShareWithError(idShare: Int)
-    func getUserAndGroup(items: [OCShareUser]?)
+    func getUserAndGroup(sharees: [NCCommunicationSharee]?)
 }

+ 2 - 1
iOSClient/Share/NCShareUserMenuView.swift

@@ -22,6 +22,7 @@
 
 import Foundation
 import FSCalendar
+import NCCommunication
 
 class NCShareUserMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkingDelegate, FSCalendarDelegate, FSCalendarDelegateAppearance {
     
@@ -325,7 +326,7 @@ class NCShareUserMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkin
         reloadData(idShare: idShare)
     }
     
-    func getUserAndGroup(items: [OCShareUser]?) { }
+    func getUserAndGroup(sharees: [NCCommunicationSharee]?) { }
     
     // MARK: - Delegate calendar