← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nik90/ubuntu-clock-app/default-alarm-sound-backwards-compatibility into lp:ubuntu-clock-app

 

Nekhelesh Ramananthan has proposed merging lp:~nik90/ubuntu-clock-app/default-alarm-sound-backwards-compatibility into lp:ubuntu-clock-app.

Commit message:
Maintain backwards compatible with users on OTA-5 users w.r.t to the default alarm sound.

Requested reviews:
  Ubuntu Clock Developers (ubuntu-clock-dev)

For more details, see:
https://code.launchpad.net/~nik90/ubuntu-clock-app/default-alarm-sound-backwards-compatibility/+merge/268808

Clock App v3.5 will be released *before* OTA-6. However Clock App also switched to "Alarm clock" as its default alarm sound which only landed in OTA-6. This MP helps maintain backwards compatibility with OTA-5 users. It is a small harmless patch.
-- 
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~nik90/ubuntu-clock-app/default-alarm-sound-backwards-compatibility into lp:ubuntu-clock-app.
=== modified file 'app/alarm/EditAlarmPage.qml'
--- app/alarm/EditAlarmPage.qml	2015-08-21 14:41:20 +0000
+++ app/alarm/EditAlarmPage.qml	2015-08-21 21:31:28 +0000
@@ -155,10 +155,28 @@
         }
     }
 
+    /*
+     #TODO: The default alarm sound was changed to "Alarm clock" which only lands
+     in OTA-6. This function is need to maintain backwards compatibility with
+     OTA-5 users.
+    */
+    function fallbacktoOldDefaultAlarmSound() {
+        _alarm.sound = getSoundPath("Suru arpeggio")
+        _alarmSound.subText = "Suru arpeggio"
+    }
+
+    function setDefaultAlarmSound() {
+        _alarm.sound = getSoundPath(_alarmSound.defaultAlarmSound)
+        _alarmSound.subText = _alarmSound.defaultAlarmSound
+    }
+
     function setAlarmSound() {
         if(isNewAlarm) {
-            _alarm.sound = getSoundPath(_alarmSound.defaultAlarmSound)
-            _alarmSound.subText = _alarmSound.defaultAlarmSound
+            if (!getSoundPath(_alarmSound.defaultAlarmSound)) {
+                fallbacktoOldDefaultAlarmSound()
+            } else {
+                setDefaultAlarmSound()
+            }
         }
         else {
             _alarmSound.subText = getSoundName(_alarm.sound.toString())
@@ -168,8 +186,11 @@
              empty string.
             */
             if (_alarmSound.subText === "") {
-                _alarm.sound = getSoundPath(_alarmSound.defaultAlarmSound)
-                _alarmSound.subText = _alarmSound.defaultAlarmSound
+                if (!getSoundPath(_alarmSound.defaultAlarmSound)) {
+                    fallbacktoOldDefaultAlarmSound()
+                } else {
+                    setDefaultAlarmSound()
+                }
             }
         }
     }


Follow ups