diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 3109d13407..280da14b80 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -53,9 +53,9 @@ AF8ED1FC2757821000B8DBC4 /* NextcloudUnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF8ED1FB2757821000B8DBC4 /* NextcloudUnitTests.swift */; }; AF93471227E2341B002537EE /* NCShare+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471127E2341B002537EE /* NCShare+Menu.swift */; }; AF93471927E2361E002537EE /* NCShareAdvancePermissionFooter.xib in Resources */ = {isa = PBXBuildFile; fileRef = AF93471427E2361E002537EE /* NCShareAdvancePermissionFooter.xib */; }; - AF93471A27E2361E002537EE /* NCShareAdvancePermissionHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471527E2361E002537EE /* NCShareAdvancePermissionHeader.swift */; }; + AF93471A27E2361E002537EE /* NCShareHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471527E2361E002537EE /* NCShareHeader.swift */; }; AF93471B27E2361E002537EE /* NCShareAdvancePermission.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471627E2361E002537EE /* NCShareAdvancePermission.swift */; }; - AF93471C27E2361E002537EE /* NCShareAdvancePermissionHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = AF93471727E2361E002537EE /* NCShareAdvancePermissionHeader.xib */; }; + AF93471C27E2361E002537EE /* NCShareHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = AF93471727E2361E002537EE /* NCShareHeader.xib */; }; AF93471D27E2361E002537EE /* NCShareAdvancePermissionFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471827E2361E002537EE /* NCShareAdvancePermissionFooter.swift */; }; AF93474C27E34120002537EE /* NCUtility+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93474B27E34120002537EE /* NCUtility+Image.swift */; }; AF93474E27E3F212002537EE /* NCShareNewUserAddComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93474D27E3F211002537EE /* NCShareNewUserAddComment.swift */; }; @@ -1099,9 +1099,9 @@ AF8ED1FB2757821000B8DBC4 /* NextcloudUnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextcloudUnitTests.swift; sourceTree = ""; }; AF93471127E2341B002537EE /* NCShare+Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Menu.swift"; sourceTree = ""; }; AF93471427E2361E002537EE /* NCShareAdvancePermissionFooter.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareAdvancePermissionFooter.xib; sourceTree = ""; }; - AF93471527E2361E002537EE /* NCShareAdvancePermissionHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareAdvancePermissionHeader.swift; sourceTree = ""; }; + AF93471527E2361E002537EE /* NCShareHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareHeader.swift; sourceTree = ""; }; AF93471627E2361E002537EE /* NCShareAdvancePermission.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareAdvancePermission.swift; sourceTree = ""; }; - AF93471727E2361E002537EE /* NCShareAdvancePermissionHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareAdvancePermissionHeader.xib; sourceTree = ""; }; + AF93471727E2361E002537EE /* NCShareHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareHeader.xib; sourceTree = ""; }; AF93471827E2361E002537EE /* NCShareAdvancePermissionFooter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareAdvancePermissionFooter.swift; sourceTree = ""; }; AF93474B27E34120002537EE /* NCUtility+Image.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCUtility+Image.swift"; sourceTree = ""; }; AF93474D27E3F211002537EE /* NCShareNewUserAddComment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareNewUserAddComment.swift; sourceTree = ""; }; @@ -1908,8 +1908,6 @@ AF93471627E2361E002537EE /* NCShareAdvancePermission.swift */, AF93471827E2361E002537EE /* NCShareAdvancePermissionFooter.swift */, AF93471427E2361E002537EE /* NCShareAdvancePermissionFooter.xib */, - AF93471527E2361E002537EE /* NCShareAdvancePermissionHeader.swift */, - AF93471727E2361E002537EE /* NCShareAdvancePermissionHeader.xib */, AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */, AF93474D27E3F211002537EE /* NCShareNewUserAddComment.swift */, ); @@ -2135,6 +2133,8 @@ F774264822EB4D0000B23912 /* NCSearchUserDropDownCell.xib */, F769453B22E9CFFF000A798A /* NCShareUserCell.xib */, AF2D7C7D2742559100ADF566 /* NCShareUserCell.swift */, + AF93471727E2361E002537EE /* NCShareHeader.xib */, + AF93471527E2361E002537EE /* NCShareHeader.swift */, ); path = Share; sourceTree = ""; @@ -2607,8 +2607,8 @@ isa = PBXGroup; children = ( F7C9555221F0C4CA0024296E /* NCActivity.storyboard */, - AF56C1DB2784856200D8BAE2 /* NCActivityCommentView.xib */, F7C9555421F0C5470024296E /* NCActivity.swift */, + AF56C1DB2784856200D8BAE2 /* NCActivityCommentView.xib */, AFA2AC8427849604008E1EA7 /* NCActivityCommentView.swift */, D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */, ); @@ -3690,7 +3690,7 @@ F7F4F10B27ECDBDB008676F9 /* Inconsolata-Light.ttf in Resources */, F7CEE6002BA9A5C9003EFD89 /* NCTrashGridCell.xib in Resources */, 3704EB2A23D5A58400455C5B /* NCMenu.storyboard in Resources */, - AF93471C27E2361E002537EE /* NCShareAdvancePermissionHeader.xib in Resources */, + AF93471C27E2361E002537EE /* NCShareHeader.xib in Resources */, F76032A0252F0F8E0015A421 /* NCTransferCell.xib in Resources */, F7F4F10527ECDBDB008676F9 /* Inconsolata-SemiBold.ttf in Resources */, F7A48415297028FC00BD1B49 /* Nextcloud Hub.png in Resources */, @@ -4312,7 +4312,7 @@ F7E98C1627E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */, F7F4F11227ECDC52008676F9 /* UIFont+Extension.swift in Sources */, F76882222C0DD1E7001CF441 /* NCCapabilitiesView.swift in Sources */, - AF93471A27E2361E002537EE /* NCShareAdvancePermissionHeader.swift in Sources */, + AF93471A27E2361E002537EE /* NCShareHeader.swift in Sources */, F7F878AE1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */, F7A7FDDD2C2DBD6200E9A93A /* NCDeepLinkHandler.swift in Sources */, 3781B9B023DB2B7E006B4B1D /* AppDelegate+Menu.swift in Sources */, @@ -5778,8 +5778,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/1024jp/GzipSwift"; requirement = { - kind = upToNextMajorVersion; - minimumVersion = 6.0.0; + kind = exactVersion; + version = 6.0.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/iOSClient/Activity/NCActivity.storyboard b/iOSClient/Activity/NCActivity.storyboard index 6e94864843..5d9b22d787 100644 --- a/iOSClient/Activity/NCActivity.storyboard +++ b/iOSClient/Activity/NCActivity.storyboard @@ -1,9 +1,9 @@ - + - + @@ -17,93 +17,52 @@ - + - - + + - + - - - + - - + - - - - + - - - - + @@ -115,10 +74,11 @@ + - + @@ -129,7 +89,7 @@ - + diff --git a/iOSClient/Activity/NCActivity.swift b/iOSClient/Activity/NCActivity.swift index 56f03776c0..826fdc858d 100644 --- a/iOSClient/Activity/NCActivity.swift +++ b/iOSClient/Activity/NCActivity.swift @@ -31,7 +31,7 @@ class NCActivity: UIViewController, NCSharePagingContent { @IBOutlet weak var tableView: UITableView! var commentView: NCActivityCommentView? - var textField: UITextField? { commentView?.newCommentField } + var textField: UIView? { commentView?.newCommentField } @IBOutlet weak var viewContainerConstraint: NSLayoutConstraint! var height: CGFloat = 0 @@ -46,7 +46,7 @@ class NCActivity: UIViewController, NCSharePagingContent { var sectionDates: [Date] = [] var dataSourceTask: URLSessionTask? - var insets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) + var insets = UIEdgeInsets(top: 8, left: 0, bottom: 0, right: 0) var didSelectItemEnable: Bool = true var objectType: String? @@ -117,7 +117,7 @@ class NCActivity: UIViewController, NCSharePagingContent { tableView.tableHeaderView = commentView commentView?.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true commentView?.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true - viewContainerConstraint.constant = height + viewContainerConstraint.constant = height - 10 } func makeTableFooterView() -> UIView { @@ -130,9 +130,16 @@ class NCActivity: UIViewController, NCSharePagingContent { label.textColor = NCBrandColor.shared.textColor2 label.textAlignment = .center label.text = NSLocalizedString("_no_activity_footer_", comment: "") - label.frame = CGRect(x: 0, y: 10, width: tableView.frame.width, height: 60) +// label.frame = CGRect(x: 0, y: 10, width: tableView.frame.width, height: 60) view.addSubview(label) + + label.translatesAutoresizingMaskIntoConstraints = false + + label.topAnchor.constraint(equalTo: view.topAnchor, constant: 20).isActive = true + label.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + label.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true + return view } } @@ -140,22 +147,12 @@ class NCActivity: UIViewController, NCSharePagingContent { // MARK: - Table View extension NCActivity: UITableViewDelegate { - - func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { - return 120 - } - func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - return 60 - } - - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return UITableView.automaticDimension + return 50 } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - - let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 60)) + let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50)) view.backgroundColor = .clear let label = UILabel() @@ -163,14 +160,28 @@ extension NCActivity: UITableViewDelegate { label.textColor = NCBrandColor.shared.textColor label.text = utility.getTitleFromDate(sectionDates[section]) label.textAlignment = .center - label.layer.cornerRadius = 11 - label.layer.masksToBounds = true - label.layer.backgroundColor = UIColor(red: 152.0 / 255.0, green: 167.0 / 255.0, blue: 181.0 / 255.0, alpha: 0.8).cgColor - let widthFrame = label.intrinsicContentSize.width + 30 - let xFrame = tableView.bounds.width / 2 - widthFrame / 2 - label.frame = CGRect(x: xFrame, y: 10, width: widthFrame, height: 22) + let blur = UIBlurEffect(style: .systemMaterial) + let blurredEffectView = UIVisualEffectView(effect: blur) + blurredEffectView.layer.cornerRadius = 11 + blurredEffectView.layer.masksToBounds = true + + view.addSubview(blurredEffectView) view.addSubview(label) + + blurredEffectView.translatesAutoresizingMaskIntoConstraints = false + label.translatesAutoresizingMaskIntoConstraints = false + + NSLayoutConstraint.activate([ + blurredEffectView.topAnchor.constraint(equalTo: view.topAnchor), + blurredEffectView.centerXAnchor.constraint(equalTo: view.centerXAnchor), + blurredEffectView.widthAnchor.constraint(equalToConstant: label.intrinsicContentSize.width + 30), + blurredEffectView.heightAnchor.constraint(equalToConstant: 22), + label.topAnchor.constraint(equalTo: view.topAnchor), + label.centerXAnchor.constraint(equalTo: view.centerXAnchor), + label.centerYAnchor.constraint(equalTo: blurredEffectView.centerYAnchor) + ]) + return view } } @@ -244,7 +255,6 @@ extension NCActivity: UITableViewDataSource { cell.indexPath = indexPath cell.avatar.image = nil cell.avatar.isHidden = true - cell.subjectTrailingConstraint.constant = 10 cell.didSelectItemEnable = self.didSelectItemEnable cell.subject.textColor = NCBrandColor.shared.textColor cell.viewController = self @@ -257,7 +267,7 @@ extension NCActivity: UITableViewDataSource { if FileManager.default.fileExists(atPath: fileNameLocalPath) { if let image = UIImage(contentsOfFile: fileNameLocalPath) { - cell.icon.image = image + cell.icon.image = image.withTintColor(NCBrandColor.shared.textColor, renderingMode: .alwaysOriginal) } } else { NextcloudKit.shared.downloadContent(serverUrl: activity.icon) { _, data, error in @@ -274,13 +284,15 @@ extension NCActivity: UITableViewDataSource { // avatar if !activity.user.isEmpty && activity.user != appDelegate.userId { - cell.subjectTrailingConstraint.constant = 50 cell.avatar.isHidden = false cell.fileUser = activity.user let fileName = appDelegate.userBaseUrl + "-" + activity.user + ".png" NCNetworking.shared.downloadAvatar(user: activity.user, dispalyName: nil, fileName: fileName, cell: cell, view: tableView) + cell.subjectLeadingConstraint.constant = 15 + } else { + cell.subjectLeadingConstraint.constant = -30 } // subject @@ -317,15 +329,6 @@ extension NCActivity: UITableViewDataSource { cell.subject.attributedText = subject.set(style: StyleGroup(base: normal, ["bold": bold, "date": date])) } - // CollectionView - cell.activityPreviews = NCManageDatabase.shared.getActivityPreview(account: activity.account, idActivity: activity.idActivity, orderKeysId: orderKeysId) - if cell.activityPreviews.isEmpty { - cell.collectionViewHeightConstraint.constant = 0 - } else { - cell.collectionViewHeightConstraint.constant = 60 - } - cell.collectionView.reloadData() - return cell } } @@ -354,7 +357,7 @@ extension NCActivity { if let mainTabBar = self.tabBarController?.tabBar as? NCMainTabBar { bottom = -mainTabBar.getHeight() } - NCActivityIndicator.shared.start(backgroundView: self.view, bottom: bottom - 5, style: .medium) + NCActivityIndicator.shared.start(backgroundView: self.view, bottom: bottom - 35, style: .medium) let dispatchGroup = DispatchGroup() loadComments(disptachGroup: dispatchGroup) diff --git a/iOSClient/Activity/NCActivityCommentView.swift b/iOSClient/Activity/NCActivityCommentView.swift index 22f9072798..9318b90789 100644 --- a/iOSClient/Activity/NCActivityCommentView.swift +++ b/iOSClient/Activity/NCActivityCommentView.swift @@ -25,7 +25,6 @@ import UIKit class NCActivityCommentView: UIView, UITextFieldDelegate { @IBOutlet weak var imageItem: UIImageView! - @IBOutlet weak var labelUser: UILabel! @IBOutlet weak var newCommentField: UITextField! var completionHandler: ((String?) -> Void)? @@ -42,18 +41,22 @@ class NCActivityCommentView: UIView, UITextFieldDelegate { } else { imageItem.image = NCUtility().loadImage(named: "person.crop.circle", colors: [NCBrandColor.shared.iconImageColor]) } - - if account.displayName.isEmpty { - labelUser.text = account.user - } else { - labelUser.text = account.displayName - } - labelUser.textColor = NCBrandColor.shared.textColor } - +// func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() completionHandler?(textField.text) return true } } + +extension NCActivityCommentView: UISearchBarDelegate { + func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { + searchBar.resignFirstResponder() + completionHandler?(searchBar.text) + } + func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { + +// return true + } +} diff --git a/iOSClient/Activity/NCActivityCommentView.xib b/iOSClient/Activity/NCActivityCommentView.xib index 0eba994ad3..e60f0514d4 100644 --- a/iOSClient/Activity/NCActivityCommentView.xib +++ b/iOSClient/Activity/NCActivityCommentView.xib @@ -1,60 +1,61 @@ - + - + + - + - + - - + + - - + + + - + - + - - - - - - - - - + + + + + + - + + + + + + + + diff --git a/iOSClient/Activity/NCActivityTableViewCell.swift b/iOSClient/Activity/NCActivityTableViewCell.swift index 4286b25902..10d7477b8f 100644 --- a/iOSClient/Activity/NCActivityTableViewCell.swift +++ b/iOSClient/Activity/NCActivityTableViewCell.swift @@ -40,14 +40,11 @@ class NCActivityCollectionViewCell: UICollectionViewCell { } class NCActivityTableViewCell: UITableViewCell, NCCellProtocol { - - @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var icon: UIImageView! @IBOutlet weak var avatar: UIImageView! @IBOutlet weak var subject: UILabel! - @IBOutlet weak var subjectTrailingConstraint: NSLayoutConstraint! - @IBOutlet weak var collectionViewHeightConstraint: NSLayoutConstraint! - + @IBOutlet weak var subjectLeadingConstraint: NSLayoutConstraint! + private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! private var user: String = "" private var index = IndexPath() @@ -73,8 +70,6 @@ class NCActivityTableViewCell: UITableViewCell, NCCellProtocol { override func awakeFromNib() { super.awakeFromNib() - collectionView.delegate = self - collectionView.dataSource = self let avatarRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAvatarImage)) avatar.addGestureRecognizer(avatarRecognizer) } @@ -215,11 +210,11 @@ extension NCActivityTableViewCell: UICollectionViewDataSource { extension NCActivityTableViewCell: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return CGSize(width: 50, height: 50) + return CGSize(width: 50, height: 30) } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { - return 20 + return 0 } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { diff --git a/iOSClient/Data/NCManageDatabase+Capabilities.swift b/iOSClient/Data/NCManageDatabase+Capabilities.swift index e3617650b5..d4ebfabf4d 100644 --- a/iOSClient/Data/NCManageDatabase+Capabilities.swift +++ b/iOSClient/Data/NCManageDatabase+Capabilities.swift @@ -360,7 +360,7 @@ extension NCManageDatabase { global.capabilityFilesComments = data.capabilities.files?.comments ?? false global.capabilityFilesBigfilechunking = data.capabilities.files?.bigfilechunking ?? false - global.capabilityUserStatusEnabled = data.capabilities.files?.undelete ?? false + global.capabilityUserStatusEnabled = data.capabilities.userstatus?.enabled ?? false if data.capabilities.external != nil { global.capabilityExternalSites = true } diff --git a/iOSClient/Extensions/UIView+Extension.swift b/iOSClient/Extensions/UIView+Extension.swift index a57cde15fc..a49d1300f0 100644 --- a/iOSClient/Extensions/UIView+Extension.swift +++ b/iOSClient/Extensions/UIView+Extension.swift @@ -55,6 +55,15 @@ extension UIView { self.addSubview(blurredEffectView) } + func insertBlur(style: UIBlurEffect.Style) { + let blur = UIBlurEffect(style: style) + let blurredEffectView = UIVisualEffectView(effect: blur) + blurredEffectView.frame = self.bounds + blurredEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + blurredEffectView.isUserInteractionEnabled = false + self.insertSubview(blurredEffectView, at: 0) + } + func makeCircularBackground(withColor backgroundColor: UIColor) { self.backgroundColor = backgroundColor self.layer.cornerRadius = self.frame.size.width / 2 diff --git a/iOSClient/Menu/NCShare+Menu.swift b/iOSClient/Menu/NCShare+Menu.swift index d497981031..a465c7ebd5 100644 --- a/iOSClient/Menu/NCShare+Menu.swift +++ b/iOSClient/Menu/NCShare+Menu.swift @@ -63,7 +63,7 @@ extension NCShare { NCMenuAction( title: NSLocalizedString("_share_unshare_", comment: ""), destructive: true, - icon: utility.loadImage(named: "trash", colors: [.red]), + icon: utility.loadImage(named: "person.2.slash"), action: { _ in Task { if share.shareType != NCShareCommon().SHARE_TYPE_LINK, let metadata = self.metadata, metadata.e2eEncrypted && NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV20 { diff --git a/iOSClient/Share/Advanced/NCShareAdvancePermission.swift b/iOSClient/Share/Advanced/NCShareAdvancePermission.swift index 56430fa914..487f21ea34 100644 --- a/iOSClient/Share/Advanced/NCShareAdvancePermission.swift +++ b/iOSClient/Share/Advanced/NCShareAdvancePermission.swift @@ -109,7 +109,7 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg } func setupHeaderView() { - guard let headerView = (Bundle.main.loadNibNamed("NCShareAdvancePermissionHeader", owner: self, options: nil)?.first as? NCShareAdvancePermissionHeader) else { return } + guard let headerView = (Bundle.main.loadNibNamed("NCShareHeader", owner: self, options: nil)?.first as? NCShareHeader) else { return } headerView.setupUI(with: metadata) let container = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 220)) diff --git a/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.xib b/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.xib deleted file mode 100644 index beb60d8c5e..0000000000 --- a/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.xib +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift b/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift index 19158e449e..a4bd06855f 100644 --- a/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift +++ b/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift @@ -58,7 +58,7 @@ class NCShareNewUserAddComment: UIViewController, NCShareDetail { noteTextField.inputAccessoryView = toolbar.wrappedSafeAreaContainer - guard let headerView = (Bundle.main.loadNibNamed("NCShareAdvancePermissionHeader", owner: self, options: nil)?.first as? NCShareAdvancePermissionHeader) else { return } + guard let headerView = (Bundle.main.loadNibNamed("NCShareHeader", owner: self, options: nil)?.first as? NCShareHeader) else { return } headerContainerView.addSubview(headerView) headerView.frame = headerContainerView.frame headerView.translatesAutoresizingMaskIntoConstraints = false diff --git a/iOSClient/Share/NCSearchUserDropDownCell.xib b/iOSClient/Share/NCSearchUserDropDownCell.xib index fa63960bcf..2ba38c8fa6 100755 --- a/iOSClient/Share/NCSearchUserDropDownCell.xib +++ b/iOSClient/Share/NCSearchUserDropDownCell.xib @@ -1,9 +1,9 @@ - + - + @@ -34,7 +34,7 @@ - + diff --git a/iOSClient/Share/NCShare.storyboard b/iOSClient/Share/NCShare.storyboard index a82cbfd1f8..d06257f31f 100644 --- a/iOSClient/Share/NCShare.storyboard +++ b/iOSClient/Share/NCShare.storyboard @@ -1,9 +1,9 @@ - + - + @@ -53,72 +53,18 @@ - + - - + + - - - - - - - + + - - - - + + - + - + - - - - - + + + + + @@ -157,11 +129,11 @@ - + - + @@ -170,8 +142,6 @@ - - @@ -179,7 +149,7 @@ - + @@ -306,28 +276,22 @@ - - - - - - - + - + - + diff --git a/iOSClient/Share/NCShare.swift b/iOSClient/Share/NCShare.swift index 477a1ced20..921fe5b7ff 100644 --- a/iOSClient/Share/NCShare.swift +++ b/iOSClient/Share/NCShare.swift @@ -31,16 +31,13 @@ import MarqueeLabel import ContactsUI class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent { - @IBOutlet weak var viewContainerConstraint: NSLayoutConstraint! @IBOutlet weak var sharedWithYouByView: UIView! @IBOutlet weak var sharedWithYouByImage: UIImageView! @IBOutlet weak var sharedWithYouByLabel: UILabel! - @IBOutlet weak var sharedWithYouByNoteImage: UIImageView! - @IBOutlet weak var sharedWithYouByNote: MarqueeLabel! @IBOutlet weak var searchFieldTopConstraint: NSLayoutConstraint! - @IBOutlet weak var searchField: UITextField! - var textField: UITextField? { searchField } + @IBOutlet weak var searchField: UISearchBar! + var textField: UIView? { searchField } @IBOutlet weak var tableView: UITableView! @IBOutlet weak var btnContact: UIButton! @@ -72,7 +69,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent view.backgroundColor = .systemBackground viewContainerConstraint.constant = height - searchFieldTopConstraint.constant = 10 + searchFieldTopConstraint.constant = 0 searchField.placeholder = NSLocalizedString("_shareLinksearch_placeholder_", comment: "") searchField.autocorrectionType = .no @@ -81,6 +78,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent tableView.delegate = self tableView.allowsSelection = false tableView.backgroundColor = .systemBackground + tableView.contentInset = UIEdgeInsets(top: 8, left: 0, bottom: 10, right: 0) tableView.register(UINib(nibName: "NCShareLinkCell", bundle: nil), forCellReuseIdentifier: "cellLink") tableView.register(UINib(nibName: "NCShareUserCell", bundle: nil), forCellReuseIdentifier: "cellUser") @@ -93,9 +91,9 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent let direcrory = NCManageDatabase.shared.getTableDirectory(account: metadata.account, serverUrl: metadata.serverUrl) if NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV12 || (NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV20 && direcrory?.e2eEncrypted ?? false) { - // searchField.isEnabled = false searchFieldTopConstraint.constant = -50 - searchField.isHidden = true + searchField.alpha = 0 + btnContact.alpha = 0 } } else { checkSharedWithYou() @@ -108,6 +106,9 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent let isVisible = (self.navigationController?.topViewController as? NCSharePaging)?.page == .sharing networking?.readShare(showLoadingIndicator: isVisible) } + + searchField.searchTextField.font = .systemFont(ofSize: 14) + searchField.delegate = self } func makeNewLinkShare() { @@ -128,11 +129,12 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent guard let appDelegate = self.appDelegate, let metadata = metadata, !metadata.ownerId.isEmpty, metadata.ownerId != appDelegate.userId else { return } if !canReshare { - searchField.isEnabled = false + searchField.isUserInteractionEnabled = false + searchField.alpha = 0.5 searchField.placeholder = NSLocalizedString("_share_reshare_disabled_", comment: "") } - searchFieldTopConstraint.constant = 65 + searchFieldTopConstraint.constant = 45 sharedWithYouByView.isHidden = false sharedWithYouByLabel.text = NSLocalizedString("_shared_with_you_by_", comment: "") + " " + metadata.ownerDisplayName sharedWithYouByImage.image = utility.loadUserImage( @@ -146,19 +148,6 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent let shareLabelAction = UITapGestureRecognizer(target: self, action: #selector(openShareProfile)) sharedWithYouByLabel.addGestureRecognizer(shareLabelAction) - if !metadata.note.isEmpty { - searchFieldTopConstraint.constant = 95 - sharedWithYouByNoteImage.isHidden = false - sharedWithYouByNoteImage.image = utility.loadImage(named: "note.text", colors: [NCBrandColor.shared.iconImageColor]) - sharedWithYouByNote.isHidden = false - sharedWithYouByNote.text = metadata.note - sharedWithYouByNote.textColor = NCBrandColor.shared.textColor - sharedWithYouByNote.trailingBuffer = sharedWithYouByNote.frame.width - } else { - sharedWithYouByNoteImage.isHidden = true - sharedWithYouByNote.isHidden = true - } - let fileName = appDelegate.userBaseUrl + "-" + metadata.ownerId + ".png" if NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) == nil { @@ -253,14 +242,18 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent dropDown = DropDown() let appearance = DropDown.appearance() + // Setting up the blur effect + let blurEffect = UIBlurEffect(style: .light) // You can choose .dark, .extraLight, or .light + let blurEffectView = UIVisualEffectView(effect: blurEffect) + blurEffectView.frame = CGRect(x: 0, y: 0, width: 500, height: 20) + appearance.backgroundColor = .systemBackground appearance.cornerRadius = 10 - appearance.shadowColor = UIColor(white: 0.5, alpha: 1) - appearance.shadowOpacity = 0.9 - appearance.shadowRadius = 25 + appearance.shadowColor = .black + appearance.shadowOpacity = 0.2 + appearance.shadowRadius = 30 appearance.animationduration = 0.25 appearance.textColor = .darkGray - appearance.setupMaskedCorners([.layerMaxXMaxYCorner, .layerMinXMaxYCorner]) for sharee in sharees { var label = sharee.label @@ -271,8 +264,8 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent } dropDown.anchorView = searchField - dropDown.bottomOffset = CGPoint(x: 0, y: searchField.bounds.height) - dropDown.width = searchField.bounds.width + dropDown.bottomOffset = CGPoint(x: 10, y: searchField.bounds.height) + dropDown.width = searchField.bounds.width - 20 dropDown.direction = .bottom dropDown.cellNib = UINib(nibName: "NCSearchUserDropDownCell", bundle: nil) @@ -308,9 +301,9 @@ extension NCShare: UITableViewDelegate { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if indexPath.section == 0, indexPath.row == 0 { // internal cell has description - return 90 + return 40 } - return 70 + return 60 } } @@ -345,7 +338,7 @@ extension NCShare: UITableViewDataSource { if metadata.e2eEncrypted && NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV12 { cell.tableShare = shares.firstShareLink } else { - if indexPath.row == 0 { + if indexPath.row == 1 { cell.isInternalLink = true } else if shares.firstShareLink?.isInvalidated != true { cell.tableShare = shares.firstShareLink @@ -390,7 +383,7 @@ extension NCShare: CNContactPickerDelegate { if contact.emailAddresses.count > 1 { showEmailList(arrEmail: contact.emailAddresses.map({$0.value as String})) } else if let email = contact.emailAddresses.first?.value as? String { - textField?.text = email + searchField?.text = email networking?.getSharees(searchString: email) } } @@ -405,7 +398,7 @@ extension NCShare: CNContactPickerDelegate { selected: false, on: false, action: { _ in - self.textField?.text = email + self.searchField?.text = email self.networking?.getSharees(searchString: email) } ) @@ -416,3 +409,28 @@ extension NCShare: CNContactPickerDelegate { } } } + +extension NCShare: UISearchBarDelegate { + func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { + NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(searchSharees), object: nil) + + if searchText.isEmpty { + dropDown.hide() + } else { + perform(#selector(searchSharees), with: nil, afterDelay: 0.5) + } + } + + @objc private func searchSharees() { + // https://stackoverflow.com/questions/25471114/how-to-validate-an-e-mail-address-in-swift + func isValidEmail(_ email: String) -> Bool { + + let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" + let emailPred = NSPredicate(format: "SELF MATCHES %@", emailRegEx) + return emailPred.evaluate(with: email) + } + guard let searchString = searchField.text, !searchString.isEmpty else { return } + if searchString.contains("@"), !isValidEmail(searchString) { return } + networking?.getSharees(searchString: searchString) + } +} diff --git a/iOSClient/Share/NCShareCommentsCell.xib b/iOSClient/Share/NCShareCommentsCell.xib index 5ce95380a5..cceef5a118 100755 --- a/iOSClient/Share/NCShareCommentsCell.xib +++ b/iOSClient/Share/NCShareCommentsCell.xib @@ -1,9 +1,9 @@ - + - + @@ -11,22 +11,22 @@ - - + + - + - + - - + + - + - - + + - + - + - - - - - - + + + + + + @@ -96,7 +93,7 @@ - + diff --git a/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift b/iOSClient/Share/NCShareHeader.swift similarity index 74% rename from iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift rename to iOSClient/Share/NCShareHeader.swift index b64a776af1..152a818cf8 100644 --- a/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift +++ b/iOSClient/Share/NCShareHeader.swift @@ -1,5 +1,5 @@ // -// NCShareAdvancePermissionHeader.swift +// NCShareHeader.swift // Nextcloud // // Created by T-systems on 10/08/21. @@ -22,18 +22,25 @@ // import UIKit +import TagListView -class NCShareAdvancePermissionHeader: UIView { +class NCShareHeader: UIView { @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var fileName: UILabel! @IBOutlet weak var info: UILabel! @IBOutlet weak var fullWidthImageView: UIImageView! + @IBOutlet weak var fileNameTopConstraint: NSLayoutConstraint! + @IBOutlet weak var tagListView: TagListView! + + private var heightConstraintWithImage: NSLayoutConstraint? + private var heightConstraintWithoutImage: NSLayoutConstraint? func setupUI(with metadata: tableMetadata) { let utilityFileSystem = NCUtilityFileSystem() if FileManager.default.fileExists(atPath: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) { fullWidthImageView.image = NCUtility().getImageMetadata(metadata, for: frame.height) fullWidthImageView.contentMode = .scaleAspectFill + imageView.image = fullWidthImageView.image imageView.isHidden = true } else { if metadata.directory { @@ -43,10 +50,24 @@ class NCShareAdvancePermissionHeader: UIView { } else { imageView.image = NCImageCache.images.file } + + fileNameTopConstraint.constant -= 45 } + fileName.text = metadata.fileNameView fileName.textColor = NCBrandColor.shared.textColor info.textColor = NCBrandColor.shared.textColor2 info.text = utilityFileSystem.transformedSize(metadata.size) + ", " + NCUtility().dateDiff(metadata.date as Date) + + tagListView.addTags(Array(metadata.tags)) + + setNeedsLayout() + layoutIfNeeded() + } + + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + if fullWidthImageView.image != nil { + imageView.isHidden = traitCollection.verticalSizeClass != .compact + } } } diff --git a/iOSClient/Share/NCShareHeader.xib b/iOSClient/Share/NCShareHeader.xib new file mode 100644 index 0000000000..55ffce6cab --- /dev/null +++ b/iOSClient/Share/NCShareHeader.xib @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOSClient/Share/NCShareHeaderView.xib b/iOSClient/Share/NCShareHeaderView.xib index 3f7727099b..44b83d3fc7 100644 --- a/iOSClient/Share/NCShareHeaderView.xib +++ b/iOSClient/Share/NCShareHeaderView.xib @@ -1,9 +1,9 @@ - + - + diff --git a/iOSClient/Share/NCShareLinkCell.xib b/iOSClient/Share/NCShareLinkCell.xib index 32182dae50..a102ccf497 100755 --- a/iOSClient/Share/NCShareLinkCell.xib +++ b/iOSClient/Share/NCShareLinkCell.xib @@ -1,9 +1,9 @@ - - + + - + @@ -11,22 +11,24 @@ - - + + - + - - + + - + + + - + - - + + - - - + + - + @@ -110,21 +107,21 @@ - + - + - + - + diff --git a/iOSClient/Share/NCSharePaging.swift b/iOSClient/Share/NCSharePaging.swift index 537fbaaacf..8e0f556f57 100644 --- a/iOSClient/Share/NCSharePaging.swift +++ b/iOSClient/Share/NCSharePaging.swift @@ -29,7 +29,7 @@ import MarqueeLabel import TagListView protocol NCSharePagingContent { - var textField: UITextField? { get } + var textField: UIView? { get } } class NCSharePaging: UIViewController { @@ -63,8 +63,9 @@ class NCSharePaging: UIViewController { pagingViewController.backgroundColor = .systemBackground pagingViewController.menuBackgroundColor = .systemBackground pagingViewController.selectedBackgroundColor = .systemBackground + pagingViewController.indicatorColor = NCBrandColor.shared.brandElement pagingViewController.textColor = NCBrandColor.shared.textColor - pagingViewController.selectedTextColor = NCBrandColor.shared.textColor + pagingViewController.selectedTextColor = NCBrandColor.shared.brandElement // Pagination addChild(pagingViewController) @@ -76,14 +77,16 @@ class NCSharePaging: UIViewController { height: 1, zIndex: Int.max, spacing: .zero, - insets: UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5) + insets: .zero ) + pagingViewController.borderOptions = .visible(height: 1, zIndex: Int.max, insets: .zero) + // Contrain the paging view to all edges. pagingViewController.view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ pagingViewController.view.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), - pagingViewController.view.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + pagingViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor), pagingViewController.view.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), pagingViewController.view.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor) ]) @@ -97,7 +100,6 @@ class NCSharePaging: UIViewController { pagingViewController.select(index: 0) } - (pagingViewController.view as? NCSharePagingView)?.setupConstraints() pagingViewController.reloadMenu() } @@ -112,9 +114,9 @@ class NCSharePaging: UIViewController { self.dismiss(animated: false, completion: nil) } - pagingViewController.menuItemSize = .fixed( - width: self.view.bounds.width / CGFloat(self.pages.count), - height: 40) +// pagingViewController.menuItemSize = .fixed( +// width: self.view.bounds.width / CGFloat(self.pages.count), +// height: 40) } override func viewWillDisappear(_ animated: Bool) { @@ -130,13 +132,7 @@ class NCSharePaging: UIViewController { override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) - - coordinator.animate(alongsideTransition: nil) { _ in - self.pagingViewController.menuItemSize = .fixed( - width: self.view.bounds.width / CGFloat(self.pages.count), - height: 40) - self.currentVC?.textField?.resignFirstResponder() - } + self.currentVC?.textField?.resignFirstResponder() } // MARK: - NotificationCenter & Keyboard & TextField @@ -186,7 +182,7 @@ extension NCSharePaging: PagingViewControllerDataSource { func pagingViewController(_: PagingViewController, viewControllerAt index: Int) -> UIViewController { - let height = pagingViewController.options.menuHeight + NCSharePagingView.headerHeight + NCSharePagingView.tagHeaderHeight + let height: CGFloat = 50 if pages[index] == .activity { guard let viewController = UIStoryboard(name: "NCActivity", bundle: nil).instantiateInitialViewController() as? NCActivity else { @@ -248,13 +244,11 @@ class NCShareHeaderViewController: PagingViewController { } class NCSharePagingView: PagingView { - - static let headerHeight: CGFloat = 90 - static var tagHeaderHeight: CGFloat = 0 var metadata = tableMetadata() let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() public var headerHeightConstraint: NSLayoutConstraint? + var header: NCShareHeader? // MARK: - View Life Cycle @@ -270,61 +264,68 @@ class NCSharePagingView: PagingView { override func setupConstraints() { - guard let headerView = Bundle.main.loadNibNamed("NCShareHeaderView", owner: self, options: nil)?.first as? NCShareHeaderView else { return } +// guard let headerView = Bundle.main.loadNibNamed("NCShareHeaderView", owner: self, options: nil)?.first as? NCShareHeaderView else { return } + + guard let headerView = Bundle.main.loadNibNamed("NCShareHeader", owner: self, options: nil)?.first as? NCShareHeader else { return } + header = headerView headerView.backgroundColor = .systemBackground - headerView.ocId = metadata.ocId +// headerView.ocId = metadata.ocId let dateFormatter = DateFormatter() dateFormatter.dateStyle = .short dateFormatter.timeStyle = .short dateFormatter.locale = Locale.current - if FileManager.default.fileExists(atPath: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) { - headerView.imageView.image = UIImage(contentsOfFile: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) - } else { - if metadata.directory { - let image = metadata.e2eEncrypted ? UIImage(named: "folderEncrypted") : UIImage(named: "folder") - headerView.imageView.image = image?.image(color: NCBrandColor.shared.brandElement, size: image?.size.width ?? 0) - headerView.imageView.image = headerView.imageView.image?.colorizeFolder(metadata: metadata) - } else if !metadata.iconName.isEmpty { - headerView.imageView.image = utility.loadImage(named: metadata.iconName, useTypeIconFile: true) - } else { - headerView.imageView.image = NCImageCache.images.file - } - } - headerView.path.text = utilityFileSystem.getPath(path: metadata.path, user: metadata.user, fileName: metadata.fileName) - headerView.path.textColor = NCBrandColor.shared.textColor - headerView.path.trailingBuffer = headerView.path.frame.width - if metadata.favorite { - headerView.favorite.setImage(utility.loadImage(named: "star.fill", colors: [NCBrandColor.shared.yellowFavorite], size: 20), for: .normal) - } else { - headerView.favorite.setImage(utility.loadImage(named: "star.fill", colors: [NCBrandColor.shared.iconImageColor2], size: 20), for: .normal) - } - headerView.info.text = utilityFileSystem.transformedSize(metadata.size) + ", " + NSLocalizedString("_modified_", comment: "") + " " + dateFormatter.string(from: metadata.date as Date) - headerView.info.textColor = NCBrandColor.shared.textColor2 - headerView.creation.text = NSLocalizedString("_creation_", comment: "") + " " + dateFormatter.string(from: metadata.creationDate as Date) - headerView.creation.textColor = NCBrandColor.shared.textColor2 - headerView.upload.text = NSLocalizedString("_upload_", comment: "") + " " + dateFormatter.string(from: metadata.uploadDate as Date) - headerView.upload.textColor = NCBrandColor.shared.textColor2 - - headerView.details.setTitleColor(NCBrandColor.shared.textColor, for: .normal) - headerView.details.setTitle(NSLocalizedString("_details_", comment: ""), for: .normal) - headerView.details.layer.cornerRadius = 9 - headerView.details.layer.masksToBounds = true - headerView.details.layer.backgroundColor = UIColor(red: 152.0 / 255.0, green: 167.0 / 255.0, blue: 181.0 / 255.0, alpha: 0.8).cgColor - - for tag in metadata.tags { - headerView.tagListView.addTag(tag) - } +// if FileManager.default.fileExists(atPath: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) { +// headerView.imageView.image = UIImage(contentsOfFile: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) +// } else { +// print(metadata.iconName) +// if metadata.directory { +// let image = metadata.e2eEncrypted ? UIImage(named: "folderEncrypted") : UIImage(named: "folder") +// headerView.imageView.image = image?.image(color: NCBrandColor.shared.brandElement, size: image?.size.width ?? 0) +// headerView.imageView.image = headerView.imageView.image?.colorizeFolder(metadata: metadata) +// } else if !metadata.iconName.isEmpty { +// headerView.imageView.image = utility.loadImage(named: metadata.iconName, useTypeIconFile: true) +// } else { +// headerView.imageView.image = NCImageCache.images.file +// } +// } +// headerView.path.text = utilityFileSystem.getPath(path: metadata.path, user: metadata.user, fileName: metadata.fileName) +// headerView.path.textColor = NCBrandColor.shared.textColor +// headerView.path.trailingBuffer = headerView.path.frame.width +// if metadata.favorite { +// headerView.favorite.setImage(utility.loadImage(named: "star.fill", colors: [NCBrandColor.shared.yellowFavorite], size: 20), for: .normal) +// } else { +// headerView.favorite.setImage(utility.loadImage(named: "star.fill", colors: [NCBrandColor.shared.iconImageColor2], size: 20), for: .normal) +// } +// headerView.info.text = utilityFileSystem.transformedSize(metadata.size) + ", " + NSLocalizedString("_modified_", comment: "") + " " + dateFormatter.string(from: metadata.date as Date) +// headerView.info.textColor = NCBrandColor.shared.textColor2 +// headerView.creation.text = NSLocalizedString("_creation_", comment: "") + " " + dateFormatter.string(from: metadata.creationDate as Date) +// headerView.creation.textColor = NCBrandColor.shared.textColor2 +// headerView.upload.text = NSLocalizedString("_upload_", comment: "") + " " + dateFormatter.string(from: metadata.uploadDate as Date) +// headerView.upload.textColor = NCBrandColor.shared.textColor2 +// +// headerView.details.setTitleColor(NCBrandColor.shared.textColor, for: .normal) +// headerView.details.setTitle(NSLocalizedString("_details_", comment: ""), for: .normal) +// headerView.details.layer.cornerRadius = 9 +// headerView.details.layer.masksToBounds = true +// headerView.details.layer.backgroundColor = UIColor(red: 152.0 / 255.0, green: 167.0 / 255.0, blue: 181.0 / 255.0, alpha: 0.8).cgColor - if metadata.tags.isEmpty { - NCSharePagingView.tagHeaderHeight = 0 - } else { - NCSharePagingView.tagHeaderHeight = headerView.tagListView.intrinsicContentSize.height + 10 - } +// for tag in metadata.tags { +//// headerView.tagListView.addTag(tag) +// } + +// if headerView.fullWidthImageView?.image == nil { +// NCSharePagingView.tagHeaderHeight = 80 +// } else { +// NCSharePagingView.tagHeaderHeight = 130 +// } + + headerView.setupUI(with: metadata) addSubview(headerView) +// recalculateHeaderHeight() collectionView.translatesAutoresizingMaskIntoConstraints = false headerView.translatesAutoresizingMaskIntoConstraints = false pageView.translatesAutoresizingMaskIntoConstraints = false @@ -335,17 +336,36 @@ class NCSharePagingView: PagingView { collectionView.heightAnchor.constraint(equalToConstant: options.menuHeight), collectionView.topAnchor.constraint(equalTo: headerView.bottomAnchor), - headerView.topAnchor.constraint(equalTo: topAnchor), - headerView.leadingAnchor.constraint(equalTo: leadingAnchor), - headerView.trailingAnchor.constraint(equalTo: trailingAnchor), - headerView.heightAnchor.constraint(equalToConstant: NCSharePagingView.headerHeight + NCSharePagingView.tagHeaderHeight), + headerView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor), + headerView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor), + headerView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor), +// headerView.heightAnchor.constraint(equalToConstant: 260), pageView.leadingAnchor.constraint(equalTo: leadingAnchor), pageView.trailingAnchor.constraint(equalTo: trailingAnchor), pageView.bottomAnchor.constraint(equalTo: bottomAnchor), - pageView.topAnchor.constraint(equalTo: topAnchor, constant: 10) + pageView.topAnchor.constraint(equalTo: headerView.bottomAnchor) ]) + + +// setNeedsLayout() +// layoutIfNeeded() } + +// func recalculateHeaderHeight() { +// guard let header else { return } +// // Deactivate existing height constraints +// for constraint in header.constraints { +// if constraint.firstAttribute == .height { +// constraint.isActive = false +// } +// } +// +// NSLayoutConstraint.activate([ +// header.heightAnchor.constraint(equalToConstant: header.heightWithImage.constant) +// ]) +// +// } } class NCShareHeaderView: UIView { @@ -383,7 +403,6 @@ class NCShareHeaderView: UIView { } @IBAction func touchUpInsideDetails(_ sender: UIButton) { - creation.isHidden = !creation.isHidden upload.isHidden = !upload.isHidden } diff --git a/iOSClient/Share/NCShareUserCell.swift b/iOSClient/Share/NCShareUserCell.swift index afa5eba26a..ad92b7d699 100644 --- a/iOSClient/Share/NCShareUserCell.swift +++ b/iOSClient/Share/NCShareUserCell.swift @@ -105,7 +105,7 @@ class NCShareUserCell: UITableViewCell, NCCellProtocol { imageItem?.addGestureRecognizer(tapGesture) labelQuickStatus.textColor = NCBrandColor.shared.customer - imageDownArrow.image = utility.loadImage(named: "arrowtriangle.down.fill", colors: [NCBrandColor.shared.customer]) + imageDownArrow.image = utility.loadImage(named: "arrowtriangle.down.circle", colors: [NCBrandColor.shared.customer]) } @objc func tapAvatarImage(_ sender: UITapGestureRecognizer) { @@ -157,7 +157,12 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol { imageItem.image = NCShareCommon().getImageShareType(shareType: sharee.shareType) imageShareeType.image = NCShareCommon().getImageShareType(shareType: sharee.shareType) let status = utility.getUserStatus(userIcon: sharee.userIcon, userStatus: sharee.userStatus, userMessage: sharee.userMessage) - imageStatus.image = status.statusImage + + if let statusImage = status.statusImage { + imageStatus.image = statusImage + imageStatus.makeCircularBackground(withColor: .systemBackground) + } + self.status.text = status.statusMessage if self.status.text?.count ?? 0 > 0 { centerTitle.constant = -5 diff --git a/iOSClient/Share/NCShareUserCell.xib b/iOSClient/Share/NCShareUserCell.xib index 613ee026d9..df97e61950 100755 --- a/iOSClient/Share/NCShareUserCell.xib +++ b/iOSClient/Share/NCShareUserCell.xib @@ -1,9 +1,9 @@ - + - + @@ -12,18 +12,19 @@ - + - + - - + + - - + + + @@ -35,16 +36,16 @@ - + - - + +