Skip to content

Commit 8f9f8cb

Browse files
committed
Adopt the changes introduced in matrix-org/matrix-rust-sdk/pull/4159
1 parent a4ea552 commit 8f9f8cb

File tree

9 files changed

+186
-251
lines changed

9 files changed

+186
-251
lines changed

ElementX.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7822,7 +7822,7 @@
78227822
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
78237823
requirement = {
78247824
kind = exactVersion;
7825-
version = 1.0.59;
7825+
version = 1.0.60;
78267826
};
78277827
};
78287828
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/Mocks/Generated/SDKGeneratedMocks.swift

Lines changed: 138 additions & 213 deletions
Large diffs are not rendered by default.

ElementX/Sources/Services/Client/ClientProxy.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ class ClientProxy: ClientProxyProtocol {
417417

418418
func knockRoom(_ roomID: String, message: String?) async -> Result<Void, ClientProxyError> {
419419
do {
420-
// TODO: It should also include a message but the API for is not available yet
421420
let _ = try await client.knock(roomIdOrAlias: roomID)
422421
await waitForRoomToSync(roomID: roomID, timeout: .seconds(30))
423422
return .success(())
@@ -429,7 +428,6 @@ class ClientProxy: ClientProxyProtocol {
429428

430429
func knockRoomAlias(_ roomAlias: String, message: String?) async -> Result<Void, ClientProxyError> {
431430
do {
432-
// TODO: It should also include a message but the API for is not available yet
433431
let room = try await client.knock(roomIdOrAlias: roomAlias)
434432
await waitForRoomToSync(roomID: room.id(), timeout: .seconds(30))
435433
return .success(())

ElementX/Sources/Services/Client/ClientProxyProtocol.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,7 @@ enum ClientProxyError: Error {
3939
}
4040

4141
enum SlidingSyncConstants {
42-
static let defaultTimelineLimit: UInt32 = 20
4342
static let maximumVisibleRangeSize = 30
44-
static let defaultRequiredState = [
45-
RequiredState(key: "m.room.name", value: ""),
46-
RequiredState(key: "m.room.topic", value: ""),
47-
RequiredState(key: "m.room.avatar", value: ""),
48-
RequiredState(key: "m.room.canonical_alias", value: ""),
49-
RequiredState(key: "m.room.join_rules", value: ""),
50-
RequiredState(key: "m.room.pinned_events", value: "")
51-
]
5243
}
5344

5445
/// This struct represents the configuration that we are using to register the application through Pusher to Sygnal

ElementX/Sources/Services/Room/JoinedRoomProxy.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,9 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
187187
}
188188

189189
subscribedForUpdates = true
190-
let settings = RoomSubscription(requiredState: SlidingSyncConstants.defaultRequiredState,
191-
timelineLimit: SlidingSyncConstants.defaultTimelineLimit,
192-
includeHeroes: false) // We don't need heroes here as they're already included in the `all_rooms` list
190+
193191
do {
194-
try roomListService.subscribeToRooms(roomIds: [id], settings: settings)
192+
try roomListService.subscribeToRooms(roomIds: [id])
195193
} catch {
196194
MXLog.error("Failed subscribing to room with error: \(error)")
197195
}

ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
176176
guard let self else { return }
177177

178178
do {
179-
try roomListService.subscribeToRooms(roomIds: roomIDs,
180-
settings: .init(requiredState: SlidingSyncConstants.defaultRequiredState,
181-
timelineLimit: SlidingSyncConstants.defaultTimelineLimit,
182-
includeHeroes: false))
179+
try roomListService.subscribeToRooms(roomIds: roomIDs)
183180
} catch {
184181
MXLog.error("Failed subscribing to rooms with error: \(error)")
185182
}

ElementX/Sources/Services/Timeline/TimelineProxy.swift

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,14 @@ final class TimelineProxy: TimelineProxyProtocol {
227227
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
228228
MXLog.info("Sending audio")
229229

230-
let handle = timeline.sendAudio(url: url.path(percentEncoded: false), audioInfo: audioInfo, caption: nil, formattedCaption: nil, progressWatcher: UploadProgressListener { progress in
231-
progressSubject?.send(progress)
232-
})
230+
let handle = timeline.sendAudio(url: url.path(percentEncoded: false),
231+
audioInfo: audioInfo,
232+
caption: nil,
233+
formattedCaption: nil,
234+
storeInCache: true,
235+
progressWatcher: UploadProgressListener { progress in
236+
progressSubject?.send(progress)
237+
})
233238

234239
await requestHandle(handle)
235240

@@ -250,9 +255,12 @@ final class TimelineProxy: TimelineProxyProtocol {
250255
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
251256
MXLog.info("Sending file")
252257

253-
let handle = timeline.sendFile(url: url.path(percentEncoded: false), fileInfo: fileInfo, progressWatcher: UploadProgressListener { progress in
254-
progressSubject?.send(progress)
255-
})
258+
let handle = timeline.sendFile(url: url.path(percentEncoded: false),
259+
fileInfo: fileInfo,
260+
storeInCache: true,
261+
progressWatcher: UploadProgressListener { progress in
262+
progressSubject?.send(progress)
263+
})
256264

257265
await requestHandle(handle)
258266

@@ -274,9 +282,15 @@ final class TimelineProxy: TimelineProxyProtocol {
274282
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
275283
MXLog.info("Sending image")
276284

277-
let handle = timeline.sendImage(url: url.path(percentEncoded: false), thumbnailUrl: thumbnailURL.path(percentEncoded: false), imageInfo: imageInfo, caption: nil, formattedCaption: nil, progressWatcher: UploadProgressListener { progress in
278-
progressSubject?.send(progress)
279-
})
285+
let handle = timeline.sendImage(url: url.path(percentEncoded: false),
286+
thumbnailUrl: thumbnailURL.path(percentEncoded: false),
287+
imageInfo: imageInfo,
288+
caption: nil,
289+
formattedCaption: nil,
290+
storeInCache: true,
291+
progressWatcher: UploadProgressListener { progress in
292+
progressSubject?.send(progress)
293+
})
280294

281295
await requestHandle(handle)
282296

@@ -316,9 +330,15 @@ final class TimelineProxy: TimelineProxyProtocol {
316330
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
317331
MXLog.info("Sending video")
318332

319-
let handle = timeline.sendVideo(url: url.path(percentEncoded: false), thumbnailUrl: thumbnailURL.path(percentEncoded: false), videoInfo: videoInfo, caption: nil, formattedCaption: nil, progressWatcher: UploadProgressListener { progress in
320-
progressSubject?.send(progress)
321-
})
333+
let handle = timeline.sendVideo(url: url.path(percentEncoded: false),
334+
thumbnailUrl: thumbnailURL.path(percentEncoded: false),
335+
videoInfo: videoInfo,
336+
caption: nil,
337+
formattedCaption: nil,
338+
storeInCache: true,
339+
progressWatcher: UploadProgressListener { progress in
340+
progressSubject?.send(progress)
341+
})
322342

323343
await requestHandle(handle)
324344

@@ -340,9 +360,15 @@ final class TimelineProxy: TimelineProxyProtocol {
340360
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
341361
MXLog.info("Sending voice message")
342362

343-
let handle = timeline.sendVoiceMessage(url: url.path(percentEncoded: false), audioInfo: audioInfo, waveform: waveform, caption: nil, formattedCaption: nil, progressWatcher: UploadProgressListener { progress in
344-
progressSubject?.send(progress)
345-
})
363+
let handle = timeline.sendVoiceMessage(url: url.path(percentEncoded: false),
364+
audioInfo: audioInfo,
365+
waveform: waveform,
366+
caption: nil,
367+
formattedCaption: nil,
368+
storeInCache: true,
369+
progressWatcher: UploadProgressListener { progress in
370+
progressSubject?.send(progress)
371+
})
346372

347373
await requestHandle(handle)
348374

project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ packages:
6060
# Element/Matrix dependencies
6161
MatrixRustSDK:
6262
url: https://github.com/element-hq/matrix-rust-components-swift
63-
exactVersion: 1.0.59
63+
exactVersion: 1.0.60
6464
# path: ../matrix-rust-sdk
6565
Compound:
6666
url: https://github.com/element-hq/compound-ios

0 commit comments

Comments
 (0)