Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
42
gaia/shared/js/simple_operator_variant_helper.js
Executable file
42
gaia/shared/js/simple_operator_variant_helper.js
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
/* exported SimpleOperatorVariantHelper */
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* A Simple Operator Variant Helper for use cases where we only need to
|
||||
* verify against the saved mcc/mnc pair. This does *not* verify against live
|
||||
* SIM card values. For that functionality and more, see
|
||||
* operator_variant_helper.js
|
||||
**/
|
||||
var SimpleOperatorVariantHelper = {
|
||||
// The mozSettings key for the saved MCC.
|
||||
get MCC_SETTINGS_KEY() {
|
||||
return 'operatorvariant.mcc';
|
||||
},
|
||||
|
||||
// The mozSettings key for the saved MNC.
|
||||
get MNC_SETTINGS_KEY() {
|
||||
return 'operatorvariant.mnc';
|
||||
},
|
||||
|
||||
/**
|
||||
* Simple function to get the operator variant values (MCC / MNC pair) that
|
||||
* are cached. This function will not verify these values against the live SIM
|
||||
* card values.
|
||||
*
|
||||
* @param {Function} callback Callback that will receive the MCC / MNC values.
|
||||
* Function signature -- function(mcc, mnc) { ... }
|
||||
*/
|
||||
getOperatorVariant: function(callback) {
|
||||
var transaction = window.navigator.mozSettings.createLock();
|
||||
var mccRequest = transaction.get(this.MCC_SETTINGS_KEY);
|
||||
|
||||
mccRequest.onsuccess = (function() {
|
||||
var mcc = mccRequest.result[this.MCC_SETTINGS_KEY] || '0';
|
||||
var mncRequest = transaction.get(this.MNC_SETTINGS_KEY);
|
||||
mncRequest.onsuccess = (function() {
|
||||
var mnc = mncRequest.result[this.MNC_SETTINGS_KEY] || '0';
|
||||
callback(mcc, mnc);
|
||||
}).bind(this);
|
||||
}).bind(this);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue