Skip to content

Commit ce5fc7d

Browse files
committed
chore: update matrix-rust-sdk to 0.14.1
1 parent a78a622 commit ce5fc7d

15 files changed

Lines changed: 12691 additions & 9504 deletions

File tree

android/src/main/java/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt

Lines changed: 3084 additions & 1400 deletions
Large diffs are not rendered by default.

android/src/main/java/uniffi/matrix_sdk/matrix_sdk.kt

Lines changed: 135 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,47 @@ public object FfiConverterTypeRoomPowerLevelChanges: FfiConverterRustBuffer<Room
15351535

15361536

15371537

1538+
/**
1539+
* Information about the server vendor obtained from the federation API.
1540+
*/
1541+
data class ServerVendorInfo (
1542+
/**
1543+
* The server name.
1544+
*/
1545+
var `serverName`: kotlin.String,
1546+
/**
1547+
* The server version.
1548+
*/
1549+
var `version`: kotlin.String
1550+
) {
1551+
1552+
companion object
1553+
}
1554+
1555+
/**
1556+
* @suppress
1557+
*/
1558+
public object FfiConverterTypeServerVendorInfo: FfiConverterRustBuffer<ServerVendorInfo> {
1559+
override fun read(buf: ByteBuffer): ServerVendorInfo {
1560+
return ServerVendorInfo(
1561+
FfiConverterString.read(buf),
1562+
FfiConverterString.read(buf),
1563+
)
1564+
}
1565+
1566+
override fun allocationSize(value: ServerVendorInfo) = (
1567+
FfiConverterString.allocationSize(value.`serverName`) +
1568+
FfiConverterString.allocationSize(value.`version`)
1569+
)
1570+
1571+
override fun write(value: ServerVendorInfo, buf: ByteBuffer) {
1572+
FfiConverterString.write(value.`serverName`, buf)
1573+
FfiConverterString.write(value.`version`, buf)
1574+
}
1575+
}
1576+
1577+
1578+
15381579
/**
15391580
* Properties to create a new virtual Element Call widget.
15401581
*/
@@ -1657,7 +1698,12 @@ data class VirtualElementCallWidgetOptions (
16571698
* - `false`: the webview shows a a list of devices injected by the
16581699
* client. (used on ios & android)
16591700
*/
1660-
var `controlledMediaDevices`: kotlin.Boolean
1701+
var `controlledMediaDevices`: kotlin.Boolean,
1702+
/**
1703+
* Whether and what type of notification Element Call should send, when
1704+
* starting a call.
1705+
*/
1706+
var `sendNotificationType`: NotificationType?
16611707
) {
16621708

16631709
companion object
@@ -1689,6 +1735,7 @@ public object FfiConverterTypeVirtualElementCallWidgetOptions: FfiConverterRustB
16891735
FfiConverterOptionalString.read(buf),
16901736
FfiConverterOptionalString.read(buf),
16911737
FfiConverterBoolean.read(buf),
1738+
FfiConverterOptionalTypeNotificationType.read(buf),
16921739
)
16931740
}
16941741

@@ -1712,7 +1759,8 @@ public object FfiConverterTypeVirtualElementCallWidgetOptions: FfiConverterRustB
17121759
FfiConverterOptionalString.allocationSize(value.`rageshakeSubmitUrl`) +
17131760
FfiConverterOptionalString.allocationSize(value.`sentryDsn`) +
17141761
FfiConverterOptionalString.allocationSize(value.`sentryEnvironment`) +
1715-
FfiConverterBoolean.allocationSize(value.`controlledMediaDevices`)
1762+
FfiConverterBoolean.allocationSize(value.`controlledMediaDevices`) +
1763+
FfiConverterOptionalTypeNotificationType.allocationSize(value.`sendNotificationType`)
17161764
)
17171765

17181766
override fun write(value: VirtualElementCallWidgetOptions, buf: ByteBuffer) {
@@ -1736,6 +1784,7 @@ public object FfiConverterTypeVirtualElementCallWidgetOptions: FfiConverterRustB
17361784
FfiConverterOptionalString.write(value.`sentryDsn`, buf)
17371785
FfiConverterOptionalString.write(value.`sentryEnvironment`, buf)
17381786
FfiConverterBoolean.write(value.`controlledMediaDevices`, buf)
1787+
FfiConverterOptionalTypeNotificationType.write(value.`sendNotificationType`, buf)
17391788
}
17401789
}
17411790

@@ -1978,6 +2027,45 @@ public object FfiConverterTypeIntent: FfiConverterRustBuffer<Intent> {
19782027

19792028

19802029

2030+
/**
2031+
* Types of call notifications.
2032+
*/
2033+
2034+
enum class NotificationType {
2035+
2036+
/**
2037+
* The receiving client should display a visual notification.
2038+
*/
2039+
NOTIFICATION,
2040+
/**
2041+
* The receiving client should ring with an audible sound.
2042+
*/
2043+
RING;
2044+
companion object
2045+
}
2046+
2047+
2048+
/**
2049+
* @suppress
2050+
*/
2051+
public object FfiConverterTypeNotificationType: FfiConverterRustBuffer<NotificationType> {
2052+
override fun read(buf: ByteBuffer) = try {
2053+
NotificationType.values()[buf.getInt() - 1]
2054+
} catch (e: IndexOutOfBoundsException) {
2055+
throw RuntimeException("invalid enum value, something is very wrong!!", e)
2056+
}
2057+
2058+
override fun allocationSize(value: NotificationType) = 4UL
2059+
2060+
override fun write(value: NotificationType, buf: ByteBuffer) {
2061+
buf.putInt(value.ordinal + 1)
2062+
}
2063+
}
2064+
2065+
2066+
2067+
2068+
19812069
/**
19822070
* Current state of a [`Paginator`].
19832071
*/
@@ -2166,6 +2254,19 @@ public object FfiConverterTypeQRCodeLoginError : FfiConverterRustBuffer<QrCodeLo
21662254

21672255
enum class RoomMemberRole {
21682256

2257+
/**
2258+
* The member is a creator.
2259+
*
2260+
* A creator has an infinite power level and cannot be demoted, so this
2261+
* role is immutable. A room can have several creators.
2262+
*
2263+
* It is available in room versions where
2264+
* `explicitly_privilege_room_creators` in [`AuthorizationRules`] is set to
2265+
* `true`.
2266+
*
2267+
* [`AuthorizationRules`]: ruma::room_version_rules::AuthorizationRules
2268+
*/
2269+
CREATOR,
21692270
/**
21702271
* The member is an administrator.
21712272
*/
@@ -2470,3 +2571,35 @@ public object FfiConverterOptionalTypeIntent: FfiConverterRustBuffer<Intent?> {
24702571
}
24712572
}
24722573

2574+
2575+
2576+
2577+
/**
2578+
* @suppress
2579+
*/
2580+
public object FfiConverterOptionalTypeNotificationType: FfiConverterRustBuffer<NotificationType?> {
2581+
override fun read(buf: ByteBuffer): NotificationType? {
2582+
if (buf.get().toInt() == 0) {
2583+
return null
2584+
}
2585+
return FfiConverterTypeNotificationType.read(buf)
2586+
}
2587+
2588+
override fun allocationSize(value: NotificationType?): ULong {
2589+
if (value == null) {
2590+
return 1UL
2591+
} else {
2592+
return 1UL + FfiConverterTypeNotificationType.allocationSize(value)
2593+
}
2594+
}
2595+
2596+
override fun write(value: NotificationType?, buf: ByteBuffer) {
2597+
if (value == null) {
2598+
buf.put(0)
2599+
} else {
2600+
buf.put(1)
2601+
FfiConverterTypeNotificationType.write(value, buf)
2602+
}
2603+
}
2604+
}
2605+

android/src/main/java/uniffi/matrix_sdk_ui/matrix_sdk_ui.kt

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,29 @@ inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
976976
* */
977977
object NoPointer
978978

979+
/**
980+
* @suppress
981+
*/
982+
public object FfiConverterBoolean: FfiConverter<Boolean, Byte> {
983+
override fun lift(value: Byte): Boolean {
984+
return value.toInt() != 0
985+
}
986+
987+
override fun read(buf: ByteBuffer): Boolean {
988+
return lift(buf.get())
989+
}
990+
991+
override fun lower(value: Boolean): Byte {
992+
return if (value) 1.toByte() else 0.toByte()
993+
}
994+
995+
override fun allocationSize(value: Boolean) = 1UL
996+
997+
override fun write(value: Boolean, buf: ByteBuffer) {
998+
buf.put(lower(value))
999+
}
1000+
}
1001+
9791002
/**
9801003
* @suppress
9811004
*/
@@ -1123,3 +1146,67 @@ public object FfiConverterTypeRoomPinnedEventsChange: FfiConverterRustBuffer<Roo
11231146

11241147

11251148

1149+
1150+
1151+
sealed class SpaceRoomListPaginationState {
1152+
1153+
data class Idle(
1154+
val `endReached`: kotlin.Boolean) : SpaceRoomListPaginationState() {
1155+
companion object
1156+
}
1157+
1158+
object Loading : SpaceRoomListPaginationState()
1159+
1160+
1161+
1162+
1163+
companion object
1164+
}
1165+
1166+
/**
1167+
* @suppress
1168+
*/
1169+
public object FfiConverterTypeSpaceRoomListPaginationState : FfiConverterRustBuffer<SpaceRoomListPaginationState>{
1170+
override fun read(buf: ByteBuffer): SpaceRoomListPaginationState {
1171+
return when(buf.getInt()) {
1172+
1 -> SpaceRoomListPaginationState.Idle(
1173+
FfiConverterBoolean.read(buf),
1174+
)
1175+
2 -> SpaceRoomListPaginationState.Loading
1176+
else -> throw RuntimeException("invalid enum value, something is very wrong!!")
1177+
}
1178+
}
1179+
1180+
override fun allocationSize(value: SpaceRoomListPaginationState) = when(value) {
1181+
is SpaceRoomListPaginationState.Idle -> {
1182+
// Add the size for the Int that specifies the variant plus the size needed for all fields
1183+
(
1184+
4UL
1185+
+ FfiConverterBoolean.allocationSize(value.`endReached`)
1186+
)
1187+
}
1188+
is SpaceRoomListPaginationState.Loading -> {
1189+
// Add the size for the Int that specifies the variant plus the size needed for all fields
1190+
(
1191+
4UL
1192+
)
1193+
}
1194+
}
1195+
1196+
override fun write(value: SpaceRoomListPaginationState, buf: ByteBuffer) {
1197+
when(value) {
1198+
is SpaceRoomListPaginationState.Idle -> {
1199+
buf.putInt(1)
1200+
FfiConverterBoolean.write(value.`endReached`, buf)
1201+
Unit
1202+
}
1203+
is SpaceRoomListPaginationState.Loading -> {
1204+
buf.putInt(2)
1205+
Unit
1206+
}
1207+
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
1208+
}
1209+
}
1210+
1211+
1212+

0 commit comments

Comments
 (0)