From f7b80ca89bf2ca6317c256aeb70bb847e799b0b6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 12 Feb 2026 16:27:55 +0100 Subject: [PATCH] Fix documentation --- .../impl/receivers/DeclineCallBroadcastReceiver.kt | 2 +- .../features/call/impl/ui/CallScreenPresenter.kt | 2 +- .../features/call/impl/ui/IncomingCallActivity.kt | 2 +- .../features/call/impl/utils/ActiveCallManager.kt | 9 +++++---- .../call/utils/DefaultActiveCallManagerTest.kt | 10 +++++----- .../features/call/utils/FakeActiveCallManager.kt | 6 +++--- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/receivers/DeclineCallBroadcastReceiver.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/receivers/DeclineCallBroadcastReceiver.kt index d2cbb0184d..902c4d7d8d 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/receivers/DeclineCallBroadcastReceiver.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/receivers/DeclineCallBroadcastReceiver.kt @@ -40,7 +40,7 @@ class DeclineCallBroadcastReceiver : BroadcastReceiver() { ?: return context.bindings().inject(this) appCoroutineScope.launch { - activeCallManager.hungUpCall(callType = CallType.RoomCall(notificationData.sessionId, notificationData.roomId)) + activeCallManager.hangUpCall(callType = CallType.RoomCall(notificationData.sessionId, notificationData.roomId)) } } } 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 497b121da5..ba670e03aa 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 @@ -100,7 +100,7 @@ class CallScreenPresenter( ) } onDispose { - appCoroutineScope.launch { activeCallManager.hungUpCall(callType) } + appCoroutineScope.launch { activeCallManager.hangUpCall(callType) } } } diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/IncomingCallActivity.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/IncomingCallActivity.kt index 714360a702..faedd2648c 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/IncomingCallActivity.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/IncomingCallActivity.kt @@ -118,7 +118,7 @@ class IncomingCallActivity : AppCompatActivity() { private fun onCancel() { val activeCall = activeCallManager.activeCall.value ?: return appCoroutineScope.launch { - activeCallManager.hungUpCall(callType = activeCall.callType) + activeCallManager.hangUpCall(callType = activeCall.callType) } } } diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/ActiveCallManager.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/ActiveCallManager.kt index 4183e22531..2c0e2e7742 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/ActiveCallManager.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/ActiveCallManager.kt @@ -72,10 +72,10 @@ interface ActiveCallManager { suspend fun registerIncomingCall(notificationData: CallNotificationData) /** - * Called when the active call has been hung up. It will remove any existing UI and the active call. - * @param callType The type of call that the user hung up, either an external url one or a room one. + * Called to hang up the active call. It will hang up the call and remove any existing UI and the active call. + * @param callType The type of call that the user hangs up, either an external url one or a room one. */ - suspend fun hungUpCall(callType: CallType) + suspend fun hangUpCall(callType: CallType) /** * Called after the user joined a call. It will remove any existing UI and set the call state as [CallState.InCall]. @@ -192,8 +192,9 @@ class DefaultActiveCallManager( } } - override suspend fun hungUpCall(callType: CallType) = mutex.withLock { + override suspend fun hangUpCall(callType: CallType) = mutex.withLock { Timber.tag(tag).d("Hung up call: $callType") + Timber.tag(tag).d("Hang up call: $callType") val currentActiveCall = activeCall.value ?: run { Timber.tag(tag).w("No active call, ignoring hang up") return@withLock diff --git a/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/DefaultActiveCallManagerTest.kt b/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/DefaultActiveCallManagerTest.kt index df14b4b423..2fac7634d7 100644 --- a/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/DefaultActiveCallManagerTest.kt +++ b/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/DefaultActiveCallManagerTest.kt @@ -155,7 +155,7 @@ class DefaultActiveCallManagerTest { } @Test - fun `hungUpCall - removes existing call if the CallType matches`() = runTest { + fun `hangUpCall - removes existing call if the CallType matches`() = runTest { setupShadowPowerManager() val notificationManagerCompat = mockk(relaxed = true) val manager = createActiveCallManager(notificationManagerCompat = notificationManagerCompat) @@ -165,7 +165,7 @@ class DefaultActiveCallManagerTest { assertThat(manager.activeCall.value).isNotNull() assertThat(manager.activeWakeLock?.isHeld).isTrue() - manager.hungUpCall(CallType.RoomCall(notificationData.sessionId, notificationData.roomId)) + manager.hangUpCall(CallType.RoomCall(notificationData.sessionId, notificationData.roomId)) assertThat(manager.activeCall.value).isNull() assertThat(manager.activeWakeLock?.isHeld).isFalse() @@ -192,7 +192,7 @@ class DefaultActiveCallManagerTest { val notificationData = aCallNotificationData(roomId = A_ROOM_ID) manager.registerIncomingCall(notificationData) - manager.hungUpCall(CallType.RoomCall(notificationData.sessionId, notificationData.roomId)) + manager.hangUpCall(CallType.RoomCall(notificationData.sessionId, notificationData.roomId)) coVerify { room.declineCall(notificationEventId = notificationData.eventId) @@ -269,7 +269,7 @@ class DefaultActiveCallManagerTest { } @Test - fun `hungUpCall - does nothing if the CallType doesn't match`() = runTest { + fun `hangUpCall - does nothing if the CallType doesn't match`() = runTest { setupShadowPowerManager() val notificationManagerCompat = mockk(relaxed = true) val manager = createActiveCallManager(notificationManagerCompat = notificationManagerCompat) @@ -278,7 +278,7 @@ class DefaultActiveCallManagerTest { assertThat(manager.activeCall.value).isNotNull() assertThat(manager.activeWakeLock?.isHeld).isTrue() - manager.hungUpCall(CallType.ExternalUrl("https://example.com")) + manager.hangUpCall(CallType.ExternalUrl("https://example.com")) assertThat(manager.activeCall.value).isNotNull() assertThat(manager.activeWakeLock?.isHeld).isTrue() diff --git a/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/FakeActiveCallManager.kt b/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/FakeActiveCallManager.kt index 74bd1c36ac..14b252e572 100644 --- a/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/FakeActiveCallManager.kt +++ b/features/call/impl/src/test/kotlin/io/element/android/features/call/utils/FakeActiveCallManager.kt @@ -17,7 +17,7 @@ import kotlinx.coroutines.flow.MutableStateFlow class FakeActiveCallManager( var registerIncomingCallResult: (CallNotificationData) -> Unit = {}, - var hungUpCallResult: (CallType) -> Unit = {}, + var hangUpCallResult: (CallType) -> Unit = {}, var joinedCallResult: (CallType) -> Unit = {}, ) : ActiveCallManager { override val activeCall = MutableStateFlow(null) @@ -26,8 +26,8 @@ class FakeActiveCallManager( registerIncomingCallResult(notificationData) } - override suspend fun hungUpCall(callType: CallType) = simulateLongTask { - hungUpCallResult(callType) + override suspend fun hangUpCall(callType: CallType) = simulateLongTask { + hangUpCallResult(callType) } override suspend fun joinedCall(callType: CallType) = simulateLongTask {