Skip to content

Commit 6630c68

Browse files
committed
Enable Both slot Flash options (Add Inactive slot flash warning) : Try 17
1 parent 3282955 commit 6630c68

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/slot/SlotFlashContent.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ import androidx.compose.foundation.layout.fillMaxWidth
1010
import androidx.compose.foundation.layout.height
1111
import androidx.compose.foundation.layout.offset
1212
import androidx.compose.foundation.shape.RoundedCornerShape
13+
import androidx.compose.foundation.layout.Arrangement
14+
import androidx.compose.foundation.layout.padding
1315
import androidx.compose.material.ExperimentalMaterialApi
1416
import androidx.compose.material3.ButtonDefaults
1517
import androidx.compose.material3.Checkbox
1618
import androidx.compose.material3.ExperimentalMaterial3Api
1719
import androidx.compose.material3.MaterialTheme
1820
import androidx.compose.material3.OutlinedButton
1921
import androidx.compose.material3.Text
22+
import androidx.compose.material3.AlertDialog
2023
import androidx.compose.runtime.Composable
24+
import androidx.compose.runtime.getValue
25+
import androidx.compose.runtime.livedata.observeAsState
2126
import androidx.compose.ui.Alignment
2227
import androidx.compose.ui.Modifier
2328
import androidx.compose.ui.draw.alpha
@@ -47,6 +52,8 @@ fun ColumnScope.SlotFlashContent(
4752
navController: NavController
4853
) {
4954
val context = LocalContext.current
55+
val showDialog by viewModel.showCautionDialog.observeAsState()
56+
5057
if (!listOf("/flash/ak3", "/flash/image/flash", "/backup/backup").any { navController.currentDestination!!.route!!.endsWith(it) }) {
5158
SlotCard(
5259
title = stringResource(if (slotSuffix == "_a") R.string.slot_a else if (slotSuffix == "_b") R.string.slot_b else R.string.slot),
@@ -178,7 +185,7 @@ fun ColumnScope.SlotFlashContent(
178185
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
179186
Text("You have flashed AnyKernel Zip to inactive slot!")
180187
Text("But the active slot is not changed after flashing.")
181-
Text("Use bootctl to change active slot or return to System Updater to complete OTA.")
188+
Text("Change active slot or return to System Updater to complete OTA.")
182189
Text("Do not reboot from here, unless you know what you are doing.")
183190
}
184191
},

app/src/main/java/com/github/capntrips/kernelflasher/ui/screens/slot/SlotViewModel.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class SlotViewModel(
6666
private var inInit = true
6767
private var _error: String? = null
6868
private val _showCautionDialog = mutableStateOf(false)
69-
val showCautionDialog: State<Boolean> = _showCautionDialog
7069

7170
val sha1: String?
7271
get() = _sha1
@@ -84,6 +83,8 @@ class SlotViewModel(
8483
get() = _error != null
8584
val error: String
8685
get() = _error!!
86+
val showCautionDialog: LiveData<Boolean>
87+
get() = _showCautionDialog
8788

8889
init {
8990
refresh(context)
@@ -160,6 +161,10 @@ class SlotViewModel(
160161
private fun showCautionDialog() {
161162
_showCautionDialog.value = true
162163
}
164+
165+
fun hideCautionDialog() {
166+
_showCautionDialog.value = false
167+
}
163168

164169
// TODO: use base class for common functions
165170
@Suppress("SameParameterValue")

0 commit comments

Comments
 (0)