Model native radio call requests and controller dependencies in host fixtures

This commit is contained in:
evgeny committed 2026-10-29 13:34:23 +01:00
1 parent 5823d6f907
commit a5718c4ca9
3 files changed
+26 -7

No files matched your search

@@ -13,6 +13,8 @@ object AppLanguage {
}
object CallController {
data class State(val ongoing: Boolean)
val state = MutableStateFlow<State?>(null)
var media = false
var blocked = false
fun blocksMedia() = blocked
@@ -22,9 +24,7 @@ object CallController {
fun end(id: Long, reason: Int) { endings.add(id to reason); IncomingCallManager.stopRinging() }
}
data class HostRadioCallState(val peerName: String, val channelName: String)
object RadioCallController {
val state = MutableStateFlow<HostRadioCallState?>(null)
val endings = mutableListOf<Long>()
fun end(id: Long) { endings.add(id); IncomingCallManager.stopRinging() }
object StreamController {
var captureBlocked = false
fun blocksCapture() = captureBlocked
}
@@ -7,5 +7,16 @@ object RadioOverlayService {
var synchronizations = 0
fun sync(context: Context) { synchronizations++ }
}
class HostRadioChannel(val id: String)
class ChatRepository { fun getChannels() = listOf(HostRadioChannel("7"), HostRadioChannel("8")) }
class HostRadioChannel(val id: String, val name: String = id)
class HostRadioMember(val nodeId: Long, val name: String)
class ChatRepository {
companion object { var failRadioLookup = false }
fun getChannels(): List<HostRadioChannel> {
check(!failRadioLookup) { "channel lookup failed" }
return listOf(HostRadioChannel("7"), HostRadioChannel("8"))
}
fun getMembers(channel: String): List<HostRadioMember> {
check(!failRadioLookup) { "member lookup failed" }
return listOf(HostRadioMember(99, "Alice"))
}
}
@@ -35,6 +35,14 @@ object LogManager {
/** Только host-тест: считает уведомления standby, не загружает JNI и не запускает ядро. */
object NativeLib {
data class RadioCallCommand(val id: Long, val action: Int, val group: Long, val peer: Long)
val radioCalls = mutableListOf<RadioCallCommand>()
var onRadioCall: (RadioCallCommand) -> Boolean = { true }
fun radioCall(id: Long, action: Int, group: Long = 0, peer: Long = 0): Boolean {
val command = RadioCallCommand(id, action, group, peer)
radioCalls.add(command)
return onRadioCall(command)
}
data class RadioCommand(val kind: String, val group: Long)
val radioCommands: MutableList<RadioCommand> = Collections.synchronizedList(mutableListOf())
@Volatile var radioRequest = 0L