mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 00:48:40 +00:00
Expose the write sides of the current-call and ringing state
`CurrentCallService` and `ActiveCallManager` are read by the whole app but written only by whoever is actually running a call. Writing has so far been reachable only from inside `features/call/impl`, because that is where both implementations live. Adds `CurrentCallTracker` and `RingingCallTracker` to `features/call/api`, so that a call implementation in another module can report the call it is running and answer a ring, without depending on `features/call/impl`. No behaviour change: both interfaces are implemented by the existing classes, and their methods are aliases of methods that already existed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.features.call.test
|
||||
|
||||
import io.element.android.features.call.api.CurrentCall
|
||||
import io.element.android.features.call.api.CurrentCallTracker
|
||||
|
||||
class FakeCurrentCallTracker : CurrentCallTracker {
|
||||
/** Every transition in order, so a test can assert the call was reported before it was cleared. */
|
||||
val calls = mutableListOf<CurrentCall>()
|
||||
|
||||
override fun onCallStarted(call: CurrentCall) {
|
||||
calls += call
|
||||
}
|
||||
|
||||
override fun onCallEnded() {
|
||||
calls += CurrentCall.None
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.features.call.test
|
||||
|
||||
import io.element.android.features.call.api.CallData
|
||||
import io.element.android.features.call.api.RingingCallTracker
|
||||
|
||||
class FakeRingingCallTracker : RingingCallTracker {
|
||||
val joined = mutableListOf<CallData>()
|
||||
val ended = mutableListOf<CallData>()
|
||||
|
||||
override suspend fun onCallJoined(callData: CallData) {
|
||||
joined += callData
|
||||
}
|
||||
|
||||
override suspend fun onCallEnded(callData: CallData) {
|
||||
ended += callData
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user