Skip to content

Commit

Permalink
refactor: PR self feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Feb 11, 2025
1 parent db4366a commit 08faf5b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class FileListViewController: UICollectionViewController, SwipeActionCollectionV
return button
}()

lazy var selectedPackId = DrivePackId(rawValue: driveFileManager.drive.pack.name)
lazy var packId = DrivePackId(rawValue: driveFileManager.drive.pack.name)

// MARK: - View controller lifecycle

Expand Down Expand Up @@ -593,7 +593,7 @@ class FileListViewController: UICollectionViewController, SwipeActionCollectionV
}

let isTrash = viewModel.currentDirectory.id == DriveFileManager.trashRootFile.id
let isMykSuite = selectedPackId == .myKSuite
let isMykSuite = packId == .myKSuite
headerView.trashInformationView.isHidden = !isTrash // !(isTrash && isMykSuite) TODO: Use actual logic

headerView.sortView.isHidden = !isEmptyViewHidden
Expand Down
6 changes: 3 additions & 3 deletions kDrive/UI/Controller/Files/FileDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class FileDetailViewController: UIViewController, SceneStateRestorable {
private var comments = [Comment]()
private var commentsInfo = (page: 1, hasNextPage: true, isLoading: true)

lazy var selectedPackId = DrivePackId(rawValue: driveFileManager.drive.pack.name)
lazy var packId = DrivePackId(rawValue: driveFileManager.drive.pack.name)

private struct ActivitySection {
let referenceDate: Date
var elements: [FileActivity]
Expand Down Expand Up @@ -552,7 +552,7 @@ extension FileDetailViewController: UITableViewDelegate, UITableViewDataSource {
case .share:
let cell = tableView.dequeueReusableCell(type: ShareLinkTableViewCell.self, for: indexPath)
cell.delegate = self
cell.configureWith(file: file, selectedPackId: selectedPackId, insets: false)
cell.configureWith(file: file, currentPackId: packId, insets: false)
return cell
case .categories:
let cell = tableView.dequeueReusableCell(type: ManageCategoriesTableViewCell.self, for: indexPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ShareAndRightsViewController: UIViewController {
var driveFileManager: DriveFileManager!
var file: File!

lazy var selectedPackId = DrivePackId(rawValue: driveFileManager.drive.pack.name)
lazy var packId = DrivePackId(rawValue: driveFileManager.drive.pack.name)

override func viewDidLoad() {
super.viewDidLoad()
Expand Down Expand Up @@ -192,7 +192,7 @@ extension ShareAndRightsViewController: UITableViewDelegate, UITableViewDataSour
let cell = tableView.dequeueReusableCell(type: ShareLinkTableViewCell.self, for: indexPath)
cell.initWithPositionAndShadow(isFirst: true, isLast: true, radius: 6)
cell.delegate = self
cell.configureWith(file: file, displayChip: true, selectedPackId: selectedPackId) // TODO: selectedPackId == .myKSuite
cell.configureWith(file: file, displayChip: true, currentPackId: packId) // TODO: selectedPackId == .myKSuite
return cell
case .access:
let cell = tableView.dequeueReusableCell(type: UsersAccessTableViewCell.self, for: indexPath)
Expand All @@ -214,8 +214,8 @@ extension ShareAndRightsViewController: UITableViewDelegate, UITableViewDataSour
case .link:
// TODO: Remove force display
// guard selectedPackId != .myKSuite else {
router.presentUpSaleSheet()
return
router.presentUpSaleSheet()
return
// }

let canBecomeLink = file?.capabilities.canBecomeSharelink ?? false || file.hasSharelink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ShareLinkTableViewCell: InsetTableViewCell {

weak var delegate: ShareLinkTableViewCellDelegate?
var url = ""
var selectedPackId: DrivePackId?
var packId: DrivePackId?

private var contentBackgroundColor = KDriveResourcesAsset.backgroundCardViewColor.color

Expand Down Expand Up @@ -96,8 +96,8 @@ class ShareLinkTableViewCell: InsetTableViewCell {
chipContainerView.subviews.forEach { $0.removeFromSuperview() }
}

func configureWith(file: File, displayChip: Bool = false, selectedPackId: DrivePackId?, insets: Bool = true) {
self.selectedPackId = selectedPackId
func configureWith(file: File, displayChip: Bool = false, currentPackId: DrivePackId?, insets: Bool = true) {
packId = currentPackId
selectionStyle = file.isDropbox ? .none : .default
if insets {
leadingConstraint.constant = 24
Expand Down Expand Up @@ -182,8 +182,8 @@ class ShareLinkTableViewCell: InsetTableViewCell {
@IBAction func copyButtonPressed(_ sender: UIButton) {
// TODO: Remove force display
// if let selectedPackId, selectedPackId == .myKSuite {
router.presentUpSaleSheet()
return
router.presentUpSaleSheet()
return
// }
// MatomoUtils.track(eventWithCategory: .shareAndRights, name: "shareButton")
// delegate?.shareLinkSharedButtonPressed(link: url, sender: sender)
Expand All @@ -192,8 +192,8 @@ class ShareLinkTableViewCell: InsetTableViewCell {
@IBAction func shareLinkSettingsButtonPressed(_ sender: Any) {
// TODO: Remove force display
// if let selectedPackId, selectedPackId == .myKSuite {
router.presentUpSaleSheet()
return
router.presentUpSaleSheet()
return
// }
// delegate?.shareLinkSettingsButtonPressed()
}
Expand Down

0 comments on commit 08faf5b

Please sign in to comment.