Skip to content

Commit

Permalink
feat: check if query args exists for app control, updater UX improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
reisxd committed Dec 12, 2024
1 parent 0c70c4a commit b5bfe5e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tizenbrew-app/TizenBrew/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="https://tizentube.vercel.app" version="1.4.4" viewmodes="maximized">
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="https://tizentube.vercel.app" version="1.4.5" viewmodes="maximized">
<access origin="*" subdomains="true"></access>
<tizen:app-control>
<tizen:src name="index.html" reload="disable"/>
Expand Down
8 changes: 6 additions & 2 deletions tizenbrew-app/TizenBrew/js/wsClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tizenbrew-updater/TizenBrewUpdater/config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="https://tizentube.vercel.app"
version="1.0.2" viewmodes="maximized">
version="1.0.3" viewmodes="maximized">
<access origin="*" subdomains="true" />
<tizen:app-control>
<tizen:src name='index.html' reload='disable'></tizen:src>
Expand Down
15 changes: 14 additions & 1 deletion tizenbrew-updater/TizenBrewUpdater/service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

}
Expand Down

0 comments on commit b5bfe5e

Please sign in to comment.