diff --git a/buildSrc/src/main/kotlin/BuildVersionsSDK.kt b/buildSrc/src/main/kotlin/BuildVersionsSDK.kt index 7755c8a..47f9f38 100644 --- a/buildSrc/src/main/kotlin/BuildVersionsSDK.kt +++ b/buildSrc/src/main/kotlin/BuildVersionsSDK.kt @@ -1,5 +1,5 @@ object BuildVersionsSDK { const val majorVersion = 0 const val minorVersion = 2 - const val patchVersion = 53 + const val patchVersion = 54 } diff --git a/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt b/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt index 7953136..31fe538 100644 --- a/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt +++ b/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt @@ -2202,7 +2202,7 @@ internal interface UniffiLib : Library { ): Pointer fun uniffi_matrix_sdk_ffi_fn_free_client(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Unit - fun uniffi_matrix_sdk_ffi_fn_method_client_abort_oidc_login(`ptr`: Pointer,`authorizationData`: Pointer, + fun uniffi_matrix_sdk_ffi_fn_method_client_abort_oidc_auth(`ptr`: Pointer,`authorizationData`: Pointer, ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_account_data(`ptr`: Pointer,`eventType`: RustBuffer.ByValue, ): Long @@ -2238,7 +2238,7 @@ internal interface UniffiLib : Library { ): RustBuffer.ByValue fun uniffi_matrix_sdk_ffi_fn_method_client_get_media_content(`ptr`: Pointer,`mediaSource`: Pointer, ): Long - fun uniffi_matrix_sdk_ffi_fn_method_client_get_media_file(`ptr`: Pointer,`mediaSource`: Pointer,`body`: RustBuffer.ByValue,`mimeType`: RustBuffer.ByValue,`useCache`: Byte,`tempDir`: RustBuffer.ByValue, + fun uniffi_matrix_sdk_ffi_fn_method_client_get_media_file(`ptr`: Pointer,`mediaSource`: Pointer,`filename`: RustBuffer.ByValue,`mimeType`: RustBuffer.ByValue,`useCache`: Byte,`tempDir`: RustBuffer.ByValue, ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_get_media_thumbnail(`ptr`: Pointer,`mediaSource`: Pointer,`width`: Long,`height`: Long, ): Long @@ -2268,6 +2268,8 @@ internal interface UniffiLib : Library { ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_join_room_by_id_or_alias(`ptr`: Pointer,`roomIdOrAlias`: RustBuffer.ByValue,`serverNames`: RustBuffer.ByValue, ): Long + fun uniffi_matrix_sdk_ffi_fn_method_client_knock(`ptr`: Pointer,`roomIdOrAlias`: RustBuffer.ByValue, + ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_login(`ptr`: Pointer,`username`: RustBuffer.ByValue,`password`: RustBuffer.ByValue,`initialDeviceName`: RustBuffer.ByValue,`deviceId`: RustBuffer.ByValue, ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_login_with_email(`ptr`: Pointer,`email`: RustBuffer.ByValue,`password`: RustBuffer.ByValue,`initialDeviceName`: RustBuffer.ByValue,`deviceId`: RustBuffer.ByValue, @@ -2322,7 +2324,7 @@ internal interface UniffiLib : Library { ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_upload_media(`ptr`: Pointer,`mimeType`: RustBuffer.ByValue,`data`: RustBuffer.ByValue,`progressWatcher`: RustBuffer.ByValue, ): Long - fun uniffi_matrix_sdk_ffi_fn_method_client_url_for_oidc_login(`ptr`: Pointer,`oidcConfiguration`: RustBuffer.ByValue, + fun uniffi_matrix_sdk_ffi_fn_method_client_url_for_oidc(`ptr`: Pointer,`oidcConfiguration`: RustBuffer.ByValue,`prompt`: RustBuffer.ByValue, ): Long fun uniffi_matrix_sdk_ffi_fn_method_client_user_id(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue @@ -2424,18 +2426,6 @@ internal interface UniffiLib : Library { ): Long fun uniffi_matrix_sdk_ffi_fn_method_encryption_wait_for_e2ee_initialization_tasks(`ptr`: Pointer, ): Long - fun uniffi_matrix_sdk_ffi_fn_clone_eventshieldsprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_matrix_sdk_ffi_fn_free_eventshieldsprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_matrix_sdk_ffi_fn_method_eventshieldsprovider_get_shields(`ptr`: Pointer,`strict`: Byte,uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue - fun uniffi_matrix_sdk_ffi_fn_clone_eventtimelineitemdebuginfoprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, - ): Pointer - fun uniffi_matrix_sdk_ffi_fn_free_eventtimelineitemdebuginfoprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, - ): Unit - fun uniffi_matrix_sdk_ffi_fn_method_eventtimelineitemdebuginfoprovider_get(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, - ): RustBuffer.ByValue fun uniffi_matrix_sdk_ffi_fn_clone_homeserverlogindetails(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_matrix_sdk_ffi_fn_free_homeserverlogindetails(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -2466,6 +2456,14 @@ internal interface UniffiLib : Library { ): RustBuffer.ByValue fun uniffi_matrix_sdk_ffi_fn_method_inreplytodetails_event_id(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue + fun uniffi_matrix_sdk_ffi_fn_clone_lazytimelineitemprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Pointer + fun uniffi_matrix_sdk_ffi_fn_free_lazytimelineitemprovider(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): Unit + fun uniffi_matrix_sdk_ffi_fn_method_lazytimelineitemprovider_debug_info(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue + fun uniffi_matrix_sdk_ffi_fn_method_lazytimelineitemprovider_get_shields(`ptr`: Pointer,`strict`: Byte,uniffi_out_err: UniffiRustCallStatus, + ): RustBuffer.ByValue fun uniffi_matrix_sdk_ffi_fn_clone_mediafilehandle(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): Pointer fun uniffi_matrix_sdk_ffi_fn_free_mediafilehandle(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -3280,7 +3278,7 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_roommessageeventcontentwithoutrelation_with_mentions( ): Short - fun uniffi_matrix_sdk_ffi_checksum_method_client_abort_oidc_login( + fun uniffi_matrix_sdk_ffi_checksum_method_client_abort_oidc_auth( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_account_data( ): Short @@ -3346,6 +3344,8 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_join_room_by_id_or_alias( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_client_knock( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_login( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_login_with_email( @@ -3400,7 +3400,7 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_upload_media( ): Short - fun uniffi_matrix_sdk_ffi_checksum_method_client_url_for_oidc_login( + fun uniffi_matrix_sdk_ffi_checksum_method_client_url_for_oidc( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_client_user_id( ): Short @@ -3492,10 +3492,6 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_encryption_wait_for_e2ee_initialization_tasks( ): Short - fun uniffi_matrix_sdk_ffi_checksum_method_eventshieldsprovider_get_shields( - ): Short - fun uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitemdebuginfoprovider_get( - ): Short fun uniffi_matrix_sdk_ffi_checksum_method_homeserverlogindetails_sliding_sync_version( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_homeserverlogindetails_supports_oidc_login( @@ -3514,6 +3510,10 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_inreplytodetails_event_id( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_lazytimelineitemprovider_debug_info( + ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_lazytimelineitemprovider_get_shields( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_mediafilehandle_path( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_mediafilehandle_persist( @@ -4113,7 +4113,7 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_roommessageeventcontentwithoutrelation_with_mentions() != 8867.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_abort_oidc_login() != 22230.toShort()) { + if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_abort_oidc_auth() != 6754.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_account_data() != 50433.toShort()) { @@ -4167,7 +4167,7 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_get_media_content() != 40308.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_get_media_file() != 47034.toShort()) { + if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_get_media_file() != 52604.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_get_media_thumbnail() != 52601.toShort()) { @@ -4212,6 +4212,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_join_room_by_id_or_alias() != 18521.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_knock() != 8228.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_login() != 33276.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -4293,7 +4296,7 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_upload_media() != 51195.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_url_for_oidc_login() != 43171.toShort()) { + if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_url_for_oidc() != 30079.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_matrix_sdk_ffi_checksum_method_client_user_id() != 40531.toShort()) { @@ -4431,12 +4434,6 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_encryption_wait_for_e2ee_initialization_tasks() != 41585.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_matrix_sdk_ffi_checksum_method_eventshieldsprovider_get_shields() != 28772.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitemdebuginfoprovider_get() != 57546.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_matrix_sdk_ffi_checksum_method_homeserverlogindetails_sliding_sync_version() != 36573.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -4464,6 +4461,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_inreplytodetails_event_id() != 5876.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_lazytimelineitemprovider_debug_info() != 55450.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_lazytimelineitemprovider_get_shields() != 12518.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_mediafilehandle_path() != 16357.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -5741,7 +5744,7 @@ public interface ClientInterface { * Aborts an existing OIDC login operation that might have been cancelled, * failed etc. */ - suspend fun `abortOidcLogin`(`authorizationData`: OidcAuthorizationData) + suspend fun `abortOidcAuth`(`authorizationData`: OidcAuthorizationData) /** * Get the content of the event of the given type out of the account data @@ -5839,7 +5842,7 @@ public interface ClientInterface { suspend fun `getMediaContent`(`mediaSource`: MediaSource): kotlin.ByteArray - suspend fun `getMediaFile`(`mediaSource`: MediaSource, `body`: kotlin.String?, `mimeType`: kotlin.String, `useCache`: kotlin.Boolean, `tempDir`: kotlin.String?): MediaFileHandle + suspend fun `getMediaFile`(`mediaSource`: MediaSource, `filename`: kotlin.String?, `mimeType`: kotlin.String, `useCache`: kotlin.Boolean, `tempDir`: kotlin.String?): MediaFileHandle suspend fun `getMediaThumbnail`(`mediaSource`: MediaSource, `width`: kotlin.ULong, `height`: kotlin.ULong): kotlin.ByteArray @@ -5904,6 +5907,11 @@ public interface ClientInterface { */ suspend fun `joinRoomByIdOrAlias`(`roomIdOrAlias`: kotlin.String, `serverNames`: List): Room + /** + * Knock on a room to join it using its ID or alias. + */ + suspend fun `knock`(`roomIdOrAlias`: kotlin.String): Room + /** * Login using a username and password. */ @@ -6021,12 +6029,12 @@ public interface ClientInterface { suspend fun `uploadMedia`(`mimeType`: kotlin.String, `data`: kotlin.ByteArray, `progressWatcher`: ProgressWatcher?): kotlin.String /** - * Requests the URL needed for login in a web view using OIDC. Once the web + * Requests the URL needed for opening a web view using OIDC. Once the web * view has succeeded, call `login_with_oidc_callback` with the callback it * returns. If a failure occurs and a callback isn't available, make sure - * to call `abort_oidc_login` to inform the client of this. + * to call `abort_oidc_auth` to inform the client of this. */ - suspend fun `urlForOidcLogin`(`oidcConfiguration`: OidcConfiguration): OidcAuthorizationData + suspend fun `urlForOidc`(`oidcConfiguration`: OidcConfiguration, `prompt`: OidcPrompt): OidcAuthorizationData fun `userId`(): kotlin.String @@ -6125,10 +6133,10 @@ open class Client: Disposable, AutoCloseable, ClientInterface { * failed etc. */ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") - override suspend fun `abortOidcLogin`(`authorizationData`: OidcAuthorizationData) { + override suspend fun `abortOidcAuth`(`authorizationData`: OidcAuthorizationData) { return uniffiRustCallAsync( callWithPointer { thisPtr -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_client_abort_oidc_login( + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_client_abort_oidc_auth( thisPtr, FfiConverterTypeOidcAuthorizationData.lower(`authorizationData`), ) @@ -6526,12 +6534,12 @@ open class Client: Disposable, AutoCloseable, ClientInterface { @Throws(ClientException::class) @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") - override suspend fun `getMediaFile`(`mediaSource`: MediaSource, `body`: kotlin.String?, `mimeType`: kotlin.String, `useCache`: kotlin.Boolean, `tempDir`: kotlin.String?) : MediaFileHandle { + override suspend fun `getMediaFile`(`mediaSource`: MediaSource, `filename`: kotlin.String?, `mimeType`: kotlin.String, `useCache`: kotlin.Boolean, `tempDir`: kotlin.String?) : MediaFileHandle { return uniffiRustCallAsync( callWithPointer { thisPtr -> UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_client_get_media_file( thisPtr, - FfiConverterTypeMediaSource.lower(`mediaSource`),FfiConverterOptionalString.lower(`body`),FfiConverterString.lower(`mimeType`),FfiConverterBoolean.lower(`useCache`),FfiConverterOptionalString.lower(`tempDir`), + FfiConverterTypeMediaSource.lower(`mediaSource`),FfiConverterOptionalString.lower(`filename`),FfiConverterString.lower(`mimeType`),FfiConverterBoolean.lower(`useCache`),FfiConverterOptionalString.lower(`tempDir`), ) }, { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_pointer(future, callback, continuation) }, @@ -6856,6 +6864,30 @@ open class Client: Disposable, AutoCloseable, ClientInterface { } + /** + * Knock on a room to join it using its ID or alias. + */ + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `knock`(`roomIdOrAlias`: kotlin.String) : Room { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_client_knock( + thisPtr, + FfiConverterString.lower(`roomIdOrAlias`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_pointer(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_pointer(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_pointer(future) }, + // lift function + { FfiConverterTypeRoom.lift(it) }, + // Error FFI converter + ClientException.ErrorHandler, + ) + } + + /** * Login using a username and password. */ @@ -7418,19 +7450,19 @@ open class Client: Disposable, AutoCloseable, ClientInterface { /** - * Requests the URL needed for login in a web view using OIDC. Once the web + * Requests the URL needed for opening a web view using OIDC. Once the web * view has succeeded, call `login_with_oidc_callback` with the callback it * returns. If a failure occurs and a callback isn't available, make sure - * to call `abort_oidc_login` to inform the client of this. + * to call `abort_oidc_auth` to inform the client of this. */ @Throws(OidcException::class) @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") - override suspend fun `urlForOidcLogin`(`oidcConfiguration`: OidcConfiguration) : OidcAuthorizationData { + override suspend fun `urlForOidc`(`oidcConfiguration`: OidcConfiguration, `prompt`: OidcPrompt) : OidcAuthorizationData { return uniffiRustCallAsync( callWithPointer { thisPtr -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_client_url_for_oidc_login( + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_client_url_for_oidc( thisPtr, - FfiConverterTypeOidcConfiguration.lower(`oidcConfiguration`), + FfiConverterTypeOidcConfiguration.lower(`oidcConfiguration`),FfiConverterTypeOidcPrompt.lower(`prompt`), ) }, { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_pointer(future, callback, continuation) }, @@ -8957,20 +8989,32 @@ public object FfiConverterTypeEncryption: FfiConverter { // -/** - * Wrapper to retrieve the shields info lazily. - */ -public interface EventShieldsProviderInterface { +public interface HomeserverLoginDetailsInterface { - fun `getShields`(`strict`: kotlin.Boolean): ShieldState? + /** + * The sliding sync version. + */ + fun `slidingSyncVersion`(): SlidingSyncVersion + + /** + * Whether the current homeserver supports login using OIDC. + */ + fun `supportsOidcLogin`(): kotlin.Boolean + + /** + * Whether the current homeserver supports the password login flow. + */ + fun `supportsPasswordLogin`(): kotlin.Boolean + + /** + * The URL of the currently configured homeserver. + */ + fun `url`(): kotlin.String companion object } -/** - * Wrapper to retrieve the shields info lazily. - */ -open class EventShieldsProvider: Disposable, AutoCloseable, EventShieldsProviderInterface { +open class HomeserverLoginDetails: Disposable, AutoCloseable, HomeserverLoginDetailsInterface { constructor(pointer: Pointer) { this.pointer = pointer @@ -9039,7 +9083,7 @@ open class EventShieldsProvider: Disposable, AutoCloseable, EventShieldsProvider override fun run() { pointer?.let { ptr -> uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_eventshieldsprovider(ptr, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_homeserverlogindetails(ptr, status) } } } @@ -9047,16 +9091,19 @@ open class EventShieldsProvider: Disposable, AutoCloseable, EventShieldsProvider fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_eventshieldsprovider(pointer!!, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_homeserverlogindetails(pointer!!, status) } } - override fun `getShields`(`strict`: kotlin.Boolean): ShieldState? { - return FfiConverterOptionalTypeShieldState.lift( + + /** + * The sliding sync version. + */override fun `slidingSyncVersion`(): SlidingSyncVersion { + return FfiConverterTypeSlidingSyncVersion.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_eventshieldsprovider_get_shields( - it, FfiConverterBoolean.lower(`strict`),_status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_sliding_sync_version( + it, _status) } } ) @@ -9064,238 +9111,43 @@ open class EventShieldsProvider: Disposable, AutoCloseable, EventShieldsProvider - - - - companion object - + /** + * Whether the current homeserver supports login using OIDC. + */override fun `supportsOidcLogin`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_supports_oidc_login( + it, _status) } - -public object FfiConverterTypeEventShieldsProvider: FfiConverter { - - override fun lower(value: EventShieldsProvider): Pointer { - return value.uniffiClonePointer() - } - - override fun lift(value: Pointer): EventShieldsProvider { - return EventShieldsProvider(value) - } - - override fun read(buf: ByteBuffer): EventShieldsProvider { - // The Rust code always writes pointers as 8 bytes, and will - // fail to compile if they don't fit. - return lift(Pointer(buf.getLong())) } - - override fun allocationSize(value: EventShieldsProvider) = 8UL - - override fun write(value: EventShieldsProvider, buf: ByteBuffer) { - // The Rust code always expects pointers written as 8 bytes, - // and will fail to compile if they don't fit. - buf.putLong(Pointer.nativeValue(lower(value))) + ) } -} - - -// This template implements a class for working with a Rust struct via a Pointer/Arc -// to the live Rust struct on the other side of the FFI. -// -// Each instance implements core operations for working with the Rust `Arc` and the -// Kotlin Pointer to work with the live Rust struct on the other side of the FFI. -// -// There's some subtlety here, because we have to be careful not to operate on a Rust -// struct after it has been dropped, and because we must expose a public API for freeing -// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are: -// -// * Each instance holds an opaque pointer to the underlying Rust struct. -// Method calls need to read this pointer from the object's state and pass it in to -// the Rust FFI. -// -// * When an instance is no longer needed, its pointer should be passed to a -// special destructor function provided by the Rust FFI, which will drop the -// underlying Rust struct. -// -// * Given an instance, calling code is expected to call the special -// `destroy` method in order to free it after use, either by calling it explicitly -// or by using a higher-level helper like the `use` method. Failing to do so risks -// leaking the underlying Rust struct. -// -// * We can't assume that calling code will do the right thing, and must be prepared -// to handle Kotlin method calls executing concurrently with or even after a call to -// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`. -// -// * We must never allow Rust code to operate on the underlying Rust struct after -// the destructor has been called, and must never call the destructor more than once. -// Doing so may trigger memory unsafety. -// -// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner` -// is implemented to call the destructor when the Kotlin object becomes unreachable. -// This is done in a background thread. This is not a panacea, and client code should be aware that -// 1. the thread may starve if some there are objects that have poorly performing -// `drop` methods or do significant work in their `drop` methods. -// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`, -// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html). -// -// If we try to implement this with mutual exclusion on access to the pointer, there is the -// possibility of a race between a method call and a concurrent call to `destroy`: -// -// * Thread A starts a method call, reads the value of the pointer, but is interrupted -// before it can pass the pointer over the FFI to Rust. -// * Thread B calls `destroy` and frees the underlying Rust struct. -// * Thread A resumes, passing the already-read pointer value to Rust and triggering -// a use-after-free. -// -// One possible solution would be to use a `ReadWriteLock`, with each method call taking -// a read lock (and thus allowed to run concurrently) and the special `destroy` method -// taking a write lock (and thus blocking on live method calls). However, we aim not to -// generate methods with any hidden blocking semantics, and a `destroy` method that might -// block if called incorrectly seems to meet that bar. -// -// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track -// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy` -// has been called. These are updated according to the following rules: -// -// * The initial value of the counter is 1, indicating a live object with no in-flight calls. -// The initial value for the flag is false. -// -// * At the start of each method call, we atomically check the counter. -// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted. -// If it is nonzero them we atomically increment it by 1 and proceed with the method call. -// -// * At the end of each method call, we atomically decrement and check the counter. -// If it has reached zero then we destroy the underlying Rust struct. -// -// * When `destroy` is called, we atomically flip the flag from false to true. -// If the flag was already true we silently fail. -// Otherwise we atomically decrement and check the counter. -// If it has reached zero then we destroy the underlying Rust struct. -// -// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc` works, -// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`. -// -// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been -// called *and* all in-flight method calls have completed, avoiding violating any of the expectations -// of the underlying Rust code. -// -// This makes a cleaner a better alternative to _not_ calling `destroy()` as -// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop` -// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner -// thread may be starved, and the app will leak memory. -// -// In this case, `destroy`ing manually may be a better solution. -// -// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects -// with Rust peers are reclaimed: -// -// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen: -// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then: -// 3. The memory is reclaimed when the process terminates. -// -// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219 -// - - -/** - * Wrapper to retrieve the debug info lazily instead of immediately - * transforming it for each timeline event. - */ -public interface EventTimelineItemDebugInfoProviderInterface { - fun `get`(): EventTimelineItemDebugInfo - - companion object -} - -/** - * Wrapper to retrieve the debug info lazily instead of immediately - * transforming it for each timeline event. - */ -open class EventTimelineItemDebugInfoProvider: Disposable, AutoCloseable, EventTimelineItemDebugInfoProviderInterface { - - constructor(pointer: Pointer) { - this.pointer = pointer - this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) - } + /** - * This constructor can be used to instantiate a fake object. Only used for tests. Any - * attempt to actually use an object constructed this way will fail as there is no - * connected Rust object. - */ - @Suppress("UNUSED_PARAMETER") - constructor(noPointer: NoPointer) { - this.pointer = null - this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer)) - } - - protected val pointer: Pointer? - protected val cleanable: UniffiCleaner.Cleanable - - private val wasDestroyed = AtomicBoolean(false) - private val callCounter = AtomicLong(1) - - override fun destroy() { - // Only allow a single call to this method. - // TODO: maybe we should log a warning if called more than once? - if (this.wasDestroyed.compareAndSet(false, true)) { - // This decrement always matches the initial count of 1 given at creation time. - if (this.callCounter.decrementAndGet() == 0L) { - cleanable.clean() - } - } - } - - @Synchronized - override fun close() { - this.destroy() - } - - internal inline fun callWithPointer(block: (ptr: Pointer) -> R): R { - // Check and increment the call counter, to keep the object alive. - // This needs a compare-and-set retry loop in case of concurrent updates. - do { - val c = this.callCounter.get() - if (c == 0L) { - throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed") - } - if (c == Long.MAX_VALUE) { - throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow") - } - } while (! this.callCounter.compareAndSet(c, c + 1L)) - // Now we can safely do the method call without the pointer being freed concurrently. - try { - return block(this.uniffiClonePointer()) - } finally { - // This decrement always matches the increment we performed above. - if (this.callCounter.decrementAndGet() == 0L) { - cleanable.clean() - } - } - } - - // Use a static inner class instead of a closure so as not to accidentally - // capture `this` as part of the cleanable's action. - private class UniffiCleanAction(private val pointer: Pointer?) : Runnable { - override fun run() { - pointer?.let { ptr -> - uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_eventtimelineitemdebuginfoprovider(ptr, status) - } - } - } + * Whether the current homeserver supports the password login flow. + */override fun `supportsPasswordLogin`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_supports_password_login( + it, _status) +} } - - fun uniffiClonePointer(): Pointer { - return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_eventtimelineitemdebuginfoprovider(pointer!!, status) - } + ) } + - override fun `get`(): EventTimelineItemDebugInfo { - return FfiConverterTypeEventTimelineItemDebugInfo.lift( + + /** + * The URL of the currently configured homeserver. + */override fun `url`(): kotlin.String { + return FfiConverterString.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_eventtimelineitemdebuginfoprovider_get( + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_url( it, _status) } } @@ -9311,25 +9163,25 @@ open class EventTimelineItemDebugInfoProvider: Disposable, AutoCloseable, EventT } -public object FfiConverterTypeEventTimelineItemDebugInfoProvider: FfiConverter { +public object FfiConverterTypeHomeserverLoginDetails: FfiConverter { - override fun lower(value: EventTimelineItemDebugInfoProvider): Pointer { + override fun lower(value: HomeserverLoginDetails): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): EventTimelineItemDebugInfoProvider { - return EventTimelineItemDebugInfoProvider(value) + override fun lift(value: Pointer): HomeserverLoginDetails { + return HomeserverLoginDetails(value) } - override fun read(buf: ByteBuffer): EventTimelineItemDebugInfoProvider { + override fun read(buf: ByteBuffer): HomeserverLoginDetails { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: EventTimelineItemDebugInfoProvider) = 8UL + override fun allocationSize(value: HomeserverLoginDetails) = 8UL - override fun write(value: EventTimelineItemDebugInfoProvider, buf: ByteBuffer) { + override fun write(value: HomeserverLoginDetails, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -9435,32 +9287,31 @@ public object FfiConverterTypeEventTimelineItemDebugInfoProvider: FfiConverter uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_homeserverlogindetails(ptr, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_identityresethandle(ptr, status) } } } @@ -9537,33 +9388,19 @@ open class HomeserverLoginDetails: Disposable, AutoCloseable, HomeserverLoginDet fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_homeserverlogindetails(pointer!!, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_identityresethandle(pointer!!, status) } } /** - * The sliding sync version. - */override fun `slidingSyncVersion`(): SlidingSyncVersion { - return FfiConverterTypeSlidingSyncVersion.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_sliding_sync_version( - it, _status) -} - } - ) - } - - - - /** - * Whether the current homeserver supports login using OIDC. - */override fun `supportsOidcLogin`(): kotlin.Boolean { - return FfiConverterBoolean.lift( + * Get the underlying [`CrossSigningResetAuthType`] this identity reset + * process is using. + */override fun `authType`(): CrossSigningResetAuthType { + return FfiConverterTypeCrossSigningResetAuthType.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_supports_oidc_login( + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_identityresethandle_auth_type( it, _status) } } @@ -9572,34 +9409,56 @@ open class HomeserverLoginDetails: Disposable, AutoCloseable, HomeserverLoginDet - /** - * Whether the current homeserver supports the password login flow. - */override fun `supportsPasswordLogin`(): kotlin.Boolean { - return FfiConverterBoolean.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_supports_password_login( - it, _status) -} - } + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `cancel`() { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_identityresethandle_cancel( + thisPtr, + + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + UniffiNullRustCallStatusErrorHandler, ) } - /** - * The URL of the currently configured homeserver. - */override fun `url`(): kotlin.String { - return FfiConverterString.lift( - callWithPointer { - uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_url( - it, _status) -} - } + * This method starts the identity reset process and + * will go through the following steps: + * + * 1. Disable backing up room keys and delete the active backup + * 2. Disable recovery and delete secret storage + * 3. Go through the cross-signing key reset flow + * 4. Finally, re-enable key backups only if they were enabled before + */ + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `reset`(`auth`: AuthData?) { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_identityresethandle_reset( + thisPtr, + FfiConverterOptionalTypeAuthData.lower(`auth`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + ClientException.ErrorHandler, ) } - @@ -9609,25 +9468,25 @@ open class HomeserverLoginDetails: Disposable, AutoCloseable, HomeserverLoginDet } -public object FfiConverterTypeHomeserverLoginDetails: FfiConverter { +public object FfiConverterTypeIdentityResetHandle: FfiConverter { - override fun lower(value: HomeserverLoginDetails): Pointer { + override fun lower(value: IdentityResetHandle): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): HomeserverLoginDetails { - return HomeserverLoginDetails(value) + override fun lift(value: Pointer): IdentityResetHandle { + return IdentityResetHandle(value) } - override fun read(buf: ByteBuffer): HomeserverLoginDetails { + override fun read(buf: ByteBuffer): IdentityResetHandle { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: HomeserverLoginDetails) = 8UL + override fun allocationSize(value: IdentityResetHandle) = 8UL - override fun write(value: HomeserverLoginDetails, buf: ByteBuffer) { + override fun write(value: IdentityResetHandle, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -9733,31 +9592,16 @@ public object FfiConverterTypeHomeserverLoginDetails: FfiConverter uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_identityresethandle(ptr, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_inreplytodetails(ptr, status) } } } @@ -9834,19 +9678,15 @@ open class IdentityResetHandle: Disposable, AutoCloseable, IdentityResetHandleIn fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_identityresethandle(pointer!!, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_inreplytodetails(pointer!!, status) } } - - /** - * Get the underlying [`CrossSigningResetAuthType`] this identity reset - * process is using. - */override fun `authType`(): CrossSigningResetAuthType { - return FfiConverterTypeCrossSigningResetAuthType.lift( + override fun `event`(): RepliedToEventDetails { + return FfiConverterTypeRepliedToEventDetails.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_identityresethandle_auth_type( + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_inreplytodetails_event( it, _status) } } @@ -9854,57 +9694,17 @@ open class IdentityResetHandle: Disposable, AutoCloseable, IdentityResetHandleIn } - - @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") - override suspend fun `cancel`() { - return uniffiRustCallAsync( - callWithPointer { thisPtr -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_identityresethandle_cancel( - thisPtr, - - ) - }, - { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, - { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, - { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, - // lift function - { Unit }, - - // Error FFI converter - UniffiNullRustCallStatusErrorHandler, - ) + override fun `eventId`(): kotlin.String { + return FfiConverterString.lift( + callWithPointer { + uniffiRustCall() { _status -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_inreplytodetails_event_id( + it, _status) +} } - - - /** - * This method starts the identity reset process and - * will go through the following steps: - * - * 1. Disable backing up room keys and delete the active backup - * 2. Disable recovery and delete secret storage - * 3. Go through the cross-signing key reset flow - * 4. Finally, re-enable key backups only if they were enabled before - */ - @Throws(ClientException::class) - @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") - override suspend fun `reset`(`auth`: AuthData?) { - return uniffiRustCallAsync( - callWithPointer { thisPtr -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_identityresethandle_reset( - thisPtr, - FfiConverterOptionalTypeAuthData.lower(`auth`), - ) - }, - { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, - { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, - { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, - // lift function - { Unit }, - - // Error FFI converter - ClientException.ErrorHandler, ) } + @@ -9914,25 +9714,25 @@ open class IdentityResetHandle: Disposable, AutoCloseable, IdentityResetHandleIn } -public object FfiConverterTypeIdentityResetHandle: FfiConverter { +public object FfiConverterTypeInReplyToDetails: FfiConverter { - override fun lower(value: IdentityResetHandle): Pointer { + override fun lower(value: InReplyToDetails): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): IdentityResetHandle { - return IdentityResetHandle(value) + override fun lift(value: Pointer): InReplyToDetails { + return InReplyToDetails(value) } - override fun read(buf: ByteBuffer): IdentityResetHandle { + override fun read(buf: ByteBuffer): InReplyToDetails { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: IdentityResetHandle) = 8UL + override fun allocationSize(value: InReplyToDetails) = 8UL - override fun write(value: IdentityResetHandle, buf: ByteBuffer) { + override fun write(value: InReplyToDetails, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -10038,16 +9838,28 @@ public object FfiConverterTypeIdentityResetHandle: FfiConverter uniffiRustCall { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_inreplytodetails(ptr, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_free_lazytimelineitemprovider(ptr, status) } } } @@ -10124,15 +9936,18 @@ open class InReplyToDetails: Disposable, AutoCloseable, InReplyToDetailsInterfac fun uniffiClonePointer(): Pointer { return uniffiRustCall() { status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_inreplytodetails(pointer!!, status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_clone_lazytimelineitemprovider(pointer!!, status) } } - override fun `event`(): RepliedToEventDetails { - return FfiConverterTypeRepliedToEventDetails.lift( + + /** + * Returns some debug information for this event timeline item. + */override fun `debugInfo`(): EventTimelineItemDebugInfo { + return FfiConverterTypeEventTimelineItemDebugInfo.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_inreplytodetails_event( + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_lazytimelineitemprovider_debug_info( it, _status) } } @@ -10140,12 +9955,15 @@ open class InReplyToDetails: Disposable, AutoCloseable, InReplyToDetailsInterfac } - override fun `eventId`(): kotlin.String { - return FfiConverterString.lift( + + /** + * Returns the shields for this event timeline item. + */override fun `getShields`(`strict`: kotlin.Boolean): ShieldState? { + return FfiConverterOptionalTypeShieldState.lift( callWithPointer { uniffiRustCall() { _status -> - UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_inreplytodetails_event_id( - it, _status) + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_lazytimelineitemprovider_get_shields( + it, FfiConverterBoolean.lower(`strict`),_status) } } ) @@ -10160,25 +9978,25 @@ open class InReplyToDetails: Disposable, AutoCloseable, InReplyToDetailsInterfac } -public object FfiConverterTypeInReplyToDetails: FfiConverter { +public object FfiConverterTypeLazyTimelineItemProvider: FfiConverter { - override fun lower(value: InReplyToDetails): Pointer { + override fun lower(value: LazyTimelineItemProvider): Pointer { return value.uniffiClonePointer() } - override fun lift(value: Pointer): InReplyToDetails { - return InReplyToDetails(value) + override fun lift(value: Pointer): LazyTimelineItemProvider { + return LazyTimelineItemProvider(value) } - override fun read(buf: ByteBuffer): InReplyToDetails { + override fun read(buf: ByteBuffer): LazyTimelineItemProvider { // The Rust code always writes pointers as 8 bytes, and will // fail to compile if they don't fit. return lift(Pointer(buf.getLong())) } - override fun allocationSize(value: InReplyToDetails) = 8UL + override fun allocationSize(value: LazyTimelineItemProvider) = 8UL - override fun write(value: InReplyToDetails, buf: ByteBuffer) { + override fun write(value: LazyTimelineItemProvider, buf: ByteBuffer) { // The Rust code always expects pointers written as 8 bytes, // and will fail to compile if they don't fit. buf.putLong(Pointer.nativeValue(lower(value))) @@ -22913,7 +22731,9 @@ public object FfiConverterTypeEmoteMessageContent: FfiConverterRustBuffer, - var `debugInfoProvider`: EventTimelineItemDebugInfoProvider, var `localSendState`: EventSendState?, var `readReceipts`: Map, var `origin`: EventItemOrigin?, var `canBeRepliedTo`: kotlin.Boolean, - var `shieldsProvider`: EventShieldsProvider + var `lazyProvider`: LazyTimelineItemProvider ) : Disposable { @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here override fun destroy() { - Disposable.destroy(this.`isLocal`) - Disposable.destroy(this.`isRemote`) Disposable.destroy(this.`eventOrTransactionId`) @@ -22954,8 +22771,6 @@ data class EventTimelineItem ( Disposable.destroy(this.`reactions`) - Disposable.destroy(this.`debugInfoProvider`) - Disposable.destroy(this.`localSendState`) Disposable.destroy(this.`readReceipts`) @@ -22964,7 +22779,7 @@ data class EventTimelineItem ( Disposable.destroy(this.`canBeRepliedTo`) - Disposable.destroy(this.`shieldsProvider`) + Disposable.destroy(this.`lazyProvider`) } @@ -22974,7 +22789,6 @@ data class EventTimelineItem ( public object FfiConverterTypeEventTimelineItem: FfiConverterRustBuffer { override fun read(buf: ByteBuffer): EventTimelineItem { return EventTimelineItem( - FfiConverterBoolean.read(buf), FfiConverterBoolean.read(buf), FfiConverterTypeEventOrTransactionId.read(buf), FfiConverterString.read(buf), @@ -22984,17 +22798,15 @@ public object FfiConverterTypeEventTimelineItem: FfiConverterRustBuffer +sealed class OidcPrompt { + + /** + * The Authorization Server must not display any authentication or consent + * user interface pages. + */ + object None : OidcPrompt() + + + /** + * The Authorization Server should prompt the End-User for + * reauthentication. + */ + object Login : OidcPrompt() + + + /** + * The Authorization Server should prompt the End-User for consent before + * returning information to the Client. + */ + object Consent : OidcPrompt() + + + /** + * The Authorization Server should prompt the End-User to select a user + * account. + * + * This enables an End-User who has multiple accounts at the Authorization + * Server to select amongst the multiple accounts that they might have + * current sessions for. + */ + object SelectAccount : OidcPrompt() + + + /** + * The Authorization Server should prompt the End-User to create a user + * account. + * + * Defined in [Initiating User Registration via OpenID Connect](https://openid.net/specs/openid-connect-prompt-create-1_0.html). + */ + object Create : OidcPrompt() + + + /** + * An unknown value. + */ + data class Unknown( + val `value`: kotlin.String) : OidcPrompt() { + companion object + } + + + + companion object +} + +public object FfiConverterTypeOidcPrompt : FfiConverterRustBuffer{ + override fun read(buf: ByteBuffer): OidcPrompt { + return when(buf.getInt()) { + 1 -> OidcPrompt.None + 2 -> OidcPrompt.Login + 3 -> OidcPrompt.Consent + 4 -> OidcPrompt.SelectAccount + 5 -> OidcPrompt.Create + 6 -> OidcPrompt.Unknown( + FfiConverterString.read(buf), + ) + else -> throw RuntimeException("invalid enum value, something is very wrong!!") + } + } + + override fun allocationSize(value: OidcPrompt) = when(value) { + is OidcPrompt.None -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is OidcPrompt.Login -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is OidcPrompt.Consent -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is OidcPrompt.SelectAccount -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is OidcPrompt.Create -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + ) + } + is OidcPrompt.Unknown -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4UL + + FfiConverterString.allocationSize(value.`value`) + ) + } + } + + override fun write(value: OidcPrompt, buf: ByteBuffer) { + when(value) { + is OidcPrompt.None -> { + buf.putInt(1) + Unit + } + is OidcPrompt.Login -> { + buf.putInt(2) + Unit + } + is OidcPrompt.Consent -> { + buf.putInt(3) + Unit + } + is OidcPrompt.SelectAccount -> { + buf.putInt(4) + Unit + } + is OidcPrompt.Create -> { + buf.putInt(5) + Unit + } + is OidcPrompt.Unknown -> { + buf.putInt(6) + FfiConverterString.write(value.`value`, buf) + Unit + } + }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ } + } +} + + + + + sealed class OtherState { object PolicyRuleRoom : OtherState()