Skip to content

Commit

Permalink
feat: MykSuite chip (#1421)
Browse files Browse the repository at this point in the history
* feat(FolderTypeTableViewCell): MykSuite chip

* feat(NewFolderTypeTableViewController): Present upsale sheet when needed

* feat(NewFolderTypeTableViewController): Explicit present call

* refactor(FolderTypeTableViewCell): Remove comment

* feat(ShareAndRightsViewController): Present upsale on myKSuite

* feat(ShareLinkTableViewCell): Display MykSuiteChip

* refactor(FolderTypeTableViewCell): Renamed to chipContainerView

* feat(FilesHeaderView): Display the trash header view that matches the design

* feat(FilesHeaderView): Show trash header view only when needed

* feat: Clear color for chip container view

* chore(FileListViewController): Force display chip for now

* feat(MyKSuiteChip): Proper chip design with correct background color

* fix(FilesHeaderView): Correct margin for chip view

* fix(FolderTypeTableViewCell): Correct chip constraint

* chore(FileListViewController): Better temporary display logic

* feat(FilesHeaderView): Present upsale sheet on tap

* feat(ShareLinkTableViewCell): Handle extra actions for mykSuite

* feat(MyKSuiteBridgeViewController): Modern sheet presentation

* feat(presentUpSaleSheet): Animate a dismiss before presenting

* chore: Upgrade tuist + Explicitly declare dependencies

Signed-off-by: Philippe Weidmann <[email protected]>

* fix: Remove target grouping

Signed-off-by: Philippe Weidmann <[email protected]>

* test: Shared Env

Signed-off-by: Philippe Weidmann <[email protected]>

* fix: Lottie needs to be dynamic

Signed-off-by: Philippe Weidmann <[email protected]>

* test: Remove old test + Stop testing DriveFileManager

Signed-off-by: Philippe Weidmann <[email protected]>

* test: Update some old tests

Signed-off-by: Philippe Weidmann <[email protected]>

* feat(ios-features): Added necessary libraries as a Framework

* chore: Bump core

Signed-off-by: Philippe Weidmann <[email protected]>

* feat(FolderTypeTableViewCell): Changed space between title and subtitle to 8pt

* feat(FilesHeaderView): Bump margin between title and subtitle to 8pt

* feat(myKSuitePlus.logo): Dark mode

* chore: Upgrade tuist + Explicitly declare dependencies

Signed-off-by: Philippe Weidmann <[email protected]>

* fix: Remove target grouping

Signed-off-by: Philippe Weidmann <[email protected]>

* test: Update some old tests

Signed-off-by: Philippe Weidmann <[email protected]>

* feat(ios-features): Added necessary libraries as a Framework

* feat(myKSuitePlus.logo): Dark mode background color

* feat(greyBackgroundChipColor): Changed darkmode background color

* feat(Drive+Quota): If Quota is not present we do not enforce limitations app side

* feat(Drive): Method isFreePack return true when pack is myKSuite

* feat(LocalizedFilenameFormatter): Use drive.isFreePack for correctness

* chore: Update to latest version os i18n

* feat(FileListViewController): Correct check for trash folder

* feat(FilesHeaderView): Translations for mykSuite trash header view

* refactor: PR self feedback

* refactor: Chore typo

* feat(ShareAndRightsViewController): Removed force display chip

* feat(ShareLinkTableViewCell): Removed force display chip

* feat(NewFolderTypeTableViewController): Enable pack check

* chore: Clean dead comment

* feat(FileListViewController): Enable actual mykSuite logic check

* fix: Make the branch build great again

* refactor(ShareLinkTableViewCell): Make sure the cell loads great

* chore: Update project post rebase to work on ios-features 1.0.0

* chore: Project setup

* chore: Remove trash asset and substitute it for delete

* feat(FilesHeaderView): Using TextStyle with IKLabel

* chore: Remove duplicated color

* feat(FilesHeaderView): Using existing color

* feat(FloatingPanelActionCollectionViewCell): Chip capability (#1429)

* feat(FloatingPanelActionCollectionViewCell): Chip capability

* feat: Enable chip for convertToDropbox action

* feat: Rework existing limitations (#1428)

* feat(MenuViewController): Hide upgrade cell that shows up on top of menu

* feat(ShareLinkSettingsViewController): Present upsale sheet instead of store

* feat(FileActionsFloatingPanelViewController): Present upsale sheet instead of store

* feat(HomeViewController): Present upsale sheet instead of store

* feat(NewFolderTypeTableViewController): Present upsale sheet instead of store

* feat(FileActionsHelper): Present upsale sheet instead of store

---------

Signed-off-by: Philippe Weidmann <[email protected]>
Co-authored-by: Philippe Weidmann <[email protected]>
  • Loading branch information
adrien-coye and PhilippeWeidmann authored Feb 12, 2025
1 parent 7518412 commit 2e9fd93
Show file tree
Hide file tree
Showing 26 changed files with 519 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"colors": [
"colors" : [
{
"color": {
"color-space": "srgb",
"components": {
"alpha": "1.000",
"blue": "0x2E",
"green": "0x47",
"red": "0xFB"
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x2E",
"green" : "0x47",
"red" : "0xFB"
}
},
"idiom": "universal"
"idiom" : "universal"
}
],
"info": {
"author": "xcode",
"version": 1
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF1",
"green" : "0xF1",
"red" : "0xF1"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1A",
"green" : "0x1A",
"red" : "0x1A"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x72",
"green" : "0x67",
"red" : "0x55"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x33",
"green" : "0x33",
"red" : "0x33"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "myKSuitePlus.logo.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "Logo kSuite.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class FileListViewController: UICollectionViewController, SwipeActionCollectionV
return button
}()

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

// MARK: - View controller lifecycle

deinit {
Expand Down Expand Up @@ -590,6 +592,10 @@ class FileListViewController: UICollectionViewController, SwipeActionCollectionV
headerView.commonDocumentsDescriptionLabel.isHidden = true
}

let isTrash = viewModel.currentDirectory.id == DriveFileManager.trashRootFile.id
let isMykSuite = packId == .myKSuite
headerView.trashInformationView.isHidden = !(isTrash && isMykSuite)

headerView.sortView.isHidden = !isEmptyViewHidden

headerView.sortButton.isHidden = viewModel.configuration.sortingOptions.isEmpty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ extension FileActionsFloatingPanelViewController {
floatingPanelViewController?.actionHandler = { [weak self] _ in
driveFloatingPanelController.dismiss(animated: true) {
guard let self else { return }
self.router.showStore(from: self, driveFileManager: self.driveFileManager)
self.router.presentUpSaleSheet()
}
}
present(driveFloatingPanelController, animated: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
}
}
Expand Down
4 changes: 3 additions & 1 deletion kDrive/UI/Controller/Files/FileDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class FileDetailViewController: UIViewController, SceneStateRestorable {
private var comments = [Comment]()
private var commentsInfo = (page: 1, hasNextPage: true, isLoading: true)

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

private struct ActivitySection {
let referenceDate: Date
var elements: [FileActivity]
Expand Down Expand Up @@ -550,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, 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 @@ -27,6 +27,7 @@ import UIKit
class ShareAndRightsViewController: UIViewController {
@IBOutlet var tableView: UITableView!

@LazyInjectService var router: AppNavigable
@LazyInjectService var accountManager: AccountManageable

private enum ShareAndRightsSections: CaseIterable {
Expand All @@ -48,6 +49,8 @@ class ShareAndRightsViewController: UIViewController {
var driveFileManager: DriveFileManager!
var file: File!

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

override func viewDidLoad() {
super.viewDidLoad()
// Documentation says it's better to put it in AppDelegate but why ?
Expand Down Expand Up @@ -189,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)
cell.configureWith(file: file, currentPackId: packId)
return cell
case .access:
let cell = tableView.dequeueReusableCell(type: UsersAccessTableViewCell.self, for: indexPath)
Expand All @@ -209,6 +212,11 @@ extension ShareAndRightsViewController: UITableViewDelegate, UITableViewDataSour
case .invite:
break
case .link:
guard packId != .myKSuite else {
router.presentUpSaleSheet()
return
}

let canBecomeLink = file?.capabilities.canBecomeSharelink ?? false || file.hasSharelink
if file.isDropbox || !canBecomeLink {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ extension ShareLinkSettingsViewController: UITableViewDelegate, UITableViewDataS
floatingPanelViewController?.rightButton.isEnabled = driveFileManager.drive.accountAdmin
floatingPanelViewController?.actionHandler = { _ in
driveFloatingPanelController.dismiss(animated: true) {
self.router.showStore(from: self, driveFileManager: self.driveFileManager)
self.router.presentUpSaleSheet()
}
}
present(driveFloatingPanelController, animated: true)
Expand Down
2 changes: 1 addition & 1 deletion kDrive/UI/Controller/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ extension HomeViewController {
cell.configureCell(with: driveFileManager.drive)
cell.actionHandler = { [weak self] _ in
guard let self else { return }
router.showStore(from: self, driveFileManager: driveFileManager)
router.presentUpSaleSheet()
}
cell.closeHandler = { [weak self] _ in
guard let self else { return }
Expand Down
7 changes: 1 addition & 6 deletions kDrive/UI/Controller/Menu/MenuViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,7 @@ final class MenuViewController: UITableViewController, SelectSwitchDriveDelegate
}

private func updateTableContent() {
// Show upgrade section if free drive
if driveFileManager.drive.isFreePack {
sections = [.header, .upgrade, .options]
} else {
sections = [.header, .options]
}
sections = [.header, .options]

if let uploadCountManager, uploadCountManager.uploadCount > 0 {
sections.insert(.uploads, at: 1)
Expand Down
Loading

0 comments on commit 2e9fd93

Please sign in to comment.