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
|
|
@ -0,0 +1,48 @@
|
|||
/* globals LazyLoader, PasscodeHelper */
|
||||
'use strict';
|
||||
(function(exports) {
|
||||
|
||||
/**
|
||||
* SettingsMigrator is used to set default value if the new property is
|
||||
* not defined in system.
|
||||
*
|
||||
* @class SettingsMigrator
|
||||
*/
|
||||
var SettingsMigrator = function SettingsMigrator() {
|
||||
this._oldPasscode = 'lockscreen.passcode-lock.code';
|
||||
this._hashedPasscode = 'lockscreen.passcode-lock.digest.value';
|
||||
};
|
||||
|
||||
SettingsMigrator.prototype = {
|
||||
/**
|
||||
* Query all settings key and do the migration
|
||||
*/
|
||||
start: function km_start() {
|
||||
var request = window.navigator.mozSettings.createLock().get('*');
|
||||
request.onsuccess = function(e) {
|
||||
this.keyMigration(request.result);
|
||||
}.bind(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Place to put key migration code when the new key is used in system.
|
||||
* @param {Object} result all settings keys
|
||||
*/
|
||||
keyMigration: function km_keyMigration(result) {
|
||||
if ((result[this._oldPasscode] !== undefined) &&
|
||||
(result[this._hashedPasscode] === undefined)) {
|
||||
LazyLoader.load(['/shared/js/passcode_helper.js']).then(() => {
|
||||
var set = {};
|
||||
var passcode = result[this._oldPasscode];
|
||||
set[this._oldPasscode] = '0000'; // this is a pre-defined default
|
||||
PasscodeHelper.set(passcode).then(() => {
|
||||
window.navigator.mozSettings.createLock().set(set);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.SettingsMigrator = SettingsMigrator;
|
||||
|
||||
}(window));
|
||||
Loading…
Reference in a new issue