Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: MyKSuite UI #1409

Merged
merged 55 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5b43b71
feat: Present a sample SwiftUI View
adrien-coye Jan 27, 2025
4f6d504
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 29, 2025
3772618
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 29, 2025
cca8830
feat: Force ios-core-ui to mykSuite branch
adrien-coye Jan 29, 2025
a3ca534
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 29, 2025
ebb5603
feat: Tuist project setup with external feature module
adrien-coye Jan 29, 2025
2babd08
chore: Bump coreUI
adrien-coye Jan 30, 2025
3063fb7
feat(MyKSuiteFloatingPanelBridgeController): Display SwiftUI code in …
adrien-coye Jan 30, 2025
2c29d90
feat(MyKSuiteFloatingPanelBridgeController): Adjusted margins
adrien-coye Jan 30, 2025
6561e98
feat(MyKSuiteFloatingPanelBridgeController): New kDrive dedicated assets
adrien-coye Jan 30, 2025
9f8af8d
feat(Drive): Quota is now non nullable as discussed with backend
adrien-coye Jan 30, 2025
42a46bc
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 30, 2025
4144c18
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 30, 2025
6daff3a
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 30, 2025
0932d47
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 31, 2025
15a2dd0
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Jan 31, 2025
d5ee873
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 3, 2025
2547686
feat: Bump UI with latest API
adrien-coye Feb 3, 2025
9d34354
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 4, 2025
77a0d17
feat(AppRouter): New explicit method presentUpSaleSheet
adrien-coye Feb 4, 2025
11799eb
chore(MyKSuiteFloatingPanelBridgeController): Clean code
adrien-coye Feb 4, 2025
d1ee013
fix(AppRouter): Animate presentUpSaleSheet method
adrien-coye Feb 5, 2025
53d7cfc
fix(AppRouter): Animate MyKSuiteFloatingPanelBridgeController prensen…
adrien-coye Feb 5, 2025
69bae35
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 6, 2025
7b39dcf
chore: Switched to ios-features
adrien-coye Feb 6, 2025
02ec6bb
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 6, 2025
a560aca
fix(MCKRouter): Updated test mock
adrien-coye Feb 6, 2025
76d2791
fix(ios-features): Allow the project to build again with the new link…
adrien-coye Feb 6, 2025
7afee67
chore(AppRouter): Removed iOS 15 conditional code
adrien-coye Feb 6, 2025
6ae2438
chore(MyKSuiteFloatingPanelBridgeController): Removed iOS 15 conditio…
adrien-coye Feb 6, 2025
498fca3
fix(Package.swift): Added InfomaniakDI as a Framework to guarantee on…
adrien-coye Feb 6, 2025
03a4d6a
feat: Trying to bridge a SwUI view in a scrollview in a presented sheet
adrien-coye Feb 7, 2025
b6008f0
feat(MyKSuiteBridgeViewController): Modern sheet presentation
adrien-coye Feb 7, 2025
5362879
feat(presentUpSaleSheet): Animate a dismiss before presenting
adrien-coye Feb 7, 2025
261b83e
chore: Upgrade tuist + Explicitly declare dependencies
PhilippeWeidmann Feb 7, 2025
09159f2
fix: Remove target grouping
PhilippeWeidmann Feb 7, 2025
e08582c
test: Shared Env
PhilippeWeidmann Feb 7, 2025
71d403b
fix: Lottie needs to be dynamic
PhilippeWeidmann Feb 7, 2025
b5e177c
test: Remove old test + Stop testing DriveFileManager
PhilippeWeidmann Feb 7, 2025
4072f0e
test: Update some old tests
PhilippeWeidmann Feb 7, 2025
c9cb451
feat(ios-features): Added necessary libraries as a Framework
adrien-coye Feb 7, 2025
951b6ae
chore: Bump core
PhilippeWeidmann Feb 7, 2025
901a587
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 10, 2025
decb0a0
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 10, 2025
f258287
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 11, 2025
535ea70
feat(ios-features): Bump to 1.0.0
adrien-coye Feb 11, 2025
7518412
chore: Tuist update
adrien-coye Feb 11, 2025
2e9fd93
feat: MykSuite chip (#1421)
adrien-coye Feb 12, 2025
4fbe8a8
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 13, 2025
3ec7a65
Merge branch 'converstion-quota-dropbox' into converstion-quota-dropb…
adrien-coye Feb 13, 2025
408d109
feat: Dropbox quota (#1432)
adrien-coye Feb 13, 2025
e7da516
chore(router): Removed .askToUpSaleIfQuotaReached method
adrien-coye Feb 13, 2025
6aac4cf
feat: Public share quota, advanced settings chip (#1430)
adrien-coye Feb 14, 2025
5fd647b
feat: MykSuite dashboard (#1419)
adrien-coye Feb 14, 2025
80673d3
refactor(MyKSuiteFloatingPanelBridgeController): Instantiate pattern
adrien-coye Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ let project = Project(name: "kDrive",
.external(name: "SwiftRegex"),
.external(name: "Sentry-Dynamic"),
.external(name: "VersionChecker"),
.external(name: "LocalizeKit")
.external(name: "LocalizeKit"),
.external(name: "MyKSuite")
]),
.target(name: "kDriveFileProvider",
destinations: Constants.destinations,
Expand Down
4 changes: 2 additions & 2 deletions Tuist/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/ios-core-ui",
"state" : {
"revision" : "824ac002c136fc706321e8f12f8c7736bebd8680",
"version" : "16.4.0"
"branch" : "mykSuite",
"revision" : "daff57b4f485aca6ceb64f5a4052583f61230f4f"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Tuist/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-algorithms", .upToNextMajor(from: "1.2.0")),
.package(url: "https://github.com/Alamofire/Alamofire", .upToNextMajor(from: "5.2.2")),
.package(url: "https://github.com/Infomaniak/ios-core", .upToNextMajor(from: "13.0.0")),
.package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "16.0.0")),
.package(url: "https://github.com/Infomaniak/ios-core-ui", branch: "mykSuite"),
.package(url: "https://github.com/Infomaniak/ios-login", .upToNextMajor(from: "7.2.0")),
.package(url: "https://github.com/Infomaniak/ios-dependency-injection", .upToNextMajor(from: "2.0.2")),
.package(url: "https://github.com/Infomaniak/swift-concurrency", .upToNextMajor(from: "1.0.0")),
Expand Down
24 changes: 24 additions & 0 deletions kDrive/AppRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public struct AppRouter: AppNavigable {
restoreMainUIStackIfPossible(driveFileManager: driveFileManager, restoration: restoration)

showLaunchFloatingPanel()
if #available(iOS 15, *) {
self.askToUpSaleIfQuotaReached()
}

Task {
await askForReview()
await askUserToRemovePicturesIfNecessary()
Expand Down Expand Up @@ -510,6 +514,26 @@ public struct AppRouter: AppNavigable {
}
}

@MainActor public func askToUpSaleIfQuotaReached() {
guard let window,
let rootViewController = window.rootViewController else {
return
}

// TODO: Check quota

if #available(iOS 15, *) {
let floatingPanelViewController = MyKSuiteFloatingPanelBridgeController()
let myKSuiteViewController = MyKSuiteBridgeViewController()
floatingPanelViewController.isRemovalInteractionEnabled = true
floatingPanelViewController.set(contentViewController: myKSuiteViewController)

rootViewController.present(floatingPanelViewController, animated: false)
} else {
fatalError("kaput")
}
}

public func askForReview() async {
guard let presentingViewController = await window?.rootViewController,
!Bundle.main.isRunningInTestFlight else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "drive.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
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "folder.arrow.up.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.
1 change: 1 addition & 0 deletions kDrive/UI/Controller/LoginDelegateHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public final class LoginDelegateHandler: InfomaniakLoginDelegate {
UserDefaults.shared.numberOfConnections = 1
_ = router.showMainViewController(driveFileManager: driveFileManager, selectedIndex: nil)
deeplinkService.processDeeplinksPostAuthentication()
router.askToUpSaleIfQuotaReached()
}

private func didCompleteLoginWithError(_ error: Error,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
/*
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 FloatingPanel
import kDriveCore
import kDriveResources
import MyKSuite
import SwiftUI
import UIKit

@available(iOS 15, *)
class MyKSuiteFloatingPanelBridgeController: FloatingPanelController {
init() {
super.init(delegate: nil)
let appearance = SurfaceAppearance()
appearance.cornerRadius = UIConstants.FloatingPanel.cornerRadius
appearance.backgroundColor = KDriveResourcesAsset.backgroundCardViewColor.color
surfaceView.appearance = appearance
surfaceView.grabberHandlePadding = 16
surfaceView.grabberHandleSize = CGSize(width: 45, height: 5)
surfaceView.grabberHandle.barColor = KDriveResourcesAsset.iconColor.color.withAlphaComponent(0.4)
surfaceView.contentPadding = UIEdgeInsets(top: 24, left: 0, bottom: 0, right: 0)
backdropView.dismissalTapGestureRecognizer.isEnabled = true
layout = MyKSuiteFloatingPanelBridgeLayout()
}

@available(*, unavailable)
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

@available(iOS 15, *)
class MyKSuiteFloatingPanelBridgeLayout: FloatingPanelLayout {
var position: FloatingPanelPosition = .bottom
var initialState: FloatingPanelState = .tip
var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring]
private var backdropAlpha: CGFloat

init(
initialState: FloatingPanelState = .full,
hideTip: Bool = false,
safeAreaInset: CGFloat = 0,
backdropAlpha: CGFloat = 0
) {
self.initialState = initialState
self.backdropAlpha = backdropAlpha
let extendedAnchor = FloatingPanelLayoutAnchor(
absoluteInset: 620.0 + safeAreaInset,
edge: .bottom,
referenceGuide: .superview
)
anchors = [
.full: extendedAnchor,
.half: extendedAnchor,
.tip: FloatingPanelLayoutAnchor(absoluteInset: 86.0 + safeAreaInset, edge: .bottom, referenceGuide: .superview)
]
}

func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
return backdropAlpha
}
}

@available(iOS 15, *)
class MyKSuiteBridgeViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

let swiftUIView = MyKSuiteView(configuration: [
MyKSuiteLabel(icon: Image("drive.cloud"), text: "1Tb for your storage"),
MyKSuiteLabel(icon: Image("folder.arrow.up"), text: "Dropbox, PDF edit …")
])
let hostingController = UIHostingController(rootView: swiftUIView)

addChild(hostingController)
let sourceBounds = view.bounds
let adjustedFrame = CGRect(x: 0,
y: -140,
width: sourceBounds.width,
height: sourceBounds.height)
hostingController.view.frame = adjustedFrame
view.addSubview(hostingController.view)
hostingController.didMove(toParent: self)

// hostingController.view.backgroundColor = .yellow
}
}
2 changes: 2 additions & 0 deletions kDriveCore/Utils/AppNavigable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ public protocol RouterActionable {
/// Ask the user to remove pictures if configured
func askUserToRemovePicturesIfNecessary() async

@MainActor func askToUpSaleIfQuotaReached()

func refreshCacheScanLibraryAndUpload(preload: Bool, isSwitching: Bool) async
}

Expand Down
2 changes: 2 additions & 0 deletions kDriveCore/Utils/InExtensionRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public struct InExtensionRouter: AppNavigable {

public func askUserToRemovePicturesIfNecessary() async {}

public func askToUpSaleIfQuotaReached() {}

public func refreshCacheScanLibraryAndUpload(preload: Bool, isSwitching: Bool) async {}

public func showMainViewController(driveFileManager: DriveFileManager, selectedIndex: Int?) -> UITabBarController? {
Expand Down
Loading