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.settingsScreen.SettingsScreenRoot
|
||||||
import org.nsh07.pomodoro.ui.statsScreen.StatsScreenRoot
|
import org.nsh07.pomodoro.ui.statsScreen.StatsScreenRoot
|
||||||
import org.nsh07.pomodoro.ui.statsScreen.viewModel.StatsViewModel
|
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.TimerScreen
|
||||||
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerAction
|
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerAction
|
||||||
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerViewModel
|
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerViewModel
|
||||||
@@ -71,6 +72,14 @@ fun AppScreen(
|
|||||||
|
|
||||||
val backStack = rememberNavBackStack<Screen>(Screen.Timer)
|
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(
|
Scaffold(
|
||||||
bottomBar = {
|
bottomBar = {
|
||||||
val wide = remember {
|
val wide = remember {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ fun AlarmDialog(
|
|||||||
onClick = stopAlarm,
|
onClick = stopAlarm,
|
||||||
modifier = Modifier.align(Alignment.End),
|
modifier = Modifier.align(Alignment.End),
|
||||||
) {
|
) {
|
||||||
Text("Ok")
|
Text("Dismiss")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,9 +114,6 @@ fun TimerScreen(
|
|||||||
onResult = {}
|
onResult = {}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (timerState.alarmRinging)
|
|
||||||
AlarmDialog { onAction(TimerAction.StopAlarm) }
|
|
||||||
|
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
|
|||||||
Reference in New Issue
Block a user