@@ -2867,6 +2867,8 @@ public protocol ClientBuilderProtocol : AnyObject {
2867
2867
*/
2868
2868
func systemIsMemoryConstrained() -> ClientBuilder
2869
2869
2870
+ func threadsEnabled(enabled: Bool) -> ClientBuilder
2871
+
2870
2872
func userAgent(userAgent: String) -> ClientBuilder
2871
2873
2872
2874
func username(username: String) -> ClientBuilder
@@ -3250,6 +3252,14 @@ open func systemIsMemoryConstrained() -> ClientBuilder {
3250
3252
})
3251
3253
}
3252
3254
3255
+ open func threadsEnabled(enabled: Bool) -> ClientBuilder {
3256
+ return try! FfiConverterTypeClientBuilder.lift(try! rustCall() {
3257
+ uniffi_matrix_sdk_ffi_fn_method_clientbuilder_threads_enabled(self.uniffiClonePointer(),
3258
+ FfiConverterBool.lower(enabled),$0
3259
+ )
3260
+ })
3261
+ }
3262
+
3253
3263
open func userAgent(userAgent: String) -> ClientBuilder {
3254
3264
return try! FfiConverterTypeClientBuilder.lift(try! rustCall() {
3255
3265
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_user_agent(self.uniffiClonePointer(),
@@ -4892,10 +4902,16 @@ public func FfiConverterTypeMediaSource_lower(_ value: MediaSource) -> UnsafeMut
4892
4902
public protocol NotificationClientProtocol : AnyObject {
4893
4903
4894
4904
/**
4895
- * See also documentation of
4896
- * `MatrixNotificationClient::get_notification`.
4905
+ * Fetches the content of a notification.
4906
+ *
4907
+ * This will first try to get the notification using a short-lived sliding
4908
+ * sync, and if the sliding-sync can't find the event, then it'll use a
4909
+ * `/context` query to find the event with associated member information.
4910
+ *
4911
+ * An error result means that we couldn't resolve the notification; in that
4912
+ * case, a dummy notification may be displayed instead.
4897
4913
*/
4898
- func getNotification(roomId: String, eventId: String) async throws -> NotificationItem?
4914
+ func getNotification(roomId: String, eventId: String) async throws -> NotificationStatus
4899
4915
4900
4916
/**
4901
4917
* Get several notification items in a single batch.
@@ -4905,7 +4921,7 @@ public protocol NotificationClientProtocol : AnyObject {
4905
4921
* [`NotificationItem`] or no entry for it if it failed to fetch a
4906
4922
* notification for the provided [`EventId`].
4907
4923
*/
4908
- func getNotifications(requests: [NotificationItemsRequest]) async throws -> [String: NotificationItem ]
4924
+ func getNotifications(requests: [NotificationItemsRequest]) async throws -> [String: BatchNotificationResult ]
4909
4925
4910
4926
/**
4911
4927
* Fetches a room by its ID using the in-memory state store backed client.
@@ -4959,10 +4975,16 @@ open class NotificationClient:
4959
4975
4960
4976
4961
4977
/**
4962
- * See also documentation of
4963
- * `MatrixNotificationClient::get_notification`.
4978
+ * Fetches the content of a notification.
4979
+ *
4980
+ * This will first try to get the notification using a short-lived sliding
4981
+ * sync, and if the sliding-sync can't find the event, then it'll use a
4982
+ * `/context` query to find the event with associated member information.
4983
+ *
4984
+ * An error result means that we couldn't resolve the notification; in that
4985
+ * case, a dummy notification may be displayed instead.
4964
4986
*/
4965
- open func getNotification(roomId: String, eventId: String)async throws -> NotificationItem? {
4987
+ open func getNotification(roomId: String, eventId: String)async throws -> NotificationStatus {
4966
4988
return
4967
4989
try await uniffiRustCallAsync(
4968
4990
rustFutureFunc: {
@@ -4974,7 +4996,7 @@ open func getNotification(roomId: String, eventId: String)async throws -> Notif
4974
4996
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
4975
4997
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
4976
4998
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
4977
- liftFunc: FfiConverterOptionTypeNotificationItem .lift,
4999
+ liftFunc: FfiConverterTypeNotificationStatus .lift,
4978
5000
errorHandler: FfiConverterTypeClientError.lift
4979
5001
)
4980
5002
}
@@ -4987,7 +5009,7 @@ open func getNotification(roomId: String, eventId: String)async throws -> Notif
4987
5009
* [`NotificationItem`] or no entry for it if it failed to fetch a
4988
5010
* notification for the provided [`EventId`].
4989
5011
*/
4990
- open func getNotifications(requests: [NotificationItemsRequest])async throws -> [String: NotificationItem ] {
5012
+ open func getNotifications(requests: [NotificationItemsRequest])async throws -> [String: BatchNotificationResult ] {
4991
5013
return
4992
5014
try await uniffiRustCallAsync(
4993
5015
rustFutureFunc: {
@@ -4999,7 +5021,7 @@ open func getNotifications(requests: [NotificationItemsRequest])async throws ->
4999
5021
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
5000
5022
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
5001
5023
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
5002
- liftFunc: FfiConverterDictionaryStringTypeNotificationItem .lift,
5024
+ liftFunc: FfiConverterDictionaryStringTypeBatchNotificationResult .lift,
5003
5025
errorHandler: FfiConverterTypeClientError.lift
5004
5026
)
5005
5027
}
@@ -21652,6 +21674,73 @@ extension BackupUploadState: Equatable, Hashable {}
21652
21674
21653
21675
21654
21676
21677
+ // Note that we don't yet support `indirect` for enums.
21678
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
21679
+
21680
+ public enum BatchNotificationResult {
21681
+
21682
+ /**
21683
+ * We have more detailed information about the notification.
21684
+ */
21685
+ case ok(status: NotificationStatus
21686
+ )
21687
+ /**
21688
+ * An error occurred while trying to fetch the notification.
21689
+ */
21690
+ case error(
21691
+ /**
21692
+ * The error message observed while handling a specific notification.
21693
+ */message: String
21694
+ )
21695
+ }
21696
+
21697
+
21698
+ public struct FfiConverterTypeBatchNotificationResult: FfiConverterRustBuffer {
21699
+ typealias SwiftType = BatchNotificationResult
21700
+
21701
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BatchNotificationResult {
21702
+ let variant: Int32 = try readInt(&buf)
21703
+ switch variant {
21704
+
21705
+ case 1: return .ok(status: try FfiConverterTypeNotificationStatus.read(from: &buf)
21706
+ )
21707
+
21708
+ case 2: return .error(message: try FfiConverterString.read(from: &buf)
21709
+ )
21710
+
21711
+ default: throw UniffiInternalError.unexpectedEnumCase
21712
+ }
21713
+ }
21714
+
21715
+ public static func write(_ value: BatchNotificationResult, into buf: inout [UInt8]) {
21716
+ switch value {
21717
+
21718
+
21719
+ case let .ok(status):
21720
+ writeInt(&buf, Int32(1))
21721
+ FfiConverterTypeNotificationStatus.write(status, into: &buf)
21722
+
21723
+
21724
+ case let .error(message):
21725
+ writeInt(&buf, Int32(2))
21726
+ FfiConverterString.write(message, into: &buf)
21727
+
21728
+ }
21729
+ }
21730
+ }
21731
+
21732
+
21733
+ public func FfiConverterTypeBatchNotificationResult_lift(_ buf: RustBuffer) throws -> BatchNotificationResult {
21734
+ return try FfiConverterTypeBatchNotificationResult.lift(buf)
21735
+ }
21736
+
21737
+ public func FfiConverterTypeBatchNotificationResult_lower(_ value: BatchNotificationResult) -> RustBuffer {
21738
+ return FfiConverterTypeBatchNotificationResult.lower(value)
21739
+ }
21740
+
21741
+
21742
+
21743
+
21655
21744
21656
21745
public enum ClientBuildError {
21657
21746
@@ -25678,6 +25767,79 @@ extension NotificationSettingsError: Foundation.LocalizedError {
25678
25767
}
25679
25768
}
25680
25769
25770
+ // Note that we don't yet support `indirect` for enums.
25771
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
25772
+
25773
+ public enum NotificationStatus {
25774
+
25775
+ /**
25776
+ * The event has been found and was not filtered out.
25777
+ */
25778
+ case event(item: NotificationItem
25779
+ )
25780
+ /**
25781
+ * The event couldn't be found in the network queries used to find it.
25782
+ */
25783
+ case eventNotFound
25784
+ /**
25785
+ * The event has been filtered out, either because of the user's push
25786
+ * rules, or because the user which triggered it is ignored by the
25787
+ * current user.
25788
+ */
25789
+ case eventFilteredOut
25790
+ }
25791
+
25792
+
25793
+ public struct FfiConverterTypeNotificationStatus: FfiConverterRustBuffer {
25794
+ typealias SwiftType = NotificationStatus
25795
+
25796
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationStatus {
25797
+ let variant: Int32 = try readInt(&buf)
25798
+ switch variant {
25799
+
25800
+ case 1: return .event(item: try FfiConverterTypeNotificationItem.read(from: &buf)
25801
+ )
25802
+
25803
+ case 2: return .eventNotFound
25804
+
25805
+ case 3: return .eventFilteredOut
25806
+
25807
+ default: throw UniffiInternalError.unexpectedEnumCase
25808
+ }
25809
+ }
25810
+
25811
+ public static func write(_ value: NotificationStatus, into buf: inout [UInt8]) {
25812
+ switch value {
25813
+
25814
+
25815
+ case let .event(item):
25816
+ writeInt(&buf, Int32(1))
25817
+ FfiConverterTypeNotificationItem.write(item, into: &buf)
25818
+
25819
+
25820
+ case .eventNotFound:
25821
+ writeInt(&buf, Int32(2))
25822
+
25823
+
25824
+ case .eventFilteredOut:
25825
+ writeInt(&buf, Int32(3))
25826
+
25827
+ }
25828
+ }
25829
+ }
25830
+
25831
+
25832
+ public func FfiConverterTypeNotificationStatus_lift(_ buf: RustBuffer) throws -> NotificationStatus {
25833
+ return try FfiConverterTypeNotificationStatus.lift(buf)
25834
+ }
25835
+
25836
+ public func FfiConverterTypeNotificationStatus_lower(_ value: NotificationStatus) -> RustBuffer {
25837
+ return FfiConverterTypeNotificationStatus.lower(value)
25838
+ }
25839
+
25840
+
25841
+
25842
+
25681
25843
// Note that we don't yet support `indirect` for enums.
25682
25844
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
25683
25845
@@ -34401,27 +34563,6 @@ fileprivate struct FfiConverterOptionTypeMentions: FfiConverterRustBuffer {
34401
34563
}
34402
34564
}
34403
34565
34404
- fileprivate struct FfiConverterOptionTypeNotificationItem: FfiConverterRustBuffer {
34405
- typealias SwiftType = NotificationItem?
34406
-
34407
- public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
34408
- guard let value = value else {
34409
- writeInt(&buf, Int8(0))
34410
- return
34411
- }
34412
- writeInt(&buf, Int8(1))
34413
- FfiConverterTypeNotificationItem.write(value, into: &buf)
34414
- }
34415
-
34416
- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
34417
- switch try readInt(&buf) as Int8 {
34418
- case 0: return nil
34419
- case 1: return try FfiConverterTypeNotificationItem.read(from: &buf)
34420
- default: throw UniffiInternalError.unexpectedOptionalTag
34421
- }
34422
- }
34423
- }
34424
-
34425
34566
fileprivate struct FfiConverterOptionTypeNotificationPowerLevels: FfiConverterRustBuffer {
34426
34567
typealias SwiftType = NotificationPowerLevels?
34427
34568
@@ -36231,46 +36372,46 @@ fileprivate struct FfiConverterDictionaryStringTypeIgnoredUser: FfiConverterRust
36231
36372
}
36232
36373
}
36233
36374
36234
- fileprivate struct FfiConverterDictionaryStringTypeNotificationItem : FfiConverterRustBuffer {
36235
- public static func write(_ value: [String: NotificationItem ], into buf: inout [UInt8]) {
36375
+ fileprivate struct FfiConverterDictionaryStringTypeReceipt : FfiConverterRustBuffer {
36376
+ public static func write(_ value: [String: Receipt ], into buf: inout [UInt8]) {
36236
36377
let len = Int32(value.count)
36237
36378
writeInt(&buf, len)
36238
36379
for (key, value) in value {
36239
36380
FfiConverterString.write(key, into: &buf)
36240
- FfiConverterTypeNotificationItem .write(value, into: &buf)
36381
+ FfiConverterTypeReceipt .write(value, into: &buf)
36241
36382
}
36242
36383
}
36243
36384
36244
- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: NotificationItem ] {
36385
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: Receipt ] {
36245
36386
let len: Int32 = try readInt(&buf)
36246
- var dict = [String: NotificationItem ]()
36387
+ var dict = [String: Receipt ]()
36247
36388
dict.reserveCapacity(Int(len))
36248
36389
for _ in 0..<len {
36249
36390
let key = try FfiConverterString.read(from: &buf)
36250
- let value = try FfiConverterTypeNotificationItem .read(from: &buf)
36391
+ let value = try FfiConverterTypeReceipt .read(from: &buf)
36251
36392
dict[key] = value
36252
36393
}
36253
36394
return dict
36254
36395
}
36255
36396
}
36256
36397
36257
- fileprivate struct FfiConverterDictionaryStringTypeReceipt : FfiConverterRustBuffer {
36258
- public static func write(_ value: [String: Receipt ], into buf: inout [UInt8]) {
36398
+ fileprivate struct FfiConverterDictionaryStringTypeBatchNotificationResult : FfiConverterRustBuffer {
36399
+ public static func write(_ value: [String: BatchNotificationResult ], into buf: inout [UInt8]) {
36259
36400
let len = Int32(value.count)
36260
36401
writeInt(&buf, len)
36261
36402
for (key, value) in value {
36262
36403
FfiConverterString.write(key, into: &buf)
36263
- FfiConverterTypeReceipt .write(value, into: &buf)
36404
+ FfiConverterTypeBatchNotificationResult .write(value, into: &buf)
36264
36405
}
36265
36406
}
36266
36407
36267
- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: Receipt ] {
36408
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: BatchNotificationResult ] {
36268
36409
let len: Int32 = try readInt(&buf)
36269
- var dict = [String: Receipt ]()
36410
+ var dict = [String: BatchNotificationResult ]()
36270
36411
dict.reserveCapacity(Int(len))
36271
36412
for _ in 0..<len {
36272
36413
let key = try FfiConverterString.read(from: &buf)
36273
- let value = try FfiConverterTypeReceipt .read(from: &buf)
36414
+ let value = try FfiConverterTypeBatchNotificationResult .read(from: &buf)
36274
36415
dict[key] = value
36275
36416
}
36276
36417
return dict
@@ -37118,6 +37259,9 @@ private var initializationResult: InitializationResult = {
37118
37259
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_system_is_memory_constrained() != 6898) {
37119
37260
return InitializationResult.apiChecksumMismatch
37120
37261
}
37262
+ if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_threads_enabled() != 33768) {
37263
+ return InitializationResult.apiChecksumMismatch
37264
+ }
37121
37265
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_user_agent() != 13719) {
37122
37266
return InitializationResult.apiChecksumMismatch
37123
37267
}
@@ -37250,10 +37394,10 @@ private var initializationResult: InitializationResult = {
37250
37394
if (uniffi_matrix_sdk_ffi_checksum_method_mediasource_url() != 62692) {
37251
37395
return InitializationResult.apiChecksumMismatch
37252
37396
}
37253
- if (uniffi_matrix_sdk_ffi_checksum_method_notificationclient_get_notification() != 2524 ) {
37397
+ if (uniffi_matrix_sdk_ffi_checksum_method_notificationclient_get_notification() != 52873 ) {
37254
37398
return InitializationResult.apiChecksumMismatch
37255
37399
}
37256
- if (uniffi_matrix_sdk_ffi_checksum_method_notificationclient_get_notifications() != 30600 ) {
37400
+ if (uniffi_matrix_sdk_ffi_checksum_method_notificationclient_get_notifications() != 32112 ) {
37257
37401
return InitializationResult.apiChecksumMismatch
37258
37402
}
37259
37403
if (uniffi_matrix_sdk_ffi_checksum_method_notificationclient_get_room() != 26581) {
0 commit comments