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
70
gaia/apps/ftu/js/finish_screen.js
Executable file
70
gaia/apps/ftu/js/finish_screen.js
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
/* exported FinishScreen */
|
||||
/* global ScreenLayout, Utils */
|
||||
(function(exports) {
|
||||
'use strict';
|
||||
// Defaut layout is 'tiny', the one for mobile device
|
||||
var currentLayout = 'tiny';
|
||||
|
||||
var elementIDs = [
|
||||
'tutorialFinished',
|
||||
'enjoyYourPhone',
|
||||
'enjoyYourPhoneUpdated'
|
||||
];
|
||||
|
||||
var dom = {};
|
||||
|
||||
var initialized = false;
|
||||
|
||||
var FinishScreen = {
|
||||
init: function (isUpgrade) {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We consider only 'tablet' & 'mobile' (tiny)
|
||||
if (ScreenLayout.getCurrentLayout() !== 'tiny') {
|
||||
currentLayout = 'large';
|
||||
}
|
||||
// Get panel selector based on layout
|
||||
var panelSelector = 'tutorial-finish-' + currentLayout;
|
||||
|
||||
// Show finish panel
|
||||
var finishPanel = document.getElementById(panelSelector);
|
||||
finishPanel.classList.add('show');
|
||||
|
||||
// Cache non-layout-related DOM elements
|
||||
elementIDs.forEach(function (name) {
|
||||
dom[Utils.camelCase(name)] = document.getElementById(name);
|
||||
}, this);
|
||||
|
||||
if (isUpgrade) {
|
||||
dom.enjoyYourPhone.hidden = true;
|
||||
dom.enjoyYourPhoneUpdated.hidden = false;
|
||||
}
|
||||
|
||||
// Add regular listener if needed
|
||||
if (currentLayout === 'tiny') {
|
||||
dom.tutorialFinished.addEventListener('click', function ftuEnd() {
|
||||
window.close();
|
||||
});
|
||||
} else {
|
||||
// In 'tablet', we have to use IAC to tell system ftu is done
|
||||
navigator.mozApps.getSelf().onsuccess = function(evt) {
|
||||
var app = evt.target.result;
|
||||
app.connect('ftucomms').then(function onConnAccepted(ports) {
|
||||
ports.forEach(function(port) {
|
||||
port.postMessage('done');
|
||||
});
|
||||
}, function onConnRejected(reason) {
|
||||
console.warn('FTU is rejected due to ' + reason);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
exports.FinishScreen = FinishScreen;
|
||||
|
||||
}(this));
|
||||
Loading…
Reference in a new issue