Update dependency org.matrix.rustcomponents:sdk-android to v0.2.33 (#3220)
* Update dependency org.matrix.rustcomponents:sdk-android to v0.2.33 * Fix API breaks --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <jorgem@element.io>
This commit is contained in:
@@ -104,11 +104,6 @@ class JoinedRoomLoadedFlowNode @AssistedInject constructor(
|
||||
inputs.room.subscribeToSync()
|
||||
}
|
||||
},
|
||||
onPause = {
|
||||
appCoroutineScope.launch {
|
||||
inputs.room.unsubscribeFromSync()
|
||||
}
|
||||
},
|
||||
onDestroy = {
|
||||
Timber.v("OnDestroy")
|
||||
appNavigationStateService.onLeavingRoom(id)
|
||||
|
||||
@@ -163,7 +163,7 @@ jsoup = "org.jsoup:jsoup:1.18.1"
|
||||
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
||||
molecule-runtime = "app.cash.molecule:molecule-runtime:2.0.0"
|
||||
timber = "com.jakewharton.timber:timber:5.0.1"
|
||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.32"
|
||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.33"
|
||||
matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
|
||||
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
|
||||
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
|
||||
|
||||
@@ -110,8 +110,6 @@ interface MatrixRoom : Closeable {
|
||||
|
||||
suspend fun subscribeToSync()
|
||||
|
||||
suspend fun unsubscribeFromSync()
|
||||
|
||||
suspend fun powerLevels(): Result<MatrixRoomPowerLevels>
|
||||
|
||||
suspend fun updatePowerLevels(matrixRoomPowerLevels: MatrixRoomPowerLevels): Result<Unit>
|
||||
|
||||
@@ -34,7 +34,7 @@ class RoomSyncSubscriber(
|
||||
private val roomListService: RoomListServiceInterface,
|
||||
private val dispatchers: CoroutineDispatchers,
|
||||
) {
|
||||
private val subscriptionCounts = HashMap<RoomId, Int>()
|
||||
private val subscribedRoomIds = mutableSetOf<RoomId>()
|
||||
private val mutex = Mutex()
|
||||
|
||||
private val settings = RoomSubscription(
|
||||
@@ -54,14 +54,7 @@ class RoomSyncSubscriber(
|
||||
suspend fun subscribe(roomId: RoomId) = mutex.withLock {
|
||||
withContext(dispatchers.io) {
|
||||
try {
|
||||
val currentSubscription = subscriptionCounts.getOrElse(roomId) { 0 }
|
||||
if (currentSubscription == 0) {
|
||||
Timber.d("Subscribing to room $roomId}")
|
||||
roomListService.room(roomId.value).use { roomListItem ->
|
||||
roomListItem.subscribe(settings)
|
||||
}
|
||||
}
|
||||
subscriptionCounts[roomId] = currentSubscription + 1
|
||||
subscribeToRoom(roomId)
|
||||
} catch (exception: Exception) {
|
||||
Timber.e("Failed to subscribe to room $roomId")
|
||||
}
|
||||
@@ -72,14 +65,7 @@ class RoomSyncSubscriber(
|
||||
withContext(dispatchers.io) {
|
||||
for (roomId in roomIds) {
|
||||
try {
|
||||
val currentSubscription = subscriptionCounts.getOrElse(roomId) { 0 }
|
||||
if (currentSubscription == 0) {
|
||||
Timber.d("Subscribing to room $roomId}")
|
||||
roomListService.room(roomId.value).use { roomListItem ->
|
||||
roomListItem.subscribe(settings)
|
||||
}
|
||||
}
|
||||
subscriptionCounts[roomId] = currentSubscription + 1
|
||||
subscribeToRoom(roomId)
|
||||
} catch (cancellationException: CancellationException) {
|
||||
throw cancellationException
|
||||
} catch (exception: Exception) {
|
||||
@@ -89,28 +75,17 @@ class RoomSyncSubscriber(
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun unsubscribe(roomId: RoomId) = mutex.withLock {
|
||||
withContext(dispatchers.io) {
|
||||
try {
|
||||
val currentSubscription = subscriptionCounts.getOrElse(roomId) { 0 }
|
||||
when (currentSubscription) {
|
||||
0 -> return@withContext
|
||||
1 -> {
|
||||
Timber.d("Unsubscribe from room $roomId")
|
||||
roomListService.room(roomId.value).use { roomListItem ->
|
||||
roomListItem.unsubscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
subscriptionCounts[roomId] = currentSubscription - 1
|
||||
} catch (exception: Exception) {
|
||||
Timber.e("Failed to unsubscribe from room $roomId")
|
||||
private fun subscribeToRoom(roomId: RoomId) {
|
||||
if (!isSubscribedTo(roomId)) {
|
||||
Timber.d("Subscribing to room $roomId}")
|
||||
roomListService.room(roomId.value).use { roomListItem ->
|
||||
roomListItem.subscribe(settings)
|
||||
}
|
||||
}
|
||||
subscribedRoomIds.add(roomId)
|
||||
}
|
||||
|
||||
fun isSubscribedTo(roomId: RoomId): Boolean {
|
||||
val subscriptionCount = subscriptionCounts[roomId] ?: return false
|
||||
return subscriptionCount > 0
|
||||
return subscribedRoomIds.contains(roomId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,8 +173,6 @@ class RustMatrixRoom(
|
||||
|
||||
override suspend fun subscribeToSync() = roomSyncSubscriber.subscribe(roomId)
|
||||
|
||||
override suspend fun unsubscribeFromSync() = roomSyncSubscriber.unsubscribe(roomId)
|
||||
|
||||
override suspend fun timelineFocusedOnEvent(eventId: EventId): Result<Timeline> {
|
||||
return runCatching {
|
||||
innerRoom.timelineFocusedOnEvent(
|
||||
@@ -582,7 +580,7 @@ class RustMatrixRoom(
|
||||
room = innerRoom,
|
||||
widgetCapabilitiesProvider = object : WidgetCapabilitiesProvider {
|
||||
override fun acquireCapabilities(capabilities: WidgetCapabilities): WidgetCapabilities {
|
||||
return getElementCallRequiredPermissions(sessionId.value)
|
||||
return getElementCallRequiredPermissions(sessionId.value, sessionData.deviceId)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -226,7 +226,6 @@ class FakeMatrixRoom(
|
||||
|
||||
override suspend fun subscribeToSync() = Unit
|
||||
|
||||
override suspend fun unsubscribeFromSync() = Unit
|
||||
override suspend fun powerLevels(): Result<MatrixRoomPowerLevels> {
|
||||
return powerLevelsResult
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user