Skip to content

Commit 5e1931d

Browse files
committed
fix: Show descriptive confirmation toasts for expert mode patch actions
1 parent cc27b07 commit 5e1931d

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

app/src/main/java/app/morphe/manager/ui/screen/home/ExpertModeDialog.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,9 @@ private fun BundlePatchControls(
549549
) {
550550
val context = LocalContext.current
551551

552-
// Returns a lambda that shows a toast with [label] and then executes [action].
553-
fun withToast(label: String, action: () -> Unit): () -> Unit = {
554-
context.toast(label)
552+
// Shows a confirmation toast with [doneMessage] and then executes [action]
553+
fun withToast(doneMessage: String, action: () -> Unit): () -> Unit = {
554+
context.toast(doneMessage)
555555
action()
556556
}
557557

@@ -560,12 +560,17 @@ private fun BundlePatchControls(
560560
val restoreLabel = stringResource(R.string.expert_mode_restore_saved)
561561
val deselectAllLabel = stringResource(R.string.expert_mode_disable_all)
562562

563+
val enabledDone = stringResource(R.string.expert_mode_enable_all_done)
564+
val disabledDone = stringResource(R.string.expert_mode_disable_all_done)
565+
val resetDone = stringResource(R.string.expert_mode_reset_to_default_done)
566+
val restoredDone = stringResource(R.string.expert_mode_restore_saved_done)
567+
563568
Row(
564569
modifier = modifier.fillMaxWidth(),
565570
horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterHorizontally)
566571
) {
567572
ActionPillButton(
568-
onClick = withToast(selectAllLabel, onSelectAll),
573+
onClick = withToast(enabledDone, onSelectAll),
569574
icon = Icons.Outlined.DoneAll,
570575
contentDescription = selectAllLabel,
571576
tooltip = selectAllLabel,
@@ -578,7 +583,7 @@ private fun BundlePatchControls(
578583
)
579584
)
580585
ActionPillButton(
581-
onClick = withToast(defaultLabel, onResetToDefault),
586+
onClick = withToast(resetDone, onResetToDefault),
582587
icon = Icons.Outlined.Recommend,
583588
contentDescription = defaultLabel,
584589
tooltip = defaultLabel,
@@ -590,7 +595,7 @@ private fun BundlePatchControls(
590595
)
591596
)
592597
ActionPillButton(
593-
onClick = withToast(restoreLabel, onRestoreSaved),
598+
onClick = withToast(restoredDone, onRestoreSaved),
594599
icon = Icons.Outlined.History,
595600
contentDescription = restoreLabel,
596601
tooltip = restoreLabel,
@@ -603,7 +608,7 @@ private fun BundlePatchControls(
603608
)
604609
)
605610
ActionPillButton(
606-
onClick = withToast(deselectAllLabel, onDeselectAll),
611+
onClick = withToast(disabledDone, onDeselectAll),
607612
icon = Icons.Outlined.ClearAll,
608613
contentDescription = deselectAllLabel,
609614
tooltip = deselectAllLabel,
@@ -618,7 +623,6 @@ private fun BundlePatchControls(
618623
}
619624
}
620625

621-
622626
/**
623627
* Individual patch card with toggle and options button.
624628
*/

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,13 @@
147147
<string name="expert_mode_search">Search patches</string>
148148
<string name="expert_mode_proceed">Proceed to patching</string>
149149
<string name="expert_mode_disable_all">Disable all</string>
150+
<string name="expert_mode_disable_all_done">All patches disabled</string>
150151
<string name="expert_mode_enable_all">Enable all</string>
152+
<string name="expert_mode_enable_all_done">All patches enabled</string>
151153
<string name="expert_mode_reset_to_default">Enable recommended patches</string>
154+
<string name="expert_mode_reset_to_default_done">Recommended patches applied</string>
152155
<string name="expert_mode_restore_saved">Restore saved selection</string>
156+
<string name="expert_mode_restore_saved_done">Saved selection restored</string>
153157
<string name="expert_mode_no_results">No patches found</string>
154158
<string name="expert_mode_universal_patches">Universal patches</string>
155159
<string name="expert_mode_new_patches">New</string>

0 commit comments

Comments
 (0)