Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
1305eff
remove redundant argument
caldrian Jan 28, 2026
09ebe6c
clean up unused code
caldrian Jan 28, 2026
5843473
some renaming
caldrian Jan 28, 2026
00eb258
prepare for refactoring
caldrian Jan 28, 2026
96fc35a
remove unused code
caldrian Jan 28, 2026
4e4cf14
start migrating SearchTask to Swift Concurrency
caldrian Jan 28, 2026
93c6687
don't send empty search requests
caldrian Jan 28, 2026
2f72db4
some more cleanup
caldrian Jan 28, 2026
f7a594f
add note
caldrian Jan 28, 2026
93c2a54
refactoring
caldrian Jan 29, 2026
f5b2e87
minor fix
caldrian Jan 29, 2026
6ac778f
note
caldrian Jan 30, 2026
63898f4
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/repl…
caldrian Jan 30, 2026
a287b76
prepare for isolating search subtasks
caldrian Jan 30, 2026
1e0cb6f
migrate performRemoteSearchForServices
caldrian Jan 30, 2026
7784c55
migrate performLocalLookup
caldrian Jan 30, 2026
23c3923
migrate performLocalSearch
caldrian Jan 30, 2026
b590360
migrate performRemoteSearchForTeamUser
caldrian Jan 30, 2026
14627e3
migrate performTeamMembershipLookup
caldrian Jan 30, 2026
1790d7b
migrate performUserLookup
caldrian Jan 30, 2026
a381efd
minor fix
caldrian Jan 30, 2026
b801764
some cleanup
caldrian Jan 30, 2026
22a43b3
some cleanup, add notes
caldrian Jan 30, 2026
8ddbf74
add guard let self
caldrian Feb 2, 2026
7f2baf7
rename local result variables
caldrian Feb 2, 2026
e14a0c5
rename member variable result
caldrian Feb 2, 2026
2d8616f
add guard let self
caldrian Feb 2, 2026
fe96e5b
format code
caldrian Feb 2, 2026
5354345
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/impr…
caldrian Feb 2, 2026
91fa5a0
Merge branch 'chore/improve-code-readability-WPB-20362' into chore/re…
caldrian Feb 2, 2026
f6969a1
attempt to fix build errors
caldrian Feb 2, 2026
a6d81e1
minor fix
caldrian Feb 2, 2026
63f647a
remove unused code
caldrian Feb 2, 2026
596b7d1
minor change
caldrian Feb 2, 2026
f7c96a4
Merge branch 'chore/improve-code-readability-WPB-20362' into chore/re…
caldrian Feb 2, 2026
2aa37e6
remove unused code
caldrian Feb 2, 2026
60e932a
remove comment
caldrian Feb 2, 2026
290b40b
revert some changes
caldrian Feb 2, 2026
9ad0541
escape plus character in query items
caldrian Feb 2, 2026
333369c
fix one test
caldrian Feb 2, 2026
0634115
Merge branch 'chore/improve-code-readability-WPB-20362' into chore/re…
caldrian Feb 2, 2026
7a9b596
add async throws
caldrian Feb 2, 2026
5ff02d7
chore: improve code readability of SearchTask.swift - WPB-20362 (#4241)
caldrian Feb 2, 2026
8ba8e98
Merge remote-tracking branch 'github/gh-readonly-queue/develop/pr-424…
caldrian Feb 2, 2026
5da848e
Merge branch 'chore/improve-code-readability-WPB-20362' into chore/re…
caldrian Feb 2, 2026
a05c7ed
fix another test
caldrian Feb 2, 2026
89357c2
fix some tests
caldrian Feb 2, 2026
b615da1
partially fix SearchTaskTests
caldrian Feb 2, 2026
7365013
Merge remote-tracking branch 'github/gh-readonly-queue/develop/pr-424…
caldrian Feb 2, 2026
ebca331
uncomment code
caldrian Feb 2, 2026
e4b92ba
Merge branch 'chore/improve-code-readability-WPB-20362' into chore/re…
caldrian Feb 2, 2026
9ad2748
fix crashes
caldrian Feb 2, 2026
eae2185
fix more tests
caldrian Feb 2, 2026
70ea913
format code
caldrian Feb 2, 2026
05ed094
delete ContextProvider.searchContext
caldrian Feb 2, 2026
45ac179
fix build errors in WireSyncEngine
caldrian Feb 2, 2026
9e23597
add notes
caldrian Feb 2, 2026
3c94a08
several fixes
caldrian Feb 2, 2026
bfbe31f
minor fixes
caldrian Feb 3, 2026
d03e77a
add debugging output
caldrian Feb 3, 2026
cc6b255
typo
caldrian Feb 3, 2026
76d7560
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/dele…
caldrian Feb 3, 2026
ffe95b7
add note
caldrian Feb 3, 2026
bc95f36
fix build error
caldrian Feb 3, 2026
cae02ce
Revert "add debugging output"
caldrian Feb 3, 2026
3bc6a9d
remove unused code
caldrian Feb 3, 2026
b0ca485
fix build errors in sync engine
caldrian Feb 3, 2026
1f2192e
fix build errors in wire-ios
caldrian Feb 3, 2026
7295e04
remove ZMUser.selfUser(inUserSession:)
caldrian Feb 3, 2026
6e22fe1
Merge branch 'chore/delete-zmselfuser-inusersession-WPB-20362' into c…
caldrian Feb 3, 2026
18b47db
Trigger CI
caldrian Feb 3, 2026
75f527f
revert change
caldrian Feb 4, 2026
ea8cf2b
Merge branch 'chore/delete-zmselfuser-inusersession-WPB-20362' into c…
caldrian Feb 4, 2026
440d668
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/refa…
caldrian Feb 4, 2026
c2b8c2a
clean up searchMOC properties
caldrian Feb 4, 2026
aae73ce
Merge branch 'chore/delete-search-context-WPB-20362' into chore/refac…
caldrian Feb 4, 2026
471d2c1
fix merge conflicts
caldrian Feb 4, 2026
4138780
fix API violation
caldrian Feb 4, 2026
9078d19
fix comment
caldrian Feb 4, 2026
f5b16d1
remove comments
caldrian Feb 4, 2026
99c9312
resolve TODOs
caldrian Feb 4, 2026
3b9e4be
Merge remote-tracking branch 'github/gh-readonly-queue/develop/pr-426…
caldrian Feb 4, 2026
af607dd
Merge branch 'chore/delete-zmselfuser-inusersession-WPB-20362' into c…
caldrian Feb 4, 2026
c9bbcf8
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/dele…
caldrian Feb 6, 2026
654fcfe
Merge remote-tracking branch 'github/gh-readonly-queue/develop/pr-424…
caldrian Feb 6, 2026
d40857e
Merge branch 'chore/delete-search-context-WPB-20362' into chore/refac…
caldrian Feb 6, 2026
33d0b06
add cancellation
caldrian Feb 6, 2026
6a885cb
revert changes
caldrian Feb 6, 2026
c1afe5c
fix issue
caldrian Feb 6, 2026
b419e16
fix build error
caldrian Feb 6, 2026
9b89654
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/refa…
caldrian Feb 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private struct SearchResultContactV15: Decodable, ToAPIModelConvertible {
documents: documents.map { $0.toAPIModel() }
)
}

}

private struct ContactV15: Decodable, ToAPIModelConvertible {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension NSManagedObjectContext {
}
}

public class SearchUserSnapshot {
public final class SearchUserSnapshot {

/// Keys that we want to be notified for
static let observableKeys: [String] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import XCTest

@testable import WireRequestStrategy

class RemoveParticipantActionHandlerTests: MessagingTestBase {
Expand Down
22 changes: 6 additions & 16 deletions wire-ios-sync-engine/Source/Use cases/SearchUsersUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,14 @@ public final class SearchUsersUseCase: SearchUsersUseCaseProtocol {
team: team
)

return try await withCheckedThrowingContinuation { continuation in
// TODO: [WPB-23110] SWIFT TASK CONTINUATION MISUSE: invoke(query:options:messageProtocol:) leaked its continuation without resuming it. This may cause tasks waiting on it to remain suspended forever.
guard !Task.isCancelled else {
continuation.resume(throwing: CancellationError())
self.activeSearchTask = nil
return
let task = searchDirectory.createSearchTask(with: request)
activeSearchTask = task
defer {
if activeSearchTask === task {
activeSearchTask = nil
}

let task = searchDirectory.perform(request)
task.addResultHandler { result, isCompleted in
if isCompleted {
continuation.resume(returning: result)
self.activeSearchTask = nil
}
}
task.start()
activeSearchTask = task
}
return await task.start()
}

// MARK: - Private methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

import Foundation

@objcMembers
public class SearchDirectory: NSObject {
public final class SearchDirectory: NSObject {

let contextProvider: ContextProvider
let transportSession: TransportSessionType
private let contextProvider: ContextProvider
private let transportSession: TransportSessionType
private let apiVersion: WireTransport.APIVersion?

var isTornDown = false
private var isTornDown = false

private let refreshUsersMissingMetadataAction: RecurringAction
private let refreshConversationsMissingMetadataAction: RecurringAction
Expand Down Expand Up @@ -64,50 +63,27 @@ public class SearchDirectory: NSObject {
self.refreshConversationsMissingMetadataAction = refreshConversationsMissingMetadataAction
}

/// Perform a search request.
///
/// Returns a SearchTask which should be retained until the results arrive.
public func perform(_ request: SearchRequest) -> SearchTask {
let task = SearchTask(
task: .search(searchRequest: request),
public func createSearchTask(with request: SearchRequest) -> SearchTask {
SearchTask(
type: .search(searchRequest: request),
contextProvider: contextProvider,
transportSession: transportSession,
searchUsersCache: searchUsersCache,
apiVersion: apiVersion
)

task.addResultHandler { [weak self] result, _ in
self?.observeSearchUsers(result)
}

return task
}

/// Lookup a user by user Id and domain (qualifiedID), returns a search user in the directory results. If the user
/// doesn't exists
/// an empty directory result is returned.
///
/// Returns a SearchTask which should be retained until the results arrive.
public func lookup(qualifiedID: QualifiedID) -> SearchTask {
let task = SearchTask(
task: .lookup(qualifiedID: qualifiedID),
public func createLookupTask(with qualifiedID: QualifiedID) -> SearchTask {
SearchTask(
type: .lookup(qualifiedID: qualifiedID),
contextProvider: contextProvider,
transportSession: transportSession,
searchUsersCache: searchUsersCache,
apiVersion: apiVersion
)

task.addResultHandler { [weak self] result, _ in
self?.observeSearchUsers(result)
}

return task
}

func observeSearchUsers(_ result: SearchResult) {
let searchUserObserverCenter = contextProvider.viewContext.searchUserObserverCenter
result.directory.forEach(searchUserObserverCenter.addSearchUser)
result.services.compactMap { $0 as? ZMSearchUser }.forEach(searchUserObserverCenter.addSearchUser)
}

public func updateIncompleteMetadataIfNeeded() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import Foundation
import WireDataModel

public struct SearchOptions: OptionSet {

public let rawValue: Int

/// Users you are connected to via connection request.
Expand Down Expand Up @@ -66,6 +66,7 @@ public struct SearchOptions: OptionSet {
}

public extension SearchOptions {

mutating func updateForSelfUserTeamRole(selfUser: UserType) {
if selfUser.teamRole == .partner {
insert(.excludeNonActiveTeamMembers)
Expand All @@ -74,6 +75,7 @@ public extension SearchOptions {
insert(.excludeNonActivePartners)
}
}

}

public struct SearchRequest {
Expand Down Expand Up @@ -169,4 +171,5 @@ private extension String {
guard let normalized = self.normalizedForSearch() as String? else { return "" }
return normalized.trimmingCharacters(in: .whitespaces)
}

}
22 changes: 22 additions & 0 deletions wire-ios-sync-engine/Source/UserSession/Search/SearchResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ public struct SearchResult {

extension SearchResult {

init() {
self.context = .init(concurrencyType: .privateQueueConcurrencyType)
self.contacts = []
self.teamMembers = []
self.directory = []
self.conversations = []
self.services = []
self.searchUsersCache = nil
}

public init?(
payload: [AnyHashable: Any],
query: SearchRequest.Query,
Expand Down Expand Up @@ -223,4 +233,16 @@ extension SearchResult {
)
}

func union(prependingDirectory result: SearchResult) -> SearchResult {
SearchResult(
context: context,
contacts: contacts,
teamMembers: teamMembers,
directory: result.directory + directory,
conversations: conversations,
services: services,
searchUsersCache: searchUsersCache
)
}

}
Loading
Loading