@@ -30,6 +30,8 @@ import java.nio.CharBuffer
3030import java.nio.charset.CodingErrorAction
3131import java.util.concurrent.atomic.AtomicLong
3232import java.util.concurrent.ConcurrentHashMap
33+ import android.os.Build
34+ import androidx.annotation.RequiresApi
3335import java.util.concurrent.atomic.AtomicBoolean
3436
3537// This is a helper for safely working with byte buffers returned from the Rust code.
@@ -634,7 +636,6 @@ internal object IntegrityCheckingUniffiLib {
634636 init {
635637 Native .register(IntegrityCheckingUniffiLib ::class .java, findLibraryName(componentName = " matrix_sdk" ))
636638 uniffiCheckContractApiVersion(this )
637- uniffiCheckApiChecksums(this )
638639 }
639640 external fun uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url (
640641 ): Short
@@ -779,12 +780,6 @@ private fun uniffiCheckContractApiVersion(lib: IntegrityCheckingUniffiLib) {
779780 throw RuntimeException (" UniFFI contract version mismatch: try cleaning and rebuilding your project" )
780781 }
781782}
782- @Suppress(" UNUSED_PARAMETER" )
783- private fun uniffiCheckApiChecksums (lib : IntegrityCheckingUniffiLib ) {
784- if (lib.uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url() != 47865 .toShort()) {
785- throw RuntimeException (" UniFFI API checksum mismatch: try cleaning and rebuilding your project" )
786- }
787- }
788783
789784/* *
790785 * @suppress
@@ -915,28 +910,28 @@ private class UniffiJnaCleanable(
915910// using Android or not.
916911// There are further runtime checks to chose the correct implementation
917912// of the cleaner.
913+
914+
918915private fun UniffiCleaner.Companion.create (): UniffiCleaner =
919- try {
920- // For safety's sake: if the library hasn't been run in android_cleaner = true
921- // mode, but is being run on Android, then we still need to think about
922- // Android API versions.
923- // So we check if java.lang.ref.Cleaner is there, and use that…
924- java.lang.Class .forName(" java.lang.ref.Cleaner" )
925- JavaLangRefCleaner ()
926- } catch (e: ClassNotFoundException ) {
927- // … otherwise, fallback to the JNA cleaner.
916+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .UPSIDE_DOWN_CAKE ) {
917+ AndroidSystemCleaner ()
918+ } else {
928919 UniffiJnaCleaner ()
929920 }
930921
931- private class JavaLangRefCleaner : UniffiCleaner {
932- val cleaner = java.lang.ref.Cleaner .create()
922+ // The SystemCleaner, available from API Level 33.
923+ // Some API Level 33 OSes do not support using it, so we require API Level 34.
924+ @RequiresApi(Build .VERSION_CODES .UPSIDE_DOWN_CAKE )
925+ private class AndroidSystemCleaner : UniffiCleaner {
926+ val cleaner = android.system.SystemCleaner .cleaner()
933927
934928 override fun register (value : Any , cleanUpTask : Runnable ): UniffiCleaner .Cleanable =
935- JavaLangRefCleanable (cleaner.register(value, cleanUpTask))
929+ AndroidSystemCleanable (cleaner.register(value, cleanUpTask))
936930}
937931
938- private class JavaLangRefCleanable (
939- val cleanable : java.lang.ref.Cleaner .Cleanable
932+ @RequiresApi(Build .VERSION_CODES .UPSIDE_DOWN_CAKE )
933+ private class AndroidSystemCleanable (
934+ private val cleanable : java.lang.ref.Cleaner .Cleanable ,
940935) : UniffiCleaner.Cleanable {
941936 override fun clean () = cleanable.clean()
942937}
@@ -1391,6 +1386,16 @@ data class RoomPowerLevelChanges (
13911386 * The level required to change the space's children.
13921387 */
13931388 var `spaceChild`: kotlin.Long? = null
1389+ ,
1390+ /* *
1391+ * The level required to send a beacon (live location) message event.
1392+ */
1393+ var `beacon`: kotlin.Long? = null
1394+ ,
1395+ /* *
1396+ * The level required to send a beacon info state event.
1397+ */
1398+ var `beaconInfo`: kotlin.Long? = null
13941399
13951400){
13961401
@@ -1418,6 +1423,8 @@ public object FfiConverterTypeRoomPowerLevelChanges: FfiConverterRustBuffer<Room
14181423 FfiConverterOptionalLong .read(buf),
14191424 FfiConverterOptionalLong .read(buf),
14201425 FfiConverterOptionalLong .read(buf),
1426+ FfiConverterOptionalLong .read(buf),
1427+ FfiConverterOptionalLong .read(buf),
14211428 )
14221429 }
14231430
@@ -1432,7 +1439,9 @@ public object FfiConverterTypeRoomPowerLevelChanges: FfiConverterRustBuffer<Room
14321439 FfiConverterOptionalLong .allocationSize(value.`roomName`) +
14331440 FfiConverterOptionalLong .allocationSize(value.`roomAvatar`) +
14341441 FfiConverterOptionalLong .allocationSize(value.`roomTopic`) +
1435- FfiConverterOptionalLong .allocationSize(value.`spaceChild`)
1442+ FfiConverterOptionalLong .allocationSize(value.`spaceChild`) +
1443+ FfiConverterOptionalLong .allocationSize(value.`beacon`) +
1444+ FfiConverterOptionalLong .allocationSize(value.`beaconInfo`)
14361445 )
14371446
14381447 override fun write (value : RoomPowerLevelChanges , buf : ByteBuffer ) {
@@ -1447,6 +1456,8 @@ public object FfiConverterTypeRoomPowerLevelChanges: FfiConverterRustBuffer<Room
14471456 FfiConverterOptionalLong .write(value.`roomAvatar`, buf)
14481457 FfiConverterOptionalLong .write(value.`roomTopic`, buf)
14491458 FfiConverterOptionalLong .write(value.`spaceChild`, buf)
1459+ FfiConverterOptionalLong .write(value.`beacon`, buf)
1460+ FfiConverterOptionalLong .write(value.`beaconInfo`, buf)
14501461 }
14511462}
14521463
@@ -2026,7 +2037,16 @@ enum class Intent {
20262037 /* *
20272038 * The user wants to start a call in a "Direct Message" (DM) room.
20282039 */
2029- START_CALL_DM ;
2040+ START_CALL_DM ,
2041+ /* *
2042+ * The user wants to start a voice call in a "Direct Message" (DM) room.
2043+ */
2044+ START_CALL_DM_VOICE ,
2045+ /* *
2046+ * The user wants to join an existing voice call that is a "Direct
2047+ * Message" (DM) room.
2048+ */
2049+ JOIN_EXISTING_DM_VOICE ;
20302050
20312051
20322052
@@ -2099,6 +2119,92 @@ public object FfiConverterTypeNotificationType: FfiConverterRustBuffer<Notificat
20992119
21002120
21012121
2122+ /* *
2123+ * Status for the pagination on a cache.
2124+ */
2125+ sealed class PaginationStatus {
2126+
2127+ /* *
2128+ * No pagination is happening right now.
2129+ */
2130+ data class Idle (
2131+ /* *
2132+ * Have we hit the start of the timeline, i.e. paginating wouldn't
2133+ * have any effect?
2134+ */
2135+ val `hitTimelineStart`: kotlin.Boolean ) : PaginationStatus()
2136+
2137+ {
2138+
2139+
2140+ companion object
2141+ }
2142+
2143+ /* *
2144+ * Pagination is already running in the background.
2145+ */
2146+ object Paginating : PaginationStatus()
2147+
2148+
2149+
2150+
2151+
2152+
2153+
2154+
2155+
2156+ companion object
2157+ }
2158+
2159+ /* *
2160+ * @suppress
2161+ */
2162+ public object FfiConverterTypePaginationStatus : FfiConverterRustBuffer<PaginationStatus>{
2163+ override fun read (buf : ByteBuffer ): PaginationStatus {
2164+ return when (buf.getInt()) {
2165+ 1 -> PaginationStatus .Idle (
2166+ FfiConverterBoolean .read(buf),
2167+ )
2168+ 2 -> PaginationStatus .Paginating
2169+ else -> throw RuntimeException (" invalid enum value, something is very wrong!!" )
2170+ }
2171+ }
2172+
2173+ override fun allocationSize (value : PaginationStatus ) = when (value) {
2174+ is PaginationStatus .Idle -> {
2175+ // Add the size for the Int that specifies the variant plus the size needed for all fields
2176+ (
2177+ 4UL
2178+ + FfiConverterBoolean .allocationSize(value.`hitTimelineStart`)
2179+ )
2180+ }
2181+ is PaginationStatus .Paginating -> {
2182+ // Add the size for the Int that specifies the variant plus the size needed for all fields
2183+ (
2184+ 4UL
2185+ )
2186+ }
2187+ }
2188+
2189+ override fun write (value : PaginationStatus , buf : ByteBuffer ) {
2190+ when (value) {
2191+ is PaginationStatus .Idle -> {
2192+ buf.putInt(1 )
2193+ FfiConverterBoolean .write(value.`hitTimelineStart`, buf)
2194+ Unit
2195+ }
2196+ is PaginationStatus .Paginating -> {
2197+ buf.putInt(2 )
2198+ Unit
2199+ }
2200+ }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
2201+ }
2202+ }
2203+
2204+
2205+
2206+
2207+
21022208/* *
21032209 * Current state of a [`Paginator`].
21042210 */
@@ -2366,92 +2472,6 @@ public object FfiConverterTypeRoomMemberRole: FfiConverterRustBuffer<RoomMemberR
23662472
23672473
23682474
2369- /* *
2370- * Status for the back-pagination on a room event cache.
2371- */
2372- sealed class RoomPaginationStatus {
2373-
2374- /* *
2375- * No back-pagination is happening right now.
2376- */
2377- data class Idle (
2378- /* *
2379- * Have we hit the start of the timeline, i.e. back-paginating wouldn't
2380- * have any effect?
2381- */
2382- val `hitTimelineStart`: kotlin.Boolean ) : RoomPaginationStatus()
2383-
2384- {
2385-
2386-
2387- companion object
2388- }
2389-
2390- /* *
2391- * Back-pagination is already running in the background.
2392- */
2393- object Paginating : RoomPaginationStatus()
2394-
2395-
2396-
2397-
2398-
2399-
2400-
2401-
2402-
2403- companion object
2404- }
2405-
2406- /* *
2407- * @suppress
2408- */
2409- public object FfiConverterTypeRoomPaginationStatus : FfiConverterRustBuffer<RoomPaginationStatus>{
2410- override fun read (buf : ByteBuffer ): RoomPaginationStatus {
2411- return when (buf.getInt()) {
2412- 1 -> RoomPaginationStatus .Idle (
2413- FfiConverterBoolean .read(buf),
2414- )
2415- 2 -> RoomPaginationStatus .Paginating
2416- else -> throw RuntimeException (" invalid enum value, something is very wrong!!" )
2417- }
2418- }
2419-
2420- override fun allocationSize (value : RoomPaginationStatus ) = when (value) {
2421- is RoomPaginationStatus .Idle -> {
2422- // Add the size for the Int that specifies the variant plus the size needed for all fields
2423- (
2424- 4UL
2425- + FfiConverterBoolean .allocationSize(value.`hitTimelineStart`)
2426- )
2427- }
2428- is RoomPaginationStatus .Paginating -> {
2429- // Add the size for the Int that specifies the variant plus the size needed for all fields
2430- (
2431- 4UL
2432- )
2433- }
2434- }
2435-
2436- override fun write (value : RoomPaginationStatus , buf : ByteBuffer ) {
2437- when (value) {
2438- is RoomPaginationStatus .Idle -> {
2439- buf.putInt(1 )
2440- FfiConverterBoolean .write(value.`hitTimelineStart`, buf)
2441- Unit
2442- }
2443- is RoomPaginationStatus .Paginating -> {
2444- buf.putInt(2 )
2445- Unit
2446- }
2447- }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
2448- }
2449- }
2450-
2451-
2452-
2453-
2454-
24552475
24562476/* *
24572477 * @suppress
0 commit comments