Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -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
}