diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index 262664628e..7975c839cf 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -51,6 +51,7 @@ class NCShareExtension: UIViewController { var filesName: [String] = [] // ------------------------------------------------------------- + var emptyDataSet: NCEmptyDataSet? let keyLayout = NCGlobal.shared.layoutViewShareExtension var metadataFolder: tableMetadata? var dataSourceTask: URLSessionTask? @@ -89,12 +90,11 @@ class NCShareExtension: UIViewController { 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.iconImageColor + refreshControl.tintColor = NCBrandColor.shared.brandText refreshControl.backgroundColor = .systemBackground refreshControl.addTarget(self, action: #selector(reloadDatasource), for: .valueChanged) @@ -108,7 +108,7 @@ class NCShareExtension: UIViewController { commandViewHeightConstraint.constant = heightCommandView 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) @@ -116,7 +116,7 @@ class NCShareExtension: UIViewController { uploadView.layer.cornerRadius = 10 uploadLabel.text = NSLocalizedString("_upload_", comment: "") - uploadLabel.textColor = .systemBlue + uploadLabel.textColor = NCBrandColor.shared.customer let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload)) uploadView.addGestureRecognizer(uploadGesture) @@ -129,6 +129,7 @@ class NCShareExtension: UIViewController { NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS) NCBrandColor.shared.createUserColors() + NCImageCache.shared.createImagesCache() NotificationCenter.default.addObserver(self, selector: #selector(didCreateFolder(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterCreateFolder), object: nil) } @@ -190,14 +191,15 @@ class NCShareExtension: UIViewController { func setNavigationBar(navigationTitle: String) { 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 if !self.uploadStarted { while self.serverUrl.last != "/" { self.serverUrl.removeLast() } @@ -210,38 +212,11 @@ class NCShareExtension: UIViewController { self.setNavigationBar(navigationTitle: navigationTitle) } } - - let tableAccount = self.database.getTableAccount(account: session.account) - let image = utility.loadUserImage(for: session.user, displayName: tableAccount?.displayName, urlBase: session.urlBase) - let profileButton = UIButton(type: .custom) - profileButton.setImage(image, for: .normal) - - if serverUrl == utilityFileSystem.getHomeServer(session: self.session) { - var title = " " - if let userAlias = tableAccount?.alias, !userAlias.isEmpty { - title += userAlias - } else { - title += tableAccount?.displayName ?? "" - } - - profileButton.setTitle(title, for: .normal) - profileButton.setTitleColor(.systemBlue, for: .normal) - } - - profileButton.semanticContentAttribute = .forceLeftToRight - profileButton.sizeToFit() - profileButton.action(for: .touchUpInside) { _ in - if !self.uploadStarted { - self.showAccountPicker() - } - } - var navItems = [UIBarButtonItem(customView: profileButton)] if serverUrl != utilityFileSystem.getHomeServer(session: self.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() { @@ -256,6 +231,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() }