From b5bfe5e95341a93de8fc7481a2c3a73c86442e0d Mon Sep 17 00:00:00 2001 From: reis <29177546+reisxd@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:52:09 +0300 Subject: [PATCH] feat: check if query args exists for app control, updater UX improvement --- tizenbrew-app/TizenBrew/config.xml | 2 +- tizenbrew-app/TizenBrew/js/wsClient.js | 8 ++++++-- tizenbrew-updater/TizenBrewUpdater/config.xml | 2 +- .../TizenBrewUpdater/service/service.js | 15 ++++++++++++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tizenbrew-app/TizenBrew/config.xml b/tizenbrew-app/TizenBrew/config.xml index ab5785c..928d99e 100644 --- a/tizenbrew-app/TizenBrew/config.xml +++ b/tizenbrew-app/TizenBrew/config.xml @@ -1,5 +1,5 @@ - + diff --git a/tizenbrew-app/TizenBrew/js/wsClient.js b/tizenbrew-app/TizenBrew/js/wsClient.js index 1ae156c..5a2def6 100644 --- a/tizenbrew-app/TizenBrew/js/wsClient.js +++ b/tizenbrew-app/TizenBrew/js/wsClient.js @@ -111,7 +111,7 @@ function onMessage(msg) { const moduleName = message.appControlData.module.name; const moduleType = message.appControlData.module.moduleType; const keys = message.appControlData.module.keys; - const appPath = message.appControlData.module.appPath; + let appPath = message.appControlData.module.appPath; const tizenAppId = message.appControlData.module.tizenAppId; const args = message.appControlData.args; @@ -124,7 +124,11 @@ function onMessage(msg) { setTimeout(() => { send({ type: 'launch', package: `${moduleType}/${moduleName}`, tvIp: webapis.network.getIp(), isTizen3 }); if (!tizenAppId) { - location.href = `${appPath}${args ? `?${args}` : ''}`; + if (appPath.includes('?') && args) { + appPath += `&${args}`; + } + + location.href = appPath; } }, 250); return; diff --git a/tizenbrew-updater/TizenBrewUpdater/config.xml b/tizenbrew-updater/TizenBrewUpdater/config.xml index a11643c..423019b 100644 --- a/tizenbrew-updater/TizenBrewUpdater/config.xml +++ b/tizenbrew-updater/TizenBrewUpdater/config.xml @@ -1,6 +1,6 @@ + version="1.0.3" viewmodes="maximized"> diff --git a/tizenbrew-updater/TizenBrewUpdater/service/service.js b/tizenbrew-updater/TizenBrewUpdater/service/service.js index 7badd34..d9c7f2b 100644 --- a/tizenbrew-updater/TizenBrewUpdater/service/service.js +++ b/tizenbrew-updater/TizenBrewUpdater/service/service.js @@ -37,18 +37,31 @@ module.exports.onStart = function () { } adb = adbhost.createConnection({ host: ip, port: 26101 }); + + let connected = false; + const waitTimeout = setTimeout(() => { + if (connected) global.currentClient.send(JSON.stringify({ type: 'connectedToDaemon' })); + }, 1000); adb._stream.on('connect', () => { console.log('ADB connection established'); - global.currentClient.send(JSON.stringify({ type: 'connectedToDaemon' })); + connected = true; }); adb._stream.on('error', (e) => { console.log('ADB connection error. ' + e); + clearTimeout(waitTimeout); + + if (e.code === 'ECONNREFUSED') { + global.currentClient.send(JSON.stringify({ type: 'error', message: 'Could not connect to daemon. Make sure the TV is on and the IP is correct.' })); + } else if (e.code === 'ECONNRESET') { + global.currentClient.send(JSON.stringify({ type: 'error', message: 'Connection reset. Either your TVs Host PC IP wasn\'t set to this devices IP or it was not rebooted properly. Reboot by holding the power button till you see the Samsung logo or the bouncing house.' })); + } }); adb._stream.on('close', () => { console.log('ADB connection closed.'); + clearTimeout(waitTimeout); }); }