@@ -633,6 +633,15 @@ public protocol ClientProtocol : AnyObject {
633
633
/**
634
634
* Clear all the non-critical caches for this Client instance.
635
635
*
636
+ * WARNING: This will clear all the caches, including the base store (state
637
+ * store), so callers must make sure that any sync is inactive before
638
+ * calling this method. In particular, the `SyncService` must not be
639
+ * running. After the method returns, the Client will be in an unstable
640
+ * state, and it is required that the caller reinstantiates a new
641
+ * Client instance, be it via dropping the previous and re-creating it,
642
+ * restarting their application, or any other similar means.
643
+ *
644
+ * - This will get rid of the backing state store file, if provided.
636
645
* - This will empty all the room's persisted event caches, so all rooms
637
646
* will start as if they were empty.
638
647
* - This will empty the media cache according to the current media
@@ -685,13 +694,18 @@ public protocol ClientProtocol : AnyObject {
685
694
686
695
func encryption() -> Encryption
687
696
697
+ /**
698
+ * Fetch the media preview configuration from the server.
699
+ */
700
+ func fetchMediaPreviewConfig() async throws -> MediaPreviewConfig?
701
+
688
702
func getDmRoom(userId: String) throws -> Room?
689
703
690
704
/**
691
705
* Get the invite request avatars display policy
692
706
* currently stored in the cache.
693
707
*/
694
- func getInviteAvatarsDisplayPolicy() async throws -> InviteAvatars
708
+ func getInviteAvatarsDisplayPolicy() async throws -> InviteAvatars?
695
709
696
710
func getMediaContent(mediaSource: MediaSource) async throws -> Data
697
711
@@ -701,7 +715,7 @@ public protocol ClientProtocol : AnyObject {
701
715
* Get the media previews timeline display policy
702
716
* currently stored in the cache.
703
717
*/
704
- func getMediaPreviewDisplayPolicy() async throws -> MediaPreviews
718
+ func getMediaPreviewDisplayPolicy() async throws -> MediaPreviews?
705
719
706
720
func getMediaThumbnail(mediaSource: MediaSource, width: UInt64, height: UInt64) async throws -> Data
707
721
@@ -1224,6 +1238,15 @@ open func canDeactivateAccount() -> Bool {
1224
1238
/**
1225
1239
* Clear all the non-critical caches for this Client instance.
1226
1240
*
1241
+ * WARNING: This will clear all the caches, including the base store (state
1242
+ * store), so callers must make sure that any sync is inactive before
1243
+ * calling this method. In particular, the `SyncService` must not be
1244
+ * running. After the method returns, the Client will be in an unstable
1245
+ * state, and it is required that the caller reinstantiates a new
1246
+ * Client instance, be it via dropping the previous and re-creating it,
1247
+ * restarting their application, or any other similar means.
1248
+ *
1249
+ * - This will get rid of the backing state store file, if provided.
1227
1250
* - This will empty all the room's persisted event caches, so all rooms
1228
1251
* will start as if they were empty.
1229
1252
* - This will empty the media cache according to the current media
@@ -1392,6 +1415,26 @@ open func encryption() -> Encryption {
1392
1415
})
1393
1416
}
1394
1417
1418
+ /**
1419
+ * Fetch the media preview configuration from the server.
1420
+ */
1421
+ open func fetchMediaPreviewConfig()async throws -> MediaPreviewConfig? {
1422
+ return
1423
+ try await uniffiRustCallAsync(
1424
+ rustFutureFunc: {
1425
+ uniffi_matrix_sdk_ffi_fn_method_client_fetch_media_preview_config(
1426
+ self.uniffiClonePointer()
1427
+
1428
+ )
1429
+ },
1430
+ pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
1431
+ completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
1432
+ freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
1433
+ liftFunc: FfiConverterOptionTypeMediaPreviewConfig.lift,
1434
+ errorHandler: FfiConverterTypeClientError.lift
1435
+ )
1436
+ }
1437
+
1395
1438
open func getDmRoom(userId: String)throws -> Room? {
1396
1439
return try FfiConverterOptionTypeRoom.lift(try rustCallWithError(FfiConverterTypeClientError.lift) {
1397
1440
uniffi_matrix_sdk_ffi_fn_method_client_get_dm_room(self.uniffiClonePointer(),
@@ -1404,7 +1447,7 @@ open func getDmRoom(userId: String)throws -> Room? {
1404
1447
* Get the invite request avatars display policy
1405
1448
* currently stored in the cache.
1406
1449
*/
1407
- open func getInviteAvatarsDisplayPolicy()async throws -> InviteAvatars {
1450
+ open func getInviteAvatarsDisplayPolicy()async throws -> InviteAvatars? {
1408
1451
return
1409
1452
try await uniffiRustCallAsync(
1410
1453
rustFutureFunc: {
@@ -1416,7 +1459,7 @@ open func getInviteAvatarsDisplayPolicy()async throws -> InviteAvatars {
1416
1459
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
1417
1460
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
1418
1461
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
1419
- liftFunc: FfiConverterTypeInviteAvatars .lift,
1462
+ liftFunc: FfiConverterOptionTypeInviteAvatars .lift,
1420
1463
errorHandler: FfiConverterTypeClientError.lift
1421
1464
)
1422
1465
}
@@ -1459,7 +1502,7 @@ open func getMediaFile(mediaSource: MediaSource, filename: String?, mimeType: St
1459
1502
* Get the media previews timeline display policy
1460
1503
* currently stored in the cache.
1461
1504
*/
1462
- open func getMediaPreviewDisplayPolicy()async throws -> MediaPreviews {
1505
+ open func getMediaPreviewDisplayPolicy()async throws -> MediaPreviews? {
1463
1506
return
1464
1507
try await uniffiRustCallAsync(
1465
1508
rustFutureFunc: {
@@ -1471,7 +1514,7 @@ open func getMediaPreviewDisplayPolicy()async throws -> MediaPreviews {
1471
1514
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
1472
1515
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
1473
1516
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
1474
- liftFunc: FfiConverterTypeMediaPreviews .lift,
1517
+ liftFunc: FfiConverterOptionTypeMediaPreviews .lift,
1475
1518
errorHandler: FfiConverterTypeClientError.lift
1476
1519
)
1477
1520
}
@@ -31536,7 +31579,7 @@ extension FfiConverterCallbackInterfaceLiveLocationShareListener : FfiConverter
31536
31579
31537
31580
public protocol MediaPreviewConfigListener : AnyObject {
31538
31581
31539
- func onChange(mediaPreviewConfig: MediaPreviewConfig)
31582
+ func onChange(mediaPreviewConfig: MediaPreviewConfig? )
31540
31583
31541
31584
}
31542
31585
@@ -31560,7 +31603,7 @@ fileprivate struct UniffiCallbackInterfaceMediaPreviewConfigListener {
31560
31603
throw UniffiInternalError.unexpectedStaleHandle
31561
31604
}
31562
31605
return uniffiObj.onChange(
31563
- mediaPreviewConfig: try FfiConverterTypeMediaPreviewConfig .lift(mediaPreviewConfig)
31606
+ mediaPreviewConfig: try FfiConverterOptionTypeMediaPreviewConfig .lift(mediaPreviewConfig)
31564
31607
)
31565
31608
}
31566
31609
@@ -33984,6 +34027,27 @@ fileprivate struct FfiConverterOptionTypeMatrixEntity: FfiConverterRustBuffer {
33984
34027
}
33985
34028
}
33986
34029
34030
+ fileprivate struct FfiConverterOptionTypeMediaPreviewConfig: FfiConverterRustBuffer {
34031
+ typealias SwiftType = MediaPreviewConfig?
34032
+
34033
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
34034
+ guard let value = value else {
34035
+ writeInt(&buf, Int8(0))
34036
+ return
34037
+ }
34038
+ writeInt(&buf, Int8(1))
34039
+ FfiConverterTypeMediaPreviewConfig.write(value, into: &buf)
34040
+ }
34041
+
34042
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
34043
+ switch try readInt(&buf) as Int8 {
34044
+ case 0: return nil
34045
+ case 1: return try FfiConverterTypeMediaPreviewConfig.read(from: &buf)
34046
+ default: throw UniffiInternalError.unexpectedOptionalTag
34047
+ }
34048
+ }
34049
+ }
34050
+
33987
34051
fileprivate struct FfiConverterOptionTypeMentions: FfiConverterRustBuffer {
33988
34052
typealias SwiftType = Mentions?
33989
34053
@@ -34425,6 +34489,27 @@ fileprivate struct FfiConverterOptionTypeIntent: FfiConverterRustBuffer {
34425
34489
}
34426
34490
}
34427
34491
34492
+ fileprivate struct FfiConverterOptionTypeInviteAvatars: FfiConverterRustBuffer {
34493
+ typealias SwiftType = InviteAvatars?
34494
+
34495
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
34496
+ guard let value = value else {
34497
+ writeInt(&buf, Int8(0))
34498
+ return
34499
+ }
34500
+ writeInt(&buf, Int8(1))
34501
+ FfiConverterTypeInviteAvatars.write(value, into: &buf)
34502
+ }
34503
+
34504
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
34505
+ switch try readInt(&buf) as Int8 {
34506
+ case 0: return nil
34507
+ case 1: return try FfiConverterTypeInviteAvatars.read(from: &buf)
34508
+ default: throw UniffiInternalError.unexpectedOptionalTag
34509
+ }
34510
+ }
34511
+ }
34512
+
34428
34513
fileprivate struct FfiConverterOptionTypeJoinRule: FfiConverterRustBuffer {
34429
34514
typealias SwiftType = JoinRule?
34430
34515
@@ -34446,6 +34531,27 @@ fileprivate struct FfiConverterOptionTypeJoinRule: FfiConverterRustBuffer {
34446
34531
}
34447
34532
}
34448
34533
34534
+ fileprivate struct FfiConverterOptionTypeMediaPreviews: FfiConverterRustBuffer {
34535
+ typealias SwiftType = MediaPreviews?
34536
+
34537
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
34538
+ guard let value = value else {
34539
+ writeInt(&buf, Int8(0))
34540
+ return
34541
+ }
34542
+ writeInt(&buf, Int8(1))
34543
+ FfiConverterTypeMediaPreviews.write(value, into: &buf)
34544
+ }
34545
+
34546
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
34547
+ switch try readInt(&buf) as Int8 {
34548
+ case 0: return nil
34549
+ case 1: return try FfiConverterTypeMediaPreviews.read(from: &buf)
34550
+ default: throw UniffiInternalError.unexpectedOptionalTag
34551
+ }
34552
+ }
34553
+ }
34554
+
34449
34555
fileprivate struct FfiConverterOptionTypeMembership: FfiConverterRustBuffer {
34450
34556
typealias SwiftType = Membership?
34451
34557
@@ -36341,7 +36447,7 @@ private var initializationResult: InitializationResult = {
36341
36447
if (uniffi_matrix_sdk_ffi_checksum_method_client_can_deactivate_account() != 39890) {
36342
36448
return InitializationResult.apiChecksumMismatch
36343
36449
}
36344
- if (uniffi_matrix_sdk_ffi_checksum_method_client_clear_caches() != 47085 ) {
36450
+ if (uniffi_matrix_sdk_ffi_checksum_method_client_clear_caches() != 65177 ) {
36345
36451
return InitializationResult.apiChecksumMismatch
36346
36452
}
36347
36453
if (uniffi_matrix_sdk_ffi_checksum_method_client_create_room() != 52700) {
@@ -36368,10 +36474,13 @@ private var initializationResult: InitializationResult = {
36368
36474
if (uniffi_matrix_sdk_ffi_checksum_method_client_encryption() != 9657) {
36369
36475
return InitializationResult.apiChecksumMismatch
36370
36476
}
36477
+ if (uniffi_matrix_sdk_ffi_checksum_method_client_fetch_media_preview_config() != 15595) {
36478
+ return InitializationResult.apiChecksumMismatch
36479
+ }
36371
36480
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_dm_room() != 5137) {
36372
36481
return InitializationResult.apiChecksumMismatch
36373
36482
}
36374
- if (uniffi_matrix_sdk_ffi_checksum_method_client_get_invite_avatars_display_policy() != 3997 ) {
36483
+ if (uniffi_matrix_sdk_ffi_checksum_method_client_get_invite_avatars_display_policy() != 46953 ) {
36375
36484
return InitializationResult.apiChecksumMismatch
36376
36485
}
36377
36486
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_content() != 40308) {
@@ -36380,7 +36489,7 @@ private var initializationResult: InitializationResult = {
36380
36489
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_file() != 52604) {
36381
36490
return InitializationResult.apiChecksumMismatch
36382
36491
}
36383
- if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_preview_display_policy() != 55631 ) {
36492
+ if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_preview_display_policy() != 19264 ) {
36384
36493
return InitializationResult.apiChecksumMismatch
36385
36494
}
36386
36495
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_thumbnail() != 52601) {
@@ -37532,7 +37641,7 @@ private var initializationResult: InitializationResult = {
37532
37641
if (uniffi_matrix_sdk_ffi_checksum_method_livelocationsharelistener_call() != 34519) {
37533
37642
return InitializationResult.apiChecksumMismatch
37534
37643
}
37535
- if (uniffi_matrix_sdk_ffi_checksum_method_mediapreviewconfiglistener_on_change() != 42142 ) {
37644
+ if (uniffi_matrix_sdk_ffi_checksum_method_mediapreviewconfiglistener_on_change() != 14770 ) {
37536
37645
return InitializationResult.apiChecksumMismatch
37537
37646
}
37538
37647
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettingsdelegate_settings_did_change() != 51708) {
0 commit comments