-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add CollectionViewCellStyle.showPathDetails property - add CollectionViewCellStyle.StyleOptionKey.showPathDetails - OCItem+UniversalItemListCellContentProvider: add support for CollectionViewCellStyle.showPathDetails - ServerSideSearchScope: add server-side search scope - SearchScope: add convenience method to instantiate ServerSideSearchScope - ClientItemViewController: add server-side search scope
- Loading branch information
1 parent
2958a32
commit 8ee4643
Showing
6 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
ownCloudAppShared/Client/Search/Item Search/Scopes/ServerSideSearchScope.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// ServerSideSearchScope.swift | ||
// ownCloudAppShared | ||
// | ||
// Created by Felix Schwarz on 04.11.24. | ||
// Copyright © 2024 ownCloud GmbH. All rights reserved. | ||
// | ||
|
||
/* | ||
* Copyright (C) 2024, ownCloud GmbH. | ||
* | ||
* This code is covered by the GNU Public License Version 3. | ||
* | ||
* For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/ | ||
* You should have received a copy of this license along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.en.html>. | ||
* | ||
*/ | ||
|
||
import UIKit | ||
import ownCloudSDK | ||
import ownCloudApp | ||
|
||
class ServerSideSearchScope: SearchScope { | ||
var searchResult: OCSearchResult? | ||
|
||
public override init(with context: ClientContext, cellStyle: CollectionViewCellStyle?, localizedName name: String, localizedPlaceholder placeholder: String? = nil, icon: UIImage? = nil) { | ||
var pathAndRevealCellStyle : CollectionViewCellStyle? | ||
|
||
if let cellStyle = cellStyle { | ||
pathAndRevealCellStyle = CollectionViewCellStyle(from: cellStyle, changing: { cellStyle in | ||
cellStyle.showRevealButton = true | ||
cellStyle.showPathDetails = true | ||
}) | ||
} | ||
|
||
super.init(with: context, cellStyle: pathAndRevealCellStyle, localizedName: name, localizedPlaceholder: placeholder, icon: icon) | ||
|
||
tokenizer = SearchTokenizer(scope: self, clientContext: clientContext) | ||
results = nil | ||
} | ||
|
||
open override func updateFor(_ searchElements: [SearchElement]) { | ||
let searchTerm = searchElements.composedSearchTerm | ||
let kqlQuery = "*" + searchTerm + "*" | ||
|
||
if searchResult?.kqlQuery != kqlQuery, let core = clientContext.core { | ||
searchResult?.cancel() | ||
|
||
searchResult = core.searchFiles(withPattern: kqlQuery, limit: 100) | ||
results = searchResult?.results | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters