diff --git a/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController.swift b/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController.swift index 8d06d037c..9006bcc0d 100644 --- a/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController.swift +++ b/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController.swift @@ -54,6 +54,7 @@ final class FileActionsFloatingPanelViewController: UICollectionViewController { var quickActions = FloatingPanelAction.quickActions var actions = FloatingPanelAction.listActions + lazy var packId = DrivePackId(rawValue: driveFileManager.drive.pack.name) private var downloadAction: FloatingPanelAction? private var fileObserver: ObservationToken? @@ -254,7 +255,7 @@ final class FileActionsFloatingPanelViewController: UICollectionViewController { case .actions: let cell = collectionView.dequeueReusableCell(type: FloatingPanelActionCollectionViewCell.self, for: indexPath) let action = actions[indexPath.item] - cell.configure(with: action, file: file, showProgress: downloadAction == action) + cell.configure(with: action, file: file, showProgress: downloadAction == action, currentPackId: packId) return cell } } diff --git a/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.swift b/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.swift index 998695987..bcfc372be 100644 --- a/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.swift +++ b/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.swift @@ -29,6 +29,7 @@ class FloatingPanelActionCollectionViewCell: UICollectionViewCell { @IBOutlet var progressView: RPCircularProgress! @IBOutlet var titleLabel: IKLabel! @IBOutlet var switchView: UISwitch! + @IBOutlet var chipContainerView: UIView! private var observationToken: ObservationToken? @@ -51,10 +52,13 @@ class FloatingPanelActionCollectionViewCell: UICollectionViewCell { override func prepareForReuse() { super.prepareForReuse() switchView.isHidden = true + chipContainerView.subviews.forEach { $0.removeFromSuperview() } observationToken?.cancel() } - func configure(with action: FloatingPanelAction, file: File?, showProgress: Bool) { + func configure(with action: FloatingPanelAction, + file: File?, showProgress: Bool, + currentPackId: DrivePackId? = nil) { titleLabel.text = action.name iconImageView.image = action.image iconImageView.tintColor = action.tintColor @@ -70,6 +74,14 @@ class FloatingPanelActionCollectionViewCell: UICollectionViewCell { observeProgress(showProgress, file: file) } } + + switch action { + case .upsaleColor, .convertToDropbox: + guard currentPackId == .myKSuite else { return } + configureChip() + default: + break + } } func configure(with action: FloatingPanelAction, files: [File], showProgress: Bool, archiveId: String?) { @@ -106,6 +118,20 @@ class FloatingPanelActionCollectionViewCell: UICollectionViewCell { } } + func configureChip() { + let chipView = MyKSuiteChip.instantiateGrayChip() + + chipView.translatesAutoresizingMaskIntoConstraints = false + chipContainerView.addSubview(chipView) + + NSLayoutConstraint.activate([ + chipView.leadingAnchor.constraint(equalTo: chipContainerView.leadingAnchor), + chipView.trailingAnchor.constraint(equalTo: chipContainerView.trailingAnchor), + chipView.topAnchor.constraint(equalTo: chipContainerView.topAnchor), + chipView.bottomAnchor.constraint(equalTo: chipContainerView.bottomAnchor) + ]) + } + func configureAvailableOffline(with file: File) { switchView.isHidden = false if switchView.isOn != file.isAvailableOffline { diff --git a/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.xib b/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.xib index 5f588aed4..cad651ae8 100644 --- a/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.xib +++ b/kDrive/UI/View/Files/FloatingPanel/FloatingPanelActionCollectionViewCell.xib @@ -1,9 +1,9 @@ - + - + @@ -35,7 +35,7 @@