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
43
gaia/apps/operatorvariant/js/customizers/nfc_customizer.js
Executable file
43
gaia/apps/operatorvariant/js/customizers/nfc_customizer.js
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
/* global Customizer */
|
||||
|
||||
'use strict';
|
||||
|
||||
var NfcCustomizer = (function() {
|
||||
Customizer.call(this, 'nfc', 'json');
|
||||
|
||||
this.set = function(nfcParams) {
|
||||
if (!this.simPresentOnFirstBoot) {
|
||||
console.log('NfcCustomizer. No first RUN with configured SIM.');
|
||||
return;
|
||||
}
|
||||
|
||||
const NFC_SETTING = 'nfc.enabled';
|
||||
|
||||
var settings = navigator.mozSettings;
|
||||
if (!settings) {
|
||||
console.error('NfcCustomizer. Settings is not available');
|
||||
return;
|
||||
}
|
||||
|
||||
var nfcLock = settings.createLock();
|
||||
var nfc = nfcLock.get(NFC_SETTING);
|
||||
|
||||
// We only change the nfc value if the user does not changed it previously
|
||||
// The user has changed the value if the actual value of nfc is
|
||||
// different from default value.
|
||||
nfc.onsuccess = function nc_onsuccess() {
|
||||
var value = nfc.result[NFC_SETTING];
|
||||
if (value === undefined || value === nfcParams.default) {
|
||||
nfcLock.set({ 'nfc.enabled': nfcParams.isEnabled });
|
||||
}
|
||||
};
|
||||
nfc.onerror = function wc_onerror() {
|
||||
console.error('Error retrieving ' + NFC_SETTING + '. ' +
|
||||
nfc.error.name);
|
||||
};
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
var nfcCustomizer = new NfcCustomizer();
|
||||
nfcCustomizer.init();
|
||||
Loading…
Reference in a new issue