@applicaster/zapp-react-dom-app 13.0.0-alpha.9433330286 → 13.0.0-rc.11

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.
@@ -451,9 +451,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
451
451
  const isHookInHomescreen = entryData?.payload?.home;
452
452
 
453
453
  const isHookFlowBlocker =
454
- typeof entryData?.hookPlugin?.module?.isFlowBlocker === "function"
455
- ? entryData?.hookPlugin?.module?.isFlowBlocker()
456
- : entryData?.hookPlugin?.module?.isFlowBlocker;
454
+ entryData?.hookPlugin?.module?.isFlowBlocker();
457
455
 
458
456
  if (isHookInHomescreen && isHookFlowBlocker) {
459
457
  this.platformBack();
@@ -11,28 +11,11 @@ import {
11
11
  PLATFORMS,
12
12
  } from "./const";
13
13
 
14
- /**
15
- * @typedef {"tv" | "web" | "other"} DeviceType
16
- * @typedef {"samsung_tv" | "lg_tv" | unknown} CustomPlatformTypes
17
- */
18
-
19
- /**
20
- * Retrieves the user agent string from the browser or global navigator.
21
- * @returns {string} The user agent string.
22
- */
23
14
  export const getUserAgent = () =>
24
15
  window?.navigator?.userAgent || global?.navigator?.userAgent;
25
16
 
26
- /**
27
- * Checks if the device is HD (1280 width).
28
- * @returns {boolean} True if the device is HD, false otherwise.
29
- */
30
17
  export const isHD = () => window.innerWidth === 1280;
31
18
 
32
- /**
33
- * Checks if the platform is LG.
34
- * @returns {boolean} True if the platform is LG, false otherwise.
35
- */
36
19
  export const isLgPlatform = () => {
37
20
  const userAgent = getUserAgent();
38
21
 
@@ -40,13 +23,10 @@ export const isLgPlatform = () => {
40
23
  return false;
41
24
  }
42
25
 
26
+ // Note: LG uses the number 0 in their userAgent, possibly because of Palm WebOS
43
27
  return hasWebOS || userAgent.includes(PLATFORMS.webos);
44
28
  };
45
29
 
46
- /**
47
- * Checks if the platform is Samsung.
48
- * @returns {boolean} True if the platform is Samsung, false otherwise.
49
- */
50
30
  export const isSamsungPlatform = () => {
51
31
  const userAgent = getUserAgent();
52
32
 
@@ -62,39 +42,42 @@ export const isSamsungPlatform = () => {
62
42
  };
63
43
 
64
44
  /**
65
- * Checks if the platform is Vizio by using the user agent string.
66
- * @returns {boolean} True if the platform is Vizio, false otherwise.
45
+ * Checks if we are on the Vizio platform by using the userAgent string
46
+ *
47
+ * Use this method when you need to identify the platform on runtime
48
+ * before the VIZIO Companion Library has loaded
67
49
  */
68
50
  export const isVizioPlatform = () => {
69
51
  const userAgent = getUserAgent();
70
52
 
71
- return (
53
+ const isVizioAgent =
72
54
  userAgent.includes(PLATFORMS.vizio) ||
73
55
  userAgent.includes(PLATFORMS.smartcast) ||
74
- userAgent.includes(PLATFORMS.conjure)
75
- );
56
+ userAgent.includes(PLATFORMS.conjure);
57
+
58
+ return isVizioAgent;
76
59
  };
77
60
 
78
61
  /**
79
- * Checks if the Vizio APIs are available.
80
- * @returns {boolean} True if the Vizio APIs are available, false otherwise.
62
+ * Checks if we are on the Vizio platform by checking for the global VIZIO object
63
+ * and the VIZIO Companion Library. This method does not use the userAgent string,
64
+ * because it mainly checks whether we have access to apis, which may not be available yet
81
65
  */
82
66
  export const hasVizioAPIs = () => {
83
- return (
67
+ const hasAPIs =
84
68
  typeof window.VIZIO !== "undefined" &&
85
- window?.applicaster?.vizioLibraryDidLoad
86
- );
69
+ window?.applicaster?.vizioLibraryDidLoad;
70
+
71
+ return hasAPIs;
87
72
  };
88
73
 
89
74
  /**
90
- * Determines the device type based on the platform.
91
- * @returns {DeviceType} The device type ("tv", "web", or "other").
75
+ * platformSelect can't be used, because Platform.OS is overriden
76
+ * by overloadReactNativePlatform and don't support 'web' value
77
+ * @returns {"tv" | "web" | "other"} value
92
78
  */
93
79
  export const getDeviceType = () => {
94
- /** @type {CustomPlatformTypes} */
95
- const platformOS = Platform.OS;
96
-
97
- switch (platformOS) {
80
+ switch (Platform.OS) {
98
81
  case "samsung_tv":
99
82
  return isSamsungPlatform() ? "tv" : "web";
100
83
  case "lg_tv":
@@ -105,15 +88,14 @@ export const getDeviceType = () => {
105
88
  };
106
89
 
107
90
  /**
108
- * Renames keys based on a predefined map.
109
- * @param {string} key - The key to rename.
110
- * @returns {string} The renamed key.
91
+ * This function is used to rename keys
92
+ * @param {string} key - key you would like to rename
111
93
  */
112
94
  export const renameKeys = (key) => desiredKeysMap?.[key] || key;
113
95
 
114
96
  /**
115
- * Retrieves the connection info from WebOS.
116
- * @returns {Promise<{networkType: string} | null>} A promise that resolves with the connection info or null.
97
+ * This function is used to get the connection info from WebOS
98
+ * TODO: move to connection hook
117
99
  */
118
100
  export const getWebOSConnectionInfo = () => {
119
101
  return new Promise((resolve, reject) => {
@@ -126,6 +108,7 @@ export const getWebOSConnectionInfo = () => {
126
108
  webOS.service.request("luna://com.palm.connectionmanager", {
127
109
  method: "getStatus",
128
110
  parameters: { subscribe: false },
111
+
129
112
  onSuccess: (args) => {
130
113
  const types = Object.keys(args)
131
114
  .filter((key) => args[key].state === "connected")
@@ -133,6 +116,7 @@ export const getWebOSConnectionInfo = () => {
133
116
 
134
117
  resolve({ networkType: types });
135
118
  },
119
+
136
120
  onFailure: (error) => {
137
121
  console.error(
138
122
  "getWebOSConnectionInfo: There was an error getting connection info",
@@ -145,10 +129,6 @@ export const getWebOSConnectionInfo = () => {
145
129
  });
146
130
  };
147
131
 
148
- /**
149
- * Retrieves the connection info from Tizen.
150
- * @returns {Promise<{networkType: string} | null>} A promise that resolves with the connection info or null.
151
- */
152
132
  export const getTizenConnectionInfo = () => {
153
133
  return new Promise((resolve, reject) => {
154
134
  if (!isSamsungPlatform) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "13.0.0-alpha.9433330286",
3
+ "version": "13.0.0-rc.11",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/applicaster/zapp-react-dom-app#readme",
24
24
  "dependencies": {
25
- "@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.9433330286",
26
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.9433330286",
27
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.9433330286",
28
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.9433330286",
29
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.9433330286",
25
+ "@applicaster/zapp-react-dom-ui-components": "13.0.0-rc.11",
26
+ "@applicaster/zapp-react-native-bridge": "13.0.0-rc.11",
27
+ "@applicaster/zapp-react-native-redux": "13.0.0-rc.11",
28
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.11",
29
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.11",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "history": "^4.7.2",
32
32
  "react-router-dom": "^5.1.2",