diff options
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/config.xml | 13 | ||||
-rw-r--r-- | src/js/app.js | 25 | ||||
-rw-r--r-- | src/js/templates.js | 4 |
4 files changed, 16 insertions, 27 deletions
diff --git a/package.json b/package.json index 2913742..a864ba5 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "zip-webpack-plugin": "^3.0.0" }, "dependencies": { - "agl-js-api": "https://github.com/AGL-web-applications/agl-js-api.git#master", "bootstrap": "4.4.1", "mustache": "^3.0.1" } diff --git a/src/config.xml b/src/config.xml index f6138f0..349018f 100644 --- a/src/config.xml +++ b/src/config.xml @@ -1,21 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<widget xmlns="http://www.w3.org/ns/widgets" id="webapps-html5-launcher" version="1.0"> +<widget xmlns="http://www.w3.org/ns/widgets" id="launcher" version="1.0"> <name>HTML5 Launcher</name> <icon src="icon.svg"/> <content src="index.html" type="text/html"/> <description>Launcher application for AGL based on html5 technologies</description> <author>Igalia, S.L.</author> <license>APL 2.0</license> - <feature name="urn:AGL:widget:required-permission"> - <param name="urn:AGL:permission::public:no-htdocs" value="required" /> - <param name="urn:AGL:permission::public:display" value="required" /> - <param name="urn:AGL:permission::public:audio" value="required" /> - <param name="urn:AGL:permission:afm:system:widget" value="required" /> <!-- list available apps --> - <param name="urn:AGL:permission:afm:system:runner" value="required" /> <!-- run other apps --> - <param name="urn:AGL:permission::public:applications:read" value="required" /> <!-- get app icons --> - </feature> <feature name="urn:AGL:widget:required-api"> - <param name="homescreen" value="ws" /> - <param name="afm-main" value="ws" /> + <param name="agl_appservice" value="injection" /> </feature> </widget> 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 { |