Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 814632 - [Clock] Put a silent alarm screen underneath the oncall screen if the alarm goes off during a phone call r=timdream #6816

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 20 additions & 7 deletions apps/clock/js/onring.js
Expand Up @@ -36,9 +36,14 @@ var RingView = {
init: function rv_init() {
this.setAlarmTime();
this.setAlarmLabel();
this.setWakeLockEnabled(true);
this.ring();
this.vibrate();
// If mozHidden is true in init state,
// it means that alarm screen underneath the oncall screen.
// Don't let the alarm ring and vibrate.
if (!document.mozHidden) {
this.setWakeLockEnabled(true);
this.ring();
this.vibrate();
}
document.addEventListener('mozvisibilitychange', this);
this.snoozeButton.addEventListener('click', this);
this.closeButton.addEventListener('click', this);
Expand Down Expand Up @@ -107,14 +112,22 @@ var RingView = {
stopAlarmNotification: function rv_stopAlarmNotification(action) {
switch (action) {
case 'ring':
this._ringtonePlayer.pause();
if (this._ringtonePlayer)
this._ringtonePlayer.pause();

break;
case 'vibrate':
window.clearInterval(this._vibrateInterval);
if (this._vibrateInterval)
window.clearInterval(this._vibrateInterval);

break;
default:
this._ringtonePlayer.pause();
window.clearInterval(this._vibrateInterval);
if (this._ringtonePlayer)
this._ringtonePlayer.pause();

if (this._vibrateInterval)
window.clearInterval(this._vibrateInterval);

break;
}
this.setWakeLockEnabled(false);
Expand Down