diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/CallScreenPresenter.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/CallScreenPresenter.kt index 68243193f4..7156a3e603 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/CallScreenPresenter.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/CallScreenPresenter.kt @@ -241,7 +241,7 @@ class CallScreenPresenter @AssistedInject constructor( private suspend fun MatrixClient.notifyCallStartIfNeeded(roomId: RoomId) { if (!notifiedCallStart) { - getJoinedRoom(roomId)?.sendCallNotificationIfNeeded() + getJoinedRoom(roomId)?.use { it.sendCallNotificationIfNeeded() } ?.onSuccess { notifiedCallStart = true } } } diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/DefaultCallWidgetProvider.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/DefaultCallWidgetProvider.kt index 1b6538e196..30977eb05f 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/DefaultCallWidgetProvider.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/DefaultCallWidgetProvider.kt @@ -47,8 +47,11 @@ class DefaultCallWidgetProvider @Inject constructor( theme = theme, ).getOrThrow() + val driver = room.getWidgetDriver(widgetSettings).getOrThrow() + room.destroy() + CallWidgetProvider.GetWidgetResult( - driver = room.getWidgetDriver(widgetSettings).getOrThrow(), + driver = driver, url = callUrl, ) } diff --git a/features/share/impl/src/main/kotlin/io/element/android/features/share/impl/SharePresenter.kt b/features/share/impl/src/main/kotlin/io/element/android/features/share/impl/SharePresenter.kt index 483b56aaa0..d46fb22ef4 100644 --- a/features/share/impl/src/main/kotlin/io/element/android/features/share/impl/SharePresenter.kt +++ b/features/share/impl/src/main/kotlin/io/element/android/features/share/impl/SharePresenter.kt @@ -86,6 +86,7 @@ class SharePresenter @AssistedInject constructor( ).isSuccess } .all { it } + .also { room.destroy() } } .all { it } } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt index 37fec422ee..da5ad50bc9 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt @@ -639,9 +639,11 @@ class JoinedRustRoom( } } + override fun close() = destroy() + override fun destroy() { baseRoom.destroy() - liveInnerTimeline.close() + liveInnerTimeline.destroy() roomCoroutineScope.cancel() } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustBaseRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustBaseRoom.kt index 0be2f49ce6..c9a1629e7b 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustBaseRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustBaseRoom.kt @@ -94,6 +94,8 @@ class RustBaseRoom( } } + override fun close() = destroy() + override fun destroy() { innerRoom.destroy() }