sync commit

This commit is contained in:
Martin Ptáček
2023-05-03 22:49:22 +02:00
parent 8852ecc74a
commit 6728c72503
3 changed files with 28 additions and 29 deletions

View File

@@ -211,4 +211,14 @@ private fun PushProxPage(
)
}
}
}
}
//TODO asap: 4 screens: loading, file error, file loaded, file missing - already implemented
@Composable
private fun LoadingPage(){
val progress : Float by remember { mutableStateOf(0.0f) }
//TODO finish this thing
}
//TODO
//https://foso.github.io/Jetpack-Compose-Playground/material/circularprogressindicator/

View File

@@ -30,22 +30,11 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.io.StringWriter
//TODO
//https://www.geeksforgeeks.org/how-to-launch-an-application-automatically-on-system-boot-up-in-android/
// reference android app architecture
//https://github.dev/google-developer-training/basic-android-kotlin-compose-training-unscramble
// reference for sharing the view model accross whole application
class MainActivity : ComponentActivity() {
private val collectorRegistry: CollectorRegistry = CollectorRegistry()
private lateinit var metricsEngine: MetricsEngine
private lateinit var customExporter: AndroidCustomExporter
private var pushProxStarted : Boolean = false
private lateinit var pushProxClient : PushProxClient
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -81,21 +70,13 @@ class MainActivity : ComponentActivity() {
promViewModel = promViewModel,
)
}
composable("homepage") { HomePage(navController = navController, promViewModel = promViewModel) }
composable("homepage") {
HomePage(
navController = navController,
promViewModel = promViewModel
)
}
composable("license") { LicensePage(navController = navController)}
}
}}
// private fun initialize (){
// metricsEngine = MetricsEngine(this.applicationContext)
// customExporter = AndroidCustomExporter(metricsEngine).register(collectorRegistry)
// }
//
// private suspend fun reallyCollectMetrics() : String {
// delay(500)
// val writer = StringWriter()
// TextFormat.write004(writer, collectorRegistry.metricFamilySamples())
// return writer.toString()
// }
}
}

View File

@@ -11,6 +11,13 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import java.io.StringWriter
enum class ConfigFileState {
LOADING,
ERROR, // file not found or was not parsed
MISSING,
SUCCESS
}
data class PromUiState(
val tabIndex : Int = 0,
val serverTurnedOn : Boolean = false,
@@ -18,6 +25,7 @@ data class PromUiState(
val serverPort : Int? = null, // if null, use default port
val fqdn : String = "",
val pushProxURL : String = "",
val configFileState : ConfigFileState = ConfigFileState.LOADING,
)
private val TAG : String = "PROMVIEWMODEL"