mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(regression): replace lost ringtone and canned message handling (#2672)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
a83724a5a8
commit
e471636dd1
2 changed files with 23 additions and 17 deletions
|
|
@ -103,7 +103,6 @@ import kotlinx.coroutines.flow.catch
|
|||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
import java.util.Random
|
||||
import java.util.UUID
|
||||
|
|
@ -233,7 +232,7 @@ class MeshService :
|
|||
private val notificationSummary: String
|
||||
get() =
|
||||
when (connectionRouter.connectionState.value) {
|
||||
ConnectionState.CONNECTED -> getString(R.string.connected_count, numOnlineNodes)
|
||||
ConnectionState.CONNECTED -> getString(R.string.connected_count, numOnlineNodes.toString())
|
||||
ConnectionState.DISCONNECTED -> getString(R.string.disconnected)
|
||||
ConnectionState.DEVICE_SLEEP -> getString(R.string.device_sleeping)
|
||||
ConnectionState.CONNECTING -> getString(R.string.connecting_to_device)
|
||||
|
|
@ -436,7 +435,7 @@ class MeshService :
|
|||
* switching to a new device connection to prevent state from a previous session from affecting the new one. It
|
||||
* ensures a clean slate for node information, configurations, pending operations, and cached data.
|
||||
*/
|
||||
private fun resetState() = serviceScope.launch {
|
||||
private fun resetState() = serviceScope.handledLaunch {
|
||||
debug("Discarding NodeDB and resetting all service state for new device connection")
|
||||
clearDatabases()
|
||||
// Core Node and Config data
|
||||
|
|
@ -465,6 +464,10 @@ class MeshService :
|
|||
|
||||
batteryPercentCooldowns.clear()
|
||||
|
||||
radioConfigRepository.clearChannelSet()
|
||||
radioConfigRepository.clearLocalConfig()
|
||||
radioConfigRepository.clearLocalModuleConfig()
|
||||
|
||||
info("MeshService state has been reset for a new device session.")
|
||||
}
|
||||
|
||||
|
|
@ -1550,11 +1553,6 @@ class MeshService :
|
|||
),
|
||||
)
|
||||
rawMyNodeInfo = myInfo
|
||||
serviceScope.handledLaunch {
|
||||
radioConfigRepository.clearChannelSet()
|
||||
radioConfigRepository.clearLocalConfig()
|
||||
radioConfigRepository.clearLocalModuleConfig()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleDeviceUiConfig(deviceuiConfig: DeviceUIProtos.DeviceUIConfig) {
|
||||
|
|
@ -1967,20 +1965,28 @@ class MeshService :
|
|||
)
|
||||
}
|
||||
|
||||
override fun setRingtone(destNum: Int, ringtone: String?) {
|
||||
TODO("Not yet implemented")
|
||||
override fun setRingtone(destNum: Int, ringtone: String) = toRemoteExceptions {
|
||||
sendToRadio(newMeshPacketTo(destNum).buildAdminPacket { setRingtoneMessage = ringtone })
|
||||
}
|
||||
|
||||
override fun getRingtone(requestId: Int, destNum: Int) {
|
||||
TODO("Not yet implemented")
|
||||
override fun getRingtone(id: Int, destNum: Int) = toRemoteExceptions {
|
||||
sendToRadio(
|
||||
newMeshPacketTo(destNum).buildAdminPacket(id = id, wantResponse = true) {
|
||||
getRingtoneRequest = true
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override fun setCannedMessages(destNum: Int, messages: String?) {
|
||||
TODO("Not yet implemented")
|
||||
override fun setCannedMessages(destNum: Int, messages: String) = toRemoteExceptions {
|
||||
sendToRadio(newMeshPacketTo(destNum).buildAdminPacket { setCannedMessageModuleMessages = messages })
|
||||
}
|
||||
|
||||
override fun getCannedMessages(requestId: Int, destNum: Int) {
|
||||
TODO("Not yet implemented")
|
||||
override fun getCannedMessages(id: Int, destNum: Int) = toRemoteExceptions {
|
||||
sendToRadio(
|
||||
newMeshPacketTo(destNum).buildAdminPacket(id = id, wantResponse = true) {
|
||||
getCannedMessageModuleMessagesRequest = true
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override fun setChannel(payload: ByteArray) = toRemoteExceptions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue