Compare commits
No commits in common. "86338e6e1fd4624c389d32a53e5dee1de9b109ec" and "7e5673f96e145ed9127149a22dd23a4ffb5061f5" have entirely different histories.
86338e6e1f
...
7e5673f96e
4 changed files with 4 additions and 89 deletions
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
package ru.nm17.narodmon
|
package ru.nm17.narodmon
|
||||||
|
|
||||||
import android.content.pm.ApplicationInfo
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
|
@ -48,7 +47,6 @@ import kotlinx.coroutines.launch
|
||||||
import ru.nm17.narodmon.db.AppDatabase
|
import ru.nm17.narodmon.db.AppDatabase
|
||||||
import ru.nm17.narodmon.db.entities.KVSetting
|
import ru.nm17.narodmon.db.entities.KVSetting
|
||||||
import ru.nm17.narodmon.ui.dialogs.AgreementDialog
|
import ru.nm17.narodmon.ui.dialogs.AgreementDialog
|
||||||
import ru.nm17.narodmon.ui.dialogs.UuidDialog
|
|
||||||
import ru.nm17.narodmon.ui.sensorsScreen.SensorsScreen
|
import ru.nm17.narodmon.ui.sensorsScreen.SensorsScreen
|
||||||
import ru.nm17.narodmon.ui.theme.NarodMonTheme
|
import ru.nm17.narodmon.ui.theme.NarodMonTheme
|
||||||
|
|
||||||
|
@ -125,10 +123,6 @@ class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
NarodMonTheme {
|
NarodMonTheme {
|
||||||
var agreed by remember { mutableStateOf(true) }
|
var agreed by remember { mutableStateOf(true) }
|
||||||
var uuid: String? by remember { mutableStateOf(null) }
|
|
||||||
val debug = remember {
|
|
||||||
0 != applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE
|
|
||||||
}
|
|
||||||
|
|
||||||
LaunchedEffect(key1 = Unit, block = {
|
LaunchedEffect(key1 = Unit, block = {
|
||||||
coScope.launch(Dispatchers.IO) {
|
coScope.launch(Dispatchers.IO) {
|
||||||
|
@ -138,7 +132,7 @@ class MainActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!agreed && !debug) {
|
if (!agreed) {
|
||||||
Scaffold {
|
Scaffold {
|
||||||
AgreementDialog {
|
AgreementDialog {
|
||||||
coScope.launch(Dispatchers.IO) {
|
coScope.launch(Dispatchers.IO) {
|
||||||
|
@ -157,26 +151,9 @@ class MainActivity : ComponentActivity() {
|
||||||
Text(text = stringResource(R.string.waiting_for_user_agreement))
|
Text(text = stringResource(R.string.waiting_for_user_agreement))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else if (debug && uuid == null) {
|
|
||||||
Scaffold {
|
|
||||||
UuidDialog { uuidNew ->
|
|
||||||
uuid = uuidNew
|
|
||||||
}
|
|
||||||
Column(
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
verticalArrangement = Arrangement.Center,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.padding(it)
|
|
||||||
) {
|
|
||||||
CircularProgressIndicator()
|
|
||||||
Text(text = "")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
AppNavHost()
|
AppNavHost()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A surface container using the 'background' color from the theme
|
// A surface container using the 'background' color from the theme
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
package ru.nm17.narodmon.ui.dialogs
|
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.filled.KeyboardArrowRight
|
|
||||||
import androidx.compose.material3.AlertDialog
|
|
||||||
import androidx.compose.material3.Divider
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.ListItem
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.material3.TextButton
|
|
||||||
import androidx.compose.material3.TextField
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import ru.nm17.narodmon.R
|
|
||||||
import kotlin.system.exitProcess
|
|
||||||
|
|
||||||
@ExperimentalMaterial3Api
|
|
||||||
@Composable
|
|
||||||
fun UuidDialog(modifier: Modifier = Modifier, onUuidInput: (uuid: String) -> Unit) {
|
|
||||||
var uuid by remember { mutableStateOf("") }
|
|
||||||
|
|
||||||
AlertDialog(
|
|
||||||
onDismissRequest = { },
|
|
||||||
title = { Text(text = stringResource(id = R.string.uuid_dialog_title)) },
|
|
||||||
text = {
|
|
||||||
TextField(
|
|
||||||
value = uuid,
|
|
||||||
onValueChange = { uuid = it },
|
|
||||||
placeholder = { Text(text = "UUID") }
|
|
||||||
)
|
|
||||||
},
|
|
||||||
confirmButton = {
|
|
||||||
TextButton(
|
|
||||||
onClick = { onUuidInput(uuid) }
|
|
||||||
) {
|
|
||||||
Text(text = stringResource(id = R.string.uuid_confirm))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dismissButton = {
|
|
||||||
TextButton(
|
|
||||||
onClick = { onUuidInput("") }) {
|
|
||||||
Text(text = stringResource(id = R.string.uuid_generate))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modifier = modifier
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -52,7 +52,4 @@
|
||||||
<string name="apply">Применить</string>
|
<string name="apply">Применить</string>
|
||||||
<string name="sort_by_distance_desc">От дальних к ближним</string>
|
<string name="sort_by_distance_desc">От дальних к ближним</string>
|
||||||
<string name="cancel1">Отменить</string>
|
<string name="cancel1">Отменить</string>
|
||||||
<string name="uuid_dialog_title">Введите UUID приложения</string>
|
|
||||||
<string name="uuid_confirm">Сохранить</string>
|
|
||||||
<string name="uuid_generate">Сгенерировать</string>
|
|
||||||
</resources>
|
</resources>
|
|
@ -1,5 +1,5 @@
|
||||||
[versions]
|
[versions]
|
||||||
agp = "8.2.0-alpha08"
|
agp = "8.2.0-alpha07"
|
||||||
kotlin = "1.8.10"
|
kotlin = "1.8.10"
|
||||||
core-ktx = "1.9.0"
|
core-ktx = "1.9.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
|
|
Loading…
Add table
Reference in a new issue