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
89
gaia/apps/keyboard/js/settings/keyboard_settings_app.js
Executable file
89
gaia/apps/keyboard/js/settings/keyboard_settings_app.js
Executable file
|
|
@ -0,0 +1,89 @@
|
|||
'use strict';
|
||||
|
||||
/* global SettingsPromiseManager, CloseLockManager, DialogController,
|
||||
MozActivity, PanelController, PromiseStorage */
|
||||
|
||||
(function(exports) {
|
||||
|
||||
var KeyboardSettingsApp = function KeyboardSettingsApp() {
|
||||
this.closeLockManager = null;
|
||||
|
||||
this.settingsPromiseManager = null;
|
||||
this.preferencesStore = null;
|
||||
|
||||
this.panelController = null;
|
||||
this.dialogController = null;
|
||||
|
||||
this._closeLock = null;
|
||||
};
|
||||
|
||||
KeyboardSettingsApp.prototype.PREFERENCES_STORE_NAME = 'preferences';
|
||||
|
||||
KeyboardSettingsApp.prototype.start = function() {
|
||||
this.closeLockManager = new CloseLockManager();
|
||||
this.closeLockManager.onclose = this.close.bind(this);
|
||||
this.closeLockManager.start();
|
||||
|
||||
// SettingsPromiseManager wraps Settings DB methods into promises.
|
||||
// This must be available to *GroupView.
|
||||
this.settingsPromiseManager = new SettingsPromiseManager();
|
||||
|
||||
// This is where we store keyboard specific preferences
|
||||
this.preferencesStore = new PromiseStorage(this.PREFERENCES_STORE_NAME);
|
||||
this.preferencesStore.start();
|
||||
|
||||
this.panelController = new PanelController(this);
|
||||
this.panelController.start();
|
||||
|
||||
this.dialogController = new DialogController();
|
||||
this.dialogController.start();
|
||||
|
||||
document.addEventListener('visibilitychange', this);
|
||||
};
|
||||
|
||||
KeyboardSettingsApp.prototype.stop = function() {
|
||||
this.closeLockManager.stop();
|
||||
this.closeLockManager = null;
|
||||
|
||||
this.settingsPromiseManager = null;
|
||||
|
||||
this.preferencesStore.stop();
|
||||
this.preferencesStore = null;
|
||||
|
||||
this.panelController.stop();
|
||||
this.panelController = null;
|
||||
|
||||
this.dialogController.stop();
|
||||
this.dialogController = null;
|
||||
|
||||
document.removeEventListener('visibilitychange', this);
|
||||
};
|
||||
|
||||
KeyboardSettingsApp.prototype.close = function() {
|
||||
this.stop();
|
||||
window.close();
|
||||
};
|
||||
|
||||
KeyboardSettingsApp.prototype.requestClose = function() {
|
||||
// Until Haida lands this is how users could go back to Settings app
|
||||
Promise.resolve(new MozActivity({
|
||||
name: 'moz_configure_window',
|
||||
data: { target: 'device' }
|
||||
})).catch(function(e) {
|
||||
console.error(e);
|
||||
});
|
||||
};
|
||||
|
||||
KeyboardSettingsApp.prototype.handleEvent = function(evt) {
|
||||
if (document.hidden) {
|
||||
this._closeLock =
|
||||
this.closeLockManager.requestLock('requestClose');
|
||||
} else if (this._closeLock) {
|
||||
this._closeLock.unlock();
|
||||
this._closeLock = null;
|
||||
}
|
||||
};
|
||||
|
||||
exports.KeyboardSettingsApp = KeyboardSettingsApp;
|
||||
|
||||
})(window);
|
||||
Loading…
Reference in a new issue