mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Configured and applied SwiftFormat
This commit is contained in:
committed by
Stefan Ceriu
parent
ff2e6ddfa7
commit
43c28d23b7
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
struct RoomMembersProviderMember {
|
||||
var userId: String
|
||||
@@ -34,7 +34,6 @@ struct UserSuggestionServiceItem: UserSuggestionItemProtocol {
|
||||
}
|
||||
|
||||
class UserSuggestionService: UserSuggestionServiceProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -58,7 +57,7 @@ class UserSuggestionService: UserSuggestionServiceProtocol {
|
||||
init(roomMemberProvider: RoomMembersProviderProtocol, shouldDebounce: Bool = true) {
|
||||
self.roomMemberProvider = roomMemberProvider
|
||||
|
||||
if (shouldDebounce) {
|
||||
if shouldDebounce {
|
||||
currentTextTriggerSubject
|
||||
.debounce(for: 0.5, scheduler: RunLoop.main)
|
||||
.removeDuplicates()
|
||||
@@ -79,12 +78,12 @@ class UserSuggestionService: UserSuggestionServiceProtocol {
|
||||
let lastComponent = textMessage.components(separatedBy: .whitespaces).last,
|
||||
lastComponent.prefix(while: { $0 == "@" }).count == 1 // Partial username should start with one and only one "@" character
|
||||
else {
|
||||
self.items.send([])
|
||||
self.currentTextTriggerSubject.send(nil)
|
||||
items.send([])
|
||||
currentTextTriggerSubject.send(nil)
|
||||
return
|
||||
}
|
||||
|
||||
self.currentTextTriggerSubject.send(lastComponent)
|
||||
currentTextTriggerSubject.send(lastComponent)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
@@ -105,12 +104,12 @@ class UserSuggestionService: UserSuggestionServiceProtocol {
|
||||
UserSuggestionServiceItem(userId: member.userId, displayName: member.displayName, avatarUrl: member.avatarUrl)
|
||||
}
|
||||
|
||||
self.items.send(self.suggestionItems.filter({ userSuggestion in
|
||||
self.items.send(self.suggestionItems.filter { userSuggestion in
|
||||
let containedInUsername = userSuggestion.userId.lowercased().contains(partialName.lowercased())
|
||||
let containedInDisplayName = (userSuggestion.displayName ?? "").lowercased().contains(partialName.lowercased())
|
||||
|
||||
return (containedInUsername || containedInDisplayName)
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
protocol UserSuggestionItemProtocol: Avatarable {
|
||||
var userId: String { get }
|
||||
@@ -24,7 +24,6 @@ protocol UserSuggestionItemProtocol: Avatarable {
|
||||
}
|
||||
|
||||
protocol UserSuggestionServiceProtocol {
|
||||
|
||||
var items: CurrentValueSubject<[UserSuggestionItemProtocol], Never> { get }
|
||||
|
||||
var currentTextTrigger: String? { get }
|
||||
@@ -38,6 +37,7 @@ extension UserSuggestionItemProtocol {
|
||||
var mxContentUri: String? {
|
||||
avatarUrl
|
||||
}
|
||||
|
||||
var matrixItemId: String {
|
||||
userId
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user