Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

Commit

Permalink
mark apps as queued on init (bug 996242)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngokevin committed Apr 15, 2014
1 parent cf489fd commit 0d8be5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/media/css/style.css
Expand Up @@ -588,7 +588,7 @@ div.description h3,
}

.notification.error {
background: #903;
background: #900;
}

.notification.show {
Expand Down
21 changes: 16 additions & 5 deletions src/media/js/install.js
Expand Up @@ -6,17 +6,27 @@ define('install',
var gettext = templating._l;
var queuedInstalls = JSON.parse(storage.getItem('queuedInstalls') || '[]');

function getDocs() {
return docs;
function findById(data, id) {
// lambda x: x.id == id
for (var i = 0; i < data.length; i++) {
if (data[i]._id === id) {
return data[i];
}
}
return null;
}

function hideSplash() {
var getDocs = function() {
return docs;
};

var hideSplash = function() {
// FIXME: move elsewhere.
// We're ready to rumble. Remove splash screen!
console.log('Preparing to remove slash screen...');
document.body.removeChild(document.getElementById('splash-overlay'));
console.log('Hiding splash screen (' + ((window.performance.now() - window.start_time) / 1000).toFixed(6) + 's)');
}
};

var installApp = function(app) {
return new Promise(function(resolve, reject) {
Expand Down Expand Up @@ -158,11 +168,12 @@ define('install',
// Get the list of installed apps so we can toggle the buttons where appropriate.
apps.getInstalled().then(function(installedApps) {
Object.keys(docs).forEach(function(key) {
if (installedApps) {
if (installedApps || queuedInstalls) {
// Attach the `navigator.mozApps` object so we can launch the app later.
// (The installed apps are keyed off the manifest URL without the querystring.)
docs[key].mozApp = installedApps[utils.baseurl(docs[key].manifest_url)] || null;
docs[key].installed = !!docs[key].mozApp;
docs[key].queued = findById(queuedInstalls, docs[key]._id);
}

// App names should already be localised before we get here (issue #14).
Expand Down

0 comments on commit 0d8be5a

Please sign in to comment.