Closed nucleus-ffm closed 8 months ago
I think we should only show the AlertSwiss source in the notification settings if it has been turned on in the general settings. Now that we have a settings page for the notifications, would it not make sense to also move the "show status notification" settings there?
It would be also a cool addition if we could hide (collapse) the frequency of background updates setting when background updates are disabled in general.
Let me explain my quite big changes to the code for the notification source settings:
storing a Severity instead of NotificationLevel in the NotificationPreferences (removal of NotificationLevel enum)
adding a disabled property to NotificationProperties => makes re-enabling restore the last notification level for that source
removal of Severity.other (as it is has always been treated as Severity.minor)
make filling the NotificationProperties with initial data a loop and move this to the class with the default values for the app settings
=> as the app already needs these settings when it calls Place#_checkIfEventShouldBeNotified
(used to have unprecise checks until you open the notification settings page)
reversing the order of severities on the slider (Severity.minor is now 0 etc.)
Instead of the NotificationLevel enum that had values like "upToMinor" (specified a range), the app now checks the enum index value of the stored notification level (a Severity) and the warning. This is a much simpler approach.
TODO: Also replace convertSourceToInt
(services/sortWarnings.dart) with a method in the related enum class (use a for-loop as seen in enums/Severity.dart in the getIndexFromSeverity
method for simplicity)
=> check the order of the enum values (especially LHP, AlertSwiss and Other) as they had no unique integer before (convert function returned 0 for everything except Mowas, Katwarn, Biwapp and DWD - although this likely aims for a stable order for all providers - see sortWarnings function)