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

Commit

Permalink
Merge pull request #11714 from alivedise/bugzilla/904525/voicemail-nu…
Browse files Browse the repository at this point in the history
…mber

Bug 904525 - Fetch voicemail number from settings DB before looking up navigator.voicemail.number, r=alive, a=leo+
  • Loading branch information
alivedise committed Aug 23, 2013
2 parents dfa366a + e5bb8c3 commit 72d9989
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions apps/system/js/voicemail.js
Expand Up @@ -40,15 +40,34 @@ var Voicemail = {
}

var text = title;
var voicemailNumber = navigator.mozVoicemail.number;
if (voicemailNumber) {
text = _('dialNumber', { number: voicemailNumber });
}

this.hideNotification();
if (status.hasMessages) {
this.showNotification(title, text, voicemailNumber);
var settings = navigator.mozSettings;
if (!settings) {
return;
}

// Fetch voicemail number from 'ril.iccInfo.mbdn' settings before
// looking up |navigator.mozVoicemail.number|.
// Some SIM card may not provide MBDN info
// but we could still use settings to overload that.
var transaction = settings.createLock();
var request = transaction.get('ril.iccInfo.mbdn');
request.onsuccess = function() {
var number = request.result['ril.iccInfo.mbdn'];
var voicemail = navigator.mozVoicemail;
if (!number && voicemail && voicemail.number) {
number = voicemail.number;
}
if (number) {
text = _('dialNumber', { number: number });
}

Voicemail.hideNotification();
if (status.hasMessages) {
Voicemail.showNotification(title, text, number);
}
};
request.onerror = function() {};
},

showNotification: function vm_showNotification(title, text, voicemailNumber) {
Expand All @@ -69,7 +88,6 @@ var Voicemail = {
if (!telephony) {
return;
}

telephony.dial(voicemailNumber);
}

Expand Down

0 comments on commit 72d9989

Please sign in to comment.