Skip to content

Commit 6832983

Browse files
committed
Bump to version v1.0.23 (matrix-rust-sdk/main 8e0282a)
1 parent 5a8b528 commit 6832983

File tree

2 files changed

+244
-11
lines changed

2 files changed

+244
-11
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// swift-tools-version:5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33
import PackageDescription
4-
let checksum = "830985c4f7f97895a35c8fd98c4a9d01f2ad9b4efa23e24115ba29266e0f77c5"
5-
let version = "v1.0.22"
4+
let checksum = "79ccc220fc4edc61822092cd2354c207db5dfbdf02ce485c8032f33a3370f179"
5+
let version = "v1.0.23"
66
let url = "https://github.com/element-hq/matrix-rust-components-swift/releases/download/\(version)/MatrixSDKFFI.xcframework.zip"
77
let package = Package(
88
name: "MatrixRustSDK",

Sources/MatrixRustSDK/matrix_sdk_ffi.swift

Lines changed: 242 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,11 @@ public protocol ClientProtocol : AnyObject {
752752
*/
753753
func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplayName: String, deviceDisplayName: String, profileTag: String?, lang: String) async throws
754754

755+
/**
756+
* Returns a handler to start the SSO login process.
757+
*/
758+
func startSsoLogin(redirectUrl: String, idpId: String?) async throws -> SsoHandler
759+
755760
func subscribeToIgnoredUsers(listener: IgnoredUsersListener) -> TaskHandle
756761

757762
/**
@@ -1557,6 +1562,26 @@ open func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplay
15571562
)
15581563
}
15591564

1565+
/**
1566+
* Returns a handler to start the SSO login process.
1567+
*/
1568+
open func startSsoLogin(redirectUrl: String, idpId: String?)async throws -> SsoHandler {
1569+
return
1570+
try await uniffiRustCallAsync(
1571+
rustFutureFunc: {
1572+
uniffi_matrix_sdk_ffi_fn_method_client_start_sso_login(
1573+
self.uniffiClonePointer(),
1574+
FfiConverterString.lower(redirectUrl),FfiConverterOptionString.lower(idpId)
1575+
)
1576+
},
1577+
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
1578+
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
1579+
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
1580+
liftFunc: FfiConverterTypeSsoHandler.lift,
1581+
errorHandler: FfiConverterTypeSsoError.lift
1582+
)
1583+
}
1584+
15601585
open func subscribeToIgnoredUsers(listener: IgnoredUsersListener) -> TaskHandle {
15611586
return try! FfiConverterTypeTaskHandle.lift(try! rustCall() {
15621587
uniffi_matrix_sdk_ffi_fn_method_client_subscribe_to_ignored_users(self.uniffiClonePointer(),
@@ -7731,6 +7756,149 @@ public func FfiConverterTypeSpan_lower(_ value: Span) -> UnsafeMutableRawPointer
77317756

77327757

77337758

7759+
/**
7760+
* An object encapsulating the SSO login flow
7761+
*/
7762+
public protocol SsoHandlerProtocol : AnyObject {
7763+
7764+
/**
7765+
* Completes the SSO login process.
7766+
*/
7767+
func finish(callbackUrl: String) async throws
7768+
7769+
/**
7770+
* Returns the URL for starting SSO authentication. The URL should be
7771+
* opened in a web view. Once the web view succeeds, call `finish` with
7772+
* the callback URL.
7773+
*/
7774+
func url() -> String
7775+
7776+
}
7777+
7778+
/**
7779+
* An object encapsulating the SSO login flow
7780+
*/
7781+
open class SsoHandler:
7782+
SsoHandlerProtocol {
7783+
fileprivate let pointer: UnsafeMutableRawPointer!
7784+
7785+
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
7786+
public struct NoPointer {
7787+
public init() {}
7788+
}
7789+
7790+
// TODO: We'd like this to be `private` but for Swifty reasons,
7791+
// we can't implement `FfiConverter` without making this `required` and we can't
7792+
// make it `required` without making it `public`.
7793+
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
7794+
self.pointer = pointer
7795+
}
7796+
7797+
/// This constructor can be used to instantiate a fake object.
7798+
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
7799+
///
7800+
/// - Warning:
7801+
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
7802+
public init(noPointer: NoPointer) {
7803+
self.pointer = nil
7804+
}
7805+
7806+
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
7807+
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_ssohandler(self.pointer, $0) }
7808+
}
7809+
// No primary constructor declared for this class.
7810+
7811+
deinit {
7812+
guard let pointer = pointer else {
7813+
return
7814+
}
7815+
7816+
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_ssohandler(pointer, $0) }
7817+
}
7818+
7819+
7820+
7821+
7822+
/**
7823+
* Completes the SSO login process.
7824+
*/
7825+
open func finish(callbackUrl: String)async throws {
7826+
return
7827+
try await uniffiRustCallAsync(
7828+
rustFutureFunc: {
7829+
uniffi_matrix_sdk_ffi_fn_method_ssohandler_finish(
7830+
self.uniffiClonePointer(),
7831+
FfiConverterString.lower(callbackUrl)
7832+
)
7833+
},
7834+
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
7835+
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
7836+
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
7837+
liftFunc: { $0 },
7838+
errorHandler: FfiConverterTypeSsoError.lift
7839+
)
7840+
}
7841+
7842+
/**
7843+
* Returns the URL for starting SSO authentication. The URL should be
7844+
* opened in a web view. Once the web view succeeds, call `finish` with
7845+
* the callback URL.
7846+
*/
7847+
open func url() -> String {
7848+
return try! FfiConverterString.lift(try! rustCall() {
7849+
uniffi_matrix_sdk_ffi_fn_method_ssohandler_url(self.uniffiClonePointer(),$0
7850+
)
7851+
})
7852+
}
7853+
7854+
7855+
}
7856+
7857+
public struct FfiConverterTypeSsoHandler: FfiConverter {
7858+
7859+
typealias FfiType = UnsafeMutableRawPointer
7860+
typealias SwiftType = SsoHandler
7861+
7862+
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> SsoHandler {
7863+
return SsoHandler(unsafeFromRawPointer: pointer)
7864+
}
7865+
7866+
public static func lower(_ value: SsoHandler) -> UnsafeMutableRawPointer {
7867+
return value.uniffiClonePointer()
7868+
}
7869+
7870+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SsoHandler {
7871+
let v: UInt64 = try readInt(&buf)
7872+
// The Rust code won't compile if a pointer won't fit in a UInt64.
7873+
// We have to go via `UInt` because that's the thing that's the size of a pointer.
7874+
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
7875+
if (ptr == nil) {
7876+
throw UniffiInternalError.unexpectedNullPointer
7877+
}
7878+
return try lift(ptr!)
7879+
}
7880+
7881+
public static func write(_ value: SsoHandler, into buf: inout [UInt8]) {
7882+
// This fiddling is because `Int` is the thing that's the same size as a pointer.
7883+
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
7884+
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
7885+
}
7886+
}
7887+
7888+
7889+
7890+
7891+
public func FfiConverterTypeSsoHandler_lift(_ pointer: UnsafeMutableRawPointer) throws -> SsoHandler {
7892+
return try FfiConverterTypeSsoHandler.lift(pointer)
7893+
}
7894+
7895+
public func FfiConverterTypeSsoHandler_lower(_ value: SsoHandler) -> UnsafeMutableRawPointer {
7896+
return FfiConverterTypeSsoHandler.lower(value)
7897+
}
7898+
7899+
7900+
7901+
77347902
public protocol SyncServiceProtocol : AnyObject {
77357903

77367904
func roomListService() -> RoomListService
@@ -12463,7 +12631,6 @@ public struct RoomInfo {
1246312631
public var isSpace: Bool
1246412632
public var isTombstoned: Bool
1246512633
public var isFavourite: Bool
12466-
public var isEncrypted: Bool
1246712634
public var canonicalAlias: String?
1246812635
public var alternativeAliases: [String]
1246912636
public var membership: Membership
@@ -12514,7 +12681,7 @@ public struct RoomInfo {
1251412681
*/displayName: String?,
1251512682
/**
1251612683
* Room name as defined by the room state event only.
12517-
*/rawName: String?, topic: String?, avatarUrl: String?, isDirect: Bool, isPublic: Bool, isSpace: Bool, isTombstoned: Bool, isFavourite: Bool, isEncrypted: Bool, canonicalAlias: String?, alternativeAliases: [String], membership: Membership,
12684+
*/rawName: String?, topic: String?, avatarUrl: String?, isDirect: Bool, isPublic: Bool, isSpace: Bool, isTombstoned: Bool, isFavourite: Bool, canonicalAlias: String?, alternativeAliases: [String], membership: Membership,
1251812685
/**
1251912686
* Member who invited the current user to a room that's in the invited
1252012687
* state.
@@ -12547,7 +12714,6 @@ public struct RoomInfo {
1254712714
self.isSpace = isSpace
1254812715
self.isTombstoned = isTombstoned
1254912716
self.isFavourite = isFavourite
12550-
self.isEncrypted = isEncrypted
1255112717
self.canonicalAlias = canonicalAlias
1255212718
self.alternativeAliases = alternativeAliases
1255312719
self.membership = membership
@@ -12603,9 +12769,6 @@ extension RoomInfo: Equatable, Hashable {
1260312769
if lhs.isFavourite != rhs.isFavourite {
1260412770
return false
1260512771
}
12606-
if lhs.isEncrypted != rhs.isEncrypted {
12607-
return false
12608-
}
1260912772
if lhs.canonicalAlias != rhs.canonicalAlias {
1261012773
return false
1261112774
}
@@ -12674,7 +12837,6 @@ extension RoomInfo: Equatable, Hashable {
1267412837
hasher.combine(isSpace)
1267512838
hasher.combine(isTombstoned)
1267612839
hasher.combine(isFavourite)
12677-
hasher.combine(isEncrypted)
1267812840
hasher.combine(canonicalAlias)
1267912841
hasher.combine(alternativeAliases)
1268012842
hasher.combine(membership)
@@ -12711,7 +12873,6 @@ public struct FfiConverterTypeRoomInfo: FfiConverterRustBuffer {
1271112873
isSpace: FfiConverterBool.read(from: &buf),
1271212874
isTombstoned: FfiConverterBool.read(from: &buf),
1271312875
isFavourite: FfiConverterBool.read(from: &buf),
12714-
isEncrypted: FfiConverterBool.read(from: &buf),
1271512876
canonicalAlias: FfiConverterOptionString.read(from: &buf),
1271612877
alternativeAliases: FfiConverterSequenceString.read(from: &buf),
1271712878
membership: FfiConverterTypeMembership.read(from: &buf),
@@ -12744,7 +12905,6 @@ public struct FfiConverterTypeRoomInfo: FfiConverterRustBuffer {
1274412905
FfiConverterBool.write(value.isSpace, into: &buf)
1274512906
FfiConverterBool.write(value.isTombstoned, into: &buf)
1274612907
FfiConverterBool.write(value.isFavourite, into: &buf)
12747-
FfiConverterBool.write(value.isEncrypted, into: &buf)
1274812908
FfiConverterOptionString.write(value.canonicalAlias, into: &buf)
1274912909
FfiConverterSequenceString.write(value.alternativeAliases, into: &buf)
1275012910
FfiConverterTypeMembership.write(value.membership, into: &buf)
@@ -19881,6 +20041,70 @@ public func FfiConverterTypeSessionVerificationData_lower(_ value: SessionVerifi
1988120041

1988220042

1988320043

20044+
20045+
public enum SsoError {
20046+
20047+
20048+
20049+
case CallbackUrlInvalid(message: String)
20050+
20051+
case LoginWithTokenFailed(message: String)
20052+
20053+
case Generic(message: String)
20054+
20055+
}
20056+
20057+
20058+
public struct FfiConverterTypeSsoError: FfiConverterRustBuffer {
20059+
typealias SwiftType = SsoError
20060+
20061+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SsoError {
20062+
let variant: Int32 = try readInt(&buf)
20063+
switch variant {
20064+
20065+
20066+
20067+
20068+
case 1: return .CallbackUrlInvalid(
20069+
message: try FfiConverterString.read(from: &buf)
20070+
)
20071+
20072+
case 2: return .LoginWithTokenFailed(
20073+
message: try FfiConverterString.read(from: &buf)
20074+
)
20075+
20076+
case 3: return .Generic(
20077+
message: try FfiConverterString.read(from: &buf)
20078+
)
20079+
20080+
20081+
default: throw UniffiInternalError.unexpectedEnumCase
20082+
}
20083+
}
20084+
20085+
public static func write(_ value: SsoError, into buf: inout [UInt8]) {
20086+
switch value {
20087+
20088+
20089+
20090+
20091+
case .CallbackUrlInvalid(_ /* message is ignored*/):
20092+
writeInt(&buf, Int32(1))
20093+
case .LoginWithTokenFailed(_ /* message is ignored*/):
20094+
writeInt(&buf, Int32(2))
20095+
case .Generic(_ /* message is ignored*/):
20096+
writeInt(&buf, Int32(3))
20097+
20098+
20099+
}
20100+
}
20101+
}
20102+
20103+
20104+
extension SsoError: Equatable, Hashable {}
20105+
20106+
extension SsoError: Error { }
20107+
1988420108
// Note that we don't yet support `indirect` for enums.
1988520109
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1988620110

@@ -25382,6 +25606,9 @@ private var initializationResult: InitializationResult {
2538225606
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_pusher() != 41975) {
2538325607
return InitializationResult.apiChecksumMismatch
2538425608
}
25609+
if (uniffi_matrix_sdk_ffi_checksum_method_client_start_sso_login() != 34571) {
25610+
return InitializationResult.apiChecksumMismatch
25611+
}
2538525612
if (uniffi_matrix_sdk_ffi_checksum_method_client_subscribe_to_ignored_users() != 23285) {
2538625613
return InitializationResult.apiChecksumMismatch
2538725614
}
@@ -26036,6 +26263,12 @@ private var initializationResult: InitializationResult {
2603626263
if (uniffi_matrix_sdk_ffi_checksum_method_span_is_none() != 33327) {
2603726264
return InitializationResult.apiChecksumMismatch
2603826265
}
26266+
if (uniffi_matrix_sdk_ffi_checksum_method_ssohandler_finish() != 64706) {
26267+
return InitializationResult.apiChecksumMismatch
26268+
}
26269+
if (uniffi_matrix_sdk_ffi_checksum_method_ssohandler_url() != 10889) {
26270+
return InitializationResult.apiChecksumMismatch
26271+
}
2603926272
if (uniffi_matrix_sdk_ffi_checksum_method_syncservice_room_list_service() != 26426) {
2604026273
return InitializationResult.apiChecksumMismatch
2604126274
}

0 commit comments

Comments
 (0)