Skip to content

Commit 7294108

Browse files
committed
updated naming and loading strings
1 parent 937de60 commit 7294108

11 files changed

+3045
-3045
lines changed

ElementX/Sources/Mocks/Generated/GeneratedMocks.swift

+2,771-2,771
Large diffs are not rendered by default.

ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift

+210-210
Large diffs are not rendered by default.

ElementX/Sources/Mocks/JoinedRoomProxyMock.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct JoinedRoomProxyMockConfiguration {
3030
var timelineStartReached = false
3131

3232
var members: [RoomMemberProxyMock] = .allMembers
33-
var knockRequests: [RequestToJoinProxyMock] = []
33+
var knockRequests: [JoinRequestProxyMock] = []
3434
var ownUserID = RoomMemberProxyMock.mockMe.userID
3535
var inviter: RoomMemberProxyProtocol?
3636

@@ -58,7 +58,7 @@ extension JoinedRoomProxyMock {
5858

5959
infoPublisher = CurrentValueSubject(.init(roomInfo: .init(configuration))).asCurrentValuePublisher()
6060
membersPublisher = CurrentValueSubject(configuration.members).asCurrentValuePublisher()
61-
requestsToJoinPublisher = CurrentValueSubject(configuration.knockRequests).asCurrentValuePublisher()
61+
joinRequestsPublisher = CurrentValueSubject(configuration.knockRequests).asCurrentValuePublisher()
6262
typingMembersPublisher = CurrentValueSubject([]).asCurrentValuePublisher()
6363
identityStatusChangesPublisher = CurrentValueSubject([]).asCurrentValuePublisher()
6464

ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenViewModel.swift

+15-15
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
4848
case .acceptRequest(let eventID):
4949
acceptRequest(eventID: eventID)
5050
case .declineRequest(let eventID):
51-
guard let request = roomProxy.requestsToJoinPublisher.value.first(where: { $0.eventID == eventID }) else {
51+
guard let request = roomProxy.joinRequestsPublisher.value.first(where: { $0.eventID == eventID }) else {
5252
return
5353
}
5454
state.bindings.alertInfo = .init(id: .declineRequest,
@@ -59,7 +59,7 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
5959
action: { [weak self] in self?.decline(request: request) }),
6060
secondaryButton: .init(title: L10n.actionCancel, role: .cancel, action: nil))
6161
case .ban(let eventID):
62-
guard let request = roomProxy.requestsToJoinPublisher.value.first(where: { $0.eventID == eventID }) else {
62+
guard let request = roomProxy.joinRequestsPublisher.value.first(where: { $0.eventID == eventID }) else {
6363
return
6464
}
6565
state.bindings.alertInfo = .init(id: .declineAndBan,
@@ -74,11 +74,11 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
7474
// MARK: - Private
7575

7676
private func acceptRequest(eventID: String) {
77-
guard let request = roomProxy.requestsToJoinPublisher.value.first(where: { $0.eventID == eventID }) else {
77+
guard let request = roomProxy.joinRequestsPublisher.value.first(where: { $0.eventID == eventID }) else {
7878
return
7979
}
8080

81-
showLoadingIndicator()
81+
showLoadingIndicator(title: L10n.screenKnockRequestsListAcceptLoadingTitle)
8282
defer { hideLoadingIndicator() }
8383

8484
state.handledEventIDs.insert(eventID)
@@ -94,8 +94,8 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
9494
}
9595
}
9696

97-
private func decline(request: RequestToJoinProxyProtocol) {
98-
showLoadingIndicator()
97+
private func decline(request: JoinRequestProxyProtocol) {
98+
showLoadingIndicator(title: L10n.screenKnockRequestsListDeclineLoadingTitle)
9999
defer { hideLoadingIndicator() }
100100

101101
let eventID = request.eventID
@@ -112,8 +112,8 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
112112
}
113113
}
114114

115-
private func declineAndBan(request: RequestToJoinProxyProtocol) {
116-
showLoadingIndicator()
115+
private func declineAndBan(request: JoinRequestProxyProtocol) {
116+
showLoadingIndicator(title: L10n.screenKnockRequestsListBanLoadingTitle)
117117
defer { hideLoadingIndicator() }
118118

119119
let eventID = request.eventID
@@ -131,13 +131,13 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
131131
}
132132

133133
private func acceptAll() {
134-
showLoadingIndicator()
134+
showLoadingIndicator(title: L10n.screenKnockRequestsListAcceptAllLoadingTitle)
135135
defer { hideLoadingIndicator() }
136136

137-
let requests = roomProxy.requestsToJoinPublisher.value
137+
let requests = roomProxy.joinRequestsPublisher.value
138138
state.handledEventIDs.formUnion(Set(requests.map(\.eventID)))
139139
Task {
140-
let failedIDs = await withTaskGroup(of: (String, Result<Void, RequestToJoinProxyError>).self) { group in
140+
let failedIDs = await withTaskGroup(of: (String, Result<Void, JoinRequestProxyError>).self) { group in
141141
for request in requests {
142142
group.addTask {
143143
await (request.eventID, request.accept())
@@ -164,7 +164,7 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
164164
}
165165
.store(in: &cancellables)
166166

167-
roomProxy.requestsToJoinPublisher
167+
roomProxy.joinRequestsPublisher
168168
.map { $0.map(KnockRequestCellInfo.init) }
169169
.removeDuplicates()
170170
.throttle(for: .milliseconds(100), scheduler: DispatchQueue.main, latest: true)
@@ -189,12 +189,12 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
189189

190190
private static let loadingIndicatorIdentifier = "\(KnockRequestsListScreenViewModel.self)-Loading"
191191

192-
private func showLoadingIndicator() {
192+
private func showLoadingIndicator(title: String) {
193193
userIndicatorController.submitIndicator(UserIndicator(id: Self.loadingIndicatorIdentifier,
194194
type: .modal(progress: .indeterminate,
195195
interactiveDismissDisabled: false,
196196
allowsInteraction: false),
197-
title: L10n.commonLoading,
197+
title: title,
198198
persistent: true),
199199
delay: .seconds(0.25))
200200
}
@@ -218,7 +218,7 @@ extension KnockRequestsListScreenViewModel {
218218
}
219219

220220
extension KnockRequestCellInfo {
221-
init(from proxy: RequestToJoinProxyProtocol) {
221+
init(from proxy: JoinRequestProxyProtocol) {
222222
self.init(eventID: proxy.eventID,
223223
userID: proxy.userID,
224224
displayName: proxy.displayName,

ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
186186
}
187187
.store(in: &cancellables)
188188

189-
roomProxy.requestsToJoinPublisher
189+
roomProxy.joinRequestsPublisher
190190
.map(\.count)
191191
.removeDuplicates()
192192
.throttle(for: .milliseconds(100), scheduler: DispatchQueue.main, latest: true)

ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ struct RoomDetailsScreen: View {
315315
struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
316316
static let genericRoomViewModel = {
317317
ServiceLocator.shared.settings.knockingEnabled = true
318-
let knockRequests: [RequestToJoinProxyMock] = [.init()]
318+
let knockRequests: [JoinRequestProxyMock] = [.init()]
319319
let members: [RoomMemberProxyMock] = [
320320
.mockMeAdmin,
321321
.mockAlice,
@@ -381,7 +381,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
381381
}()
382382

383383
static let simpleRoomViewModel = {
384-
let knockRequests: [RequestToJoinProxyMock] = [.init()]
384+
let knockRequests: [JoinRequestProxyMock] = [.init()]
385385
ServiceLocator.shared.settings.knockingEnabled = true
386386
let members: [RoomMemberProxyMock] = [
387387
.mockMeAdmin,

ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
180180
}
181181
.store(in: &cancellables)
182182

183-
roomProxy.requestsToJoinPublisher
183+
roomProxy.joinRequestsPublisher
184184
// We only care about unseen requests
185185
.map { $0.filter { !$0.isSeen }.map(KnockRequestInfo.init) }
186186
// If the requests have the same event ids we can discard the output
@@ -286,7 +286,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
286286
}
287287

288288
private func acceptKnock(eventID: String) async {
289-
guard let knockRequest = roomProxy.requestsToJoinPublisher.value.first(where: { $0.eventID == eventID }) else {
289+
guard let knockRequest = roomProxy.joinRequestsPublisher.value.first(where: { $0.eventID == eventID }) else {
290290
return
291291
}
292292

@@ -301,9 +301,9 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
301301
}
302302

303303
private func markAllKnocksAsSeen() async {
304-
let requests = roomProxy.requestsToJoinPublisher.value
304+
let requests = roomProxy.joinRequestsPublisher.value
305305
state.handledEventIDs.formUnion(Set(requests.map(\.eventID)))
306-
let failedIDs = await withTaskGroup(of: (String, Result<Void, RequestToJoinProxyError>).self) { group in
306+
let failedIDs = await withTaskGroup(of: (String, Result<Void, JoinRequestProxyError>).self) { group in
307307
for request in requests {
308308
group.addTask {
309309
await (request.eventID, request.markAsSeen())
@@ -348,7 +348,7 @@ extension RoomScreenViewModel {
348348
}
349349

350350
private extension KnockRequestInfo {
351-
init(from proxy: RequestToJoinProxyProtocol) {
351+
init(from proxy: JoinRequestProxyProtocol) {
352352
self.init(displayName: proxy.displayName,
353353
avatarURL: proxy.avatarURL,
354354
userID: proxy.userID,

ElementX/Sources/Services/Room/RequestToJoinProxy.swift ElementX/Sources/Services/Room/JoinRequestProxy.swift

+19-19
Original file line numberDiff line numberDiff line change
@@ -8,79 +8,79 @@
88
import Foundation
99
import MatrixRustSDK
1010

11-
struct RequestToJoinProxy: RequestToJoinProxyProtocol {
12-
private let requestToJoin: RequestToJoin
11+
struct JoinRequestProxy: JoinRequestProxyProtocol {
12+
private let joinRequest: JoinRequest
1313

14-
init(requestToJoin: RequestToJoin) {
15-
self.requestToJoin = requestToJoin
14+
init(joinRequest: JoinRequest) {
15+
self.joinRequest = joinRequest
1616
}
1717

1818
var eventID: String {
19-
requestToJoin.eventId
19+
joinRequest.eventId
2020
}
2121

2222
var userID: String {
23-
requestToJoin.userId
23+
joinRequest.userId
2424
}
2525

2626
var displayName: String? {
27-
requestToJoin.displayName
27+
joinRequest.displayName
2828
}
2929

3030
var avatarURL: URL? {
31-
requestToJoin.avatarUrl.flatMap(URL.init)
31+
joinRequest.avatarUrl.flatMap(URL.init)
3232
}
3333

3434
var reason: String? {
35-
requestToJoin.reason
35+
joinRequest.reason
3636
}
3737

3838
var formattedTimestamp: String? {
39-
guard let timestamp = requestToJoin.timestamp else {
39+
guard let timestamp = joinRequest.timestamp else {
4040
return nil
4141
}
4242
return Date(timeIntervalSince1970: TimeInterval(timestamp / 1000)).formattedMinimal()
4343
}
4444

4545
var isSeen: Bool {
46-
requestToJoin.isSeen
46+
joinRequest.isSeen
4747
}
4848

49-
func accept() async -> Result<Void, RequestToJoinProxyError> {
49+
func accept() async -> Result<Void, JoinRequestProxyError> {
5050
do {
51-
try await requestToJoin.actions.accept()
51+
try await joinRequest.actions.accept()
5252
return .success(())
5353
} catch {
5454
MXLog.error("Failed accepting request with eventID: \(eventID) to join error: \(error)")
5555
return .failure(.sdkError(error))
5656
}
5757
}
5858

59-
func decline() async -> Result<Void, RequestToJoinProxyError> {
59+
func decline() async -> Result<Void, JoinRequestProxyError> {
6060
do {
6161
// As of right now we don't provide reasons in the app for declining
62-
try await requestToJoin.actions.decline(reason: nil)
62+
try await joinRequest.actions.decline(reason: nil)
6363
return .success(())
6464
} catch {
6565
MXLog.error("Failed declining request with eventID: \(eventID) to join error: \(error)")
6666
return .failure(.sdkError(error))
6767
}
6868
}
6969

70-
func ban() async -> Result<Void, RequestToJoinProxyError> {
70+
func ban() async -> Result<Void, JoinRequestProxyError> {
7171
do {
7272
// As of right now we don't provide reasons in the app for declining and banning
73-
try await requestToJoin.actions.declineAndBan(reason: nil)
73+
try await joinRequest.actions.declineAndBan(reason: nil)
7474
return .success(())
7575
} catch {
7676
MXLog.error("Failed declining and banning user for request with eventID: \(eventID) with error: \(error)")
7777
return .failure(.sdkError(error))
7878
}
7979
}
8080

81-
func markAsSeen() async -> Result<Void, RequestToJoinProxyError> {
81+
func markAsSeen() async -> Result<Void, JoinRequestProxyError> {
8282
do {
83-
try await requestToJoin.actions.markAsSeen()
83+
try await joinRequest.actions.markAsSeen()
8484
return .success(())
8585
} catch {
8686
MXLog.error("Failed marking request with eventID: \(eventID) to join as seen error: \(error)")

ElementX/Sources/Services/Room/RequestToJoinProxyProtocol.swift ElementX/Sources/Services/Room/JoinRequestProxyProtocol.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
import Foundation
99

10-
enum RequestToJoinProxyError: Error {
10+
enum JoinRequestProxyError: Error {
1111
case sdkError(Error)
1212
}
1313

1414
// sourcery: AutoMockable
15-
protocol RequestToJoinProxyProtocol {
15+
protocol JoinRequestProxyProtocol {
1616
var eventID: String { get }
1717
var userID: String { get }
1818
var displayName: String? { get }
@@ -21,8 +21,8 @@ protocol RequestToJoinProxyProtocol {
2121
var formattedTimestamp: String? { get }
2222
var isSeen: Bool { get }
2323

24-
func accept() async -> Result<Void, RequestToJoinProxyError>
25-
func decline() async -> Result<Void, RequestToJoinProxyError>
26-
func ban() async -> Result<Void, RequestToJoinProxyError>
27-
func markAsSeen() async -> Result<Void, RequestToJoinProxyError>
24+
func accept() async -> Result<Void, JoinRequestProxyError>
25+
func decline() async -> Result<Void, JoinRequestProxyError>
26+
func ban() async -> Result<Void, JoinRequestProxyError>
27+
func markAsSeen() async -> Result<Void, JoinRequestProxyError>
2828
}

ElementX/Sources/Services/Room/JoinedRoomProxy.swift

+13-13
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
6161
// periphery:ignore - required for instance retention in the rust codebase
6262
private var identityStatusChangesObservationToken: TaskHandle?
6363
// periphery:ignore - required for instance retention in the rust codebase
64-
private var requestsToJoinChangesObservationToken: TaskHandle?
64+
private var joinRequestsChangesObservationToken: TaskHandle?
6565

6666
private var subscribedForUpdates = false
6767

@@ -85,9 +85,9 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
8585
identityStatusChangesSubject.asCurrentValuePublisher()
8686
}
8787

88-
private let requestsToJoinSubject = CurrentValueSubject<[RequestToJoinProxyProtocol], Never>([])
89-
var requestsToJoinPublisher: CurrentValuePublisher<[RequestToJoinProxyProtocol], Never> {
90-
requestsToJoinSubject.asCurrentValuePublisher()
88+
private let joinRequestsSubject = CurrentValueSubject<[JoinRequestProxyProtocol], Never>([])
89+
var joinRequestsPublisher: CurrentValuePublisher<[JoinRequestProxyProtocol], Never> {
90+
joinRequestsSubject.asCurrentValuePublisher()
9191
}
9292

9393
// A room identifier is constant and lazy stops it from being fetched
@@ -139,7 +139,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
139139

140140
subscribeToTypingNotifications()
141141

142-
await subscribeToRequestsToJoin()
142+
await subscribeToJoinRequests()
143143
}
144144

145145
func subscribeToRoomInfoUpdates() {
@@ -655,13 +655,13 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
655655
})
656656
}
657657

658-
private func subscribeToRequestsToJoin() async {
658+
private func subscribeToJoinRequests() async {
659659
do {
660-
requestsToJoinChangesObservationToken = try await room.subscribeToRequestsToJoin(listener: RoomRequestsToJoinListener { [weak self] requests in
660+
joinRequestsChangesObservationToken = try await room.subscribeToJoinRequests(listener: RoomJoinRequestsListener { [weak self] requests in
661661
guard let self else { return }
662662

663663
MXLog.info("Received requests to join update, requests id: \(requests.map(\.eventId))")
664-
requestsToJoinSubject.send(requests.map(RequestToJoinProxy.init))
664+
joinRequestsSubject.send(requests.map(JoinRequestProxy.init))
665665
})
666666
} catch {
667667
MXLog.error("Failed observing requests to join with error: \(error)")
@@ -705,14 +705,14 @@ private final class RoomIdentityStatusChangeListener: IdentityStatusChangeListen
705705
}
706706
}
707707

708-
private final class RoomRequestsToJoinListener: RequestsToJoinListener {
709-
private let onUpdateClosure: ([RequestToJoin]) -> Void
708+
private final class RoomJoinRequestsListener: RequestsToJoinListener {
709+
private let onUpdateClosure: ([JoinRequest]) -> Void
710710

711-
init(_ onUpdateClosure: @escaping ([RequestToJoin]) -> Void) {
711+
init(_ onUpdateClosure: @escaping ([JoinRequest]) -> Void) {
712712
self.onUpdateClosure = onUpdateClosure
713713
}
714714

715-
func call(requestsToJoin: [RequestToJoin]) {
716-
onUpdateClosure(requestsToJoin)
715+
func call(joinRequests: [JoinRequest]) {
716+
onUpdateClosure(joinRequests)
717717
}
718718
}

ElementX/Sources/Services/Room/RoomProxyProtocol.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol {
6060

6161
var identityStatusChangesPublisher: CurrentValuePublisher<[IdentityStatusChange], Never> { get }
6262

63-
var requestsToJoinPublisher: CurrentValuePublisher<[RequestToJoinProxyProtocol], Never> { get }
63+
var joinRequestsPublisher: CurrentValuePublisher<[JoinRequestProxyProtocol], Never> { get }
6464

6565
var timeline: TimelineProxyProtocol { get }
6666

0 commit comments

Comments
 (0)