Skip to content

Commit

Permalink
Bug 823431 - [Clock] No ringtone and vibration when alarm goes off fr…
Browse files Browse the repository at this point in the history
…om screen off mode. r=timdream
  • Loading branch information
ian-liu committed Dec 26, 2012
1 parent 4065ef5 commit bf239ec
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions apps/clock/js/onring.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,12 @@ var RingView = {

init: function rv_init() {
document.addEventListener('mozvisibilitychange', this);
// If mozHidden is true in init state,
// it means that the incoming call happens before the alarm.
// We should just put a "silent" alarm screen
// underneath the oncall screen
if (!document.mozHidden) {
this.startAlarmNotification();
} else {
// The setTimeout() is used to workaround
// https://bugzilla.mozilla.org/show_bug.cgi?id=810431
// The workaround is used in screen off mode.
// mozHidden will be true in init() state.
var self = this;
window.setTimeout(function rv_checkMozHidden() {
// If mozHidden is true in init state,
// it means that the incoming call happens before the alarm.
// We should just put a "silent" alarm screen
// underneath the oncall screen
if (!document.mozHidden) {
self.startAlarmNotification();
}
}, 0);
}

this.setAlarmTime();
Expand Down Expand Up @@ -190,5 +179,9 @@ var RingView = {

};

RingView.init();
window.addEventListener('localized', function showBody() {
window.removeEventListener('localized', showBody);
RingView.init();
});


0 comments on commit bf239ec

Please sign in to comment.