From 49caad79cfc3886a91774c34dbf907f7b8e5b5d7 Mon Sep 17 00:00:00 2001 From: Amrut Waghmare Date: Tue, 20 Jun 2023 16:56:45 +0530 Subject: [PATCH 1/7] nmc 2298 - Share extension theaming changes --- Share/NCShareExtension.swift | 41 ++++++++---------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index 1d0ba7cc68..26c80c59ff 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -82,8 +82,8 @@ class NCShareExtension: UIViewController { uploadView.layer.cornerRadius = 10 uploadLabel.text = NSLocalizedString("_upload_", comment: "") - uploadLabel.textColor = .systemBlue - let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload(_:))) + uploadLabel.textColor = NCBrandColor.shared.customer + let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload)) uploadView.addGestureRecognizer(uploadGesture) let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, utility.getVersionBuild()) @@ -220,14 +220,15 @@ class NCShareExtension: UIViewController { navigationItem.title = navigationTitle cancelButton.title = NSLocalizedString("_cancel_", comment: "") + cancelButton.tintColor = NCBrandColor.shared.customer // BACK BUTTON let backButton = UIButton(type: .custom) - backButton.setImage(UIImage(named: "back"), for: .normal) - backButton.tintColor = .systemBlue + backButton.setImage(UIImage(named: "back")?.imageColor(NCBrandColor.shared.customer), for: .normal) + backButton.tintColor = NCBrandColor.shared.customer backButton.semanticContentAttribute = .forceLeftToRight backButton.setTitle(" " + NSLocalizedString("_back_", comment: ""), for: .normal) - backButton.setTitleColor(.systemBlue, for: .normal) + backButton.setTitleColor(NCBrandColor.shared.customer, for: .normal) backButton.action(for: .touchUpInside) { _ in while self.serverUrl.last != "/" { self.serverUrl.removeLast() } self.serverUrl.removeLast() @@ -240,35 +241,11 @@ class NCShareExtension: UIViewController { } self.setNavigationBar(navigationTitle: navigationTitle) } - - let image = utility.loadUserImage(for: tblAccount.user, displayName: tblAccount.displayName, urlBase: tblAccount.urlBase) - let profileButton = UIButton(type: .custom) - profileButton.setImage(image, for: .normal) - - if serverUrl == utilityFileSystem.getHomeServer(session: session) { - var title = " " - if !tblAccount.alias.isEmpty { - title += tblAccount.alias - } else { - title += tblAccount.displayName - } - - profileButton.setTitle(title, for: .normal) - profileButton.setTitleColor(.systemBlue, for: .normal) - } - - profileButton.semanticContentAttribute = .forceLeftToRight - profileButton.sizeToFit() - profileButton.action(for: .touchUpInside) { _ in - self.showAccountPicker() - } - var navItems = [UIBarButtonItem(customView: profileButton)] if serverUrl != utilityFileSystem.getHomeServer(session: session) { - let space = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) - space.width = 20 - navItems.append(contentsOf: [UIBarButtonItem(customView: backButton), space]) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: backButton) + } else { + navigationItem.leftBarButtonItem = nil } - navigationItem.setLeftBarButtonItems(navItems, animated: true) } func setCommandView() { From 2061a0e0fb67631d64652ba91bf15b45a65d8172 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Tue, 15 Apr 2025 17:42:32 +0530 Subject: [PATCH 2/7] NMC 2298 - Share Extension theming changes, added emptydataset changes --- Share/NCShareExtension.swift | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index 26c80c59ff..0138b67f93 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -34,6 +34,7 @@ class NCShareExtension: UIViewController { var filesName: [String] = [] // ------------------------------------------------------------- + var emptyDataSet: NCEmptyDataSet? let keyLayout = NCGlobal.shared.layoutViewShareExtension var metadataFolder: tableMetadata? var dataSourceTask: URLSessionTask? @@ -58,9 +59,13 @@ class NCShareExtension: UIViewController { override func viewDidLoad() { super.viewDidLoad() - collectionView.register(UINib(nibName: "NCSectionFirstHeaderEmptyData", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionFirstHeaderEmptyData") + self.navigationController?.navigationBar.prefersLargeTitles = false collectionView.register(UINib(nibName: "NCListCell", bundle: nil), forCellWithReuseIdentifier: "listCell") collectionView.collectionViewLayout = NCListLayout() + collectionView.refreshControl = refreshControl + refreshControl.tintColor = NCBrandColor.shared.brandText + refreshControl.backgroundColor = .systemBackground + refreshControl.addTarget(self, action: #selector(reloadDatasource), for: .valueChanged) commandView.backgroundColor = .secondarySystemBackground separatorView.backgroundColor = .separator @@ -74,7 +79,7 @@ class NCShareExtension: UIViewController { cancelButton.title = NSLocalizedString("_cancel_", comment: "") createFolderView.layer.cornerRadius = 10 - createFolderImage.image = utility.loadImage(named: "folder.badge.plus", colors: [NCBrandColor.shared.iconImageColor]) + createFolderImage.image = utility.loadImage(named: "folder.badge.plus", colors: [NCBrandColor.shared.iconColor]) createFolderLabel.text = NSLocalizedString("_create_folder_", comment: "") let createFolderGesture = UITapGestureRecognizer(target: self, action: #selector(actionCreateFolder(_:))) createFolderView.addGestureRecognizer(createFolderGesture) @@ -127,6 +132,9 @@ class NCShareExtension: UIViewController { if let windowScene = view.window?.windowScene { banner = LucidBannerRegistry.shared.banner(for: windowScene) } + NCImageCache.shared.createImagesCache() + + NotificationCenter.default.addObserver(self, selector: #selector(didCreateFolder(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterCreateFolder), object: nil) } override func viewWillAppear(_ animated: Bool) { @@ -260,6 +268,10 @@ class NCShareExtension: UIViewController { self.tableView.isScrollEnabled = false } uploadLabel.text = NSLocalizedString("_upload_", comment: "") + " \(filesName.count) " + NSLocalizedString("_files_", comment: "") + + // Empty + emptyDataSet = NCEmptyDataSet(view: collectionView, offset: -50 * counter, delegate: self) + self.tableView.reloadData() } From b2fb3d0aca83fd23fb61e12d8430a8a2f999ac06 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Tue, 30 Sep 2025 18:43:58 +0530 Subject: [PATCH 3/7] NMC-2298 - Share extension theming changes --- Share/NCShareExtension.swift | 62 +++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index 0138b67f93..292004674f 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -13,7 +13,7 @@ enum NCShareExtensionError: Error { case cancel, fileUpload, noAccount, noFiles, versionMismatch } -class NCShareExtension: UIViewController { +class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var tableView: UITableView! @IBOutlet weak var cancelButton: UIBarButtonItem! @@ -43,9 +43,13 @@ class NCShareExtension: UIViewController { let heightCommandView: CGFloat = 170 var autoUploadFileName = "" var autoUploadDirectory = "" + let refreshControl = UIRefreshControl() var progress: CGFloat = 0 var counterUploaded: Int = 0 + var uploadErrors: [tableMetadata] = [] var uploadMetadata: [tableMetadata] = [] + var uploadStarted = false + let hud = NCHud() let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() let global = NCGlobal.shared @@ -54,6 +58,20 @@ class NCShareExtension: UIViewController { var banner: LucidBanner? var sceneIdentifier: String = UUID().uuidString + let database = NCManageDatabase.shared + var account: String = "" + var session: NCSession.Session { + if !account.isEmpty, + let tableAccount = self.database.getTableAccount(account: account) { + return NCSession.Session(account: tableAccount.account, urlBase: tableAccount.urlBase, user: tableAccount.user, userId: tableAccount.userId) + } else if let activeTableAccount = self.database.getActiveTableAccount() { + self.account = activeTableAccount.account + return NCSession.Session(account: activeTableAccount.account, urlBase: activeTableAccount.urlBase, user: activeTableAccount.user, userId: activeTableAccount.userId) + } else { + return NCSession.Session(account: "", urlBase: "", user: "", userId: "") + } + } + // MARK: - View Life Cycle override func viewDidLoad() { @@ -96,6 +114,21 @@ class NCShareExtension: UIViewController { nkLog(start: "Start Share session " + versionNextcloudiOS) + // LOG + let levelLog = NCKeychain().logLevel +// +// NextcloudKit.shared.nkCommonInstance.levelLog = levelLog +// NextcloudKit.shared.nkCommonInstance.pathLog = utilityFileSystem.directoryGroup +// NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS) + NKLogFileManager.shared.logLevel = NKLogLevel(rawValue: levelLog) ?? .normal + NKLogFileManager.shared.logDirectory = URL(fileURLWithPath: utilityFileSystem.directoryGroup) + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS) + +// hud.indicatorView = JGProgressHUDRingIndicatorView() +// if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView { +// indicatorView.ringWidth = 1.5 +// indicatorView.ringColor = NCBrandColor.shared.brandElement +// } NCBrandColor.shared.createUserColors() registerForTraitChanges([UITraitUserInterfaceStyle.self]) { (self: Self, _) in @@ -154,6 +187,8 @@ class NCShareExtension: UIViewController { } } + accountRequestChangeAccount(account: account, controller: nil) + guard let inputItems = extensionContext?.inputItems as? [NSExtensionItem] else { cancel(with: .noFiles) return @@ -201,6 +236,21 @@ class NCShareExtension: UIViewController { tableView.visibleCells.forEach { $0.setNeedsLayout() } } + // MARK: - Empty + + func emptyDataSetView(_ view: NCEmptyView) { + + if self.dataSourceTask?.state == .running { + view.emptyImage.image = UIImage(named: "networkInProgress")?.image(color: .gray, size: UIScreen.main.bounds.width) + view.emptyTitle.text = NSLocalizedString("_request_in_progress_", comment: "") + view.emptyDescription.text = "" + } else { + view.emptyImage.image = UIImage(named: "folder_nmcloud") + view.emptyTitle.text = NSLocalizedString("_files_no_folders_", comment: "") + view.emptyDescription.text = "" + } + } + // MARK: - func cancel(with error: NCShareExtensionError? = nil) { @@ -517,6 +567,16 @@ extension NCShareExtension { } } +extension NCShareExtension: uploadE2EEDelegate { + func start() { + self.hud.progress(0) + } + + func uploadE2EEProgress(_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) { + self.hud.progress(fractionCompleted) + } +} + extension NCShareExtension: NCPasscodeDelegate { func passcodeReset(_ passcodeViewController: TOPasscodeViewController) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { From 700de502808eee80d62533b9f549c68ebe01d06e Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Mon, 15 Dec 2025 12:40:29 +0530 Subject: [PATCH 4/7] NMC-2298 - Share extension theming changes --- Share/NCShareExtension.swift | 101 ++++++++++++----------------------- 1 file changed, 35 insertions(+), 66 deletions(-) diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index 292004674f..6400936757 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -13,7 +13,7 @@ enum NCShareExtensionError: Error { case cancel, fileUpload, noAccount, noFiles, versionMismatch } -class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { +class NCShareExtension: UIViewController { @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var tableView: UITableView! @IBOutlet weak var cancelButton: UIBarButtonItem! @@ -34,7 +34,6 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { var filesName: [String] = [] // ------------------------------------------------------------- - var emptyDataSet: NCEmptyDataSet? let keyLayout = NCGlobal.shared.layoutViewShareExtension var metadataFolder: tableMetadata? var dataSourceTask: URLSessionTask? @@ -43,12 +42,9 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { let heightCommandView: CGFloat = 170 var autoUploadFileName = "" var autoUploadDirectory = "" - let refreshControl = UIRefreshControl() var progress: CGFloat = 0 var counterUploaded: Int = 0 - var uploadErrors: [tableMetadata] = [] var uploadMetadata: [tableMetadata] = [] - var uploadStarted = false let hud = NCHud() let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() @@ -77,13 +73,9 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { override func viewDidLoad() { super.viewDidLoad() - self.navigationController?.navigationBar.prefersLargeTitles = false + collectionView.register(UINib(nibName: "NCSectionFirstHeaderEmptyData", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionFirstHeaderEmptyData") collectionView.register(UINib(nibName: "NCListCell", bundle: nil), forCellWithReuseIdentifier: "listCell") collectionView.collectionViewLayout = NCListLayout() - collectionView.refreshControl = refreshControl - refreshControl.tintColor = NCBrandColor.shared.brandText - refreshControl.backgroundColor = .systemBackground - refreshControl.addTarget(self, action: #selector(reloadDatasource), for: .valueChanged) commandView.backgroundColor = .secondarySystemBackground separatorView.backgroundColor = .separator @@ -97,7 +89,7 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { cancelButton.title = NSLocalizedString("_cancel_", comment: "") createFolderView.layer.cornerRadius = 10 - createFolderImage.image = utility.loadImage(named: "folder.badge.plus", colors: [NCBrandColor.shared.iconColor]) + createFolderImage.image = utility.loadImage(named: "folder.badge.plus", colors: [NCBrandColor.shared.iconImageColor]) createFolderLabel.text = NSLocalizedString("_create_folder_", comment: "") let createFolderGesture = UITapGestureRecognizer(target: self, action: #selector(actionCreateFolder(_:))) createFolderView.addGestureRecognizer(createFolderGesture) @@ -105,8 +97,8 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { uploadView.layer.cornerRadius = 10 uploadLabel.text = NSLocalizedString("_upload_", comment: "") - uploadLabel.textColor = NCBrandColor.shared.customer - let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload)) + uploadLabel.textColor = .systemBlue + let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload(_:))) uploadView.addGestureRecognizer(uploadGesture) let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, utility.getVersionBuild()) @@ -114,21 +106,6 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { nkLog(start: "Start Share session " + versionNextcloudiOS) - // LOG - let levelLog = NCKeychain().logLevel -// -// NextcloudKit.shared.nkCommonInstance.levelLog = levelLog -// NextcloudKit.shared.nkCommonInstance.pathLog = utilityFileSystem.directoryGroup -// NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS) - NKLogFileManager.shared.logLevel = NKLogLevel(rawValue: levelLog) ?? .normal - NKLogFileManager.shared.logDirectory = URL(fileURLWithPath: utilityFileSystem.directoryGroup) - NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS) - -// hud.indicatorView = JGProgressHUDRingIndicatorView() -// if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView { -// indicatorView.ringWidth = 1.5 -// indicatorView.ringColor = NCBrandColor.shared.brandElement -// } NCBrandColor.shared.createUserColors() registerForTraitChanges([UITraitUserInterfaceStyle.self]) { (self: Self, _) in @@ -187,8 +164,6 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { } } - accountRequestChangeAccount(account: account, controller: nil) - guard let inputItems = extensionContext?.inputItems as? [NSExtensionItem] else { cancel(with: .noFiles) return @@ -236,21 +211,6 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { tableView.visibleCells.forEach { $0.setNeedsLayout() } } - // MARK: - Empty - - func emptyDataSetView(_ view: NCEmptyView) { - - if self.dataSourceTask?.state == .running { - view.emptyImage.image = UIImage(named: "networkInProgress")?.image(color: .gray, size: UIScreen.main.bounds.width) - view.emptyTitle.text = NSLocalizedString("_request_in_progress_", comment: "") - view.emptyDescription.text = "" - } else { - view.emptyImage.image = UIImage(named: "folder_nmcloud") - view.emptyTitle.text = NSLocalizedString("_files_no_folders_", comment: "") - view.emptyDescription.text = "" - } - } - // MARK: - func cancel(with error: NCShareExtensionError? = nil) { @@ -278,15 +238,14 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { navigationItem.title = navigationTitle cancelButton.title = NSLocalizedString("_cancel_", comment: "") - cancelButton.tintColor = NCBrandColor.shared.customer // BACK BUTTON let backButton = UIButton(type: .custom) - backButton.setImage(UIImage(named: "back")?.imageColor(NCBrandColor.shared.customer), for: .normal) - backButton.tintColor = NCBrandColor.shared.customer + backButton.setImage(UIImage(named: "back"), for: .normal) + backButton.tintColor = .systemBlue backButton.semanticContentAttribute = .forceLeftToRight backButton.setTitle(" " + NSLocalizedString("_back_", comment: ""), for: .normal) - backButton.setTitleColor(NCBrandColor.shared.customer, for: .normal) + backButton.setTitleColor(.systemBlue, for: .normal) backButton.action(for: .touchUpInside) { _ in while self.serverUrl.last != "/" { self.serverUrl.removeLast() } self.serverUrl.removeLast() @@ -299,11 +258,35 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { } self.setNavigationBar(navigationTitle: navigationTitle) } + + let image = utility.loadUserImage(for: tblAccount.user, displayName: tblAccount.displayName, urlBase: tblAccount.urlBase) + let profileButton = UIButton(type: .custom) + profileButton.setImage(image, for: .normal) + + if serverUrl == utilityFileSystem.getHomeServer(session: session) { + var title = " " + if !tblAccount.alias.isEmpty { + title += tblAccount.alias + } else { + title += tblAccount.displayName + } + + profileButton.setTitle(title, for: .normal) + profileButton.setTitleColor(.systemBlue, for: .normal) + } + + profileButton.semanticContentAttribute = .forceLeftToRight + profileButton.sizeToFit() + profileButton.action(for: .touchUpInside) { _ in + self.showAccountPicker() + } + var navItems = [UIBarButtonItem(customView: profileButton)] if serverUrl != utilityFileSystem.getHomeServer(session: session) { - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: backButton) - } else { - navigationItem.leftBarButtonItem = nil + let space = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) + space.width = 20 + navItems.append(contentsOf: [UIBarButtonItem(customView: backButton), space]) } + navigationItem.setLeftBarButtonItems(navItems, animated: true) } func setCommandView() { @@ -318,10 +301,6 @@ class NCShareExtension: UIViewController, NCEmptyDataSetDelegate { self.tableView.isScrollEnabled = false } uploadLabel.text = NSLocalizedString("_upload_", comment: "") + " \(filesName.count) " + NSLocalizedString("_files_", comment: "") - - // Empty - emptyDataSet = NCEmptyDataSet(view: collectionView, offset: -50 * counter, delegate: self) - self.tableView.reloadData() } @@ -567,16 +546,6 @@ extension NCShareExtension { } } -extension NCShareExtension: uploadE2EEDelegate { - func start() { - self.hud.progress(0) - } - - func uploadE2EEProgress(_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) { - self.hud.progress(fractionCompleted) - } -} - extension NCShareExtension: NCPasscodeDelegate { func passcodeReset(_ passcodeViewController: TOPasscodeViewController) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { From 9714d0ab50b63d8572d31689541cd7910313641d Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Tue, 16 Jun 2026 16:04:02 +0530 Subject: [PATCH 5/7] NMC 2298 - Share extension theaming changes --- Share/NCShareExtension.swift | 130 ++++++++++------------------------- 1 file changed, 38 insertions(+), 92 deletions(-) diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index 6400936757..200d9dfdab 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -4,7 +4,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later import UIKit -import UniformTypeIdentifiers import NextcloudKit import LucidBanner import SwiftUI @@ -45,29 +44,14 @@ class NCShareExtension: UIViewController { var progress: CGFloat = 0 var counterUploaded: Int = 0 var uploadMetadata: [tableMetadata] = [] - let hud = NCHud() let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() let global = NCGlobal.shared var maintenanceMode: Bool = false var token: Int? - var banner: LucidBanner? var sceneIdentifier: String = UUID().uuidString + var banner: LucidBanner? - let database = NCManageDatabase.shared - var account: String = "" - var session: NCSession.Session { - if !account.isEmpty, - let tableAccount = self.database.getTableAccount(account: account) { - return NCSession.Session(account: tableAccount.account, urlBase: tableAccount.urlBase, user: tableAccount.user, userId: tableAccount.userId) - } else if let activeTableAccount = self.database.getActiveTableAccount() { - self.account = activeTableAccount.account - return NCSession.Session(account: activeTableAccount.account, urlBase: activeTableAccount.urlBase, user: activeTableAccount.user, userId: activeTableAccount.userId) - } else { - return NCSession.Session(account: "", urlBase: "", user: "", userId: "") - } - } - // MARK: - View Life Cycle override func viewDidLoad() { @@ -97,7 +81,7 @@ class NCShareExtension: UIViewController { uploadView.layer.cornerRadius = 10 uploadLabel.text = NSLocalizedString("_upload_", comment: "") - uploadLabel.textColor = .systemBlue + uploadLabel.textColor = NCBrandColor.shared.label let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload(_:))) uploadView.addGestureRecognizer(uploadGesture) @@ -108,13 +92,6 @@ class NCShareExtension: UIViewController { NCBrandColor.shared.createUserColors() - registerForTraitChanges([UITraitUserInterfaceStyle.self]) { (self: Self, _) in - guard !self.maintenanceMode else { - return - } - self.updateAppearance() - } - NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: nil) { _ in if NCPreferences().presentPasscode { NCPasscode.shared.presentPasscode(viewController: self, delegate: self) { @@ -138,13 +115,10 @@ class NCShareExtension: UIViewController { } NCNetworking.shared.setupScene(sceneIdentifier: sceneIdentifier, controller: self) - + if let windowScene = view.window?.windowScene { banner = LucidBannerRegistry.shared.banner(for: windowScene) } - NCImageCache.shared.createImagesCache() - - NotificationCenter.default.addObserver(self, selector: #selector(didCreateFolder(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterCreateFolder), object: nil) } override func viewWillAppear(_ animated: Bool) { @@ -169,33 +143,20 @@ class NCShareExtension: UIViewController { return } - // Keep the Share extension visually hidden until we know whether this is - // an Assistant text handoff or a normal file upload flow. This avoids the - // visible open-and-close flash when the extension only needs to redirect text. - view.alpha = 0 - - Task { @MainActor in - if await handleAssistantSharedTextIfNeeded(inputItems: inputItems) { - return + NCFilesExtensionHandler(items: inputItems) { fileNames in + self.filesName = fileNames + DispatchQueue.main.async { + self.setCommandView() } + } - self.view.alpha = 1 - - NCFilesExtensionHandler(items: inputItems) { fileNames in - self.filesName = fileNames - DispatchQueue.main.async { - self.setCommandView() - } + if NCPreferences().presentPasscode { + NCPasscode.shared.presentPasscode(viewController: self, delegate: self) { + NCPasscode.shared.enableTouchFaceID() } - - if NCPreferences().presentPasscode { - NCPasscode.shared.presentPasscode(viewController: self, delegate: self) { - NCPasscode.shared.enableTouchFaceID() - } - } - - self.collectionView.reloadData() } + + self.collectionView.reloadData() } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { @@ -206,9 +167,13 @@ class NCShareExtension: UIViewController { } } - private func updateAppearance() { - collectionView.visibleCells.forEach { $0.setNeedsLayout() } - tableView.visibleCells.forEach { $0.setNeedsLayout() } + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + if !maintenanceMode { + collectionView.reloadData() + tableView.reloadData() + } } // MARK: - @@ -217,7 +182,7 @@ class NCShareExtension: UIViewController { if let error { extensionContext?.cancelRequest(withError: error) } else { - extensionContext?.completeRequest(returningItems: extensionContext?.inputItems, completionHandler: nil) + self.extensionContext?.completeRequest(returningItems: self.extensionContext?.inputItems, completionHandler: nil) } } @@ -241,11 +206,11 @@ class NCShareExtension: UIViewController { // BACK BUTTON let backButton = UIButton(type: .custom) - backButton.setImage(UIImage(named: "back"), for: .normal) - backButton.tintColor = .systemBlue + backButton.setImage(UIImage(named: "back")?.withTintColor(NCBrandColor.shared.iconImageColor), for: .normal) + backButton.tintColor = NCBrandColor.shared.label backButton.semanticContentAttribute = .forceLeftToRight backButton.setTitle(" " + NSLocalizedString("_back_", comment: ""), for: .normal) - backButton.setTitleColor(.systemBlue, for: .normal) + backButton.setTitleColor(NCBrandColor.shared.label, for: .normal) backButton.action(for: .touchUpInside) { _ in while self.serverUrl.last != "/" { self.serverUrl.removeLast() } self.serverUrl.removeLast() @@ -259,34 +224,8 @@ class NCShareExtension: UIViewController { self.setNavigationBar(navigationTitle: navigationTitle) } - let image = utility.loadUserImage(for: tblAccount.user, displayName: tblAccount.displayName, urlBase: tblAccount.urlBase) - let profileButton = UIButton(type: .custom) - profileButton.setImage(image, for: .normal) - - if serverUrl == utilityFileSystem.getHomeServer(session: session) { - var title = " " - if !tblAccount.alias.isEmpty { - title += tblAccount.alias - } else { - title += tblAccount.displayName - } - - profileButton.setTitle(title, for: .normal) - profileButton.setTitleColor(.systemBlue, for: .normal) - } - - profileButton.semanticContentAttribute = .forceLeftToRight - profileButton.sizeToFit() - profileButton.action(for: .touchUpInside) { _ in - self.showAccountPicker() - } - var navItems = [UIBarButtonItem(customView: profileButton)] - if serverUrl != utilityFileSystem.getHomeServer(session: session) { - let space = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) - space.width = 20 - navItems.append(contentsOf: [UIBarButtonItem(customView: backButton), space]) - } - navigationItem.setLeftBarButtonItems(navItems, animated: true) +// navigationItem.setLeftBarButtonItems(navItems, animated: true) + navigationItem.setLeftBarButtonItems([UIBarButtonItem(customView: backButton)], animated: true) } func setCommandView() { @@ -315,7 +254,7 @@ class NCShareExtension: UIViewController { guard let capabilities = NCNetworking.shared.capabilities[session.account] else { return } - let alertController = UIAlertController.createFolderWith(serverUrl: serverUrl, session: session, capabilities: capabilities) { error in + let alertController = UIAlertController.createFolder(serverUrl: serverUrl, session: session, capabilities: capabilities, scene: self.view.window?.windowScene) { error in if error == .success { Task { await self.loadFolder() @@ -414,8 +353,14 @@ extension NCShareExtension { guard let window = self.view.window else { return } + let horizontalLayout = horizontalLayoutBanner(bounds: window.bounds, + safeAreaInsets: window.safeAreaInsets, + idiom: window.traitCollection.userInterfaceIdiom) + let payload = LucidBannerPayload(stage: .button, + backgroundColor: Color(.systemBackground), vPosition: .center, + horizontalLayout: horizontalLayout, blocksTouches: true) (banner, token) = showUploadBanner(windowScene: window.windowScene, payload: payload, @@ -445,10 +390,11 @@ extension NCShareExtension { banner?.update(payload: LucidBannerPayload.Update(subtitle: error?.errorDescription, stage: .error), for: self.token) } - Task { @MainActor in - try? await Task.sleep(for: .seconds(2)) - banner?.dismiss() - extensionContext?.completeRequest(returningItems: extensionContext?.inputItems, completionHandler: nil) + if let banner, let token { + Task { @MainActor in + try? await Task.sleep(for: .seconds(2)) + banner.dismiss() + } } } From aa14cd7b6cb241f43e2c380ccfd3c90bd2743569 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Tue, 16 Jun 2026 16:07:11 +0530 Subject: [PATCH 6/7] NMC 2346 - File Conflict changes --- iOSClient/Main/Create/NCCreateFormUploadConflict.swift | 2 +- iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/iOSClient/Main/Create/NCCreateFormUploadConflict.swift b/iOSClient/Main/Create/NCCreateFormUploadConflict.swift index 68041c44a8..b1937b3299 100644 --- a/iOSClient/Main/Create/NCCreateFormUploadConflict.swift +++ b/iOSClient/Main/Create/NCCreateFormUploadConflict.swift @@ -325,7 +325,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource { cell.switchAlreadyExistingFile.onTintColor = NCBrandColor.shared.getElement(account: metadataNewFile.account) cell.ocId = metadataNewFile.ocId cell.delegate = self - cell.setBidiSafeFilename(metadataNewFile.fileNameView, isDirectory: metadataNewFile.directory, titleLabel: cell.labelFileName, extensionLabel: cell.labelExtensionFileName) + cell.labelFileName.text = metadataNewFile.fileNameView cell.labelDetailAlreadyExistingFile.text = "" cell.labelDetailNewFile.text = "" diff --git a/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift b/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift index 446a02edde..0c49140faa 100644 --- a/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift +++ b/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift @@ -26,7 +26,6 @@ import UIKit class NCCreateFormUploadConflictCell: UITableViewCell { @IBOutlet weak var labelFileName: UILabel! - @IBOutlet weak var labelExtensionFileName: UILabel! @IBOutlet weak var imageAlreadyExistingFile: UIImageView! @IBOutlet weak var imageNewFile: UIImageView! From 4d48dadbd205f0c335c211e70652d4514f64bacd Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Tue, 16 Jun 2026 16:07:42 +0530 Subject: [PATCH 7/7] Revert "NMC 2346 - File Conflict changes" This reverts commit d9790c013c6e018294e6bf2ede11ee4c350d154b. --- iOSClient/Main/Create/NCCreateFormUploadConflict.swift | 2 +- iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/iOSClient/Main/Create/NCCreateFormUploadConflict.swift b/iOSClient/Main/Create/NCCreateFormUploadConflict.swift index b1937b3299..68041c44a8 100644 --- a/iOSClient/Main/Create/NCCreateFormUploadConflict.swift +++ b/iOSClient/Main/Create/NCCreateFormUploadConflict.swift @@ -325,7 +325,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource { cell.switchAlreadyExistingFile.onTintColor = NCBrandColor.shared.getElement(account: metadataNewFile.account) cell.ocId = metadataNewFile.ocId cell.delegate = self - cell.labelFileName.text = metadataNewFile.fileNameView + cell.setBidiSafeFilename(metadataNewFile.fileNameView, isDirectory: metadataNewFile.directory, titleLabel: cell.labelFileName, extensionLabel: cell.labelExtensionFileName) cell.labelDetailAlreadyExistingFile.text = "" cell.labelDetailNewFile.text = "" diff --git a/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift b/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift index 0c49140faa..446a02edde 100644 --- a/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift +++ b/iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift @@ -26,6 +26,7 @@ import UIKit class NCCreateFormUploadConflictCell: UITableViewCell { @IBOutlet weak var labelFileName: UILabel! + @IBOutlet weak var labelExtensionFileName: UILabel! @IBOutlet weak var imageAlreadyExistingFile: UIImageView! @IBOutlet weak var imageNewFile: UIImageView!