Skip to content

Commit 73b1199

Browse files
committed
Bump to v1.1.10 (matrix-rust-sdk 64bdbdcbaad92f8e5e4e751979932d4b9921c853)
1 parent c6b3c6c commit 73b1199

File tree

2 files changed

+242
-27
lines changed

2 files changed

+242
-27
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let checksum = "00b339b00b3ee66423735db557cac825d928dae6dfbce9ef807db79372d7c6fd"
7-
let version = "v1.1.9"
6+
let checksum = "3632af5c80d8cf89b5d019d500c24371101589cccfb8a2f093dc6cdce8be2bdf"
7+
let version = "v1.1.10"
88
let url = "https://github.com/matrix-org/matrix-rust-components-swift/releases/download/\(version)/MatrixSDKFFI.xcframework.zip"
99

1010
let package = Package(

Sources/MatrixRustSDK/matrix_sdk_ffi.swift

Lines changed: 240 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ public protocol ClientProtocol {
610610
func ignoreUser(userId: String) throws
611611
func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) throws
612612
func logout() throws -> String?
613-
func notificationClient() throws -> NotificationClientBuilder
613+
func notificationClient(processSetup: NotificationProcessSetup) throws -> NotificationClientBuilder
614614
func restoreSession(session: Session) throws
615615
func rooms() -> [Room]
616616
func searchUsers(searchTerm: String, limit: UInt64) throws -> SearchUsersResults
@@ -841,11 +841,12 @@ public class Client: ClientProtocol {
841841
)
842842
}
843843

844-
public func notificationClient() throws -> NotificationClientBuilder {
844+
public func notificationClient(processSetup: NotificationProcessSetup) throws -> NotificationClientBuilder {
845845
return try FfiConverterTypeNotificationClientBuilder.lift(
846846
try
847847
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
849850
)
850851
}
851852
)
@@ -1950,7 +1951,6 @@ public func FfiConverterTypeNotificationClient_lower(_ value: NotificationClient
19501951
public protocol NotificationClientBuilderProtocol {
19511952
func filterByPushRules() -> NotificationClientBuilder
19521953
func finish() -> NotificationClient
1953-
func retryDecryption(withCrossProcessLock: Bool) -> NotificationClientBuilder
19541954

19551955
}
19561956

@@ -1991,18 +1991,6 @@ public class NotificationClientBuilder: NotificationClientBuilderProtocol {
19911991

19921992
uniffi_matrix_sdk_ffi_fn_method_notificationclientbuilder_finish(self.pointer, $0
19931993
)
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-
)
20061994
}
20071995
)
20081996
}
@@ -3978,6 +3966,7 @@ public protocol RoomListServiceProtocol {
39783966
func invites() async throws -> RoomList
39793967
func room(roomId: String) throws -> RoomListItem
39803968
func state(listener: RoomListServiceStateListener) -> TaskHandle
3969+
func syncIndicator(listener: RoomListServiceSyncIndicatorListener) -> TaskHandle
39813970

39823971
}
39833972

@@ -4092,6 +4081,18 @@ public class RoomListService: RoomListServiceProtocol {
40924081
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_state(self.pointer,
40934082
FfiConverterCallbackInterfaceRoomListServiceStateListener.lower(listener),$0
40944083
)
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+
)
40954096
}
40964097
)
40974098
}
@@ -5131,7 +5132,7 @@ public func FfiConverterTypeSyncService_lower(_ value: SyncService) -> UnsafeMut
51315132

51325133
public protocol SyncServiceBuilderProtocol {
51335134
func finish() async throws -> SyncService
5134-
func withEncryptionSync(withCrossProcessLock: Bool, appIdentifier: String?) -> SyncServiceBuilder
5135+
func withCrossProcessLock(appIdentifier: String?) -> SyncServiceBuilder
51355136

51365137
}
51375138

@@ -5178,13 +5179,12 @@ public class SyncServiceBuilder: SyncServiceBuilderProtocol {
51785179

51795180

51805181

5181-
public func withEncryptionSync(withCrossProcessLock: Bool, appIdentifier: String?) -> SyncServiceBuilder {
5182+
public func withCrossProcessLock(appIdentifier: String?) -> SyncServiceBuilder {
51825183
return try! FfiConverterTypeSyncServiceBuilder.lift(
51835184
try!
51845185
rustCall() {
51855186

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,
51885188
FfiConverterOptionString.lower(appIdentifier),$0
51895189
)
51905190
}
@@ -10197,6 +10197,59 @@ public func FfiConverterTypeNotificationEvent_lower(_ value: NotificationEvent)
1019710197

1019810198

1019910199

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+
1020010253
public enum NotificationSettingsError {
1020110254

1020210255

@@ -11495,6 +11548,58 @@ extension RoomListServiceState: Equatable, Hashable {}
1149511548

1149611549

1149711550

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+
1149811603
// Note that we don't yet support `indirect` for enums.
1149911604
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1150011605
public enum RoomNotificationMode {
@@ -13569,6 +13674,113 @@ extension FfiConverterCallbackInterfaceRoomListServiceStateListener : FfiConvert
1356913674

1357013675

1357113676

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+
1357213784
// Declaration and FfiConverters for SessionVerificationControllerDelegate Callback Interface
1357313785

1357413786
public protocol SessionVerificationControllerDelegate : AnyObject {
@@ -17082,7 +17294,7 @@ private var initializationResult: InitializationResult {
1708217294
if (uniffi_matrix_sdk_ffi_checksum_method_client_logout() != 16841) {
1708317295
return InitializationResult.apiChecksumMismatch
1708417296
}
17085-
if (uniffi_matrix_sdk_ffi_checksum_method_client_notification_client() != 43839) {
17297+
if (uniffi_matrix_sdk_ffi_checksum_method_client_notification_client() != 16860) {
1708617298
return InitializationResult.apiChecksumMismatch
1708717299
}
1708817300
if (uniffi_matrix_sdk_ffi_checksum_method_client_restore_session() != 19558) {
@@ -17235,9 +17447,6 @@ private var initializationResult: InitializationResult {
1723517447
if (uniffi_matrix_sdk_ffi_checksum_method_notificationclientbuilder_finish() != 12382) {
1723617448
return InitializationResult.apiChecksumMismatch
1723717449
}
17238-
if (uniffi_matrix_sdk_ffi_checksum_method_notificationclientbuilder_retry_decryption() != 12777) {
17239-
return InitializationResult.apiChecksumMismatch
17240-
}
1724117450
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_contains_keywords_rules() != 42972) {
1724217451
return InitializationResult.apiChecksumMismatch
1724317452
}
@@ -17550,6 +17759,9 @@ private var initializationResult: InitializationResult {
1755017759
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_state() != 7038) {
1755117760
return InitializationResult.apiChecksumMismatch
1755217761
}
17762+
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_sync_indicator() != 1112) {
17763+
return InitializationResult.apiChecksumMismatch
17764+
}
1755317765
if (uniffi_matrix_sdk_ffi_checksum_method_roommember_avatar_url() != 9148) {
1755417766
return InitializationResult.apiChecksumMismatch
1755517767
}
@@ -17661,7 +17873,7 @@ private var initializationResult: InitializationResult {
1766117873
if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_finish() != 61604) {
1766217874
return InitializationResult.apiChecksumMismatch
1766317875
}
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) {
1766517877
return InitializationResult.apiChecksumMismatch
1766617878
}
1766717879
if (uniffi_matrix_sdk_ffi_checksum_method_taskhandle_cancel() != 59047) {
@@ -17775,6 +17987,9 @@ private var initializationResult: InitializationResult {
1777517987
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservicestatelistener_on_update() != 27905) {
1777617988
return InitializationResult.apiChecksumMismatch
1777717989
}
17990+
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservicesyncindicatorlistener_on_update() != 63691) {
17991+
return InitializationResult.apiChecksumMismatch
17992+
}
1777817993
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_accept_verification_request() != 59777) {
1777917994
return InitializationResult.apiChecksumMismatch
1778017995
}

0 commit comments

Comments
 (0)