Skip to content

Commit

Permalink
feat(FolderTypeTableViewCell): MykSuite chip
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Feb 4, 2025
1 parent 9d34354 commit 4de4641
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "myKSuitePlus.logo.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.
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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
}
Expand Down
24 changes: 24 additions & 0 deletions kDrive/UI/View/NewFolder/FolderTypeTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
])
}
}
19 changes: 15 additions & 4 deletions kDrive/UI/View/NewFolder/FolderTypeTableViewCell.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
Expand Down Expand Up @@ -57,6 +57,14 @@
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="caption"/>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1Hm-LS-nCV">
<rect key="frame" x="237" y="20" width="17" height="17"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="width" constant="17" placeholder="YES" id="Pzp-cq-zLT"/>
<constraint firstAttribute="height" constant="17" id="bYq-4D-7Pe"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
Expand All @@ -66,12 +74,14 @@
<constraint firstItem="rtI-Wc-46s" firstAttribute="top" secondItem="aqX-hy-10J" secondAttribute="top" constant="20" id="8vf-Us-SrW"/>
<constraint firstItem="EHm-bK-k4d" firstAttribute="top" secondItem="rtI-Wc-46s" secondAttribute="bottom" constant="5" id="LLA-54-gdk"/>
<constraint firstItem="BSA-Kc-s9g" firstAttribute="leading" secondItem="aqX-hy-10J" secondAttribute="leading" id="R3j-yG-BbO"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="rtI-Wc-46s" secondAttribute="trailing" constant="20" id="X3b-xC-w1O"/>
<constraint firstAttribute="trailing" secondItem="1Hm-LS-nCV" secondAttribute="trailing" constant="20" id="Va0-qe-ERi"/>
<constraint firstItem="1Hm-LS-nCV" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="rtI-Wc-46s" secondAttribute="trailing" constant="20" id="VpO-9Q-Dor"/>
<constraint firstAttribute="bottom" secondItem="BSA-Kc-s9g" secondAttribute="bottom" id="cOZ-0h-Q3u"/>
<constraint firstItem="EHm-bK-k4d" firstAttribute="leading" secondItem="rtI-Wc-46s" secondAttribute="leading" id="m7B-US-USx"/>
<constraint firstItem="BSA-Kc-s9g" firstAttribute="top" relation="greaterThanOrEqual" secondItem="EHm-bK-k4d" secondAttribute="bottom" constant="20" id="qJf-kU-v8z"/>
<constraint firstAttribute="trailing" secondItem="BSA-Kc-s9g" secondAttribute="trailing" id="uil-cy-w7O"/>
<constraint firstItem="kZU-CD-ye1" firstAttribute="top" secondItem="aqX-hy-10J" secondAttribute="top" constant="20" id="umx-J7-7yZ"/>
<constraint firstItem="1Hm-LS-nCV" firstAttribute="centerY" secondItem="rtI-Wc-46s" secondAttribute="centerY" id="xWF-40-T0u"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
Expand All @@ -93,6 +103,7 @@
<connections>
<outlet property="accessoryImageView" destination="kZU-CD-ye1" id="V4o-qX-R0L"/>
<outlet property="bottomConstraint" destination="b3L-GJ-LSF" id="Y7h-fG-fCo"/>
<outlet property="chip" destination="1Hm-LS-nCV" id="X60-ba-pVL"/>
<outlet property="contentInsetView" destination="aqX-hy-10J" id="elq-4h-42h"/>
<outlet property="descriptionLabel" destination="EHm-bK-k4d" id="Ta8-Xv-Zah"/>
<outlet property="separator" destination="BSA-Kc-s9g" id="Aqp-OR-DH2"/>
Expand All @@ -114,7 +125,7 @@
<color red="0.96862745098039216" green="0.96862745098039216" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="titleColor">
<color red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.20000000298023224" green="0.20000000298023224" blue="0.20000000298023224" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand Down
33 changes: 33 additions & 0 deletions kDrive/UI/View/Upsale/MyKSuiteChip.swift
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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
}
}

0 comments on commit 4de4641

Please sign in to comment.