Skip to content

Commit 0c35ad7

Browse files
authored
Merge pull request #4297 from robintown/ec-close
Show error screens in group calls
2 parents aed134b + 09231ff commit 0c35ad7

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/data/WidgetMessage.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ data class WidgetMessage(
3333
@SerialName("im.vector.hangup")
3434
HangUp,
3535

36+
@SerialName("io.element.close")
37+
Close,
38+
3639
@SerialName("send_event")
3740
SendEvent,
3841
}

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/CallScreenPresenter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class CallScreenPresenter @AssistedInject constructor(
135135

136136
val parsedMessage = parseMessage(it)
137137
if (parsedMessage?.direction == WidgetMessage.Direction.FromWidget) {
138-
if (parsedMessage.action == WidgetMessage.Action.HangUp) {
138+
if (parsedMessage.action == WidgetMessage.Action.Close) {
139139
close(callWidgetDriver.value, navigator)
140140
} else if (parsedMessage.action == WidgetMessage.Action.SendEvent) {
141141
// This event is received when a member joins the call, the first one will be the current one

features/call/impl/src/test/kotlin/io/element/android/features/call/ui/CallScreenPresenterTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class CallScreenPresenterTest {
174174

175175
@OptIn(ExperimentalCoroutinesApi::class)
176176
@Test
177-
fun `present - a received hang up message closes the screen and stops the widget driver`() = runTest(UnconfinedTestDispatcher()) {
177+
fun `present - a received close message closes the screen and stops the widget driver`() = runTest(UnconfinedTestDispatcher()) {
178178
val navigator = FakeCallScreenNavigator()
179179
val widgetDriver = FakeMatrixWidgetDriver()
180180
val presenter = createCallScreenPresenter(
@@ -191,7 +191,7 @@ class CallScreenPresenterTest {
191191
val initialState = awaitItem()
192192
initialState.eventSink(CallScreenEvents.SetupMessageChannels(messageInterceptor))
193193

194-
messageInterceptor.givenInterceptedMessage("""{"action":"im.vector.hangup","api":"fromWidget","widgetId":"1","requestId":"1"}""")
194+
messageInterceptor.givenInterceptedMessage("""{"action":"io.element.close","api":"fromWidget","widgetId":"1","requestId":"1"}""")
195195

196196
// Let background coroutines run
197197
runCurrent()

0 commit comments

Comments
 (0)