@@ -610,7 +610,7 @@ public protocol ClientProtocol {
610
610
func ignoreUser(userId: String) throws
611
611
func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) throws
612
612
func logout() throws -> String?
613
- func notificationClient() throws -> NotificationClientBuilder
613
+ func notificationClient(processSetup: NotificationProcessSetup ) throws -> NotificationClientBuilder
614
614
func restoreSession(session: Session) throws
615
615
func rooms() -> [Room]
616
616
func searchUsers(searchTerm: String, limit: UInt64) throws -> SearchUsersResults
@@ -841,11 +841,12 @@ public class Client: ClientProtocol {
841
841
)
842
842
}
843
843
844
- public func notificationClient() throws -> NotificationClientBuilder {
844
+ public func notificationClient(processSetup: NotificationProcessSetup ) throws -> NotificationClientBuilder {
845
845
return try FfiConverterTypeNotificationClientBuilder.lift(
846
846
try
847
847
rustCallWithError(FfiConverterTypeClientError.lift) {
848
- uniffi_matrix_sdk_ffi_fn_method_client_notification_client(self.pointer, $0
848
+ uniffi_matrix_sdk_ffi_fn_method_client_notification_client(self.pointer,
849
+ FfiConverterTypeNotificationProcessSetup.lower(processSetup),$0
849
850
)
850
851
}
851
852
)
@@ -1950,7 +1951,6 @@ public func FfiConverterTypeNotificationClient_lower(_ value: NotificationClient
1950
1951
public protocol NotificationClientBuilderProtocol {
1951
1952
func filterByPushRules() -> NotificationClientBuilder
1952
1953
func finish() -> NotificationClient
1953
- func retryDecryption(withCrossProcessLock: Bool) -> NotificationClientBuilder
1954
1954
1955
1955
}
1956
1956
@@ -1991,18 +1991,6 @@ public class NotificationClientBuilder: NotificationClientBuilderProtocol {
1991
1991
1992
1992
uniffi_matrix_sdk_ffi_fn_method_notificationclientbuilder_finish(self.pointer, $0
1993
1993
)
1994
- }
1995
- )
1996
- }
1997
-
1998
- public func retryDecryption(withCrossProcessLock: Bool) -> NotificationClientBuilder {
1999
- return try! FfiConverterTypeNotificationClientBuilder.lift(
2000
- try!
2001
- rustCall() {
2002
-
2003
- uniffi_matrix_sdk_ffi_fn_method_notificationclientbuilder_retry_decryption(self.pointer,
2004
- FfiConverterBool.lower(withCrossProcessLock),$0
2005
- )
2006
1994
}
2007
1995
)
2008
1996
}
@@ -3978,6 +3966,7 @@ public protocol RoomListServiceProtocol {
3978
3966
func invites() async throws -> RoomList
3979
3967
func room(roomId: String) throws -> RoomListItem
3980
3968
func state(listener: RoomListServiceStateListener) -> TaskHandle
3969
+ func syncIndicator(listener: RoomListServiceSyncIndicatorListener) -> TaskHandle
3981
3970
3982
3971
}
3983
3972
@@ -4092,6 +4081,18 @@ public class RoomListService: RoomListServiceProtocol {
4092
4081
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_state(self.pointer,
4093
4082
FfiConverterCallbackInterfaceRoomListServiceStateListener.lower(listener),$0
4094
4083
)
4084
+ }
4085
+ )
4086
+ }
4087
+
4088
+ public func syncIndicator(listener: RoomListServiceSyncIndicatorListener) -> TaskHandle {
4089
+ return try! FfiConverterTypeTaskHandle.lift(
4090
+ try!
4091
+ rustCall() {
4092
+
4093
+ uniffi_matrix_sdk_ffi_fn_method_roomlistservice_sync_indicator(self.pointer,
4094
+ FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener.lower(listener),$0
4095
+ )
4095
4096
}
4096
4097
)
4097
4098
}
@@ -5131,7 +5132,7 @@ public func FfiConverterTypeSyncService_lower(_ value: SyncService) -> UnsafeMut
5131
5132
5132
5133
public protocol SyncServiceBuilderProtocol {
5133
5134
func finish() async throws -> SyncService
5134
- func withEncryptionSync( withCrossProcessLock: Bool, appIdentifier: String?) -> SyncServiceBuilder
5135
+ func withCrossProcessLock( appIdentifier: String?) -> SyncServiceBuilder
5135
5136
5136
5137
}
5137
5138
@@ -5178,13 +5179,12 @@ public class SyncServiceBuilder: SyncServiceBuilderProtocol {
5178
5179
5179
5180
5180
5181
5181
- public func withEncryptionSync( withCrossProcessLock: Bool, appIdentifier: String?) -> SyncServiceBuilder {
5182
+ public func withCrossProcessLock( appIdentifier: String?) -> SyncServiceBuilder {
5182
5183
return try! FfiConverterTypeSyncServiceBuilder.lift(
5183
5184
try!
5184
5185
rustCall() {
5185
5186
5186
- uniffi_matrix_sdk_ffi_fn_method_syncservicebuilder_with_encryption_sync(self.pointer,
5187
- FfiConverterBool.lower(withCrossProcessLock),
5187
+ uniffi_matrix_sdk_ffi_fn_method_syncservicebuilder_with_cross_process_lock(self.pointer,
5188
5188
FfiConverterOptionString.lower(appIdentifier),$0
5189
5189
)
5190
5190
}
@@ -10197,6 +10197,59 @@ public func FfiConverterTypeNotificationEvent_lower(_ value: NotificationEvent)
10197
10197
10198
10198
10199
10199
10200
+ // Note that we don't yet support `indirect` for enums.
10201
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
10202
+ public enum NotificationProcessSetup {
10203
+
10204
+ case multipleProcesses
10205
+ case singleProcess(syncService: SyncService)
10206
+ }
10207
+
10208
+ public struct FfiConverterTypeNotificationProcessSetup: FfiConverterRustBuffer {
10209
+ typealias SwiftType = NotificationProcessSetup
10210
+
10211
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationProcessSetup {
10212
+ let variant: Int32 = try readInt(&buf)
10213
+ switch variant {
10214
+
10215
+ case 1: return .multipleProcesses
10216
+
10217
+ case 2: return .singleProcess(
10218
+ syncService: try FfiConverterTypeSyncService.read(from: &buf)
10219
+ )
10220
+
10221
+ default: throw UniffiInternalError.unexpectedEnumCase
10222
+ }
10223
+ }
10224
+
10225
+ public static func write(_ value: NotificationProcessSetup, into buf: inout [UInt8]) {
10226
+ switch value {
10227
+
10228
+
10229
+ case .multipleProcesses:
10230
+ writeInt(&buf, Int32(1))
10231
+
10232
+
10233
+ case let .singleProcess(syncService):
10234
+ writeInt(&buf, Int32(2))
10235
+ FfiConverterTypeSyncService.write(syncService, into: &buf)
10236
+
10237
+ }
10238
+ }
10239
+ }
10240
+
10241
+
10242
+ public func FfiConverterTypeNotificationProcessSetup_lift(_ buf: RustBuffer) throws -> NotificationProcessSetup {
10243
+ return try FfiConverterTypeNotificationProcessSetup.lift(buf)
10244
+ }
10245
+
10246
+ public func FfiConverterTypeNotificationProcessSetup_lower(_ value: NotificationProcessSetup) -> RustBuffer {
10247
+ return FfiConverterTypeNotificationProcessSetup.lower(value)
10248
+ }
10249
+
10250
+
10251
+
10252
+
10200
10253
public enum NotificationSettingsError {
10201
10254
10202
10255
@@ -11495,6 +11548,58 @@ extension RoomListServiceState: Equatable, Hashable {}
11495
11548
11496
11549
11497
11550
11551
+ // Note that we don't yet support `indirect` for enums.
11552
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
11553
+ public enum RoomListServiceSyncIndicator {
11554
+
11555
+ case show
11556
+ case hide
11557
+ }
11558
+
11559
+ public struct FfiConverterTypeRoomListServiceSyncIndicator: FfiConverterRustBuffer {
11560
+ typealias SwiftType = RoomListServiceSyncIndicator
11561
+
11562
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListServiceSyncIndicator {
11563
+ let variant: Int32 = try readInt(&buf)
11564
+ switch variant {
11565
+
11566
+ case 1: return .show
11567
+
11568
+ case 2: return .hide
11569
+
11570
+ default: throw UniffiInternalError.unexpectedEnumCase
11571
+ }
11572
+ }
11573
+
11574
+ public static func write(_ value: RoomListServiceSyncIndicator, into buf: inout [UInt8]) {
11575
+ switch value {
11576
+
11577
+
11578
+ case .show:
11579
+ writeInt(&buf, Int32(1))
11580
+
11581
+
11582
+ case .hide:
11583
+ writeInt(&buf, Int32(2))
11584
+
11585
+ }
11586
+ }
11587
+ }
11588
+
11589
+
11590
+ public func FfiConverterTypeRoomListServiceSyncIndicator_lift(_ buf: RustBuffer) throws -> RoomListServiceSyncIndicator {
11591
+ return try FfiConverterTypeRoomListServiceSyncIndicator.lift(buf)
11592
+ }
11593
+
11594
+ public func FfiConverterTypeRoomListServiceSyncIndicator_lower(_ value: RoomListServiceSyncIndicator) -> RustBuffer {
11595
+ return FfiConverterTypeRoomListServiceSyncIndicator.lower(value)
11596
+ }
11597
+
11598
+
11599
+ extension RoomListServiceSyncIndicator: Equatable, Hashable {}
11600
+
11601
+
11602
+
11498
11603
// Note that we don't yet support `indirect` for enums.
11499
11604
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
11500
11605
public enum RoomNotificationMode {
@@ -13569,6 +13674,113 @@ extension FfiConverterCallbackInterfaceRoomListServiceStateListener : FfiConvert
13569
13674
13570
13675
13571
13676
13677
+ // Declaration and FfiConverters for RoomListServiceSyncIndicatorListener Callback Interface
13678
+
13679
+ public protocol RoomListServiceSyncIndicatorListener : AnyObject {
13680
+ func onUpdate(syncIndicator: RoomListServiceSyncIndicator)
13681
+
13682
+ }
13683
+
13684
+ // The ForeignCallback that is passed to Rust.
13685
+ fileprivate let foreignCallbackCallbackInterfaceRoomListServiceSyncIndicatorListener : ForeignCallback =
13686
+ { (handle: UniFFICallbackHandle, method: Int32, argsData: UnsafePointer<UInt8>, argsLen: Int32, out_buf: UnsafeMutablePointer<RustBuffer>) -> Int32 in
13687
+
13688
+
13689
+ func invokeOnUpdate(_ swiftCallbackInterface: RoomListServiceSyncIndicatorListener, _ argsData: UnsafePointer<UInt8>, _ argsLen: Int32, _ out_buf: UnsafeMutablePointer<RustBuffer>) throws -> Int32 {
13690
+ var reader = createReader(data: Data(bytes: argsData, count: Int(argsLen)))
13691
+ func makeCall() throws -> Int32 {
13692
+ try swiftCallbackInterface.onUpdate(
13693
+ syncIndicator: try FfiConverterTypeRoomListServiceSyncIndicator.read(from: &reader)
13694
+ )
13695
+ return UNIFFI_CALLBACK_SUCCESS
13696
+ }
13697
+ return try makeCall()
13698
+ }
13699
+
13700
+
13701
+ switch method {
13702
+ case IDX_CALLBACK_FREE:
13703
+ FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener.drop(handle: handle)
13704
+ // Sucessful return
13705
+ // See docs of ForeignCallback in `uniffi_core/src/ffi/foreigncallbacks.rs`
13706
+ return UNIFFI_CALLBACK_SUCCESS
13707
+ case 1:
13708
+ let cb: RoomListServiceSyncIndicatorListener
13709
+ do {
13710
+ cb = try FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener.lift(handle)
13711
+ } catch {
13712
+ out_buf.pointee = FfiConverterString.lower("RoomListServiceSyncIndicatorListener: Invalid handle")
13713
+ return UNIFFI_CALLBACK_UNEXPECTED_ERROR
13714
+ }
13715
+ do {
13716
+ return try invokeOnUpdate(cb, argsData, argsLen, out_buf)
13717
+ } catch let error {
13718
+ out_buf.pointee = FfiConverterString.lower(String(describing: error))
13719
+ return UNIFFI_CALLBACK_UNEXPECTED_ERROR
13720
+ }
13721
+
13722
+ // This should never happen, because an out of bounds method index won't
13723
+ // ever be used. Once we can catch errors, we should return an InternalError.
13724
+ // https://github.com/mozilla/uniffi-rs/issues/351
13725
+ default:
13726
+ // An unexpected error happened.
13727
+ // See docs of ForeignCallback in `uniffi_core/src/ffi/foreigncallbacks.rs`
13728
+ return UNIFFI_CALLBACK_UNEXPECTED_ERROR
13729
+ }
13730
+ }
13731
+
13732
+ // FfiConverter protocol for callback interfaces
13733
+ fileprivate struct FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener {
13734
+ private static let initCallbackOnce: () = {
13735
+ // Swift ensures this initializer code will once run once, even when accessed by multiple threads.
13736
+ try! rustCall { (err: UnsafeMutablePointer<RustCallStatus>) in
13737
+ uniffi_matrix_sdk_ffi_fn_init_callback_roomlistservicesyncindicatorlistener(foreignCallbackCallbackInterfaceRoomListServiceSyncIndicatorListener, err)
13738
+ }
13739
+ }()
13740
+
13741
+ private static func ensureCallbackinitialized() {
13742
+ _ = initCallbackOnce
13743
+ }
13744
+
13745
+ static func drop(handle: UniFFICallbackHandle) {
13746
+ handleMap.remove(handle: handle)
13747
+ }
13748
+
13749
+ private static var handleMap = UniFFICallbackHandleMap<RoomListServiceSyncIndicatorListener>()
13750
+ }
13751
+
13752
+ extension FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener : FfiConverter {
13753
+ typealias SwiftType = RoomListServiceSyncIndicatorListener
13754
+ // We can use Handle as the FfiType because it's a typealias to UInt64
13755
+ typealias FfiType = UniFFICallbackHandle
13756
+
13757
+ public static func lift(_ handle: UniFFICallbackHandle) throws -> SwiftType {
13758
+ ensureCallbackinitialized();
13759
+ guard let callback = handleMap.get(handle: handle) else {
13760
+ throw UniffiInternalError.unexpectedStaleHandle
13761
+ }
13762
+ return callback
13763
+ }
13764
+
13765
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
13766
+ ensureCallbackinitialized();
13767
+ let handle: UniFFICallbackHandle = try readInt(&buf)
13768
+ return try lift(handle)
13769
+ }
13770
+
13771
+ public static func lower(_ v: SwiftType) -> UniFFICallbackHandle {
13772
+ ensureCallbackinitialized();
13773
+ return handleMap.insert(obj: v)
13774
+ }
13775
+
13776
+ public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
13777
+ ensureCallbackinitialized();
13778
+ writeInt(&buf, lower(v))
13779
+ }
13780
+ }
13781
+
13782
+
13783
+
13572
13784
// Declaration and FfiConverters for SessionVerificationControllerDelegate Callback Interface
13573
13785
13574
13786
public protocol SessionVerificationControllerDelegate : AnyObject {
@@ -17082,7 +17294,7 @@ private var initializationResult: InitializationResult {
17082
17294
if (uniffi_matrix_sdk_ffi_checksum_method_client_logout() != 16841) {
17083
17295
return InitializationResult.apiChecksumMismatch
17084
17296
}
17085
- if (uniffi_matrix_sdk_ffi_checksum_method_client_notification_client() != 43839 ) {
17297
+ if (uniffi_matrix_sdk_ffi_checksum_method_client_notification_client() != 16860 ) {
17086
17298
return InitializationResult.apiChecksumMismatch
17087
17299
}
17088
17300
if (uniffi_matrix_sdk_ffi_checksum_method_client_restore_session() != 19558) {
@@ -17235,9 +17447,6 @@ private var initializationResult: InitializationResult {
17235
17447
if (uniffi_matrix_sdk_ffi_checksum_method_notificationclientbuilder_finish() != 12382) {
17236
17448
return InitializationResult.apiChecksumMismatch
17237
17449
}
17238
- if (uniffi_matrix_sdk_ffi_checksum_method_notificationclientbuilder_retry_decryption() != 12777) {
17239
- return InitializationResult.apiChecksumMismatch
17240
- }
17241
17450
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_contains_keywords_rules() != 42972) {
17242
17451
return InitializationResult.apiChecksumMismatch
17243
17452
}
@@ -17550,6 +17759,9 @@ private var initializationResult: InitializationResult {
17550
17759
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_state() != 7038) {
17551
17760
return InitializationResult.apiChecksumMismatch
17552
17761
}
17762
+ if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_sync_indicator() != 1112) {
17763
+ return InitializationResult.apiChecksumMismatch
17764
+ }
17553
17765
if (uniffi_matrix_sdk_ffi_checksum_method_roommember_avatar_url() != 9148) {
17554
17766
return InitializationResult.apiChecksumMismatch
17555
17767
}
@@ -17661,7 +17873,7 @@ private var initializationResult: InitializationResult {
17661
17873
if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_finish() != 61604) {
17662
17874
return InitializationResult.apiChecksumMismatch
17663
17875
}
17664
- if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_with_encryption_sync () != 35198 ) {
17876
+ if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_with_cross_process_lock () != 29139 ) {
17665
17877
return InitializationResult.apiChecksumMismatch
17666
17878
}
17667
17879
if (uniffi_matrix_sdk_ffi_checksum_method_taskhandle_cancel() != 59047) {
@@ -17775,6 +17987,9 @@ private var initializationResult: InitializationResult {
17775
17987
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservicestatelistener_on_update() != 27905) {
17776
17988
return InitializationResult.apiChecksumMismatch
17777
17989
}
17990
+ if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservicesyncindicatorlistener_on_update() != 63691) {
17991
+ return InitializationResult.apiChecksumMismatch
17992
+ }
17778
17993
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_accept_verification_request() != 59777) {
17779
17994
return InitializationResult.apiChecksumMismatch
17780
17995
}
0 commit comments