Bug 822528 - PhonenumberJS: Start using previous MCC. r=sicking

This commit is contained in:
Gregor Wagner 2012-12-19 23:17:37 -08:00
parent 9416e5d67d
commit 0983d9bffc

View File

@ -35,24 +35,36 @@ this.PhoneNumberUtils = {
let countryName;
#ifdef MOZ_B2G_RIL
// Get network mcc.
if (ril.voiceConnectionInfo && ril.voiceConnectionInfo.network)
// Get network mcc
if (ril.voiceConnectionInfo && ril.voiceConnectionInfo.network) {
mcc = ril.voiceConnectionInfo.network.mcc;
}
// Get SIM mcc or set it to mcc for Brasil
if (!mcc)
mcc = ril.iccInfo.mcc || this._mcc;
// Get SIM mcc
if (!mcc) {
mcc = ril.iccInfo.mcc;
}
// Get previous mcc
if (!mcc && ril.voiceConnectionInfo && ril.voiceConnectionInfo.network) {
mcc = ril.voiceConnectionInfo.network.previousMcc;
}
// Set to default mcc
if (!mcc) {
mcc = this._mcc;
}
#else
mcc = this._mcc;
#endif
countryName = MCC_ISO3166_TABLE[mcc];
debug("MCC: " + mcc + "countryName: " + countryName);
if (DEBUG) debug("MCC: " + mcc + "countryName: " + countryName);
return countryName;
},
parse: function(aNumber) {
debug("call parse: " + aNumber);
if (DEBUG) debug("call parse: " + aNumber);
let result = PhoneNumber.Parse(aNumber, this._getCountryName());
if (DEBUG) {
if (result) {
@ -69,7 +81,7 @@ this.PhoneNumberUtils = {
parseWithMCC: function(aNumber, aMCC) {
let countryName = MCC_ISO3166_TABLE[aMCC];
debug("found country name: " + countryName);
if (DEBUG) debug("found country name: " + countryName);
return PhoneNumber.Parse(aNumber, countryName);
}
};