fix: Make alarm dialog viewable from any screen
This commit is contained in:
@@ -47,6 +47,7 @@ import org.nsh07.pomodoro.service.TimerService
|
||||
import org.nsh07.pomodoro.ui.settingsScreen.SettingsScreenRoot
|
||||
import org.nsh07.pomodoro.ui.statsScreen.StatsScreenRoot
|
||||
import org.nsh07.pomodoro.ui.statsScreen.viewModel.StatsViewModel
|
||||
import org.nsh07.pomodoro.ui.timerScreen.AlarmDialog
|
||||
import org.nsh07.pomodoro.ui.timerScreen.TimerScreen
|
||||
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerAction
|
||||
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerViewModel
|
||||
@@ -71,6 +72,14 @@ fun AppScreen(
|
||||
|
||||
val backStack = rememberNavBackStack<Screen>(Screen.Timer)
|
||||
|
||||
if (uiState.alarmRinging)
|
||||
AlarmDialog {
|
||||
Intent(context, TimerService::class.java).also {
|
||||
it.action = TimerService.Actions.STOP_ALARM.toString()
|
||||
context.startService(it)
|
||||
}
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
bottomBar = {
|
||||
val wide = remember {
|
||||
|
||||
@@ -69,7 +69,7 @@ fun AlarmDialog(
|
||||
onClick = stopAlarm,
|
||||
modifier = Modifier.align(Alignment.End),
|
||||
) {
|
||||
Text("Ok")
|
||||
Text("Dismiss")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,9 +114,6 @@ fun TimerScreen(
|
||||
onResult = {}
|
||||
)
|
||||
|
||||
if (timerState.alarmRinging)
|
||||
AlarmDialog { onAction(TimerAction.StopAlarm) }
|
||||
|
||||
Column(modifier = modifier) {
|
||||
TopAppBar(
|
||||
title = {
|
||||
|
||||
Reference in New Issue
Block a user