diff --git a/kDrive/Resources/Assets.xcassets/myKSuitePlus.logo.imageset/Contents.json b/kDrive/Resources/Assets.xcassets/myKSuitePlus.logo.imageset/Contents.json new file mode 100644 index 000000000..96fe931e4 --- /dev/null +++ b/kDrive/Resources/Assets.xcassets/myKSuitePlus.logo.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "myKSuitePlus.logo.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/kDrive/Resources/Assets.xcassets/myKSuitePlus.logo.imageset/myKSuitePlus.logo.svg b/kDrive/Resources/Assets.xcassets/myKSuitePlus.logo.imageset/myKSuitePlus.logo.svg new file mode 100644 index 000000000..5c68d8123 --- /dev/null +++ b/kDrive/Resources/Assets.xcassets/myKSuitePlus.logo.imageset/myKSuitePlus.logo.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kDrive/UI/Controller/NewFolder/NewFolderTypeTableViewController.swift b/kDrive/UI/Controller/NewFolder/NewFolderTypeTableViewController.swift index e81cc3965..9d9bb7797 100644 --- a/kDrive/UI/Controller/NewFolder/NewFolderTypeTableViewController.swift +++ b/kDrive/UI/Controller/NewFolder/NewFolderTypeTableViewController.swift @@ -23,6 +23,8 @@ import kDriveResources import UIKit class NewFolderTypeTableViewController: UITableViewController { + private lazy var selectedPackId = DrivePackId(rawValue: driveFileManager.drive.pack.name) + @LazyInjectService private var router: AppNavigable var driveFileManager: DriveFileManager! @@ -103,6 +105,10 @@ class NewFolderTypeTableViewController: UITableViewController { cell.titleLabel.text = KDriveResourcesStrings.Localizable.dropBoxTitle cell.accessoryImageView.image = KDriveResourcesAsset.folderDropBox.image cell.descriptionLabel.text = KDriveResourcesStrings.Localizable.dropBoxDescription + // TODO: enable pack check +// if selectedPackId == .myKSuite { + cell.setMykSuiteChip() +// } } return cell } diff --git a/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.swift b/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.swift index 09ccfd8c1..d110e148e 100644 --- a/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.swift +++ b/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.swift @@ -21,4 +21,28 @@ import UIKit class FolderTypeTableViewCell: InsetTableViewCell { @IBOutlet var descriptionLabel: UILabel! + @IBOutlet var chip: UIView! + + override func prepareForReuse() { + super.prepareForReuse() + descriptionLabel.text = nil + chip.subviews.forEach { $0.removeFromSuperview() } + } + + public func setMykSuiteChip() { + // TODO: Use SwiftUI chip component + let image = UIImage(named: "myKSuitePlus.logo") + let chipImageView = UIImageView(image: image) + + chipImageView.translatesAutoresizingMaskIntoConstraints = false + chip.addSubview(chipImageView) + + // Set constraints to match the superview + NSLayoutConstraint.activate([ + chipImageView.leadingAnchor.constraint(equalTo: chip.leadingAnchor), + chipImageView.trailingAnchor.constraint(equalTo: chip.trailingAnchor), + chipImageView.topAnchor.constraint(equalTo: chip.topAnchor), + chipImageView.bottomAnchor.constraint(equalTo: chip.bottomAnchor) + ]) + } } diff --git a/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.xib b/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.xib index 55ac484f1..c02816c0d 100644 --- a/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.xib +++ b/kDrive/UI/View/NewFolder/FolderTypeTableViewCell.xib @@ -1,9 +1,9 @@ - + - + @@ -57,6 +57,14 @@ + + + + + + + + @@ -66,12 +74,14 @@ - + + + @@ -93,6 +103,7 @@ + @@ -114,7 +125,7 @@ - + diff --git a/kDrive/UI/View/Upsale/MyKSuiteChip.swift b/kDrive/UI/View/Upsale/MyKSuiteChip.swift new file mode 100644 index 000000000..13f9d04c2 --- /dev/null +++ b/kDrive/UI/View/Upsale/MyKSuiteChip.swift @@ -0,0 +1,33 @@ +/* + Infomaniak kDrive - iOS App + Copyright (C) 2025 Infomaniak Network SA + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +import kDriveCore +import UIKit + +public enum MyKSuiteChip { + static func instantiateView() -> UIView { + let image = UIImage(named: "myKSuitePlus.logo") + return UIImageView(image: image) + } + + static func instantiateButton() -> IKLargeButton { + let button = IKLargeButton(frame: .zero) + button.setImage(UIImage(named: "myKSuitePlus.logo"), for: .normal) + return button + } +}