Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarino Faggiana <marino@marinofaggiana.com>2022-11-07 12:11:54 +0300
committerMarino Faggiana <marino@marinofaggiana.com>2022-11-07 12:11:54 +0300
commitf1dfccd75577c638244d188e64f77784a7e3a04c (patch)
tree634fd1d6ec675194e5c4cbc5b545c2417500463a /iOSClient
parent9a799a125f6d362204c93690fbe4fdaec31b68c6 (diff)
fix searchmode
Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Diffstat (limited to 'iOSClient')
-rw-r--r--iOSClient/AppDelegate.swift3
-rw-r--r--iOSClient/Files/NCFiles.swift4
-rw-r--r--iOSClient/Main/Collection Common/NCCollectionViewCommon.swift49
-rw-r--r--iOSClient/Main/NCFunctionCenter.swift2
4 files changed, 29 insertions, 29 deletions
diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift
index 6c4194f88..f9f164f2e 100644
--- a/iOSClient/AppDelegate.swift
+++ b/iOSClient/AppDelegate.swift
@@ -48,7 +48,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
@objc var activeViewController: UIViewController?
var mainTabBar: NCMainTabBar?
var activeMetadata: tableMetadata?
- var isSearchingMode: Bool = false
let listFilesVC = ThreadSafeDictionary<String,NCFiles>()
let listFavoriteVC = ThreadSafeDictionary<String,NCFavorite>()
@@ -866,7 +865,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
else if scheme == "nextcloud" && action == "open-file" {
- if !isSearchingMode, let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {
+ if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {
let queryItems = urlComponents.queryItems
guard let userScheme = CCUtility.value(forKey: "user", fromQueryItems: queryItems) else { return false }
diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift
index ab5d68f5a..d1041a435 100644
--- a/iOSClient/Files/NCFiles.swift
+++ b/iOSClient/Files/NCFiles.swift
@@ -94,7 +94,7 @@ class NCFiles: NCCollectionViewCommon {
DispatchQueue.main.async { self.refreshControl.endRefreshing() }
DispatchQueue.global().async {
- guard !self.appDelegate.isSearchingMode, !self.appDelegate.account.isEmpty, !self.appDelegate.urlBase.isEmpty, !self.serverUrl.isEmpty else { return }
+ guard !self.isSearchingMode, !self.appDelegate.account.isEmpty, !self.appDelegate.urlBase.isEmpty, !self.serverUrl.isEmpty else { return }
let metadatas = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, self.serverUrl))
if self.metadataFolder == nil {
@@ -136,7 +136,7 @@ class NCFiles: NCCollectionViewCommon {
override func reloadDataSourceNetwork(forced: Bool = false) {
super.reloadDataSourceNetwork(forced: forced)
- guard !appDelegate.isSearchingMode else {
+ guard !isSearchingMode else {
networkSearch()
return
}
diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
index d0c55b2c5..e105f828e 100644
--- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
+++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
@@ -44,6 +44,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
internal var dataSource = NCDataSource()
internal var richWorkspaceText: String?
internal var headerMenu: NCSectionHeaderMenu?
+ internal var isSearchingMode: Bool = false
internal var layoutForView: NCGlobal.layoutForViewType?
internal var selectableDataSource: [RealmSwiftObject] { dataSource.getMetadataSourceForAllSections() }
@@ -216,7 +217,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
setNavigationItem()
reloadDataSource(forced: false)
- if !appDelegate.isSearchingMode {
+ if !isSearchingMode {
reloadDataSourceNetwork()
}
@@ -291,9 +292,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
guard !appDelegate.account.isEmpty else { return }
// Search
- if searchController?.isActive ?? false || appDelegate.isSearchingMode {
+ if searchController?.isActive ?? false || isSearchingMode {
searchController?.isActive = false
- appDelegate.isSearchingMode = false
+ isSearchingMode = false
}
// Select
@@ -343,7 +344,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
@objc func reloadDataSourceNetworkForced(_ notification: NSNotification) {
- if !appDelegate.isSearchingMode {
+ if !isSearchingMode {
reloadDataSourceNetwork(forced: true)
}
}
@@ -426,7 +427,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
@objc func renameFile(_ notification: NSNotification) {
- if appDelegate.isSearchingMode {
+ if isSearchingMode {
reloadDataSourceNetwork()
} else {
reloadDataSource()
@@ -545,7 +546,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
account == appDelegate.account
else { return }
- guard !appDelegate.isSearchingMode, let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return }
+ guard !isSearchingMode, let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return }
dataSource.addMetadata(metadata)
self.collectionView?.reloadData()
}
@@ -741,7 +742,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
func emptyDataSetView(_ view: NCEmptyView) {
self.emptyDataSet?.setOffset(getHeaderHeight())
- if appDelegate.isSearchingMode {
+ if isSearchingMode {
view.emptyImage.image = UIImage(named: "search")?.image(color: .gray, size: UIScreen.main.bounds.width)
if isReloadDataSourceNetworkInProgress {
view.emptyTitle.text = NSLocalizedString("_search_in_progress_", comment: "")
@@ -774,7 +775,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
- appDelegate.isSearchingMode = true
+ isSearchingMode = true
self.providers?.removeAll()
self.dataSource.clearDataSource()
self.collectionView.reloadData()
@@ -785,7 +786,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
- if appDelegate.isSearchingMode && self.literalSearch?.count ?? 0 >= 2 {
+ if isSearchingMode && self.literalSearch?.count ?? 0 >= 2 {
reloadDataSourceNetwork()
}
}
@@ -795,7 +796,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
DispatchQueue.global().async {
NCNetworking.shared.cancelUnifiedSearchFiles()
- self.appDelegate.isSearchingMode = false
+ self.isSearchingMode = false
self.literalSearch = ""
self.providers?.removeAll()
self.dataSource.clearDataSource()
@@ -845,7 +846,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
headerMenu?.buttonSwitch.accessibilityLabel = NSLocalizedString("_list_view_", comment: "")
layoutForView?.layout = NCGlobal.shared.layoutGrid
NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
- if appDelegate.isSearchingMode {
+ if isSearchingMode {
self.groupByField = "name"
} else {
self.groupByField = "classFile"
@@ -1016,7 +1017,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
// set GroupField for Grid
- if !appDelegate.isSearchingMode && layoutForView?.layout == NCGlobal.shared.layoutGrid {
+ if !isSearchingMode && layoutForView?.layout == NCGlobal.shared.layoutGrid {
groupByField = "classFile"
} else {
groupByField = "name"
@@ -1053,7 +1054,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
providers: self.providers,
searchResults: self.searchResults)
} update: { account, id, searchResult, metadatas in
- guard let metadatas = metadatas, metadatas.count > 0, self.appDelegate.isSearchingMode , let searchResult = searchResult else { return }
+ guard let metadatas = metadatas, metadatas.count > 0, self.isSearchingMode , let searchResult = searchResult else { return }
NCOperationQueue.shared.unifiedSearchAddSection(collectionViewCommon: self, metadatas: metadatas, searchResult: searchResult)
} completion: { account, error in
self.refreshControl.endRefreshing()
@@ -1066,7 +1067,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
self.refreshControl.endRefreshing()
self.collectionView.reloadData()
}
- guard let metadatas = metadatas, error == .success, self.appDelegate.isSearchingMode else { return }
+ guard let metadatas = metadatas, error == .success, self.isSearchingMode else { return }
self.dataSource = NCDataSource(
metadatas: metadatas,
account: self.appDelegate.account,
@@ -1498,7 +1499,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
cell.hideButtonMore(false)
cell.titleInfoTrailingDefault()
- if appDelegate.isSearchingMode {
+ if isSearchingMode {
cell.fileTitleLabel?.text = metadata.fileName
cell.fileTitleLabel?.lineBreakMode = .byTruncatingTail
if metadata.name == NCGlobal.shared.appName {
@@ -1649,7 +1650,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
}
// Separator
- if collectionView.numberOfItems(inSection: indexPath.section) == indexPath.row + 1 || appDelegate.isSearchingMode {
+ if collectionView.numberOfItems(inSection: indexPath.section) == indexPath.row + 1 || isSearchingMode {
cell.cellSeparatorView?.isHidden = true
} else {
cell.cellSeparatorView?.isHidden = false
@@ -1672,7 +1673,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
cell.setAccessibility(label: metadata.fileNameView + ", " + (cell.fileInfoLabel?.text ?? ""), value: a11yValues.joined(separator: ", "))
// Color string find in search
- if appDelegate.isSearchingMode, let literalSearch = self.literalSearch, let title = cell.fileTitleLabel?.text {
+ if isSearchingMode, let literalSearch = self.literalSearch, let title = cell.fileTitleLabel?.text {
let longestWordRange = (title.lowercased() as NSString).range(of: literalSearch)
let attributedString = NSMutableAttributedString(string: title, attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 15)])
attributedString.setAttributes([NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor : UIColor.systemBlue], range: longestWordRange)
@@ -1701,7 +1702,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
}
header.delegate = self
- if headerMenuButtonsCommand && !appDelegate.isSearchingMode {
+ if headerMenuButtonsCommand && !isSearchingMode {
header.setButtonsCommand(heigt: NCGlobal.shared.heightButtonsCommand, imageButton1: UIImage(named: "addImage"), titleButton1: NSLocalizedString("_upload_", comment: ""), imageButton2: UIImage(named: "folder"), titleButton2: NSLocalizedString("_create_folder_", comment: ""), imageButton3: UIImage(named: "scan"), titleButton3: NSLocalizedString("_scan_", comment: ""))
} else {
header.setButtonsCommand(heigt: 0)
@@ -1756,11 +1757,11 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
footer.buttonIsHidden(true)
footer.hideActivityIndicatorSection()
- if appDelegate.isSearchingMode {
+ if isSearchingMode {
if sections > 1 && section != sections - 1 {
footer.separatorIsHidden(false)
}
- if appDelegate.isSearchingMode && isPaginated && metadatasCount > 0 {
+ if isSearchingMode && isPaginated && metadatasCount > 0 {
footer.buttonIsHidden(false)
}
if unifiedSearchInProgress {
@@ -1786,7 +1787,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
var size: CGFloat = 0
- if headerMenuButtonsCommand && !appDelegate.isSearchingMode {
+ if headerMenuButtonsCommand && !isSearchingMode {
size += NCGlobal.shared.heightButtonsCommand
}
if headerMenuButtonsView {
@@ -1802,12 +1803,12 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
if let richWorkspaceText = richWorkspaceText, !headerRichWorkspaceDisable {
let trimmed = richWorkspaceText.trimmingCharacters(in: .whitespaces)
- if trimmed.count > 0 && !appDelegate.isSearchingMode {
+ if trimmed.count > 0 && !isSearchingMode {
headerRichWorkspace = UIScreen.main.bounds.size.height / 6
}
}
- if appDelegate.isSearchingMode || layoutForView?.layout == NCGlobal.shared.layoutGrid || dataSource.numberOfSections() > 1 {
+ if isSearchingMode || layoutForView?.layout == NCGlobal.shared.layoutGrid || dataSource.numberOfSections() > 1 {
if section == 0 {
return (getHeaderHeight(), headerRichWorkspace, NCGlobal.shared.heightSection)
} else {
@@ -1840,7 +1841,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
size.height += NCGlobal.shared.heightFooter
}
- if appDelegate.isSearchingMode && isPaginated && metadatasCount > 0 {
+ if isSearchingMode && isPaginated && metadatasCount > 0 {
size.height += NCGlobal.shared.heightFooterButton
}
diff --git a/iOSClient/Main/NCFunctionCenter.swift b/iOSClient/Main/NCFunctionCenter.swift
index baa2aafad..b0d550867 100644
--- a/iOSClient/Main/NCFunctionCenter.swift
+++ b/iOSClient/Main/NCFunctionCenter.swift
@@ -462,7 +462,7 @@ import Photos
func openFileViewInFolder(serverUrl: String, fileNameBlink: String?, fileNameOpen: String?) {
- appDelegate.isSearchingMode = false
+ //appDelegate.isSearchingMode = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
var topNavigationController: UINavigationController?