diff --git a/kDrive/Resources/Assets.xcassets/gallery.fill.imageset/Contents.json b/kDrive/Resources/Assets.xcassets/gallery.fill.imageset/Contents.json
new file mode 100644
index 000000000..f89e39c10
--- /dev/null
+++ b/kDrive/Resources/Assets.xcassets/gallery.fill.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "gallery.fill.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/kDrive/Resources/Assets.xcassets/gallery.fill.imageset/gallery.fill.svg b/kDrive/Resources/Assets.xcassets/gallery.fill.imageset/gallery.fill.svg
new file mode 100644
index 000000000..6b280716c
--- /dev/null
+++ b/kDrive/Resources/Assets.xcassets/gallery.fill.imageset/gallery.fill.svg
@@ -0,0 +1,10 @@
+
diff --git a/kDrive/Resources/Assets.xcassets/gallery.imageset/Contents.json b/kDrive/Resources/Assets.xcassets/gallery.imageset/Contents.json
new file mode 100644
index 000000000..8cb7f8940
--- /dev/null
+++ b/kDrive/Resources/Assets.xcassets/gallery.imageset/Contents.json
@@ -0,0 +1,16 @@
+{
+ "images" : [
+ {
+ "filename" : "gallery.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true,
+ "template-rendering-intent" : "template"
+ }
+}
diff --git a/kDrive/Resources/Assets.xcassets/gallery.imageset/gallery.svg b/kDrive/Resources/Assets.xcassets/gallery.imageset/gallery.svg
new file mode 100644
index 000000000..5b18df579
--- /dev/null
+++ b/kDrive/Resources/Assets.xcassets/gallery.imageset/gallery.svg
@@ -0,0 +1,10 @@
+
diff --git a/kDrive/Resources/de.lproj/Localizable.strings b/kDrive/Resources/de.lproj/Localizable.strings
index 729a0e74b..1b749415a 100644
--- a/kDrive/Resources/de.lproj/Localizable.strings
+++ b/kDrive/Resources/de.lproj/Localizable.strings
@@ -4,8 +4,8 @@
* Release: Working copy
* Locale: de, German
* Tagged: ios
- * Exported by: Adrien Coye
- * Exported at: Mon, 27 Nov 2023 13:37:54 +0100
+ * Exported by: Philippe Weidmann
+ * Exported at: Fri, 12 Jan 2024 15:27:42 +0100
*/
/* loco:610a8791fa12ab20713c09e4 */
@@ -1292,6 +1292,12 @@
/* loco:6049df4d5c2c3a04bc3979fc */
"lastEditsTitle" = "Letzte Änderungen";
+/* loco:65a13fff84b88c92410f5052 */
+"localizedFilenamePrivateSpace" = "Meine Dateien";
+
+/* loco:65a140c3cdbe107c5a025352 */
+"localizedFilenameTeamSpace" = "Akten der Organisation";
+
/* loco:60dc3d5b27c2f44e2f7a3c12 */
"locateButton" = "Finden Sie";
diff --git a/kDrive/Resources/en.lproj/Localizable.strings b/kDrive/Resources/en.lproj/Localizable.strings
index 57b42d757..0348cb791 100644
--- a/kDrive/Resources/en.lproj/Localizable.strings
+++ b/kDrive/Resources/en.lproj/Localizable.strings
@@ -4,8 +4,8 @@
* Release: Working copy
* Locale: en, English
* Tagged: ios
- * Exported by: Adrien Coye
- * Exported at: Mon, 27 Nov 2023 13:37:54 +0100
+ * Exported by: Philippe Weidmann
+ * Exported at: Fri, 12 Jan 2024 15:27:42 +0100
*/
/* loco:610a8791fa12ab20713c09e4 */
@@ -1292,6 +1292,12 @@
/* loco:6049df4d5c2c3a04bc3979fc */
"lastEditsTitle" = "Most recent changes";
+/* loco:65a13fff84b88c92410f5052 */
+"localizedFilenamePrivateSpace" = "My files";
+
+/* loco:65a140c3cdbe107c5a025352 */
+"localizedFilenameTeamSpace" = "Organisation's files";
+
/* loco:60dc3d5b27c2f44e2f7a3c12 */
"locateButton" = "Locate";
diff --git a/kDrive/Resources/es.lproj/Localizable.strings b/kDrive/Resources/es.lproj/Localizable.strings
index c57126dd7..97855fe41 100644
--- a/kDrive/Resources/es.lproj/Localizable.strings
+++ b/kDrive/Resources/es.lproj/Localizable.strings
@@ -4,8 +4,8 @@
* Release: Working copy
* Locale: es, Spanish
* Tagged: ios
- * Exported by: Adrien Coye
- * Exported at: Mon, 27 Nov 2023 13:37:55 +0100
+ * Exported by: Philippe Weidmann
+ * Exported at: Fri, 12 Jan 2024 15:27:42 +0100
*/
/* loco:610a8791fa12ab20713c09e4 */
@@ -1292,6 +1292,12 @@
/* loco:6049df4d5c2c3a04bc3979fc */
"lastEditsTitle" = "Últimas modificaciones";
+/* loco:65a13fff84b88c92410f5052 */
+"localizedFilenamePrivateSpace" = "Mis archivos";
+
+/* loco:65a140c3cdbe107c5a025352 */
+"localizedFilenameTeamSpace" = "Archivos de la organización";
+
/* loco:60dc3d5b27c2f44e2f7a3c12 */
"locateButton" = "Localizar";
diff --git a/kDrive/Resources/fr.lproj/Localizable.strings b/kDrive/Resources/fr.lproj/Localizable.strings
index 1936af219..d35e320aa 100644
--- a/kDrive/Resources/fr.lproj/Localizable.strings
+++ b/kDrive/Resources/fr.lproj/Localizable.strings
@@ -4,8 +4,8 @@
* Release: Working copy
* Locale: fr, French
* Tagged: ios
- * Exported by: Adrien Coye
- * Exported at: Mon, 27 Nov 2023 13:37:54 +0100
+ * Exported by: Philippe Weidmann
+ * Exported at: Fri, 12 Jan 2024 15:27:42 +0100
*/
/* loco:610a8791fa12ab20713c09e4 */
@@ -1292,6 +1292,12 @@
/* loco:6049df4d5c2c3a04bc3979fc */
"lastEditsTitle" = "Dernières modifications";
+/* loco:65a13fff84b88c92410f5052 */
+"localizedFilenamePrivateSpace" = "Mes fichiers";
+
+/* loco:65a140c3cdbe107c5a025352 */
+"localizedFilenameTeamSpace" = "Dossiers de l’organisation";
+
/* loco:60dc3d5b27c2f44e2f7a3c12 */
"locateButton" = "Localiser";
diff --git a/kDrive/Resources/it.lproj/Localizable.strings b/kDrive/Resources/it.lproj/Localizable.strings
index 479ccb453..79dac5be7 100644
--- a/kDrive/Resources/it.lproj/Localizable.strings
+++ b/kDrive/Resources/it.lproj/Localizable.strings
@@ -4,8 +4,8 @@
* Release: Working copy
* Locale: it, Italian
* Tagged: ios
- * Exported by: Adrien Coye
- * Exported at: Mon, 27 Nov 2023 13:37:55 +0100
+ * Exported by: Philippe Weidmann
+ * Exported at: Fri, 12 Jan 2024 15:27:42 +0100
*/
/* loco:610a8791fa12ab20713c09e4 */
@@ -1292,6 +1292,12 @@
/* loco:6049df4d5c2c3a04bc3979fc */
"lastEditsTitle" = "Ultime modifiche";
+/* loco:65a13fff84b88c92410f5052 */
+"localizedFilenamePrivateSpace" = "I miei file";
+
+/* loco:65a140c3cdbe107c5a025352 */
+"localizedFilenameTeamSpace" = "File dell'organizzazione";
+
/* loco:60dc3d5b27c2f44e2f7a3c12 */
"locateButton" = "Localizzare";
diff --git a/kDrive/UI/Controller/Files/File List/FileListViewController.swift b/kDrive/UI/Controller/Files/File List/FileListViewController.swift
index 78e53f83d..d7b544ef0 100644
--- a/kDrive/UI/Controller/Files/File List/FileListViewController.swift
+++ b/kDrive/UI/Controller/Files/File List/FileListViewController.swift
@@ -586,6 +586,15 @@ class FileListViewController: UIViewController, UICollectionViewDataSource, Swip
func setUpHeaderView(_ headerView: FilesHeaderView, isEmptyViewHidden: Bool) {
headerView.delegate = self
+ if viewModel.currentDirectory.visibility == .isTeamSpace {
+ let driveName = KDriveResourcesStrings.Localizable.commonDocumentsDescription(viewModel.driveFileManager.drive.name)
+
+ headerView.commonDocumentsDescriptionLabel.text = driveName
+ headerView.commonDocumentsDescriptionLabel.isHidden = false
+ } else {
+ headerView.commonDocumentsDescriptionLabel.isHidden = true
+ }
+
headerView.sortView.isHidden = !isEmptyViewHidden
headerView.sortButton.isHidden = viewModel.configuration.sortingOptions.isEmpty
diff --git a/kDrive/UI/Controller/Files/File List/FileListViewModel.swift b/kDrive/UI/Controller/Files/File List/FileListViewModel.swift
index fd9f64e45..28f01bdfd 100644
--- a/kDrive/UI/Controller/Files/File List/FileListViewModel.swift
+++ b/kDrive/UI/Controller/Files/File List/FileListViewModel.swift
@@ -196,7 +196,7 @@ class FileListViewModel: SelectDelegate {
title = driveFileManager.drive.name
}
} else {
- title = self.currentDirectory.name
+ title = self.currentDirectory.formattedLocalizedName()
}
if configuration.showUploadingFiles {
diff --git a/kDrive/UI/Controller/Files/RootMenuViewController.swift b/kDrive/UI/Controller/Files/RootMenuViewController.swift
new file mode 100644
index 000000000..126a3ef64
--- /dev/null
+++ b/kDrive/UI/Controller/Files/RootMenuViewController.swift
@@ -0,0 +1,243 @@
+/*
+ Infomaniak kDrive - iOS App
+ Copyright (C) 2023 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 InfomaniakCoreUI
+import InfomaniakDI
+import kDriveCore
+import kDriveResources
+import RealmSwift
+import UIKit
+
+class RootMenuViewController: CustomLargeTitleCollectionViewController, SelectSwitchDriveDelegate {
+ private typealias MenuDataSource = UICollectionViewDiffableDataSource
+ private typealias DataSourceSnapshot = NSDiffableDataSourceSnapshot
+
+ private enum RootMenuSection {
+ case main
+ }
+
+ private struct RootMenuItem: Equatable, Hashable {
+ var id: Int {
+ return destinationFile.id
+ }
+
+ let name: String
+ let image: UIImage
+ let destinationFile: File
+ var isFirst = false
+ var isLast = false
+
+ func hash(into hasher: inout Hasher) {
+ hasher.combine(id)
+ hasher.combine(isFirst)
+ hasher.combine(isLast)
+ }
+ }
+
+ private static let baseItems: [RootMenuItem] = [RootMenuItem(name: KDriveResourcesStrings.Localizable.favoritesTitle,
+ image: KDriveResourcesAsset.favorite.image,
+ destinationFile: DriveFileManager.favoriteRootFile),
+ RootMenuItem(name: KDriveResourcesStrings.Localizable.lastEditsTitle,
+ image: KDriveResourcesAsset.clock.image,
+ destinationFile: DriveFileManager.lastModificationsRootFile),
+ RootMenuItem(name: KDriveResourcesStrings.Localizable.sharedWithMeTitle,
+ image: KDriveResourcesAsset.folderSelect2.image,
+ destinationFile: DriveFileManager.sharedWithMeRootFile),
+ RootMenuItem(name: KDriveResourcesStrings.Localizable.mySharesTitle,
+ image: KDriveResourcesAsset.folderSelect.image,
+ destinationFile: DriveFileManager.mySharedRootFile),
+ RootMenuItem(name: KDriveResourcesStrings.Localizable.offlineFileTitle,
+ image: KDriveResourcesAsset.availableOffline.image,
+ destinationFile: DriveFileManager.offlineRoot),
+ RootMenuItem(name: KDriveResourcesStrings.Localizable.trashTitle,
+ image: KDriveResourcesAsset.delete.image,
+ destinationFile: DriveFileManager.trashRootFile)]
+
+ @LazyInjectService private var accountManager: AccountManageable
+
+ let driveFileManager: DriveFileManager
+ private var rootChildrenObservationToken: NotificationToken?
+ private var rootViewChildren: [File]?
+ private var dataSource: MenuDataSource?
+ private let refreshControl = UIRefreshControl()
+
+ private var itemsSnapshot: DataSourceSnapshot {
+ let userRootFolders = rootViewChildren?.compactMap {
+ RootMenuItem(name: $0.formattedLocalizedName(), image: $0.icon, destinationFile: $0)
+ } ?? []
+
+ var menuItems = userRootFolders + RootMenuViewController.baseItems
+ if !menuItems.isEmpty {
+ menuItems[0].isFirst = true
+ menuItems[menuItems.count - 1].isLast = true
+ }
+
+ var snapshot = DataSourceSnapshot()
+ snapshot.appendSections([RootMenuSection.main])
+ snapshot.appendItems(menuItems)
+ return snapshot
+ }
+
+ init(driveFileManager: DriveFileManager) {
+ self.driveFileManager = driveFileManager
+ super.init(collectionViewLayout: RootMenuViewController.createListLayout())
+ }
+
+ @available(*, unavailable)
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ navigationItem.title = driveFileManager.drive.name
+ navigationItem.rightBarButtonItem = FileListBarButton(type: .search, target: self, action: #selector(presentSearch))
+
+ collectionView.backgroundColor = KDriveResourcesAsset.backgroundColor.color
+ collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: UIConstants.listPaddingBottom, right: 0)
+ collectionView.refreshControl = refreshControl
+
+ collectionView.register(RootMenuCell.self, forCellWithReuseIdentifier: RootMenuCell.identifier)
+ collectionView.register(supplementaryView: HomeLargeTitleHeaderView.self, forSupplementaryViewOfKind: .header)
+
+ configureDataSource()
+
+ let rootChildren = driveFileManager.getRealm()
+ .object(ofType: File.self, forPrimaryKey: DriveFileManager.constants.rootID)?.children
+ rootChildrenObservationToken = rootChildren?.observe { [weak self] changes in
+ guard let self else { return }
+ switch changes {
+ case .initial(let children):
+ rootViewChildren = Array(AnyRealmCollection(children).filesSorted(by: .nameAZ))
+ dataSource?.apply(itemsSnapshot, animatingDifferences: false)
+ case .update(let children, _, _, _):
+ rootViewChildren = Array(AnyRealmCollection(children).filesSorted(by: .nameAZ))
+ dataSource?.apply(itemsSnapshot, animatingDifferences: true)
+ case .error:
+ break
+ }
+ }
+ }
+
+ override func viewWillAppear(_ animated: Bool) {
+ super.viewWillAppear(animated)
+ Task {
+ try await driveFileManager.initRoot()
+ }
+ }
+
+ @objc func presentSearch() {
+ let viewModel = SearchFilesViewModel(driveFileManager: driveFileManager)
+ let searchViewController = SearchViewController.instantiateInNavigationController(viewModel: viewModel)
+ present(searchViewController, animated: true)
+ }
+
+ func configureDataSource() {
+ dataSource = MenuDataSource(collectionView: collectionView) { collectionView, indexPath, menuItem -> RootMenuCell? in
+ guard let rootMenuCell = collectionView.dequeueReusableCell(
+ withReuseIdentifier: RootMenuCell.identifier,
+ for: indexPath
+ ) as? RootMenuCell else {
+ fatalError("Failed to dequeue cell")
+ }
+
+ rootMenuCell.configure(title: menuItem.name, icon: menuItem.image)
+ rootMenuCell.initWithPositionAndShadow(isFirst: menuItem.isFirst, isLast: menuItem.isLast)
+ return rootMenuCell
+ }
+
+ dataSource?.supplementaryViewProvider = { [weak self] collectionView, kind, indexPath in
+ guard let self else { return UICollectionReusableView() }
+
+ let homeLargeTitleHeaderView = collectionView.dequeueReusableSupplementaryView(
+ ofKind: kind,
+ view: HomeLargeTitleHeaderView.self,
+ for: indexPath
+ )
+ homeLargeTitleHeaderView.isEnabled = accountManager.drives.count > 1
+ homeLargeTitleHeaderView.text = driveFileManager.drive.name
+ homeLargeTitleHeaderView.titleButtonPressedHandler = { [weak self] _ in
+ guard let self else { return }
+ let drives = accountManager.drives
+ let floatingPanelViewController = FloatingPanelSelectOptionViewController.instantiatePanel(
+ options: drives,
+ selectedOption: driveFileManager.drive,
+ headerTitle: KDriveResourcesStrings.Localizable.buttonSwitchDrive,
+ delegate: self
+ )
+ present(floatingPanelViewController, animated: true)
+ }
+ headerViewHeight = homeLargeTitleHeaderView.frame.height
+ return homeLargeTitleHeaderView
+ }
+
+ dataSource?.apply(itemsSnapshot, animatingDifferences: false)
+ }
+
+ static func createListLayout() -> UICollectionViewLayout {
+ let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
+ heightDimension: .estimated(60))
+ let item = NSCollectionLayoutItem(layoutSize: itemSize)
+
+ let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
+ heightDimension: .estimated(60))
+ let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize,
+ subitems: [item])
+
+ let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
+ heightDimension: .estimated(40))
+ let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(
+ layoutSize: headerSize,
+ elementKind: UICollectionView.elementKindSectionHeader, alignment: .top
+ )
+ sectionHeader.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 24, bottom: 0, trailing: 24)
+
+ let section = NSCollectionLayoutSection(group: group)
+ section.boundarySupplementaryItems = [sectionHeader]
+
+ let layout = UICollectionViewCompositionalLayout(section: section)
+ return layout
+ }
+
+ override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+ guard let selectedRootFile = dataSource?.itemIdentifier(for: indexPath)?.destinationFile else { return }
+
+ let destinationViewModel: FileListViewModel
+ switch selectedRootFile.id {
+ case DriveFileManager.favoriteRootFile.id:
+ destinationViewModel = FavoritesViewModel(driveFileManager: driveFileManager)
+ case DriveFileManager.lastModificationsRootFile.id:
+ destinationViewModel = LastModificationsViewModel(driveFileManager: driveFileManager)
+ case DriveFileManager.sharedWithMeRootFile.id:
+ navigationController?.pushViewController(SharedDrivesViewController.instantiate(), animated: true)
+ return
+ case DriveFileManager.offlineRoot.id:
+ destinationViewModel = OfflineFilesViewModel(driveFileManager: driveFileManager)
+ case DriveFileManager.trashRootFile.id:
+ destinationViewModel = TrashListViewModel(driveFileManager: driveFileManager)
+ default:
+ destinationViewModel = ConcreteFileListViewModel(
+ driveFileManager: driveFileManager,
+ currentDirectory: selectedRootFile
+ )
+ }
+
+ let destinationViewController = FileListViewController.instantiate(viewModel: destinationViewModel)
+ navigationController?.pushViewController(destinationViewController, animated: true)
+ }
+}
diff --git a/kDrive/UI/Controller/Home/HomeViewController.swift b/kDrive/UI/Controller/Home/HomeViewController.swift
index e16e5c0a5..fb586538f 100644
--- a/kDrive/UI/Controller/Home/HomeViewController.swift
+++ b/kDrive/UI/Controller/Home/HomeViewController.swift
@@ -24,7 +24,7 @@ import kDriveCore
import kDriveResources
import UIKit
-class HomeViewController: UICollectionViewController, UpdateAccountDelegate, TopScrollable,
+class HomeViewController: CustomLargeTitleCollectionViewController, UpdateAccountDelegate, TopScrollable,
SelectSwitchDriveDelegate {
private static let loadingCellCount = 12
@@ -158,10 +158,6 @@ class HomeViewController: UICollectionViewController, UpdateAccountDelegate, Top
}
}
- private var navbarHeight: CGFloat {
- return navigationController?.navigationBar.frame.height ?? 0
- }
-
private var floatingPanelViewController: DriveFloatingPanelController?
private var fileInformationsViewController: FileActionsFloatingPanelViewController!
private lazy var filePresenter = FilePresenter(viewController: self)
@@ -184,7 +180,7 @@ class HomeViewController: UICollectionViewController, UpdateAccountDelegate, Top
private var showInsufficientStorage = true
private var filesObserver: ObservationToken?
- private var refreshControl = UIRefreshControl()
+ private let refreshControl = UIRefreshControl()
init(driveFileManager: DriveFileManager) {
self.driveFileManager = driveFileManager
@@ -198,8 +194,10 @@ class HomeViewController: UICollectionViewController, UpdateAccountDelegate, Top
override func viewDidLoad() {
super.viewDidLoad()
+ navigationItem.title = driveFileManager.drive.name
collectionView.backgroundColor = KDriveResourcesAsset.backgroundColor.color
+
collectionView.register(supplementaryView: HomeRecentFilesHeaderView.self, forSupplementaryViewOfKind: .header)
collectionView.register(supplementaryView: HomeLargeTitleHeaderView.self, forSupplementaryViewOfKind: .header)
collectionView.register(cellView: HomeRecentFilesSelectorCollectionViewCell.self)
@@ -233,34 +231,11 @@ class HomeViewController: UICollectionViewController, UpdateAccountDelegate, Top
setSelectedHomeIndex(UserDefaults.shared.selectedHomeIndex)
}
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- navigationItem.largeTitleDisplayMode = .never
- navigationController?.navigationBar.isTranslucent = true
- navigationController?.navigationBar.shadowImage = UIImage()
- navigationController?.navigationBar.setBackgroundImage(nil, for: .default)
- navigationController?.navigationBar.barTintColor = KDriveResourcesAsset.backgroundColor.color
- navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: KDriveResourcesAsset.titleColor.color]
- updateNavbarAppearance()
- }
-
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
- updateNavbarAppearance()
MatomoUtils.track(view: ["Home"])
}
- override func viewWillDisappear(_ animated: Bool) {
- super.viewWillDisappear(animated)
- navigationController?.navigationBar.shadowImage = nil
- navigationController?.navigationBar.setBackgroundImage(nil, for: .default)
- navigationController?.navigationBar.barTintColor = nil
- navigationController?.navigationBar.titleTextAttributes = nil
- navigationController?.navigationBar.alpha = 1
- navigationController?.navigationBar.isUserInteractionEnabled = true
- navigationController?.navigationBar.layoutIfNeeded()
- }
-
func observeFileUpdated() {
guard driveFileManager != nil else { return }
filesObserver?.cancel()
@@ -416,24 +391,6 @@ class HomeViewController: UICollectionViewController, UpdateAccountDelegate, Top
}
}
- private func updateNavbarAppearance() {
- let scrollOffset = collectionView.contentOffset.y
- guard let navigationBar = navigationController?.navigationBar else {
- return
- }
-
- if view.window?.windowScene?.interfaceOrientation.isPortrait ?? true {
- navigationItem.title = driveFileManager?.drive.name ?? ""
- navigationBar.alpha = min(1, max(0, (scrollOffset + collectionView.contentInset.top) / navbarHeight))
- navigationBar.isUserInteractionEnabled = navigationBar.alpha > 0.5
- } else {
- navigationBar.isUserInteractionEnabled = false
- navigationItem.title = ""
- navigationBar.alpha = 0
- }
- navigationBar.layoutIfNeeded()
- }
-
private func createLayout() -> UICollectionViewLayout {
let layout = UICollectionViewCompositionalLayout { [weak self] section, layoutEnvironment in
guard let self else { return nil }
@@ -637,10 +594,7 @@ extension HomeViewController {
for: indexPath
)
driveHeaderView.isEnabled = accountManager.drives.count > 1
- UIView.performWithoutAnimation {
- driveHeaderView.titleButton.setTitle(driveFileManager.drive.name, for: .normal)
- driveHeaderView.titleButton.layoutIfNeeded()
- }
+ driveHeaderView.text = driveFileManager.drive.name
driveHeaderView.titleButtonPressedHandler = { [weak self] _ in
guard let self else { return }
let drives = accountManager.drives
@@ -652,6 +606,7 @@ extension HomeViewController {
)
present(floatingPanelViewController, animated: true)
}
+ headerViewHeight = driveHeaderView.frame.height
return driveHeaderView
case .recentFiles:
let headerView = collectionView.dequeueReusableSupplementaryView(
@@ -690,10 +645,6 @@ extension HomeViewController {
// MARK: - UICollectionViewDelegate
extension HomeViewController {
- override func scrollViewDidScroll(_ scrollView: UIScrollView) {
- updateNavbarAppearance()
- }
-
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
switch HomeSection.allCases[indexPath.section] {
case .top:
diff --git a/kDrive/UI/Controller/MainTabViewController.swift b/kDrive/UI/Controller/MainTabViewController.swift
index e74857a7b..5197d5047 100644
--- a/kDrive/UI/Controller/MainTabViewController.swift
+++ b/kDrive/UI/Controller/MainTabViewController.swift
@@ -38,15 +38,9 @@ class MainTabViewController: UITabBarController, Restorable {
self.driveFileManager = driveFileManager
var rootViewControllers = [UIViewController]()
rootViewControllers.append(Self.initHomeViewController(driveFileManager: driveFileManager))
- rootViewControllers.append(Self.initRootViewController(with: ConcreteFileListViewModel(
- driveFileManager: driveFileManager,
- currentDirectory: nil
- )))
+ rootViewControllers.append(Self.initRootMenuViewController(driveFileManager: driveFileManager))
rootViewControllers.append(UIViewController())
- rootViewControllers.append(Self.initRootViewController(with: FavoritesViewModel(
- driveFileManager: driveFileManager,
- currentDirectory: nil
- )))
+ rootViewControllers.append(Self.initPhotoListViewController(with: PhotoListViewModel(driveFileManager: driveFileManager)))
rootViewControllers.append(Self.initMenuViewController(driveFileManager: driveFileManager))
super.init(nibName: nil, bundle: nil)
viewControllers = rootViewControllers
@@ -108,6 +102,16 @@ class MainTabViewController: UITabBarController, Restorable {
return navigationViewController
}
+ private static func initRootMenuViewController(driveFileManager: DriveFileManager) -> UIViewController {
+ let homeViewController = RootMenuViewController(driveFileManager: driveFileManager)
+ let navigationViewController = TitleSizeAdjustingNavigationController(rootViewController: homeViewController)
+ navigationViewController.navigationBar.prefersLargeTitles = true
+ navigationViewController.tabBarItem.accessibilityLabel = KDriveResourcesStrings.Localizable.homeTitle
+ navigationViewController.tabBarItem.image = KDriveResourcesAsset.folder.image
+ navigationViewController.tabBarItem.selectedImage = KDriveResourcesAsset.folderFilledTab.image
+ return navigationViewController
+ }
+
private static func initMenuViewController(driveFileManager: DriveFileManager) -> UIViewController {
let menuViewController = MenuViewController(driveFileManager: driveFileManager)
let navigationViewController = TitleSizeAdjustingNavigationController(rootViewController: menuViewController)
@@ -119,14 +123,14 @@ class MainTabViewController: UITabBarController, Restorable {
return navigationViewController
}
- private static func initRootViewController(with viewModel: FileListViewModel) -> UIViewController {
- let fileListViewController = FileListViewController.instantiate(viewModel: viewModel)
- let navigationViewController = TitleSizeAdjustingNavigationController(rootViewController: fileListViewController)
- navigationViewController.restorationIdentifier = String(describing: type(of: viewModel))
+ private static func initPhotoListViewController(with viewModel: FileListViewModel) -> UIViewController {
+ let photoListViewController = PhotoListViewController.instantiate(viewModel: viewModel)
+ let navigationViewController = TitleSizeAdjustingNavigationController(rootViewController: photoListViewController)
+ navigationViewController.restorationIdentifier = String(describing: PhotoListViewController.self)
navigationViewController.navigationBar.prefersLargeTitles = true
navigationViewController.tabBarItem.accessibilityLabel = viewModel.title
- navigationViewController.tabBarItem.image = viewModel.configuration.tabBarIcon.image
- navigationViewController.tabBarItem.selectedImage = viewModel.configuration.selectedTabBarIcon.image
+ navigationViewController.tabBarItem.image = KDriveResourcesAsset.gallery.image
+ navigationViewController.tabBarItem.selectedImage = KDriveResourcesAsset.galleryFill.image
return navigationViewController
}
diff --git a/kDrive/UI/Controller/Menu/Menu.storyboard b/kDrive/UI/Controller/Menu/Menu.storyboard
index 8f0129c48..1ac2620e2 100644
--- a/kDrive/UI/Controller/Menu/Menu.storyboard
+++ b/kDrive/UI/Controller/Menu/Menu.storyboard
@@ -160,7 +160,7 @@
-
+
diff --git a/kDrive/UI/Controller/Menu/MenuViewController.swift b/kDrive/UI/Controller/Menu/MenuViewController.swift
index a61476708..f9c890ab6 100644
--- a/kDrive/UI/Controller/Menu/MenuViewController.swift
+++ b/kDrive/UI/Controller/Menu/MenuViewController.swift
@@ -36,8 +36,7 @@ final class MenuViewController: UITableViewController, SelectSwitchDriveDelegate
static var header = Section(id: 1, actions: [])
static var uploads = Section(id: 2, actions: [])
static var upgrade = Section(id: 3, actions: [.store])
- static var more = Section(id: 4, actions: [.sharedWithMe, .lastModifications, .images, .offline, .myShares, .trash])
- static var options = Section(id: 5, actions: [.switchUser, .parameters, .help, .disconnect])
+ static var options = Section(id: 4, actions: [.switchUser, .parameters, .help, .disconnect])
}
private struct MenuAction: Equatable {
@@ -48,30 +47,6 @@ final class MenuViewController: UITableViewController, SelectSwitchDriveDelegate
name: KDriveResourcesStrings.Localizable.upgradeOfferTitle,
image: KDriveResourcesAsset.upgradeKdrive.image
)
- static let sharedWithMe = MenuAction(
- name: KDriveResourcesStrings.Localizable.sharedWithMeTitle,
- image: KDriveResourcesAsset.folderSelect2.image
- )
- static let lastModifications = MenuAction(
- name: KDriveResourcesStrings.Localizable.lastEditsTitle,
- image: KDriveResourcesAsset.clock.image
- )
- static let images = MenuAction(
- name: KDriveResourcesStrings.Localizable.galleryTitle,
- image: KDriveResourcesAsset.images.image
- )
- static let myShares = MenuAction(
- name: KDriveResourcesStrings.Localizable.mySharesTitle,
- image: KDriveResourcesAsset.folderSelect.image
- )
- static let offline = MenuAction(
- name: KDriveResourcesStrings.Localizable.offlineFileTitle,
- image: KDriveResourcesAsset.availableOffline.image
- )
- static let trash = MenuAction(
- name: KDriveResourcesStrings.Localizable.trashTitle,
- image: KDriveResourcesAsset.delete.image
- )
static let switchUser = MenuAction(
name: KDriveResourcesStrings.Localizable.switchUserTitle,
image: KDriveResourcesAsset.userSwitch.image
@@ -177,24 +152,14 @@ final class MenuViewController: UITableViewController, SelectSwitchDriveDelegate
private func updateTableContent() {
// Show upgrade section if free drive
if driveFileManager.drive.isFreePack {
- sections = [.header, .upgrade, .more, .options]
+ sections = [.header, .upgrade, .options]
} else {
- sections = [.header, .more, .options]
+ sections = [.header, .options]
}
if let uploadCountManager, uploadCountManager.uploadCount > 0 {
sections.insert(.uploads, at: 1)
}
-
- // Hide shared with me action if no shared with me drive
- guard let sectionIndex = sections.firstIndex(of: .more) else { return }
- let sharedWithMeInList = sections[sectionIndex].actions.contains(.sharedWithMe)
- let hasSharedWithMe = !DriveInfosManager.instance.getDrives(for: accountManager.currentUserId, sharedWithMe: true).isEmpty
- if sharedWithMeInList && !hasSharedWithMe {
- sections[sectionIndex].actions.removeFirst()
- } else if !sharedWithMeInList && hasSharedWithMe {
- sections[sectionIndex].actions.insert(.sharedWithMe, at: 0)
- }
}
}
@@ -252,32 +217,6 @@ extension MenuViewController {
}
let action = section.actions[indexPath.row]
switch action {
- case .lastModifications:
- createAndPushFileListViewController(
- with: LastModificationsViewModel(driveFileManager: driveFileManager),
- as: FileListViewController.self
- )
- case .trash:
- createAndPushFileListViewController(
- with: TrashListViewModel(driveFileManager: driveFileManager),
- as: FileListViewController.self
- )
- case .myShares:
- createAndPushFileListViewController(
- with: MySharesViewModel(driveFileManager: driveFileManager),
- as: FileListViewController.self,
- shouldHideBottomBar: false
- )
- case .offline:
- createAndPushFileListViewController(
- with: OfflineFilesViewModel(driveFileManager: driveFileManager),
- as: FileListViewController.self
- )
- case .images:
- createAndPushFileListViewController(
- with: PhotoListViewModel(driveFileManager: driveFileManager),
- as: PhotoListViewController.self
- )
case .disconnect:
let alert = AlertTextViewController(title: KDriveResourcesStrings.Localizable.alertRemoveUserTitle,
message: KDriveResourcesStrings.Localizable
@@ -306,9 +245,6 @@ extension MenuViewController {
case .parameters:
let parameterTableViewController = ParameterTableViewController.instantiate(driveFileManager: driveFileManager)
navigationController?.pushViewController(parameterTableViewController, animated: true)
- case .sharedWithMe:
- let sharedDrivesViewController = SharedDrivesViewController.instantiate()
- navigationController?.pushViewController(sharedDrivesViewController, animated: true)
case .switchUser:
let switchUserViewController = SwitchUserViewController.instantiate()
navigationController?.pushViewController(switchUserViewController, animated: true)
diff --git a/kDrive/UI/View/Header view/FilesHeaderView.swift b/kDrive/UI/View/Header view/FilesHeaderView.swift
index 53bf778f2..fa9f66f58 100644
--- a/kDrive/UI/View/Header view/FilesHeaderView.swift
+++ b/kDrive/UI/View/Header view/FilesHeaderView.swift
@@ -34,6 +34,7 @@ extension FilesHeaderViewDelegate {
}
class FilesHeaderView: UICollectionReusableView {
+ @IBOutlet weak var commonDocumentsDescriptionLabel: UILabel!
@IBOutlet weak var sortView: UIView!
@IBOutlet weak var sortButton: UIButton!
@IBOutlet weak var listOrGridButton: UIButton!
diff --git a/kDrive/UI/View/Header view/FilesHeaderView.xib b/kDrive/UI/View/Header view/FilesHeaderView.xib
index ff40e8443..fbe2c15f9 100644
--- a/kDrive/UI/View/Header view/FilesHeaderView.xib
+++ b/kDrive/UI/View/Header view/FilesHeaderView.xib
@@ -1,9 +1,9 @@
-
+
-
+
@@ -17,8 +17,17 @@
-
+
+
@@ -296,6 +305,7 @@
+
@@ -323,6 +333,9 @@
+
+
+
@@ -347,7 +360,7 @@
-
+
diff --git a/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.swift b/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.swift
index 32f18207b..d99eca119 100644
--- a/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.swift
+++ b/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.swift
@@ -24,6 +24,18 @@ class HomeLargeTitleHeaderView: UICollectionReusableView {
@IBOutlet weak var titleButton: IKButton!
var titleButtonPressedHandler: ((UIButton) -> Void)?
+ var text: String? {
+ get {
+ titleButton.titleLabel?.text
+ }
+ set {
+ UIView.performWithoutAnimation {
+ titleButton.setTitle(newValue, for: .normal)
+ titleButton.layoutIfNeeded()
+ }
+ }
+ }
+
var isEnabled = true {
didSet {
chevronButton.isHidden = !isEnabled
diff --git a/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.xib b/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.xib
index 2c4eaa540..0f8165839 100644
--- a/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.xib
+++ b/kDrive/UI/View/Header view/HomeLargeTitleHeaderView.xib
@@ -1,9 +1,9 @@
-
+
-
+
@@ -16,10 +16,10 @@
-
+