@applicaster/zapp-react-native-utils 12.0.0-alpha.4337072244 → 12.0.0-alpha.4354608902
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/analyticsUtils/AnalyticsEvents/index.ts +7 -0
- package/analyticsUtils/AnalyticsEvents/sendShareEvent.ts +21 -0
- package/analyticsUtils/analyticsPlugins.ts +25 -0
- package/analyticsUtils/events.ts +6 -0
- package/analyticsUtils/index.tsx +6 -0
- package/appUtils/HooksManager/{Hook.js → Hook.ts} +35 -23
- package/appUtils/HooksManager/{constants.js → constants.ts} +1 -1
- package/appUtils/HooksManager/{index.js → index.ts} +118 -111
- package/appUtils/HooksManager/types.ts +116 -0
- package/appUtils/RiverFocusManager/index.js +17 -12
- package/appUtils/accessibilityManager/const.ts +50 -0
- package/appUtils/accessibilityManager/hooks.ts +31 -0
- package/appUtils/accessibilityManager/index.ts +150 -0
- package/appUtils/accessibilityManager/logger.ts +5 -0
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +1 -2
- package/appUtils/focusManager/__tests__/index.test.ts +1 -2
- package/appUtils/focusManager/index.ts +7 -73
- package/appUtils/focusManager/treeDataStructure/Tree/index.js +2 -3
- package/appUtils/focusManager/treeDataStructure/Utils/index.js +7 -8
- package/appUtils/focusManager/utils/index.ts +8 -2
- package/appUtils/focusManagerAux/index.ts +76 -0
- package/appUtils/focusManagerAux/utils/index.ts +100 -0
- package/appUtils/{index.js → index.ts} +2 -0
- package/appUtils/keyCodes/{index.js → index.ts} +2 -0
- package/appUtils/keyCodes/keys/index.ts +3 -0
- package/appUtils/keyCodes/{keys.android.js → keys/keyEventMapper.ts} +0 -19
- package/appUtils/keyCodes/keys/keys.android.ts +18 -0
- package/appUtils/keyCodes/keys/keys.ios.ts +25 -0
- package/appUtils/keyCodes/keys/keys.ts +15 -0
- package/appUtils/keyCodes/{keys.web.js → keys/keys.web.ts} +8 -0
- package/appUtils/keyCodes/{keysByPlatform.js → keys/keysByPlatform.ts} +11 -1
- package/appUtils/platform/const.ts +25 -0
- package/appUtils/platform/index.ts +3 -0
- package/appUtils/platform/platformUtils.ts +171 -0
- package/appUtils/playerManager/conts.ts +1 -0
- package/appUtils/playerManager/index.ts +11 -5
- package/appUtils/playerManager/nativePlayerManager.ts +12 -0
- package/appUtils/playerManager/player.ts +9 -3
- package/appUtils/playerManager/playerNative.ts +5 -14
- package/appUtils/playerManager/usePlayerControllerSetup.tsx +7 -1
- package/booleanUtils/index.ts +4 -4
- package/domUtils/{cookieManager.js → cookieManager.ts} +1 -2
- package/functionUtils/index.ts +15 -11
- package/keyboardState/index.ts +0 -0
- package/modalState/index.ts +1 -5
- package/navigationUtils/index.ts +62 -5
- package/package.json +2 -2
- package/pluginUtils/index.ts +9 -0
- package/reactHooks/cell-click/__tests__/index.test.js +2 -1
- package/reactHooks/cell-click/index.ts +1 -1
- package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +6 -2
- package/reactHooks/feed/useFeedRefresh.tsx +9 -7
- package/reactHooks/navigation/__tests__/index.test.tsx +11 -8
- package/reactHooks/navigation/index.ts +53 -72
- package/reactHooks/screen/useScreenContext.ts +1 -2
- package/reactUtils/index.ts +91 -0
- package/appUtils/focusManager/FocusableEvents.ts +0 -8
- package/appUtils/focusManager/treeDataStructure/Utils/__tests__/Utils_android.test.js +0 -1094
- package/appUtils/focusManager/treeDataStructure/Utils/index.android.js +0 -261
- package/appUtils/keyCodes/keys.ios.js +0 -46
- /package/appUtils/HooksManager/{logger.js → logger.ts} +0 -0
- /package/appUtils/{directionHelper.js → directionHelper.ts} +0 -0
- /package/appUtils/keyCodes/{androidTVKeys.js → androidTVKeys.ts} +0 -0
- /package/appUtils/{localizationsHelper.js → localizationsHelper.ts} +0 -0
- /package/domUtils/{logger.js → logger.ts} +0 -0
package/reactUtils/index.ts
CHANGED
|
@@ -108,3 +108,94 @@ export const isAndroidPlatform = () => Platform.OS === "android";
|
|
|
108
108
|
export const isTvOSPlatform = () => getPlatform() === "tvos";
|
|
109
109
|
|
|
110
110
|
export const isAndroidTVPlatform = () => getPlatform() === "android_tv";
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Platforms found in userAgent string, please note that simulators
|
|
114
|
+
* might not have the same agents that the devices have
|
|
115
|
+
*/
|
|
116
|
+
export const PLATFORMS = {
|
|
117
|
+
webos: "Web0S",
|
|
118
|
+
tizen: "Tizen",
|
|
119
|
+
samsung: "SMART-TV",
|
|
120
|
+
mac: "Mac",
|
|
121
|
+
win: "Win",
|
|
122
|
+
linux: "Linux",
|
|
123
|
+
iphone: "iPhone",
|
|
124
|
+
android: "Android",
|
|
125
|
+
mobile: "Mobile",
|
|
126
|
+
vizio: "VIZIO",
|
|
127
|
+
smartcast: "SmartCast",
|
|
128
|
+
conjure: "Conjure",
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Simple way of identifying if we have access to the tizen APIs
|
|
133
|
+
*/
|
|
134
|
+
export const hasTizen = typeof window?.tizen !== "undefined";
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Simple way of identifying if we have access to the webOS APIs
|
|
138
|
+
*/
|
|
139
|
+
export const hasWebOS = typeof window?.webOS !== "undefined";
|
|
140
|
+
|
|
141
|
+
export const getUserAgent = () =>
|
|
142
|
+
window?.navigator?.userAgent || global?.navigator?.userAgent;
|
|
143
|
+
|
|
144
|
+
export const isLgPlatform = () => {
|
|
145
|
+
const userAgent = getUserAgent();
|
|
146
|
+
|
|
147
|
+
if (!userAgent) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Note: LG uses the number 0 in their userAgent, possibly because of Palm WebOS
|
|
152
|
+
return hasWebOS || userAgent.includes(PLATFORMS.webos);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const isSamsungPlatform = () => {
|
|
156
|
+
const userAgent = getUserAgent();
|
|
157
|
+
|
|
158
|
+
if (!userAgent) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
hasTizen ||
|
|
164
|
+
userAgent.includes(PLATFORMS.samsung) ||
|
|
165
|
+
userAgent.includes(PLATFORMS.tizen)
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Checks if we are on the Vizio platform by using the userAgent string
|
|
171
|
+
*
|
|
172
|
+
* Use this method when you need to identify the platform on runtime
|
|
173
|
+
* before the VIZIO Companion Library has loaded
|
|
174
|
+
*/
|
|
175
|
+
export const isVizioPlatform = () => {
|
|
176
|
+
const userAgent = getUserAgent();
|
|
177
|
+
|
|
178
|
+
if (!userAgent) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const isVizioAgent =
|
|
183
|
+
userAgent.includes(PLATFORMS.vizio) ||
|
|
184
|
+
userAgent.includes(PLATFORMS.smartcast) ||
|
|
185
|
+
userAgent.includes(PLATFORMS.conjure);
|
|
186
|
+
|
|
187
|
+
return isVizioAgent;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Checks if we are on the Vizio platform by checking for the global VIZIO object
|
|
192
|
+
* and the VIZIO Companion Library. This method does not use the userAgent string,
|
|
193
|
+
* because it mainly checks whether we have access to apis, which may not be available yet
|
|
194
|
+
*/
|
|
195
|
+
export const hasVizioAPIs = () => {
|
|
196
|
+
const hasAPIs =
|
|
197
|
+
typeof window.VIZIO !== "undefined" &&
|
|
198
|
+
window?.applicaster?.vizioLibraryDidLoad;
|
|
199
|
+
|
|
200
|
+
return hasAPIs;
|
|
201
|
+
};
|