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 7156a3e603..be6eb8e470 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 @@ -71,7 +71,6 @@ class CallScreenPresenter @AssistedInject constructor( private val isInWidgetMode = callType is CallType.RoomCall private val userAgent = userAgentProvider.provide() - private var notifiedCallStart = false @Composable override fun present(): CallScreenState { @@ -225,9 +224,7 @@ class CallScreenPresenter @AssistedInject constructor( coroutineScope.launch { client.syncService().syncState .collect { state -> - if (state == SyncState.Running) { - client.notifyCallStartIfNeeded(callType.roomId) - } else { + if (state != SyncState.Running) { appForegroundStateService.updateIsInCallState(true) } } @@ -239,13 +236,6 @@ class CallScreenPresenter @AssistedInject constructor( } } - private suspend fun MatrixClient.notifyCallStartIfNeeded(roomId: RoomId) { - if (!notifiedCallStart) { - getJoinedRoom(roomId)?.use { it.sendCallNotificationIfNeeded() } - ?.onSuccess { notifiedCallStart = true } - } - } - private fun parseMessage(message: String): WidgetMessage? { return WidgetMessageSerializer.deserialize(message).getOrNull() } diff --git a/features/call/impl/src/test/kotlin/io/element/android/features/call/ui/CallScreenPresenterTest.kt b/features/call/impl/src/test/kotlin/io/element/android/features/call/ui/CallScreenPresenterTest.kt index 43a1e7ceba..97f3e81add 100644 --- a/features/call/impl/src/test/kotlin/io/element/android/features/call/ui/CallScreenPresenterTest.kt +++ b/features/call/impl/src/test/kotlin/io/element/android/features/call/ui/CallScreenPresenterTest.kt @@ -81,19 +81,12 @@ import kotlin.time.Duration.Companion.seconds } @Test - fun `present - with CallType RoomCall sets call as active, loads URL, runs WidgetDriver and notifies the other clients a call started`() = runTest { - val sendCallNotificationIfNeededLambda = lambdaRecorder> { Result.success(Unit) } - val syncService = FakeSyncService(SyncState.Running) - val fakeRoom = FakeJoinedRoom(sendCallNotificationIfNeededResult = sendCallNotificationIfNeededLambda) - val client = FakeMatrixClient(syncService = syncService).apply { - givenGetRoomResult(A_ROOM_ID, fakeRoom) - } + fun `present - with CallType RoomCall sets call as active, loads URL, and runs WidgetDriver`() = runTest { val widgetDriver = FakeMatrixWidgetDriver() val widgetProvider = FakeCallWidgetProvider(widgetDriver) val analyticsLambda = lambdaRecorder {} val joinedCallLambda = lambdaRecorder {} val presenter = createCallScreenPresenter( - matrixClientsProvider = FakeMatrixClientProvider(getClient = { Result.success(client) }), callType = CallType.RoomCall(A_SESSION_ID, A_ROOM_ID), widgetDriver = widgetDriver, widgetProvider = widgetProvider, @@ -115,7 +108,6 @@ import kotlin.time.Duration.Companion.seconds assertThat(widgetProvider.getWidgetCalled).isTrue() assertThat(widgetDriver.runCalledCount).isEqualTo(1) analyticsLambda.assertions().isCalledOnce().with(value(MobileScreen.ScreenName.RoomCall)) - sendCallNotificationIfNeededLambda.assertions().isCalledOnce() // Wait until the WidgetDriver is loaded skipItems(1) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt index 4373721b70..7fbb4068e0 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt @@ -156,11 +156,6 @@ interface JoinedRoom : BaseRoom { */ fun getWidgetDriver(widgetSettings: MatrixWidgetSettings): Result - /** - * Send an Element Call started notification if needed. - */ - suspend fun sendCallNotificationIfNeeded(): Result - suspend fun setSendQueueEnabled(enabled: Boolean) /** 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 d01675bb29..3d622e51f0 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 @@ -426,12 +426,6 @@ class JoinedRustRoom( } } - override suspend fun sendCallNotificationIfNeeded(): Result = withContext(roomDispatcher) { - runCatching { - innerRoom.sendCallNotificationIfNeeded() - } - } - override suspend fun setSendQueueEnabled(enabled: Boolean) { withContext(roomDispatcher) { Timber.d("setSendQueuesEnabled: $enabled") diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt index 64d0a800d6..833d8ceaa4 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt @@ -55,7 +55,6 @@ class FakeJoinedRoom( private val roomNotificationSettingsService: FakeNotificationSettingsService = FakeNotificationSettingsService(), private var createTimelineResult: (CreateTimelineParams) -> Result = { lambdaError() }, private val editMessageLambda: (EventId, String, String?, List) -> Result = { _, _, _, _ -> lambdaError() }, - private val sendCallNotificationIfNeededResult: () -> Result = { lambdaError() }, private val progressCallbackValues: List> = emptyList(), private val generateWidgetWebViewUrlResult: (MatrixWidgetSettings, String, String?, String?) -> Result = { _, _, _, _ -> lambdaError() }, private val getWidgetDriverResult: (MatrixWidgetSettings) -> Result = { lambdaError() }, @@ -207,10 +206,6 @@ class FakeJoinedRoom( return getWidgetDriverResult(widgetSettings) } - override suspend fun sendCallNotificationIfNeeded(): Result = simulateLongTask { - sendCallNotificationIfNeededResult() - } - override suspend fun setSendQueueEnabled(enabled: Boolean) = simulateLongTask { setSendQueueEnabledResult(enabled) }