Skip to content

Commit 27a877d

Browse files
committed
Bump the SDK to v25.06.13 and add thread support to the ComposerDraftService
1 parent f0d3e85 commit 27a877d

File tree

10 files changed

+238
-141
lines changed

10 files changed

+238
-141
lines changed

ElementX.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8736,7 +8736,7 @@
87368736
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
87378737
requirement = {
87388738
kind = exactVersion;
8739-
version = "25.06.12-2";
8739+
version = 25.06.13;
87408740
};
87418741
};
87428742
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {

ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
500500

501501
let completionSuggestionService = CompletionSuggestionService(roomProxy: roomProxy,
502502
roomListPublisher: userSession.clientProxy.staticRoomSummaryProvider.roomListPublisher.eraseToAnyPublisher())
503-
let composerDraftService = ComposerDraftService(roomProxy: roomProxy, timelineItemfactory: timelineItemFactory)
503+
let composerDraftService = ComposerDraftService(roomProxy: roomProxy,
504+
timelineItemfactory: timelineItemFactory,
505+
threadRootEventID: nil)
504506

505507
let parameters = RoomScreenCoordinatorParameters(clientProxy: userSession.clientProxy,
506508
roomProxy: roomProxy,
@@ -581,11 +583,11 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
581583
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
582584
stateEventStringBuilder: RoomStateEventStringBuilder(userID: userSession.clientProxy.userID))
583585

584-
guard let eventID = itemID.eventID else {
586+
guard let threadRootEventID = itemID.eventID else {
585587
fatalError("Invalid thread event ID")
586588
}
587589

588-
guard case let .success(timelineController) = await timelineControllerFactory.buildThreadTimelineController(eventID: eventID,
590+
guard case let .success(timelineController) = await timelineControllerFactory.buildThreadTimelineController(eventID: threadRootEventID,
589591
roomProxy: roomProxy,
590592
timelineItemFactory: timelineItemFactory,
591593
mediaProvider: userSession.mediaProvider) else {
@@ -595,7 +597,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
595597

596598
let completionSuggestionService = CompletionSuggestionService(roomProxy: roomProxy,
597599
roomListPublisher: userSession.clientProxy.staticRoomSummaryProvider.roomListPublisher.eraseToAnyPublisher())
598-
let composerDraftService = ComposerDraftService(roomProxy: roomProxy, timelineItemfactory: timelineItemFactory)
600+
let composerDraftService = ComposerDraftService(roomProxy: roomProxy,
601+
timelineItemfactory: timelineItemFactory,
602+
threadRootEventID: threadRootEventID)
599603

600604
let coordinator = ThreadTimelineScreenCoordinator(parameters: .init(clientProxy: userSession.clientProxy,
601605
roomProxy: roomProxy,

ElementX/Sources/Mocks/Generated/GeneratedMocks.swift

Lines changed: 76 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -10121,200 +10121,212 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable {
1012110121
}
1012210122
//MARK: - saveDraft
1012310123

10124-
var saveDraftUnderlyingCallsCount = 0
10125-
var saveDraftCallsCount: Int {
10124+
var saveDraftThreadRootEventIDUnderlyingCallsCount = 0
10125+
var saveDraftThreadRootEventIDCallsCount: Int {
1012610126
get {
1012710127
if Thread.isMainThread {
10128-
return saveDraftUnderlyingCallsCount
10128+
return saveDraftThreadRootEventIDUnderlyingCallsCount
1012910129
} else {
1013010130
var returnValue: Int? = nil
1013110131
DispatchQueue.main.sync {
10132-
returnValue = saveDraftUnderlyingCallsCount
10132+
returnValue = saveDraftThreadRootEventIDUnderlyingCallsCount
1013310133
}
1013410134

1013510135
return returnValue!
1013610136
}
1013710137
}
1013810138
set {
1013910139
if Thread.isMainThread {
10140-
saveDraftUnderlyingCallsCount = newValue
10140+
saveDraftThreadRootEventIDUnderlyingCallsCount = newValue
1014110141
} else {
1014210142
DispatchQueue.main.sync {
10143-
saveDraftUnderlyingCallsCount = newValue
10143+
saveDraftThreadRootEventIDUnderlyingCallsCount = newValue
1014410144
}
1014510145
}
1014610146
}
1014710147
}
10148-
var saveDraftCalled: Bool {
10149-
return saveDraftCallsCount > 0
10148+
var saveDraftThreadRootEventIDCalled: Bool {
10149+
return saveDraftThreadRootEventIDCallsCount > 0
1015010150
}
10151-
var saveDraftReceivedDraft: ComposerDraft?
10152-
var saveDraftReceivedInvocations: [ComposerDraft] = []
10151+
var saveDraftThreadRootEventIDReceivedArguments: (draft: ComposerDraft, threadRootEventID: String?)?
10152+
var saveDraftThreadRootEventIDReceivedInvocations: [(draft: ComposerDraft, threadRootEventID: String?)] = []
1015310153

10154-
var saveDraftUnderlyingReturnValue: Result<Void, RoomProxyError>!
10155-
var saveDraftReturnValue: Result<Void, RoomProxyError>! {
10154+
var saveDraftThreadRootEventIDUnderlyingReturnValue: Result<Void, RoomProxyError>!
10155+
var saveDraftThreadRootEventIDReturnValue: Result<Void, RoomProxyError>! {
1015610156
get {
1015710157
if Thread.isMainThread {
10158-
return saveDraftUnderlyingReturnValue
10158+
return saveDraftThreadRootEventIDUnderlyingReturnValue
1015910159
} else {
1016010160
var returnValue: Result<Void, RoomProxyError>? = nil
1016110161
DispatchQueue.main.sync {
10162-
returnValue = saveDraftUnderlyingReturnValue
10162+
returnValue = saveDraftThreadRootEventIDUnderlyingReturnValue
1016310163
}
1016410164

1016510165
return returnValue!
1016610166
}
1016710167
}
1016810168
set {
1016910169
if Thread.isMainThread {
10170-
saveDraftUnderlyingReturnValue = newValue
10170+
saveDraftThreadRootEventIDUnderlyingReturnValue = newValue
1017110171
} else {
1017210172
DispatchQueue.main.sync {
10173-
saveDraftUnderlyingReturnValue = newValue
10173+
saveDraftThreadRootEventIDUnderlyingReturnValue = newValue
1017410174
}
1017510175
}
1017610176
}
1017710177
}
10178-
var saveDraftClosure: ((ComposerDraft) async -> Result<Void, RoomProxyError>)?
10178+
var saveDraftThreadRootEventIDClosure: ((ComposerDraft, String?) async -> Result<Void, RoomProxyError>)?
1017910179

10180-
func saveDraft(_ draft: ComposerDraft) async -> Result<Void, RoomProxyError> {
10181-
saveDraftCallsCount += 1
10182-
saveDraftReceivedDraft = draft
10180+
func saveDraft(_ draft: ComposerDraft, threadRootEventID: String?) async -> Result<Void, RoomProxyError> {
10181+
saveDraftThreadRootEventIDCallsCount += 1
10182+
saveDraftThreadRootEventIDReceivedArguments = (draft: draft, threadRootEventID: threadRootEventID)
1018310183
DispatchQueue.main.async {
10184-
self.saveDraftReceivedInvocations.append(draft)
10184+
self.saveDraftThreadRootEventIDReceivedInvocations.append((draft: draft, threadRootEventID: threadRootEventID))
1018510185
}
10186-
if let saveDraftClosure = saveDraftClosure {
10187-
return await saveDraftClosure(draft)
10186+
if let saveDraftThreadRootEventIDClosure = saveDraftThreadRootEventIDClosure {
10187+
return await saveDraftThreadRootEventIDClosure(draft, threadRootEventID)
1018810188
} else {
10189-
return saveDraftReturnValue
10189+
return saveDraftThreadRootEventIDReturnValue
1019010190
}
1019110191
}
1019210192
//MARK: - loadDraft
1019310193

10194-
var loadDraftUnderlyingCallsCount = 0
10195-
var loadDraftCallsCount: Int {
10194+
var loadDraftThreadRootEventIDUnderlyingCallsCount = 0
10195+
var loadDraftThreadRootEventIDCallsCount: Int {
1019610196
get {
1019710197
if Thread.isMainThread {
10198-
return loadDraftUnderlyingCallsCount
10198+
return loadDraftThreadRootEventIDUnderlyingCallsCount
1019910199
} else {
1020010200
var returnValue: Int? = nil
1020110201
DispatchQueue.main.sync {
10202-
returnValue = loadDraftUnderlyingCallsCount
10202+
returnValue = loadDraftThreadRootEventIDUnderlyingCallsCount
1020310203
}
1020410204

1020510205
return returnValue!
1020610206
}
1020710207
}
1020810208
set {
1020910209
if Thread.isMainThread {
10210-
loadDraftUnderlyingCallsCount = newValue
10210+
loadDraftThreadRootEventIDUnderlyingCallsCount = newValue
1021110211
} else {
1021210212
DispatchQueue.main.sync {
10213-
loadDraftUnderlyingCallsCount = newValue
10213+
loadDraftThreadRootEventIDUnderlyingCallsCount = newValue
1021410214
}
1021510215
}
1021610216
}
1021710217
}
10218-
var loadDraftCalled: Bool {
10219-
return loadDraftCallsCount > 0
10218+
var loadDraftThreadRootEventIDCalled: Bool {
10219+
return loadDraftThreadRootEventIDCallsCount > 0
1022010220
}
10221+
var loadDraftThreadRootEventIDReceivedThreadRootEventID: String?
10222+
var loadDraftThreadRootEventIDReceivedInvocations: [String?] = []
1022110223

10222-
var loadDraftUnderlyingReturnValue: Result<ComposerDraft?, RoomProxyError>!
10223-
var loadDraftReturnValue: Result<ComposerDraft?, RoomProxyError>! {
10224+
var loadDraftThreadRootEventIDUnderlyingReturnValue: Result<ComposerDraft?, RoomProxyError>!
10225+
var loadDraftThreadRootEventIDReturnValue: Result<ComposerDraft?, RoomProxyError>! {
1022410226
get {
1022510227
if Thread.isMainThread {
10226-
return loadDraftUnderlyingReturnValue
10228+
return loadDraftThreadRootEventIDUnderlyingReturnValue
1022710229
} else {
1022810230
var returnValue: Result<ComposerDraft?, RoomProxyError>? = nil
1022910231
DispatchQueue.main.sync {
10230-
returnValue = loadDraftUnderlyingReturnValue
10232+
returnValue = loadDraftThreadRootEventIDUnderlyingReturnValue
1023110233
}
1023210234

1023310235
return returnValue!
1023410236
}
1023510237
}
1023610238
set {
1023710239
if Thread.isMainThread {
10238-
loadDraftUnderlyingReturnValue = newValue
10240+
loadDraftThreadRootEventIDUnderlyingReturnValue = newValue
1023910241
} else {
1024010242
DispatchQueue.main.sync {
10241-
loadDraftUnderlyingReturnValue = newValue
10243+
loadDraftThreadRootEventIDUnderlyingReturnValue = newValue
1024210244
}
1024310245
}
1024410246
}
1024510247
}
10246-
var loadDraftClosure: (() async -> Result<ComposerDraft?, RoomProxyError>)?
10248+
var loadDraftThreadRootEventIDClosure: ((String?) async -> Result<ComposerDraft?, RoomProxyError>)?
1024710249

10248-
func loadDraft() async -> Result<ComposerDraft?, RoomProxyError> {
10249-
loadDraftCallsCount += 1
10250-
if let loadDraftClosure = loadDraftClosure {
10251-
return await loadDraftClosure()
10250+
func loadDraft(threadRootEventID: String?) async -> Result<ComposerDraft?, RoomProxyError> {
10251+
loadDraftThreadRootEventIDCallsCount += 1
10252+
loadDraftThreadRootEventIDReceivedThreadRootEventID = threadRootEventID
10253+
DispatchQueue.main.async {
10254+
self.loadDraftThreadRootEventIDReceivedInvocations.append(threadRootEventID)
10255+
}
10256+
if let loadDraftThreadRootEventIDClosure = loadDraftThreadRootEventIDClosure {
10257+
return await loadDraftThreadRootEventIDClosure(threadRootEventID)
1025210258
} else {
10253-
return loadDraftReturnValue
10259+
return loadDraftThreadRootEventIDReturnValue
1025410260
}
1025510261
}
1025610262
//MARK: - clearDraft
1025710263

10258-
var clearDraftUnderlyingCallsCount = 0
10259-
var clearDraftCallsCount: Int {
10264+
var clearDraftThreadRootEventIDUnderlyingCallsCount = 0
10265+
var clearDraftThreadRootEventIDCallsCount: Int {
1026010266
get {
1026110267
if Thread.isMainThread {
10262-
return clearDraftUnderlyingCallsCount
10268+
return clearDraftThreadRootEventIDUnderlyingCallsCount
1026310269
} else {
1026410270
var returnValue: Int? = nil
1026510271
DispatchQueue.main.sync {
10266-
returnValue = clearDraftUnderlyingCallsCount
10272+
returnValue = clearDraftThreadRootEventIDUnderlyingCallsCount
1026710273
}
1026810274

1026910275
return returnValue!
1027010276
}
1027110277
}
1027210278
set {
1027310279
if Thread.isMainThread {
10274-
clearDraftUnderlyingCallsCount = newValue
10280+
clearDraftThreadRootEventIDUnderlyingCallsCount = newValue
1027510281
} else {
1027610282
DispatchQueue.main.sync {
10277-
clearDraftUnderlyingCallsCount = newValue
10283+
clearDraftThreadRootEventIDUnderlyingCallsCount = newValue
1027810284
}
1027910285
}
1028010286
}
1028110287
}
10282-
var clearDraftCalled: Bool {
10283-
return clearDraftCallsCount > 0
10288+
var clearDraftThreadRootEventIDCalled: Bool {
10289+
return clearDraftThreadRootEventIDCallsCount > 0
1028410290
}
10291+
var clearDraftThreadRootEventIDReceivedThreadRootEventID: String?
10292+
var clearDraftThreadRootEventIDReceivedInvocations: [String?] = []
1028510293

10286-
var clearDraftUnderlyingReturnValue: Result<Void, RoomProxyError>!
10287-
var clearDraftReturnValue: Result<Void, RoomProxyError>! {
10294+
var clearDraftThreadRootEventIDUnderlyingReturnValue: Result<Void, RoomProxyError>!
10295+
var clearDraftThreadRootEventIDReturnValue: Result<Void, RoomProxyError>! {
1028810296
get {
1028910297
if Thread.isMainThread {
10290-
return clearDraftUnderlyingReturnValue
10298+
return clearDraftThreadRootEventIDUnderlyingReturnValue
1029110299
} else {
1029210300
var returnValue: Result<Void, RoomProxyError>? = nil
1029310301
DispatchQueue.main.sync {
10294-
returnValue = clearDraftUnderlyingReturnValue
10302+
returnValue = clearDraftThreadRootEventIDUnderlyingReturnValue
1029510303
}
1029610304

1029710305
return returnValue!
1029810306
}
1029910307
}
1030010308
set {
1030110309
if Thread.isMainThread {
10302-
clearDraftUnderlyingReturnValue = newValue
10310+
clearDraftThreadRootEventIDUnderlyingReturnValue = newValue
1030310311
} else {
1030410312
DispatchQueue.main.sync {
10305-
clearDraftUnderlyingReturnValue = newValue
10313+
clearDraftThreadRootEventIDUnderlyingReturnValue = newValue
1030610314
}
1030710315
}
1030810316
}
1030910317
}
10310-
var clearDraftClosure: (() async -> Result<Void, RoomProxyError>)?
10318+
var clearDraftThreadRootEventIDClosure: ((String?) async -> Result<Void, RoomProxyError>)?
1031110319

10312-
func clearDraft() async -> Result<Void, RoomProxyError> {
10313-
clearDraftCallsCount += 1
10314-
if let clearDraftClosure = clearDraftClosure {
10315-
return await clearDraftClosure()
10320+
func clearDraft(threadRootEventID: String?) async -> Result<Void, RoomProxyError> {
10321+
clearDraftThreadRootEventIDCallsCount += 1
10322+
clearDraftThreadRootEventIDReceivedThreadRootEventID = threadRootEventID
10323+
DispatchQueue.main.async {
10324+
self.clearDraftThreadRootEventIDReceivedInvocations.append(threadRootEventID)
10325+
}
10326+
if let clearDraftThreadRootEventIDClosure = clearDraftThreadRootEventIDClosure {
10327+
return await clearDraftThreadRootEventIDClosure(threadRootEventID)
1031610328
} else {
10317-
return clearDraftReturnValue
10329+
return clearDraftThreadRootEventIDReturnValue
1031810330
}
1031910331
}
1032010332
}

0 commit comments

Comments
 (0)