Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
2 changes: 1 addition & 1 deletion tizen-app/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="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
id="https://github.com/Apps2Samsung/TV-Store" version="0.3.10" viewmodes="maximized">
id="https://github.com/Apps2Samsung/TV-Store" version="0.3.11" viewmodes="maximized">
<name>Apps2Samsung TV-Store</name>
<icon src="icon.png"/>
<content src="index.html"/>
Expand Down
34 changes: 28 additions & 6 deletions tizen-app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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; }); }
Expand Down Expand Up @@ -573,6 +587,14 @@
if (ms && ms.update) h += '<div class="notice" style="display:flex;align-items:center;margin:0 0 26px"><span style="flex:1">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.</span>'
+ '<button class="btn primary f" style="margin-left:20px" data-k="selfupd" data-act="selfupd">Update TV-Store</button></div>';
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 += '<div class="notice" style="margin:0 0 26px">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.</div>';
}

if (!hover || apps.indexOf(hover) < 0) hover = apps[0] || null;
if (!query) {
Expand Down
Loading