refactor: clean up unused code

pull/650/head
andrekir 2023-06-29 21:16:40 -03:00
rodzic 60b13fd020
commit cdea292169
1 zmienionych plików z 0 dodań i 30 usunięć

Wyświetl plik

@ -47,9 +47,6 @@ import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.osmdroid.bonuspack.kml.KmlDocument
import org.osmdroid.views.MapView
import org.osmdroid.views.overlay.FolderOverlay
import java.io.BufferedWriter import java.io.BufferedWriter
import java.io.FileNotFoundException import java.io.FileNotFoundException
import java.io.FileOutputStream import java.io.FileOutputStream
@ -234,7 +231,6 @@ class UIViewModel @Inject constructor(
destNum: Int, destNum: Int,
requestAction: suspend (IMeshService, Int, Int) -> Unit, requestAction: suspend (IMeshService, Int, Int) -> Unit,
errorMessage: String, errorMessage: String,
configType: Int = 0
) = viewModelScope.launch { ) = viewModelScope.launch {
meshService?.let { service -> meshService?.let { service ->
val packetId = service.packetId val packetId = service.packetId
@ -263,14 +259,12 @@ class UIViewModel @Inject constructor(
destNum, destNum,
{ service, packetId, dest -> service.getRemoteConfig(packetId, dest, configType) }, { service, packetId, dest -> service.getRemoteConfig(packetId, dest, configType) },
"Request getConfig error", "Request getConfig error",
configType
) )
fun getModuleConfig(destNum: Int, configType: Int) = request( fun getModuleConfig(destNum: Int, configType: Int) = request(
destNum, destNum,
{ service, packetId, dest -> service.getModuleConfig(packetId, dest, configType) }, { service, packetId, dest -> service.getModuleConfig(packetId, dest, configType) },
"Request getModuleConfig error", "Request getModuleConfig error",
configType
) )
fun setRingtone(destNum: Int, ringtone: String) { fun setRingtone(destNum: Int, ringtone: String) {
@ -726,30 +720,6 @@ class UIViewModel @Inject constructor(
// meshService?.commitEditSettings() // meshService?.commitEditSettings()
} }
fun parseUrl(url: String, map: MapView) {
viewModelScope.launch(Dispatchers.IO) {
parseIt(url, map)
}
}
// For Future Use
// model.parseUrl(
// "https://www.google.com/maps/d/kml?forcekml=1&mid=1FmqWhZG3PG3dY92x9yf2RlREcK7kMZs&lid=-ivSjBCePsM",
// map
// )
private fun parseIt(url: String, map: MapView) {
val kmlDoc = KmlDocument()
try {
kmlDoc.parseKMLUrl(url)
val kmlOverlay = kmlDoc.mKmlRoot.buildOverlay(map, null, null, kmlDoc) as FolderOverlay
kmlDoc.mKmlRoot.mItems
kmlDoc.mKmlRoot.mName
map.overlayManager.overlays().add(kmlOverlay)
} catch (ex: Exception) {
debug("Failed to download .kml $ex")
}
}
fun addQuickChatAction(name: String, value: String, mode: QuickChatAction.Mode) { fun addQuickChatAction(name: String, value: String, mode: QuickChatAction.Mode) {
viewModelScope.launch(Dispatchers.Main) { viewModelScope.launch(Dispatchers.Main) {
val action = QuickChatAction(0, name, value, mode, _quickChatActions.value.size) val action = QuickChatAction(0, name, value, mode, _quickChatActions.value.size)