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
58
gaia/tv_apps/smart-system/fxa/js/fxam_manager.js
Executable file
58
gaia/tv_apps/smart-system/fxa/js/fxam_manager.js
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
/* global FxaModuleUI */
|
||||
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* FxaModuleManager is in charge of communication with the core of
|
||||
* FxAccounts, sending the info retrieved during the process if the
|
||||
* process was succeeded.
|
||||
*/
|
||||
|
||||
var FxaModuleManager = {
|
||||
paramsRetrieved: null,
|
||||
init: function fxamm_init() {
|
||||
// Some FxA UI flows require us to get some data from the platform, like
|
||||
// the account information. This data is given by FxAccountsUI in the form
|
||||
// of URL query parameters.
|
||||
var hash = window.location.hash.split('?');
|
||||
var flow = hash[0].replace('#', '');
|
||||
if (hash.length > 1) {
|
||||
var queryParams = hash[1].split('&');
|
||||
for (var i = 0; i < queryParams.length; i++) {
|
||||
var param = queryParams[i].split('=');
|
||||
if (param.length != 2) {
|
||||
console.warning('Wrong query parameter');
|
||||
continue;
|
||||
}
|
||||
this.setParam(param[0], param[1]);
|
||||
}
|
||||
}
|
||||
FxaModuleUI.init(flow);
|
||||
},
|
||||
setParam: function fxamm_setParam(key, value) {
|
||||
if (!this.paramsRetrieved) {
|
||||
this.paramsRetrieved = {};
|
||||
}
|
||||
this.paramsRetrieved[key] = value;
|
||||
},
|
||||
done: function fxamm_done() {
|
||||
window.parent.FxAccountsUI.done(FxaModuleManager.paramsRetrieved);
|
||||
},
|
||||
close: function fxamm_close(error) {
|
||||
// If there is no params retrieved, or the flow is not complete ()
|
||||
if (!this.paramsRetrieved ||
|
||||
!this.paramsRetrieved.done) {
|
||||
window.parent.FxAccountsUI.error(error);
|
||||
return;
|
||||
}
|
||||
window.parent.FxAccountsUI.done(this.paramsRetrieved);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('load', function managerLoaded() {
|
||||
window.removeEventListener('load', managerLoaded);
|
||||
FxaModuleManager.init();
|
||||
});
|
||||
Loading…
Reference in a new issue