ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #04480
[Merge] lp:~nik90/ubuntu-clock-app/fix-invalid-alarm-model into lp:ubuntu-clock-app
The proposal to merge lp:~nik90/ubuntu-clock-app/fix-invalid-alarm-model into lp:ubuntu-clock-app has been updated.
Description changed to:
This MP fixes the issue where an edited alarm is not saveable after importing a new custom sound from the music app.
Background Info
---------------
We reload the Alarms Model whenever the clock app loses focus. This was done a long time ago to fix the issue of one-time alarms that rang not appearing switched off after they were switched off by indicator-datetime.
That's when an idea struck us that clock app loses focus when the user proceed to dismiss the one-time alarm notification and we can use that signal (losing focus) to quickly reload the alarms model.
Reloading the Alarms Model causes the UI to refresh, which thereby then shows the correct alarm switch value.
Current Situation
-----------------
However it turns out that when in the EditAlarmPage, if clock app loses focus due to switching to the music app, the tempAlarm variable loses track of the alarm we were editing since the Alarms Model reloaded silently in the background. As a result, saving an edited alarm after importing a new custom sound from music-app results in an error that tempAlarm is undefined :-)
Solution
--------
I have made the Alarms Model to reload *only* when in the MainPage or the AlarmsPage (basically when the alarms list is visible in the UI and requires refreshing). This thereby fixes the critical bug for good.
I have also added a manual test to ensure that this bug is never introduced accidentally in future versions of the clock app.
For more details, see:
https://code.launchpad.net/~nik90/ubuntu-clock-app/fix-invalid-alarm-model/+merge/268838
--
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~nik90/ubuntu-clock-app/fix-invalid-alarm-model into lp:ubuntu-clock-app.
References