diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/data/WidgetMessage.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/data/WidgetMessage.kt index df518caeee..0e9ddbe364 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/data/WidgetMessage.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/data/WidgetMessage.kt @@ -33,6 +33,9 @@ data class WidgetMessage( @SerialName("im.vector.hangup") HangUp, + @SerialName("io.element.close") + Close, + @SerialName("send_event") SendEvent, } 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 ac0c89f0fd..47f5682f4c 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 @@ -135,7 +135,7 @@ class CallScreenPresenter @AssistedInject constructor( val parsedMessage = parseMessage(it) if (parsedMessage?.direction == WidgetMessage.Direction.FromWidget) { - if (parsedMessage.action == WidgetMessage.Action.HangUp) { + if (parsedMessage.action == WidgetMessage.Action.Close) { close(callWidgetDriver.value, navigator) } else if (parsedMessage.action == WidgetMessage.Action.SendEvent) { // This event is received when a member joins the call, the first one will be the current one 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 fb894ac9de..ce185bcdfc 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 @@ -174,7 +174,7 @@ class CallScreenPresenterTest { @OptIn(ExperimentalCoroutinesApi::class) @Test - fun `present - a received hang up message closes the screen and stops the widget driver`() = runTest(UnconfinedTestDispatcher()) { + fun `present - a received close message closes the screen and stops the widget driver`() = runTest(UnconfinedTestDispatcher()) { val navigator = FakeCallScreenNavigator() val widgetDriver = FakeMatrixWidgetDriver() val presenter = createCallScreenPresenter( @@ -191,7 +191,7 @@ class CallScreenPresenterTest { val initialState = awaitItem() initialState.eventSink(CallScreenEvents.SetupMessageChannels(messageInterceptor)) - messageInterceptor.givenInterceptedMessage("""{"action":"im.vector.hangup","api":"fromWidget","widgetId":"1","requestId":"1"}""") + messageInterceptor.givenInterceptedMessage("""{"action":"io.element.close","api":"fromWidget","widgetId":"1","requestId":"1"}""") // Let background coroutines run runCurrent()