@applicaster/zapp-react-native-utils 12.0.4-rc.3 → 12.0.5-alpha.1340200034

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.
@@ -95,9 +95,12 @@ export class ClosedCaptioningManager {
95
95
 
96
96
  static getInstance(): ClosedCaptioningManager {
97
97
  if (!ClosedCaptioningManager.ccManagerInstance) {
98
+ log_debug("ClosedCaptioningManager: Creating new instance");
98
99
  ClosedCaptioningManager.ccManagerInstance = new ClosedCaptioningManager();
99
100
  }
100
101
 
102
+ log_debug("ClosedCaptioningManager: Returning existing instance");
103
+
101
104
  return ClosedCaptioningManager.ccManagerInstance;
102
105
  }
103
106
 
@@ -106,23 +109,41 @@ export class ClosedCaptioningManager {
106
109
  PLATFORM_KEYS.deviceClosedCaptioningEnabled
107
110
  );
108
111
 
109
- log_debug("Initializing closed captioning manager", { existingState });
110
-
111
112
  if (existingState !== null) {
113
+ log_debug(
114
+ `ClosedCaptioningManager: Setting initial state to ${existingState}`
115
+ );
116
+
112
117
  this.ccState$.next(existingState === "true" || existingState === true);
118
+ } else {
119
+ log_debug("ClosedCaptioningManager: No existing state found");
113
120
  }
114
121
 
115
122
  if (hasVizioAPIs()) {
123
+ log_debug("ClosedCaptioningManager: Setting closed captioning handler");
124
+
116
125
  window.VIZIO!.setClosedCaptionHandler((isCCEnabled) => {
117
- log_debug("CC state changed", { isCCEnabled });
126
+ log_debug(
127
+ "ClosedCaptioningManager: There was a change in the CC state",
128
+ { isCCEnabled }
129
+ );
118
130
 
119
131
  sessionStorage.setItem(
120
132
  PLATFORM_KEYS.deviceClosedCaptioningEnabled,
121
133
  isCCEnabled
122
134
  );
123
135
 
136
+ log_debug(
137
+ "ClosedCaptioningManager: Saved CC state to session storage",
138
+ { isCCEnabled }
139
+ );
140
+
124
141
  this.ccState$.next(isCCEnabled);
125
142
  });
143
+ } else {
144
+ log_debug(
145
+ "ClosedCaptioningManager: Vizio APIs are not available, skipping setup"
146
+ );
126
147
  }
127
148
  }
128
149
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.4-rc.3",
3
+ "version": "12.0.5-alpha.1340200034",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.4-rc.3",
31
+ "@applicaster/applicaster-types": "12.0.5-alpha.1340200034",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+
3
+ /**
4
+ * returns a ref with an initial value that is lazily evaluated once
5
+ * */
6
+ export const useRefWithInitialValue = <T>(initialValueGetter: () => T) => {
7
+ const ref = React.useRef<T>(null);
8
+
9
+ if (ref.current === null) {
10
+ ref.current = initialValueGetter();
11
+ }
12
+
13
+ return ref;
14
+ };