@applicaster/zapp-react-native-utils 15.0.0-alpha.2413435535 → 15.0.0-alpha.2598273579

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.
@@ -234,35 +234,67 @@ export class TTSManager {
234
234
  });
235
235
  } catch (error) {
236
236
  log_debug("webOS settings service request error", { error });
237
- this.screenReaderEnabled$.next(false);
237
+ // Fallback to true if the service is not available
238
+ this.screenReaderEnabled$.next(true);
238
239
  }
239
240
  }
240
241
 
241
- if (isSamsungPlatform() && typeof window.tizen !== "undefined") {
242
+ if (isSamsungPlatform() && typeof window.webapis !== "undefined") {
242
243
  try {
243
244
  if (
244
- window.tizen.accessibility &&
245
- typeof window.tizen.accessibility
246
- .addVoiceGuideStatusChangeListener === "function"
245
+ window.webapis?.tvinfo &&
246
+ typeof window.webapis.tvinfo.getMenuValue === "function" &&
247
+ typeof window.webapis.tvinfo.addCaptionChangeListener === "function"
247
248
  ) {
249
+ // Get initial Voice Guide status
250
+ const initialStatus = window.webapis.tvinfo.getMenuValue(
251
+ window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY
252
+ );
253
+
254
+ const isEnabled =
255
+ initialStatus === window.webapis.tvinfo.TvInfoMenuValue.ON;
256
+
257
+ log_debug("Samsung Voice Guide initial status", {
258
+ isEnabled,
259
+ initialStatus,
260
+ });
261
+
262
+ this.screenReaderEnabled$.next(isEnabled);
263
+
264
+ // Listen for Voice Guide status changes
265
+ const onChange = () => {
266
+ const currentStatus = window.webapis.tvinfo.getMenuValue(
267
+ window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY
268
+ );
269
+
270
+ const enabled =
271
+ currentStatus === window.webapis.tvinfo.TvInfoMenuValue.ON;
272
+
273
+ log_debug("Samsung Voice Guide status changed", {
274
+ enabled,
275
+ currentStatus,
276
+ });
277
+
278
+ this.screenReaderEnabled$.next(enabled);
279
+ };
280
+
248
281
  this.samsungListenerId =
249
- window.tizen.accessibility.addVoiceGuideStatusChangeListener(
250
- (enabled: boolean) => {
251
- log_debug("Samsung Voice Guide status changed", { enabled });
252
- this.screenReaderEnabled$.next(!!enabled);
253
- }
282
+ window.webapis.tvinfo.addCaptionChangeListener(
283
+ window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY,
284
+ onChange
254
285
  );
255
286
 
256
287
  log_debug("Samsung Voice Guide listener registered", {
257
288
  listenerId: this.samsungListenerId,
258
289
  });
259
290
  } else {
260
- log_debug("Samsung accessibility API not available");
291
+ log_debug("Samsung TvInfo API not available");
261
292
  this.screenReaderEnabled$.next(false);
262
293
  }
263
294
  } catch (error) {
264
295
  log_debug("Samsung Voice Guide listener error", { error });
265
- this.screenReaderEnabled$.next(false);
296
+ // Fallback to true if the service is not available
297
+ this.screenReaderEnabled$.next(true);
266
298
  }
267
299
  }
268
300
  }
@@ -282,31 +314,14 @@ export class TTSManager {
282
314
  readText(text: string) {
283
315
  this.ttsState$.next(true);
284
316
 
285
- if (
286
- isSamsungPlatform() &&
287
- typeof window.tizen !== "undefined" &&
288
- window.tizen.speech
289
- ) {
290
- try {
291
- const successCallback = () => {
292
- log_debug("Samsung TTS play started successfully");
293
- // Estimate reading time and set inactive when done
294
- this.scheduleTTSComplete(text);
295
- };
296
-
297
- const errorCallback = (error: any) => {
298
- log_debug("Samsung TTS error", { error: error?.message || error });
299
- this.ttsState$.next(false);
300
- };
317
+ if (isSamsungPlatform() && window.speechSynthesis) {
318
+ const utterance = new SpeechSynthesisUtterance(text);
301
319
 
302
- // Clear any previous speech before speaking new text
303
- window.tizen.speech.stop();
320
+ window.speechSynthesis.cancel(); // Cancel previous speech before speaking new text
321
+ window.speechSynthesis.speak(utterance);
304
322
 
305
- window.tizen.speech.speak(text, successCallback, errorCallback);
306
- } catch (error) {
307
- log_debug("Samsung TTS speak() error", { error });
308
- this.ttsState$.next(false);
309
- }
323
+ // Estimate reading time and set inactive when done
324
+ this.scheduleTTSComplete(text);
310
325
  }
311
326
 
312
327
  if (isLgPlatform() && window.webOS?.service) {
@@ -9,10 +9,7 @@ import {
9
9
  } from "@applicaster/zapp-react-native-utils/stringUtils";
10
10
  import { cellUtilsLogger } from "@applicaster/zapp-react-native-utils/cellUtils/logger";
11
11
  import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
12
- import {
13
- isNotNil,
14
- isNilOrEmpty,
15
- } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
12
+ import { isNotNil } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
16
13
 
17
14
  import { toNumberWithDefault, toNumberWithDefaultZero } from "../numberUtils";
18
15
 
@@ -509,9 +506,6 @@ export const getImageContainerMarginStyles = ({ value }: { value: any }) => {
509
506
  };
510
507
  };
511
508
 
512
- export const withoutNilOrEmpty = (arr: string[]): string[] =>
513
- arr.filter((item) => !isNilOrEmpty(item));
514
-
515
509
  export const isTextLabel = (key: string): boolean =>
516
510
  key.includes("text_label_") && key.endsWith("_switch");
517
511
 
@@ -531,7 +525,6 @@ export const hasTextLabelsEnabled = (
531
525
 
532
526
  const pickedValues = Object.values(picked);
533
527
 
534
- // Check if any switch value is truthy (true, "true", "1", etc.)
535
528
  return pickedValues.some((value) => {
536
529
  if (typeof value === "boolean") {
537
530
  return value === true;
@@ -959,6 +959,27 @@ const TV_CELL_LABEL_FIELDS = [
959
959
  rules: "conditional",
960
960
  conditions: [{ key: "switch", section: "styles", value: true }],
961
961
  },
962
+ {
963
+ type: ZAPPIFEST_FIELDS.font_selector.roku,
964
+ suffix: "roku font family",
965
+ tooltip: "",
966
+ rules: "conditional",
967
+ conditions: [{ key: "switch", section: "styles", value: true }],
968
+ },
969
+ {
970
+ type: ZAPPIFEST_FIELDS.number_input,
971
+ suffix: "roku font size",
972
+ tooltip: "",
973
+ rules: "conditional",
974
+ conditions: [{ key: "switch", section: "styles", value: true }],
975
+ },
976
+ {
977
+ type: ZAPPIFEST_FIELDS.number_input,
978
+ suffix: "roku line height",
979
+ tooltip: "",
980
+ rules: "conditional",
981
+ conditions: [{ key: "switch", section: "styles", value: true }],
982
+ },
962
983
  {
963
984
  type: ZAPPIFEST_FIELDS.select,
964
985
  suffix: "text alignment",
@@ -3,6 +3,7 @@ const defaultPlatforms = {
3
3
  android_tv: "Android TV",
4
4
  lg_tv: "LG TV",
5
5
  samsung_tv: "Samsung TV",
6
+ roku: "Roku TV",
6
7
  };
7
8
 
8
9
  const global_defaults = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "15.0.0-alpha.2413435535",
3
+ "version": "15.0.0-alpha.2598273579",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "15.0.0-alpha.2413435535",
30
+ "@applicaster/applicaster-types": "15.0.0-alpha.2598273579",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",