@@ -752,6 +752,11 @@ public protocol ClientProtocol : AnyObject {
752
752
*/
753
753
func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplayName: String, deviceDisplayName: String, profileTag: String?, lang: String) async throws
754
754
755
+ /**
756
+ * Returns a handler to start the SSO login process.
757
+ */
758
+ func startSsoLogin(redirectUrl: String, idpId: String?) async throws -> SsoHandler
759
+
755
760
func subscribeToIgnoredUsers(listener: IgnoredUsersListener) -> TaskHandle
756
761
757
762
/**
@@ -1557,6 +1562,26 @@ open func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplay
1557
1562
)
1558
1563
}
1559
1564
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
+
1560
1585
open func subscribeToIgnoredUsers(listener: IgnoredUsersListener) -> TaskHandle {
1561
1586
return try! FfiConverterTypeTaskHandle.lift(try! rustCall() {
1562
1587
uniffi_matrix_sdk_ffi_fn_method_client_subscribe_to_ignored_users(self.uniffiClonePointer(),
@@ -7731,6 +7756,149 @@ public func FfiConverterTypeSpan_lower(_ value: Span) -> UnsafeMutableRawPointer
7731
7756
7732
7757
7733
7758
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
+
7734
7902
public protocol SyncServiceProtocol : AnyObject {
7735
7903
7736
7904
func roomListService() -> RoomListService
@@ -12463,7 +12631,6 @@ public struct RoomInfo {
12463
12631
public var isSpace: Bool
12464
12632
public var isTombstoned: Bool
12465
12633
public var isFavourite: Bool
12466
- public var isEncrypted: Bool
12467
12634
public var canonicalAlias: String?
12468
12635
public var alternativeAliases: [String]
12469
12636
public var membership: Membership
@@ -12514,7 +12681,7 @@ public struct RoomInfo {
12514
12681
*/displayName: String?,
12515
12682
/**
12516
12683
* 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,
12518
12685
/**
12519
12686
* Member who invited the current user to a room that's in the invited
12520
12687
* state.
@@ -12547,7 +12714,6 @@ public struct RoomInfo {
12547
12714
self.isSpace = isSpace
12548
12715
self.isTombstoned = isTombstoned
12549
12716
self.isFavourite = isFavourite
12550
- self.isEncrypted = isEncrypted
12551
12717
self.canonicalAlias = canonicalAlias
12552
12718
self.alternativeAliases = alternativeAliases
12553
12719
self.membership = membership
@@ -12603,9 +12769,6 @@ extension RoomInfo: Equatable, Hashable {
12603
12769
if lhs.isFavourite != rhs.isFavourite {
12604
12770
return false
12605
12771
}
12606
- if lhs.isEncrypted != rhs.isEncrypted {
12607
- return false
12608
- }
12609
12772
if lhs.canonicalAlias != rhs.canonicalAlias {
12610
12773
return false
12611
12774
}
@@ -12674,7 +12837,6 @@ extension RoomInfo: Equatable, Hashable {
12674
12837
hasher.combine(isSpace)
12675
12838
hasher.combine(isTombstoned)
12676
12839
hasher.combine(isFavourite)
12677
- hasher.combine(isEncrypted)
12678
12840
hasher.combine(canonicalAlias)
12679
12841
hasher.combine(alternativeAliases)
12680
12842
hasher.combine(membership)
@@ -12711,7 +12873,6 @@ public struct FfiConverterTypeRoomInfo: FfiConverterRustBuffer {
12711
12873
isSpace: FfiConverterBool.read(from: &buf),
12712
12874
isTombstoned: FfiConverterBool.read(from: &buf),
12713
12875
isFavourite: FfiConverterBool.read(from: &buf),
12714
- isEncrypted: FfiConverterBool.read(from: &buf),
12715
12876
canonicalAlias: FfiConverterOptionString.read(from: &buf),
12716
12877
alternativeAliases: FfiConverterSequenceString.read(from: &buf),
12717
12878
membership: FfiConverterTypeMembership.read(from: &buf),
@@ -12744,7 +12905,6 @@ public struct FfiConverterTypeRoomInfo: FfiConverterRustBuffer {
12744
12905
FfiConverterBool.write(value.isSpace, into: &buf)
12745
12906
FfiConverterBool.write(value.isTombstoned, into: &buf)
12746
12907
FfiConverterBool.write(value.isFavourite, into: &buf)
12747
- FfiConverterBool.write(value.isEncrypted, into: &buf)
12748
12908
FfiConverterOptionString.write(value.canonicalAlias, into: &buf)
12749
12909
FfiConverterSequenceString.write(value.alternativeAliases, into: &buf)
12750
12910
FfiConverterTypeMembership.write(value.membership, into: &buf)
@@ -19881,6 +20041,70 @@ public func FfiConverterTypeSessionVerificationData_lower(_ value: SessionVerifi
19881
20041
19882
20042
19883
20043
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
+
19884
20108
// Note that we don't yet support `indirect` for enums.
19885
20109
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
19886
20110
@@ -25382,6 +25606,9 @@ private var initializationResult: InitializationResult {
25382
25606
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_pusher() != 41975) {
25383
25607
return InitializationResult.apiChecksumMismatch
25384
25608
}
25609
+ if (uniffi_matrix_sdk_ffi_checksum_method_client_start_sso_login() != 34571) {
25610
+ return InitializationResult.apiChecksumMismatch
25611
+ }
25385
25612
if (uniffi_matrix_sdk_ffi_checksum_method_client_subscribe_to_ignored_users() != 23285) {
25386
25613
return InitializationResult.apiChecksumMismatch
25387
25614
}
@@ -26036,6 +26263,12 @@ private var initializationResult: InitializationResult {
26036
26263
if (uniffi_matrix_sdk_ffi_checksum_method_span_is_none() != 33327) {
26037
26264
return InitializationResult.apiChecksumMismatch
26038
26265
}
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
+ }
26039
26272
if (uniffi_matrix_sdk_ffi_checksum_method_syncservice_room_list_service() != 26426) {
26040
26273
return InitializationResult.apiChecksumMismatch
26041
26274
}
0 commit comments