Skip to content

Commit

Permalink
feat: Public share feature branch (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann authored Jan 24, 2025
2 parents 902f8cb + c4e70ea commit 81e9212
Show file tree
Hide file tree
Showing 103 changed files with 4,530 additions and 979 deletions.
1 change: 1 addition & 0 deletions Tuist/ProjectDescriptionHelpers/ExtensionTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public extension Target {
"kDrive/UI/Controller/DriveUpdateRequiredViewController.swift",
"kDrive/UI/Controller/FloatingPanelSelectOptionViewController.swift",
"kDrive/UI/Controller/Create File/FloatingPanelUtils.swift",
"kDrive/UI/Controller/Create File/FloatingPanelLayouts.swift",
"kDrive/UI/Controller/Files/Categories/**",
"kDrive/UI/Controller/Files/Rights and Share/**",
"kDrive/UI/Controller/Files/Save File/**",
Expand Down
113 changes: 113 additions & 0 deletions kDrive/AppRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import InfomaniakCore
import InfomaniakCoreUIKit
import InfomaniakDI
import InfomaniakLogin
import kDriveCore
import kDriveResources
import SafariServices
Expand All @@ -33,6 +34,8 @@ public struct AppRouter: AppNavigable {
@LazyInjectService private var reviewManager: ReviewManageable
@LazyInjectService private var availableOfflineManager: AvailableOfflineManageable
@LazyInjectService private var accountManager: AccountManageable
@LazyInjectService private var infomaniakLogin: InfomaniakLoginable
@LazyInjectService private var deeplinkService: DeeplinkServiceable

@LazyInjectService var backgroundDownloadSessionManager: BackgroundDownloadSessionManager
@LazyInjectService var backgroundUploadSessionManager: BackgroundUploadSessionManager
Expand Down Expand Up @@ -144,6 +147,7 @@ public struct AppRouter: AppNavigable {
Task {
await askForReview()
await askUserToRemovePicturesIfNecessary()
deeplinkService.processDeeplinksPostAuthentication()
}
case .onboarding:
showOnboarding()
Expand Down Expand Up @@ -412,6 +416,16 @@ public struct AppRouter: AppNavigable {
}
}

@MainActor public func showUpsaleFloatingPanel() {
guard let topMostViewController else {
return
}

let upsaleFloatingPanelController = UpsaleViewController
.instantiateInFloatingPanel(rootViewController: topMostViewController)
topMostViewController.present(upsaleFloatingPanelController, animated: true)
}

@MainActor public func showUpdateRequired() {
guard let window else {
SentryDebug.captureNoWindow()
Expand Down Expand Up @@ -444,6 +458,27 @@ public struct AppRouter: AppNavigable {
viewController.present(vc, animated: true)
}

@MainActor public func showRegister(delegate: InfomaniakLoginDelegate) {
guard let topMostViewController else {
return
}

MatomoUtils.track(eventWithCategory: .account, name: "openCreationWebview")
let registerViewController = RegisterViewController.instantiateInNavigationController(delegate: delegate)
topMostViewController.present(registerViewController, animated: true)
}

@MainActor public func showLogin(delegate: InfomaniakLoginDelegate) {
guard let topMostViewController else {
return
}

MatomoUtils.track(eventWithCategory: .account, name: "openLoginWebview")
infomaniakLogin.webviewLoginFrom(viewController: topMostViewController,
hideCreateAccountButton: true,
delegate: delegate)
}

// MARK: AppExtensionRouter

public func showStore(from viewController: UIViewController, driveFileManager: DriveFileManager) {
Expand Down Expand Up @@ -585,6 +620,84 @@ public struct AppRouter: AppNavigable {

// MARK: RouterFileNavigable

@MainActor public func presentPublicShareLocked(_ destinationURL: URL) {
guard let window,
let rootViewController = window.rootViewController else {
return
}

rootViewController.dismiss(animated: false) {
let viewController = LockedFolderViewController()
viewController.destinationURL = destinationURL
let publicShareNavigationController = UINavigationController(rootViewController: viewController)
publicShareNavigationController.modalPresentationStyle = .fullScreen
publicShareNavigationController.modalTransitionStyle = .coverVertical

rootViewController.present(publicShareNavigationController, animated: true, completion: nil)
}
}

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

rootViewController.dismiss(animated: false) {
let viewController = UnavaillableFolderViewController()
let publicShareNavigationController = UINavigationController(rootViewController: viewController)
publicShareNavigationController.modalPresentationStyle = .fullScreen
publicShareNavigationController.modalTransitionStyle = .coverVertical

rootViewController.present(publicShareNavigationController, animated: true, completion: nil)
}
}

@MainActor public func presentPublicShare(
frozenRootFolder: File,
publicShareProxy: PublicShareProxy,
driveFileManager: DriveFileManager,
apiFetcher: PublicShareApiFetcher
) {
guard let window,
let rootViewController = window.rootViewController else {
return
}

if let topMostViewController, (topMostViewController as? LockedAppViewController) != nil {
return
}

rootViewController.dismiss(animated: false) {
let configuration = FileListViewModel.Configuration(selectAllSupported: true,
rootTitle: nil,
emptyViewType: .emptyFolder,
supportsDrop: false,
leftBarButtons: [.cancel],
rightBarButtons: [.downloadAll],
matomoViewPath: [
MatomoUtils.Views.menu.displayName,
"publicShare"
])

let viewModel = PublicShareViewModel(publicShareProxy: publicShareProxy,
sortType: .nameAZ,
driveFileManager: driveFileManager,
currentDirectory: frozenRootFolder,
apiFetcher: apiFetcher,
configuration: configuration)
let viewController = FileListViewController(viewModel: viewModel)
viewModel.onDismissViewController = { [weak viewController] in
viewController?.dismiss(animated: false)
}
let publicShareNavigationController = UINavigationController(rootViewController: viewController)
publicShareNavigationController.modalPresentationStyle = .fullScreen
publicShareNavigationController.modalTransitionStyle = .coverVertical

rootViewController.present(publicShareNavigationController, animated: true, completion: nil)
}
}

@MainActor public func present(file: File, driveFileManager: DriveFileManager) {
present(file: file, driveFileManager: driveFileManager, office: false)
}
Expand Down
24 changes: 24 additions & 0 deletions kDrive/Resources/Assets.xcassets/UFO.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"images" : [
{
"filename" : "abducted_files.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
39 changes: 39 additions & 0 deletions kDrive/Resources/Assets.xcassets/UFO.imageset/abducted_files.svg
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,25 @@
{
"images" : [
{
"filename" : "lock-clear.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "lock-dark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
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
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "img-kDrive.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
Loading

0 comments on commit 81e9212

Please sign in to comment.