@oxymoron.13/tizentube-s95b 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mods/config.js CHANGED
@@ -38,7 +38,7 @@ const defaultConfig = {
38
38
  enablePatchingVideoPlayer: true,
39
39
  enableMPButton: true,
40
40
  enableSwapMPWithPIP: false,
41
- enablePreviews: true,
41
+ enablePreviews: false,
42
42
  enableHideWatchedVideos: false,
43
43
  hideWatchedVideosThreshold: 80,
44
44
  hideWatchedVideosPages: [],
@@ -10,6 +10,13 @@ export const STRINGS = Object.freeze({
10
10
  statVideo: 'Video', statFrames: 'Verlorene Bilder', statCodec: 'Codec-Wunsch',
11
11
  statUnavailable: 'nicht verfügbar', statWait: 'wartet auf Video',
12
12
  languageDE: 'Deutsch', languageEN: 'English',
13
+ exit: 'Beenden',
14
+ exitHintTizen: 'Beendet die App (TizenTube und TizenBrew, wie die Zurück-Taste in TizenBrew). TizenBrews Hintergrunddienst wird dabei nicht gestoppt.',
15
+ exitHintSignal: 'Die Tizen-Funktion zum Beenden ist hier nicht verfügbar; es wird YouTubes Beenden-Signal versucht (am TV ungeprüft). Sonst die Home-Taste der Fernbedienung benutzen.',
16
+ exitCancel: 'Abbrechen', exitNow: 'Ja, App beenden',
17
+ exitFailed: 'Beenden nicht möglich. Bitte die Home-Taste der Fernbedienung benutzen.',
18
+ previews: 'Video-Vorschau beim Markieren',
19
+ previewsHint: 'Spielt ein Video mit Ton an, sobald eine Kachel markiert ist (TizenTube-Funktion). Wirkt ab dem nächsten Laden der Seite.',
13
20
  mini: 'Mini-Player',
14
21
  miniHint: 'TizenTubes Mini-Player (Eintrag „MiniPlayer“ im Video-Menü). Änderungen gelten beim nächsten Start des Mini-Players. Ein neu gestartetes Video öffnet im Vollbild und ersetzt den Mini-Player.',
15
22
  miniOn: 'Mini-Player anbieten',
@@ -29,6 +36,13 @@ export const STRINGS = Object.freeze({
29
36
  statVideo: 'Video', statFrames: 'Dropped frames', statCodec: 'Codec preference',
30
37
  statUnavailable: 'not available', statWait: 'waiting for video',
31
38
  languageDE: 'Deutsch', languageEN: 'English',
39
+ exit: 'Exit',
40
+ exitHintTizen: 'Closes the app (TizenTube and TizenBrew, like the Back key in TizenBrew). TizenBrew’s background service is not stopped.',
41
+ exitHintSignal: 'The Tizen exit function is not available here; YouTube’s exit signal is tried instead (untested on the TV). Otherwise use the remote’s Home key.',
42
+ exitCancel: 'Cancel', exitNow: 'Yes, exit the app',
43
+ exitFailed: 'Could not exit. Please use the remote’s Home key.',
44
+ previews: 'Video preview on focus',
45
+ previewsHint: 'Plays a video with sound as soon as a tile is focused (TizenTube feature). Applies from the next page load.',
32
46
  mini: 'Mini player',
33
47
  miniHint: 'TizenTube’s mini player (“MiniPlayer” row in the video menu). Changes apply the next time the mini player starts. A newly started video opens full screen and replaces the mini player.',
34
48
  miniOn: 'Offer mini player',
@@ -5,13 +5,17 @@
5
5
  */
6
6
  import { configRead, configWrite, configChangeEmitter } from '../config.js';
7
7
  import { optionShow } from '../ui/settings.js';
8
+ import { showToast } from '../ui/ytUI.js';
9
+ import resolveCommand from '../resolveCommand.js';
10
+ import { S95B_VERSION_TAG } from './s95bVersion.js';
8
11
  import { translate } from './s95bI18n.js';
9
12
  import { codecMenu, qualityMenu, codecLabel, currentCodec } from './s95bOptions.js';
10
13
  import { MINI_POSITIONS, MINI_SIZES, MINI_BROWSE } from './s95bMiniPlayer.js';
11
14
 
12
15
  const STATE_KEY = 's95b-perf-edition-v1';
13
16
  const EDITED = ['enablePreviews', 'enableDeArrow', 'enableDeArrowThumbnails'];
14
- const defaultState = { lang: 'de', light: false, previous: null };
17
+ const VERSION = String(S95B_VERSION_TAG).split(':')[1] || '?';
18
+ const defaultState = { lang: 'de', light: false, previous: null, previewsOff033: false };
15
19
  let state = { ...defaultState };
16
20
 
17
21
  function readState() {
@@ -20,7 +24,8 @@ function readState() {
20
24
  if (data && typeof data === 'object') {
21
25
  state = { ...defaultState,
22
26
  lang: data.lang === 'en' ? 'en' : 'de', light: data.light === true,
23
- previous: data.previous && typeof data.previous === 'object' ? data.previous : null };
27
+ previous: data.previous && typeof data.previous === 'object' ? data.previous : null,
28
+ previewsOff033: data.previewsOff033 === true };
24
29
  }
25
30
  } catch (_) { state = { ...defaultState }; }
26
31
  }
@@ -103,6 +108,27 @@ function miniMenu() {
103
108
  ] };
104
109
  }
105
110
 
111
+ // Exit: the same call TizenBrew's own Back key uses; YouTube's exit signal is the fallback.
112
+ function canExitViaTizen() {
113
+ try { return !!(window.tizen && window.tizen.application && typeof window.tizen.application.getCurrentApplication === 'function'); }
114
+ catch (_) { return false; }
115
+ }
116
+ function exitMenu() {
117
+ return { name: t('exit'), value: null, menuId: 's95b-exit',
118
+ menuHeader: { title: t('exit'), subtitle: canExitViaTizen() ? t('exitHintTizen') : t('exitHintSignal') },
119
+ options: [
120
+ { name: t('exitCancel'), key: 's95bExit', value: 'no' },
121
+ { name: t('exitNow'), key: 's95bExit', value: 'now' }
122
+ ] };
123
+ }
124
+ function exitApp() {
125
+ if (canExitViaTizen()) {
126
+ try { window.tizen.application.getCurrentApplication().exit(); return; } catch (_) { /* try the signal */ }
127
+ }
128
+ try { resolveCommand({ signalAction: { signal: 'EXIT_APP' } }); }
129
+ catch (e) { showToast('TizenTube', t('exitFailed')); }
130
+ }
131
+
106
132
  function buildOptions() {
107
133
  return [
108
134
  { name: t('language'), value: null, menuId: 's95b-language',
@@ -114,7 +140,10 @@ function buildOptions() {
114
140
  codecMenu(t),
115
141
  qualityMenu(t),
116
142
  miniMenu(),
117
- { name: t('light'), subtitle: t('lightHint'), value: 's95bLowOverhead' }
143
+ // TizenTube's own switch (also in green > misc): plays a video with sound when a tile is focused.
144
+ { name: t('previews'), subtitle: t('previewsHint'), value: 'enablePreviews' },
145
+ { name: t('light'), subtitle: t('lightHint'), value: 's95bLowOverhead' },
146
+ exitMenu()
118
147
  ];
119
148
  }
120
149
 
@@ -122,7 +151,7 @@ function openMenu() {
122
151
  try {
123
152
  optionShow({
124
153
  menuId: 's95b-menu',
125
- menuHeader: { title: t('title'), subtitle: statsLine() },
154
+ menuHeader: { title: t('title') + ' v' + VERSION, subtitle: statsLine() },
126
155
  selectedIndex: 0,
127
156
  options: buildOptions()
128
157
  }, false);
@@ -143,13 +172,29 @@ function onConfigChange(event) {
143
172
  const detail = event && event.detail;
144
173
  if (!detail) return;
145
174
  if (detail.key === 's95bLowOverhead') turnLight(detail.value === true);
146
- else if (detail.key === 's95bLanguage') { state.lang = detail.value === 'en' ? 'en' : 'de'; save(); }
175
+ else if (detail.key === 's95bExit') {
176
+ if (detail.value !== 'now') return;
177
+ configWrite('s95bExit', 'no'); // never leave "now" stored
178
+ exitApp();
179
+ } else if (detail.key === 's95bLanguage') { state.lang = detail.value === 'en' ? 'en' : 'de'; save(); }
180
+ }
181
+
182
+ // Once, on the first start of 0.3.3 or later: switch TizenTube's tile previews off (they autoplay with sound).
183
+ // Afterwards the user's choice in the menu is never touched again.
184
+ function previewsOffOnce() {
185
+ if (state.previewsOff033) return;
186
+ if (configRead('enablePreviews') !== false) configWrite('enablePreviews', false);
187
+ if (state.previous && Object.prototype.hasOwnProperty.call(state.previous, 'enablePreviews')) state.previous.enablePreviews = false;
188
+ state.previewsOff033 = true;
189
+ save();
147
190
  }
148
191
 
149
192
  function init() {
193
+ previewsOffOnce();
150
194
  // Menu entries read their current value from the TizenTube config, so mirror our stored state into it first.
151
195
  if (configRead('s95bLowOverhead') !== state.light) configWrite('s95bLowOverhead', state.light);
152
196
  if (configRead('s95bLanguage') !== state.lang) configWrite('s95bLanguage', state.lang);
197
+ if (configRead('s95bExit') !== 'no') configWrite('s95bExit', 'no');
153
198
  Object.keys(MINI_DEFAULTS).forEach(key => {
154
199
  if (MINI_VALUES[key].indexOf(configRead(key)) < 0) configWrite(key, MINI_DEFAULTS[key]);
155
200
  });
@@ -0,0 +1,2 @@
1
+ // Generated by create-fork.mjs from the kit's VERSION file. Do not edit.
2
+ export const S95B_VERSION_TAG = 's95b-version:0.3.3';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oxymoron.13/tizentube-s95b",
3
- "appName": "TizenTube S95B Performance (Fork)",
4
- "version": "0.3.1",
3
+ "appName": "TizenTube S95B 0.3.3 (Fork)",
4
+ "version": "0.3.3",
5
5
  "description": "Unofficial fork of TizenTube (@foxreis/tizentube) for TizenBrew: reversible performance profile, German/English settings, smaller bundle.",
6
6
  "packageType": "mods",
7
7
  "websiteURL": "https://youtube.com/tv?additionalDataUrl=http%3A%2F%2Flocalhost%3A8085%2Fdial%2Fapps%2FYouTube",