Handle unavailable channel snapshots in Android media consumers

This commit is contained in:
evgeny committed 2026-10-29 13:34:26 +01:00
1 parent e23f7318ce
commit 2552c57730
3 files changed
+5 -3

No files matched your search

@@ -182,7 +182,7 @@ class AvatarRepository(context: Context, private val memberRepository: MemberRep
log("INFO", "Start account=${AvatarProtocol.hex(uid)} default=$defaultAvatar memoryLimit=32MiB diskLimit=100MiB transfers=2")
val epoch = generation
scope.launch {
val channels = withContext(Dispatchers.IO) { ChatRepository().getChannels() }
val channels = withContext(Dispatchers.IO) { ChatRepository().getChannels() } ?: return@launch
alive(epoch)
channels.forEach { requestMembers(it.id) }
}
@@ -239,7 +239,9 @@ class RadioAudioEngine {
LogManager.addLog("WARN", "radio", "call restore skipped: audio busy group=$group active=$active")
return
}
val exists = ChatRepository().getChannels().any { it.id.toULongOrNull()?.toLong() == group }
val channels = ChatRepository().getChannels()
if (channels == null) { LogManager.addLog("ERROR", "radio", "call restore skipped: channel snapshot unavailable group=$group"); return }
val exists = channels.any { it.id.toULongOrNull()?.toLong() == group }
if (!exists) { LogManager.addLog("WARN", "radio", "call restore skipped: channel removed group=$group"); return }
NativeLib.radioSetActive(group, true)
start(group) { ready ->
@@ -202,7 +202,7 @@ object RadioCallController {
try {
val repo = ChatRepository()
name = repo.getMembers(channelId).firstOrNull { it.nodeId == peer }?.name?.takeIf { it.isNotEmpty() } ?: name
channelName = repo.getChannels().firstOrNull { it.id == channelId }?.name ?: channelId
channelName = repo.getChannels()?.firstOrNull { it.id == channelId }?.name ?: channelId
} catch (e: Exception) {
LogManager.addLog("WARN", "radio", "Call names unavailable id=$id group=$group peer=$peer; using identifiers: $e")
}