@@ -2241,6 +2241,21 @@ public protocol ClientBuilderProtocol : AnyObject {
2241
2241
2242
2242
func slidingSyncVersionBuilder(versionBuilder: SlidingSyncVersionBuilder) -> ClientBuilder
2243
2243
2244
+ /**
2245
+ * Whether to use the event cache persistent storage or not.
2246
+ *
2247
+ * This is a temporary feature flag, for testing the event cache's
2248
+ * persistent storage. Follow new developments in https://github.com/matrix-org/matrix-rust-sdk/issues/3280.
2249
+ *
2250
+ * This is disabled by default. When disabled, a one-time cleanup is
2251
+ * performed when creating the client, and it will clear all the events
2252
+ * previously stored in the event cache.
2253
+ *
2254
+ * When enabled, it will attempt to store events in the event cache as
2255
+ * they're received, and reuse them when reconstructing timelines.
2256
+ */
2257
+ func useEventCachePersistentStorage(value: Bool) -> ClientBuilder
2258
+
2244
2259
func userAgent(userAgent: String) -> ClientBuilder
2245
2260
2246
2261
func username(username: String) -> ClientBuilder
@@ -2530,6 +2545,27 @@ open func slidingSyncVersionBuilder(versionBuilder: SlidingSyncVersionBuilder) -
2530
2545
FfiConverterTypeSlidingSyncVersionBuilder.lower(versionBuilder),$0
2531
2546
)
2532
2547
})
2548
+ }
2549
+
2550
+ /**
2551
+ * Whether to use the event cache persistent storage or not.
2552
+ *
2553
+ * This is a temporary feature flag, for testing the event cache's
2554
+ * persistent storage. Follow new developments in https://github.com/matrix-org/matrix-rust-sdk/issues/3280.
2555
+ *
2556
+ * This is disabled by default. When disabled, a one-time cleanup is
2557
+ * performed when creating the client, and it will clear all the events
2558
+ * previously stored in the event cache.
2559
+ *
2560
+ * When enabled, it will attempt to store events in the event cache as
2561
+ * they're received, and reuse them when reconstructing timelines.
2562
+ */
2563
+ open func useEventCachePersistentStorage(value: Bool) -> ClientBuilder {
2564
+ return try! FfiConverterTypeClientBuilder.lift(try! rustCall() {
2565
+ uniffi_matrix_sdk_ffi_fn_method_clientbuilder_use_event_cache_persistent_storage(self.uniffiClonePointer(),
2566
+ FfiConverterBool.lower(value),$0
2567
+ )
2568
+ })
2533
2569
}
2534
2570
2535
2571
open func userAgent(userAgent: String) -> ClientBuilder {
@@ -4890,6 +4926,14 @@ public protocol RoomProtocol : AnyObject {
4890
4926
*/
4891
4927
func clearComposerDraft() async throws
4892
4928
4929
+ /**
4930
+ * Clear the event cache storage for the current room.
4931
+ *
4932
+ * This will remove all the information related to the event cache, in
4933
+ * memory and in the persisted storage, if enabled.
4934
+ */
4935
+ func clearEventCacheStorage() async throws
4936
+
4893
4937
/**
4894
4938
* Forces the currently active room key, which is used to encrypt messages,
4895
4939
* to be rotated.
@@ -5048,7 +5092,7 @@ public protocol RoomProtocol : AnyObject {
5048
5092
* * `allowed_message_types` - A list of `RoomMessageEventMessageType` that
5049
5093
* will be allowed to appear in the timeline
5050
5094
*/
5051
- func messageFilteredTimeline(internalIdPrefix: String?, allowedMessageTypes: [RoomMessageEventMessageType]) async throws -> Timeline
5095
+ func messageFilteredTimeline(internalIdPrefix: String?, allowedMessageTypes: [RoomMessageEventMessageType], dateDividerMode: DateDividerMode ) async throws -> Timeline
5052
5096
5053
5097
func ownUserId() -> String
5054
5098
@@ -5128,6 +5172,17 @@ public protocol RoomProtocol : AnyObject {
5128
5172
*/
5129
5173
func sendCallNotificationIfNeeded() async throws
5130
5174
5175
+ /**
5176
+ * Send a raw event to the room.
5177
+ *
5178
+ * # Arguments
5179
+ *
5180
+ * * `event_type` - The type of the event to send.
5181
+ *
5182
+ * * `content` - The content of the event to send encoded as JSON string.
5183
+ */
5184
+ func sendRaw(eventType: String, content: String) async throws
5185
+
5131
5186
func setIsFavourite(isFavourite: Bool, tagOrder: Double?) async throws
5132
5187
5133
5188
func setIsLowPriority(isLowPriority: Bool, tagOrder: Double?) async throws
@@ -5500,6 +5555,29 @@ open func clearComposerDraft()async throws {
5500
5555
)
5501
5556
}
5502
5557
5558
+ /**
5559
+ * Clear the event cache storage for the current room.
5560
+ *
5561
+ * This will remove all the information related to the event cache, in
5562
+ * memory and in the persisted storage, if enabled.
5563
+ */
5564
+ open func clearEventCacheStorage()async throws {
5565
+ return
5566
+ try await uniffiRustCallAsync(
5567
+ rustFutureFunc: {
5568
+ uniffi_matrix_sdk_ffi_fn_method_room_clear_event_cache_storage(
5569
+ self.uniffiClonePointer()
5570
+
5571
+ )
5572
+ },
5573
+ pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
5574
+ completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
5575
+ freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
5576
+ liftFunc: { $0 },
5577
+ errorHandler: FfiConverterTypeClientError.lift
5578
+ )
5579
+ }
5580
+
5503
5581
/**
5504
5582
* Forces the currently active room key, which is used to encrypt messages,
5505
5583
* to be rotated.
@@ -6014,13 +6092,13 @@ open func membership() -> Membership {
6014
6092
* * `allowed_message_types` - A list of `RoomMessageEventMessageType` that
6015
6093
* will be allowed to appear in the timeline
6016
6094
*/
6017
- open func messageFilteredTimeline(internalIdPrefix: String?, allowedMessageTypes: [RoomMessageEventMessageType])async throws -> Timeline {
6095
+ open func messageFilteredTimeline(internalIdPrefix: String?, allowedMessageTypes: [RoomMessageEventMessageType], dateDividerMode: DateDividerMode )async throws -> Timeline {
6018
6096
return
6019
6097
try await uniffiRustCallAsync(
6020
6098
rustFutureFunc: {
6021
6099
uniffi_matrix_sdk_ffi_fn_method_room_message_filtered_timeline(
6022
6100
self.uniffiClonePointer(),
6023
- FfiConverterOptionString.lower(internalIdPrefix),FfiConverterSequenceTypeRoomMessageEventMessageType.lower(allowedMessageTypes)
6101
+ FfiConverterOptionString.lower(internalIdPrefix),FfiConverterSequenceTypeRoomMessageEventMessageType.lower(allowedMessageTypes),FfiConverterTypeDateDividerMode.lower(dateDividerMode)
6024
6102
)
6025
6103
},
6026
6104
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
@@ -6254,6 +6332,32 @@ open func sendCallNotificationIfNeeded()async throws {
6254
6332
)
6255
6333
}
6256
6334
6335
+ /**
6336
+ * Send a raw event to the room.
6337
+ *
6338
+ * # Arguments
6339
+ *
6340
+ * * `event_type` - The type of the event to send.
6341
+ *
6342
+ * * `content` - The content of the event to send encoded as JSON string.
6343
+ */
6344
+ open func sendRaw(eventType: String, content: String)async throws {
6345
+ return
6346
+ try await uniffiRustCallAsync(
6347
+ rustFutureFunc: {
6348
+ uniffi_matrix_sdk_ffi_fn_method_room_send_raw(
6349
+ self.uniffiClonePointer(),
6350
+ FfiConverterString.lower(eventType),FfiConverterString.lower(content)
6351
+ )
6352
+ },
6353
+ pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
6354
+ completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
6355
+ freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
6356
+ liftFunc: { $0 },
6357
+ errorHandler: FfiConverterTypeClientError.lift
6358
+ )
6359
+ }
6360
+
6257
6361
open func setIsFavourite(isFavourite: Bool, tagOrder: Double?)async throws {
6258
6362
return
6259
6363
try await uniffiRustCallAsync(
@@ -17617,6 +17721,8 @@ public enum ClientBuildError {
17617
17721
17618
17722
case Sdk(message: String)
17619
17723
17724
+ case EventCache(message: String)
17725
+
17620
17726
case Generic(message: String)
17621
17727
17622
17728
}
@@ -17660,7 +17766,11 @@ public struct FfiConverterTypeClientBuildError: FfiConverterRustBuffer {
17660
17766
message: try FfiConverterString.read(from: &buf)
17661
17767
)
17662
17768
17663
- case 8: return .Generic(
17769
+ case 8: return .EventCache(
17770
+ message: try FfiConverterString.read(from: &buf)
17771
+ )
17772
+
17773
+ case 9: return .Generic(
17664
17774
message: try FfiConverterString.read(from: &buf)
17665
17775
)
17666
17776
@@ -17689,8 +17799,10 @@ public struct FfiConverterTypeClientBuildError: FfiConverterRustBuffer {
17689
17799
writeInt(&buf, Int32(6))
17690
17800
case .Sdk(_ /* message is ignored*/):
17691
17801
writeInt(&buf, Int32(7))
17692
- case .Generic (_ /* message is ignored*/):
17802
+ case .EventCache (_ /* message is ignored*/):
17693
17803
writeInt(&buf, Int32(8))
17804
+ case .Generic(_ /* message is ignored*/):
17805
+ writeInt(&buf, Int32(9))
17694
17806
17695
17807
17696
17808
}
@@ -17905,6 +18017,65 @@ extension CrossSigningResetAuthType: Equatable, Hashable {}
17905
18017
17906
18018
17907
18019
18020
+ // Note that we don't yet support `indirect` for enums.
18021
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
18022
+ /**
18023
+ * Changes how date dividers get inserted, either in between each day or in
18024
+ * between each month
18025
+ */
18026
+
18027
+ public enum DateDividerMode {
18028
+
18029
+ case daily
18030
+ case monthly
18031
+ }
18032
+
18033
+
18034
+ public struct FfiConverterTypeDateDividerMode: FfiConverterRustBuffer {
18035
+ typealias SwiftType = DateDividerMode
18036
+
18037
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DateDividerMode {
18038
+ let variant: Int32 = try readInt(&buf)
18039
+ switch variant {
18040
+
18041
+ case 1: return .daily
18042
+
18043
+ case 2: return .monthly
18044
+
18045
+ default: throw UniffiInternalError.unexpectedEnumCase
18046
+ }
18047
+ }
18048
+
18049
+ public static func write(_ value: DateDividerMode, into buf: inout [UInt8]) {
18050
+ switch value {
18051
+
18052
+
18053
+ case .daily:
18054
+ writeInt(&buf, Int32(1))
18055
+
18056
+
18057
+ case .monthly:
18058
+ writeInt(&buf, Int32(2))
18059
+
18060
+ }
18061
+ }
18062
+ }
18063
+
18064
+
18065
+ public func FfiConverterTypeDateDividerMode_lift(_ buf: RustBuffer) throws -> DateDividerMode {
18066
+ return try FfiConverterTypeDateDividerMode.lift(buf)
18067
+ }
18068
+
18069
+ public func FfiConverterTypeDateDividerMode_lower(_ value: DateDividerMode) -> RustBuffer {
18070
+ return FfiConverterTypeDateDividerMode.lower(value)
18071
+ }
18072
+
18073
+
18074
+
18075
+ extension DateDividerMode: Equatable, Hashable {}
18076
+
18077
+
18078
+
17908
18079
// Note that we don't yet support `indirect` for enums.
17909
18080
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
17910
18081
@@ -24241,9 +24412,10 @@ extension VerificationState: Equatable, Hashable {}
24241
24412
public enum VirtualTimelineItem {
24242
24413
24243
24414
/**
24244
- * A divider between messages of two days.
24415
+ * A divider between messages of different day or month depending on
24416
+ * timeline settings.
24245
24417
*/
24246
- case dayDivider (
24418
+ case dateDivider (
24247
24419
/**
24248
24420
* A timestamp in milliseconds since Unix Epoch on that day in local
24249
24421
* time.
@@ -24263,7 +24435,7 @@ public struct FfiConverterTypeVirtualTimelineItem: FfiConverterRustBuffer {
24263
24435
let variant: Int32 = try readInt(&buf)
24264
24436
switch variant {
24265
24437
24266
- case 1: return .dayDivider (ts: try FfiConverterUInt64.read(from: &buf)
24438
+ case 1: return .dateDivider (ts: try FfiConverterUInt64.read(from: &buf)
24267
24439
)
24268
24440
24269
24441
case 2: return .readMarker
@@ -24276,7 +24448,7 @@ public struct FfiConverterTypeVirtualTimelineItem: FfiConverterRustBuffer {
24276
24448
switch value {
24277
24449
24278
24450
24279
- case let .dayDivider (ts):
24451
+ case let .dateDivider (ts):
24280
24452
writeInt(&buf, Int32(1))
24281
24453
FfiConverterUInt64.write(ts, into: &buf)
24282
24454
@@ -29412,6 +29584,9 @@ private var initializationResult: InitializationResult = {
29412
29584
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_sliding_sync_version_builder() != 39381) {
29413
29585
return InitializationResult.apiChecksumMismatch
29414
29586
}
29587
+ if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_use_event_cache_persistent_storage() != 58836) {
29588
+ return InitializationResult.apiChecksumMismatch
29589
+ }
29415
29590
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_user_agent() != 13719) {
29416
29591
return InitializationResult.apiChecksumMismatch
29417
29592
}
@@ -29643,6 +29818,9 @@ private var initializationResult: InitializationResult = {
29643
29818
if (uniffi_matrix_sdk_ffi_checksum_method_room_clear_composer_draft() != 39667) {
29644
29819
return InitializationResult.apiChecksumMismatch
29645
29820
}
29821
+ if (uniffi_matrix_sdk_ffi_checksum_method_room_clear_event_cache_storage() != 13838) {
29822
+ return InitializationResult.apiChecksumMismatch
29823
+ }
29646
29824
if (uniffi_matrix_sdk_ffi_checksum_method_room_discard_room_key() != 18081) {
29647
29825
return InitializationResult.apiChecksumMismatch
29648
29826
}
@@ -29742,7 +29920,7 @@ private var initializationResult: InitializationResult = {
29742
29920
if (uniffi_matrix_sdk_ffi_checksum_method_room_membership() != 26065) {
29743
29921
return InitializationResult.apiChecksumMismatch
29744
29922
}
29745
- if (uniffi_matrix_sdk_ffi_checksum_method_room_message_filtered_timeline() != 47862 ) {
29923
+ if (uniffi_matrix_sdk_ffi_checksum_method_room_message_filtered_timeline() != 32258 ) {
29746
29924
return InitializationResult.apiChecksumMismatch
29747
29925
}
29748
29926
if (uniffi_matrix_sdk_ffi_checksum_method_room_own_user_id() != 39510) {
@@ -29778,6 +29956,9 @@ private var initializationResult: InitializationResult = {
29778
29956
if (uniffi_matrix_sdk_ffi_checksum_method_room_send_call_notification_if_needed() != 53551) {
29779
29957
return InitializationResult.apiChecksumMismatch
29780
29958
}
29959
+ if (uniffi_matrix_sdk_ffi_checksum_method_room_send_raw() != 20486) {
29960
+ return InitializationResult.apiChecksumMismatch
29961
+ }
29781
29962
if (uniffi_matrix_sdk_ffi_checksum_method_room_set_is_favourite() != 64403) {
29782
29963
return InitializationResult.apiChecksumMismatch
29783
29964
}
0 commit comments