From 510b52e8865e71e76fa00091618cb2e5909022c6 Mon Sep 17 00:00:00 2001 From: PatrickSt1991 Date: Thu, 29 Oct 2026 20:11:40 +0100 Subject: [PATCH 1/2] Recognise TV-Store's own catalog entry under a renamed package id Apps2Samsung can install TV-Store under a new package id (its "Install under a new package id" option rewrites the package part of every id). self() matched the catalog entry by package id only, so such a copy never saw its own entry and the self-update notice never showed. self() now also matches by the application part of the id, which the rename keeps, plus the entry name. A renamed copy cannot update itself: an install from here would land a second TV-Store under the catalog id. So instead of the Update button it tells the user to update from Apps2Samsung, which remembers the renamed id and updates the right tile. --- tizen-app/js/app.js | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tizen-app/js/app.js b/tizen-app/js/app.js index 1811fe3..809554e 100644 --- a/tizen-app/js/app.js +++ b/tizen-app/js/app.js @@ -438,13 +438,27 @@ return { installed: true, version: st.version, update: newer(v.version, st.version), latest: v.version, exact: st.known }; } - // TV-Store's own catalog entry. + // What the platform says about this very app: null off a TV. + function selfInfo() { try { return tizen.application.getCurrentApplication().appInfo || null; } catch (e) { return null; } } + // TV-Store's own catalog entry: by its package id, or, when a head installed it under another id + // (Apps2Samsung's "Install under a new package id" rewrites the package part only), by the + // application part of the id, which the rename keeps, plus the entry's name. function self() { - var pkg = ''; - try { pkg = tizen.application.getCurrentApplication().appInfo.packageId; } catch (e) {} + var info = selfInfo(), pkg = info ? info.packageId : '', app = info && info.id ? String(info.id).split('.').pop() : '', byName = null; for (var i = 0; i < catalogApps.length; i++) - for (var j = 0; j < catalogApps[i].variants.length; j++) if (pkg && catalogApps[i].variants[j].packageId === pkg) return catalogApps[i]; - return null; + for (var j = 0; j < catalogApps[i].variants.length; j++) { + var v = catalogApps[i].variants[j]; + if (pkg && v.packageId === pkg) return catalogApps[i]; + if (app && v.appId && String(v.appId).split('.').pop() === app && /TV-Store/i.test(catalogApps[i].name)) byName = byName || catalogApps[i]; + } + return byName; + } + // This copy runs under a package id that is not its catalog one: a head renamed it at install. + // It cannot update itself then (an install from here would land a second TV-Store under the + // catalog id); the head that renamed it remembers the id and updates the right tile. + function selfRenamed() { + var me = self(), info = selfInfo(); + return !!(me && info && info.packageId && !me.variants.some(function (v) { return v.packageId === info.packageId; })); } function updates() { return catalogApps.filter(function (x) { return state(x).update; }); } function onTv() { return catalogApps.filter(function (x) { return state(x).installed; }); } @@ -573,6 +587,14 @@ if (ms && ms.update) h += '
TV-Store v' + esc(ms.latest) + ' is out (this is v' + esc(ms.version) + '). TV-Store closes while it updates itself; open it again after a minute.' + '
'; + else if (me && selfRenamed()) { + // Installed under another package id: the platform lists this copy under that id, so + // state() cannot see it. Compare the catalog's version with our own and send the user to + // the head that renamed it rather than install a second TV-Store from here. + var own = (selfInfo() || {}).version || '', latest = me.variants[0] ? me.variants[0].version : ''; + if (own && latest && newer(latest, own)) h += '
TV-Store v' + esc(latest) + ' is out (this is v' + esc(own) + + '). This copy was installed under another package id by Apps2Samsung, so update it from Apps2Samsung (On the TV, Update) rather than from here.
'; + } if (!hover || apps.indexOf(hover) < 0) hover = apps[0] || null; if (!query) { From 897a74743b63e8b287518b1932beb952a8ca7013 Mon Sep 17 00:00:00 2001 From: PatrickSt1991 Date: Thu, 29 Oct 2026 20:12:57 +0100 Subject: [PATCH 2/2] Version 0.3.11 --- README.md | 2 +- tizen-app/config.xml | 2 +- tizen-app/js/app.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f8fcc6..c6b7b2a 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ Install the `.wgt` with Apps2Samsung like any package. A `vX.Y.Z` tag (matching | Install through the TV's own `sdbd` | proven on a retail set | | Signing on the TV | done, identical output to the Apps2Samsung signer | | Arming from Apps2Samsung (phone, PC, CLI) | done | -| The screens above | built (0.3.4); pins, developer search, your own .wgt or .tpk (0.3.10) | +| The screens above | built (0.3.4); pins, developer search, your own .wgt or .tpk (0.3.10); finds itself under a renamed package id (0.3.11) | | First real install from the TV | done, 2019 Tizen 5.0 set (0.3.4) | | Tizen 3.0 and 4.0 sets (2017, 2018) | untested | | Tizen 10 sets (2025) | done, retail set (0.3.9) | diff --git a/tizen-app/config.xml b/tizen-app/config.xml index 8a2e715..6c5cddc 100644 --- a/tizen-app/config.xml +++ b/tizen-app/config.xml @@ -1,6 +1,6 @@ + id="https://github.com/Apps2Samsung/TV-Store" version="0.3.11" viewmodes="maximized"> Apps2Samsung TV-Store diff --git a/tizen-app/js/app.js b/tizen-app/js/app.js index 809554e..8d58f1b 100644 --- a/tizen-app/js/app.js +++ b/tizen-app/js/app.js @@ -39,7 +39,7 @@ // TV's current IP and loopback too, and keeps whichever answers. var BASE = 'http://127.0.0.1:8077'; var KOFI = 'https://ko-fi.com/patrickst'; - var VERSION = '0.3.10'; + var VERSION = '0.3.11'; var KEY = { LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, ENTER: 13, RETURN: 10009, ESC: 27, BACK: 8 }; // What the manifest providers are called; resolved.json carries only their ids.