diff options
author | Jose Dapena Paz <jdapena@igalia.com> | 2022-05-31 18:40:52 +0200 |
---|---|---|
committer | Jose Dapena Paz <jdapena@igalia.com> | 2022-05-31 20:13:54 +0200 |
commit | 69af4d9b9b209fcb33ef9071ddfa8561106044c2 (patch) | |
tree | 04b7d41ca675886d7169771a4cad2b0fcf13c750 | |
parent | 6de51f102451a9f63e6f597e99104eff14c5c2c1 (diff) |
Adapt to new application frameworkneedlefish_13.93.0needlefish/13.93.013.93.0
Drop usage of agl-js-api, and just provide a mock for bluetooth
and network calls.
Bug-AGL: SPEC-4248
Signed-off-by: Jose Dapena Paz <jdapena@igalia.com>
Change-Id: I9265a44f810012dd68ccfdd675de157156a73f79
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | src/index.js | 2 | ||||
-rw-r--r-- | src/js/agl_stubs_bluetooth.js | 29 | ||||
-rw-r--r-- | src/js/agl_stubs_network.js | 7 | ||||
-rw-r--r-- | src/js/bluetooth.js | 2 | ||||
-rw-r--r-- | src/js/templates.js | 4 | ||||
-rw-r--r-- | src/js/wifi.js | 2 | ||||
-rw-r--r-- | src/js/wired.js | 2 |
8 files changed, 43 insertions, 9 deletions
diff --git a/package.json b/package.json index b4840fb..9a81586 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "build": "webpack", "start": "webpack-dev-server" }, - "homepage": "https://github.com/AGL-web-applications/settings", + "homepage": "https://git.automotivelinux.org/apps/html5-settings", "repository": { "type": "git", - "url": "git@github.com:AGL-web-applications/agl-js-api.git" + "url": "https://gerrit.automotivelinux.org/gerrit/apps/html5-settings" }, "keywords": [ "agl", diff --git a/src/index.js b/src/index.js index 5f640a8..c1de9fc 100644 --- a/src/index.js +++ b/src/index.js @@ -16,7 +16,6 @@ /* JS */ import * as app from './js/app'; -import { api } from 'agl-js-api'; import * as bluetooth from './js/bluetooth'; import * as wifi from './js/wifi'; import * as wired from './js/wired'; @@ -30,7 +29,6 @@ window.wifi = wifi; window.wired = wired; window.date = date; -api.init(); app.init(); bluetooth.init(); wifi.init(); diff --git a/src/js/agl_stubs_bluetooth.js b/src/js/agl_stubs_bluetooth.js new file mode 100644 index 0000000..34b92e0 --- /dev/null +++ b/src/js/agl_stubs_bluetooth.js @@ -0,0 +1,29 @@ +export function managed_objects() { + return new Promise((resolve, reject) => { + resolve({ + devices: [] + }) + }); +} + + +let _powered = false + +export function adapter_state(new_state) { + return new Promise((resolve, reject) => { + if (typeof new_state !== undefined) + _powered = new_state.powered; + resolve({ + powered: _powered + }); + }); +} + +export function pair() { +} + +export function connect() { +} + +export function disconnect() { +}
\ No newline at end of file diff --git a/src/js/agl_stubs_network.js b/src/js/agl_stubs_network.js new file mode 100644 index 0000000..b0e6823 --- /dev/null +++ b/src/js/agl_stubs_network.js @@ -0,0 +1,7 @@ +export function services() { + return new Promise((resolve, reject) => { + resolve({ + values: [] + }); + }); +} diff --git a/src/js/bluetooth.js b/src/js/bluetooth.js index 258a8a7..6793feb 100644 --- a/src/js/bluetooth.js +++ b/src/js/bluetooth.js @@ -1,4 +1,4 @@ -import { bluetooth } from 'agl-js-api'; +import * as bluetooth from './agl_stubs_bluetooth'; import Mustache from 'mustache'; import { load as load_template } from './templates'; import * as app from './app'; 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 { diff --git a/src/js/wifi.js b/src/js/wifi.js index 15d9173..49a2543 100644 --- a/src/js/wifi.js +++ b/src/js/wifi.js @@ -1,4 +1,4 @@ -import { network } from 'agl-js-api'; +import * as network from './agl_stubs_network'; import Mustache from 'mustache'; import { load as load_template } from './templates'; import * as app from './app'; diff --git a/src/js/wired.js b/src/js/wired.js index c5407c8..c2e137e 100644 --- a/src/js/wired.js +++ b/src/js/wired.js @@ -1,4 +1,4 @@ -import { network } from 'agl-js-api'; +import * as network from './agl_stubs_network'; import Mustache from 'mustache'; import { load as load_template } from './templates'; import * as app from './app'; |