diff options
author | Jose Dapena Paz <jdapena@igalia.com> | 2022-02-16 11:26:35 +0100 |
---|---|---|
committer | Jose Dapena Paz <jdapena@igalia.com> | 2022-03-01 18:06:13 +0100 |
commit | b83192da9cd7cb86bd08be2d914456065c603d63 (patch) | |
tree | 37dd35edaaad5f779d9b41138c0a7e95c9e7af86 /src/js | |
parent | bf07ba892d41d3717324ed0f1cdfc0c9f7c77b57 (diff) |
Rework launcher to use new appservice APImarlin_12.93.0marlin/12.93.012.93.0
Bug-AGL: SPEC-4250
Signed-off-by: Jose Dapena Paz <jdapena@igalia.com>
Change-Id: I57c9348a9806804ca0ce1246edcd1bb2601a6cfe
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/app.js | 25 | ||||
-rw-r--r-- | src/js/templates.js | 4 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/js/app.js b/src/js/app.js index d989f36..90f0e80 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -1,5 +1,5 @@ /* - * Copyright 2019 Igalia, S.L. + * Copyright 2019-2022 Igalia, S.L. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ import Mustache from 'mustache'; import { load as load_template } from './templates'; -import { afmMain, api, homescreen } from 'agl-js-api'; var configjson = require('../config.json'); var template; @@ -29,20 +28,23 @@ function render() { } function load_application_list() { - afmMain.runnables().then(function(apps) { + navigator.appService.getApplications(true, apps => { page.apps = []; for( var i=0; i<apps.length; i++) { - if( configjson.black_list.indexOf(apps[i].id) === -1 ) { + if( configjson.black_list.indexOf(apps[i][0]) === -1 ) { (function(app) { - if( configjson.icons[app.id.split('@')[0]] ) { - app.icon = configjson.icons[app.id.split('@')[0]]; + let app_entry = {}; + app_entry.id = app[0]; + app_entry.name = app[1]; + if( configjson.icons[app_entry.id.split('@')[0]] ) { + app_entry.icon = configjson.icons[app_entry.id.split('@')[0]]; } else { - app.icon = undefined; - app.letter = app.name[0]; + app_entry.icon = undefined; + app_entry.letter = app[1][0]; } - page.apps.push(app); + page.apps.push(app_entry); })(apps[i]); } } @@ -53,13 +55,10 @@ function load_application_list() { export function launch(appId) { console.log(appId); - homescreen.showWindow(appId.split('@')[0]).then(function(result) { - log("success: " + result); - }); + navigator.appService.start(appId.split('@')[0]); } export function init() { - api.init(); load_template('apps.template.html').then(function(result) { template = result; Mustache.parse(template); diff --git a/src/js/templates.js b/src/js/templates.js index 2513722..4b71638 100644 --- a/src/js/templates.js +++ b/src/js/templates.js @@ -2,12 +2,12 @@ export function load(template) { return new Promise(function(resolve, reject){ var xhr = new XMLHttpRequest(); - xhr.open('GET', '/templates/'+template); + xhr.open('GET', './templates/'+template); xhr.send(); xhr.onload = function() { - if (xhr.status != 200) { + if (xhr.status != 200 && xhr.status != 0) { console.error('Error loading template', xhr.status, xhr.statusText); reject(xhr.status); } else { |