Give a habit's day questions their own dialog on the Habits screen

A habit's questions for a day, and the answers of a day that is done,
open in a dialog of their own. Like the count dialog, it belongs to the
Habits screen in either tab and closes when the app leaves it; a new law
states this, and the remaining dialogs may still appear anywhere.
This commit is contained in:
waozi committed 2026-10-13 13:56:21 -03:00
1 parent 14de0e9b74
commit 347fc198c2
2 files changed
+7 -2

No files matched your search

+2 -1
View File
@@ -28,6 +28,7 @@ ModalType :: enum {
ModalDonationReminder
ModalAppIconPicker
ModalHabitCount
ModalHabitQuestions
}
#program_export
@@ -45,7 +46,7 @@ ModalValidOnScreen :: (modal_type: ModalType, screen: s32,
if modal_type == cast(ModalType)ModalBottomNavConfig {
return screen == ScreenCustomizeNav
}
if modal_type == cast(ModalType)ModalHabitCount {
if modal_type == cast(ModalType)ModalHabitCount || modal_type == cast(ModalType)ModalHabitQuestions {
return screen == ScreenHabits
}
return true
+5 -1
View File
@@ -28,9 +28,13 @@ Valid :: (modal: ModalType, screen: s32, habits_tab: s32) -> bool {
// either habits tab.
#law HabitCountOnlyOnHabits forall screen: -2..20, tab: 0..1 => Valid(ModalType.ModalHabitCount, screen, tab) == (screen == ScreenHabits);
// A habit's questions for a day, or its answers, are shown over the habits
// screen that opened them, in either habits tab.
#law HabitQuestionsOnlyOnHabits forall screen: -2..20, tab: 0..1 => Valid(ModalType.ModalHabitQuestions, screen, tab) == (screen == ScreenHabits);
// The remaining dialogs may appear anywhere, so a rule change cannot silently
// hide them.
#law OtherDialogsAppearAnywhere forall modal: ModalType, screen: -2..20, tab: 0..1 => Valid(modal, screen, tab) || modal == ModalType.ModalConfirmExitSession || modal == ModalType.ModalMeditationSetup || modal == ModalType.ModalConfirmDeleteHabit || modal == ModalType.ModalHabitPracticePicker || modal == ModalType.ModalBottomNavConfig || modal == ModalType.ModalHabitCount;
#law OtherDialogsAppearAnywhere forall modal: ModalType, screen: -2..20, tab: 0..1 => Valid(modal, screen, tab) || modal == ModalType.ModalConfirmExitSession || modal == ModalType.ModalMeditationSetup || modal == ModalType.ModalConfirmDeleteHabit || modal == ModalType.ModalHabitPracticePicker || modal == ModalType.ModalBottomNavConfig || modal == ModalType.ModalHabitCount || modal == ModalType.ModalHabitQuestions;
// No dialog type can appear on a screen that is not a habit editor unless its
// rule allows it: the habit tab flag alone never enables a dialog elsewhere.