|
@@ -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()
|