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 #15066 from jaoo/951436
Browse files Browse the repository at this point in the history
Bug 951436 - [B2G][WAP Push][Notification][Settings] APN settings are not stored in settings once received. r=gsvelto
  • Loading branch information
jaoo committed Jan 8, 2014
2 parents dfd7958 + 4ad4806 commit b23813f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
24 changes: 21 additions & 3 deletions apps/wappush/js/store.js
Expand Up @@ -36,14 +36,32 @@ var StoreProvisioning = (function() {
return;
}

// XXX: Bug 947198
// We must add support for multi ICC card devices to the OMA CP logic.
// In the meantime we assume the ICC card the WAP push app is working with
// is the first one.
var iccCardIndex = 0;

var transaction = navigator.mozSettings.createLock();
var mccRequest = transaction.get(MCC_KEY);
mccRequest.onsuccess = function() {
mccMncCodes.mcc = mccRequest.result[MCC_KEY] || '000';
var mccs = mccRequest.result[MCC_KEY];
if (!mccs || !Array.isArray(mccs) || !mccs[iccCardIndex]) {
mccMncCodes.mcc = '000';
} else {
mccMncCodes.mcc = mccs[iccCardIndex];
}
var mncRequest = transaction.get(MNC_KEY);
mncRequest.onsuccess = function() {
mccMncCodes.mnc = mncRequest.result[MNC_KEY] || '00';
callback(mccMncCodes.mcc, mccMncCodes.mnc);
var mncs = mncRequest.result[MNC_KEY];
if (!mncs || !Array.isArray(mncs) || !mncs[iccCardIndex]) {
mccMncCodes.mnc = '00';
} else {
mccMncCodes.mnc = mncs[iccCardIndex];
}
if (callback) {
callback(mccMncCodes.mcc, mccMncCodes.mnc);
}
};
};
}
Expand Down
4 changes: 2 additions & 2 deletions apps/wappush/test/unit/store_test.js
Expand Up @@ -14,8 +14,8 @@ suite('StoreProvisioning >', function() {
suiteSetup(function() {
realSettings = navigator.mozSettings;
navigator.mozSettings = MockNavigatorSettings;
MockNavigatorSettings.mSettings['operatorvariant.mcc'] = '214';
MockNavigatorSettings.mSettings['operatorvariant.mnc'] = '07';
MockNavigatorSettings.mSettings['operatorvariant.mcc'] = ['214', '000'];
MockNavigatorSettings.mSettings['operatorvariant.mnc'] = ['07', '00'];
});

suiteTeardown(function() {
Expand Down

0 comments on commit b23813f

Please sign in to comment.