@applicaster/zapp-react-native-utils 14.0.0-alpha.1216545755 → 14.0.0-alpha.1384310723
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/actionsExecutor/ActionExecutorContext.tsx +83 -54
- package/appUtils/accessibilityManager/index.ts +2 -2
- package/appUtils/contextKeysManager/contextResolver.ts +1 -14
- package/manifestUtils/defaultManifestConfigurations/player.js +8 -0
- package/manifestUtils/keys.js +12 -0
- package/package.json +2 -2
- package/playerUtils/getPlayerActionButtons.ts +1 -1
- package/reactHooks/cell-click/index.ts +1 -8
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +0 -20
- package/reactHooks/feed/useFeedLoader.tsx +5 -12
- package/reactHooks/navigation/useRoute.ts +2 -7
- package/time/BackgroundTimer.ts +5 -3
- package/utils/index.ts +4 -0
- package/actionsExecutor/ScreenActions.ts +0 -92
- package/actionsExecutor/StorageActions.ts +0 -110
- package/actionsExecutor/feedDecorator.ts +0 -171
- package/actionsExecutor/screenResolver.ts +0 -11
- package/reactHooks/navigation/useScreenStateStore.ts +0 -11
- package/storage/ScreenSingleValueProvider.ts +0 -198
- package/storage/ScreenStateMultiSelectProvider.ts +0 -293
- package/storage/StorageMultiSelectProvider.ts +0 -192
- package/storage/StorageSingleSelectProvider.ts +0 -108
|
@@ -16,6 +16,7 @@ import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickB
|
|
|
16
16
|
import { showConfirmationDialog } from "../alertUtils";
|
|
17
17
|
import { createCloudEvent, sendCloudEvent } from "../cloudEventsUtils";
|
|
18
18
|
import { createLogger } from "../logger";
|
|
19
|
+
import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
|
|
19
20
|
import { ACTIVE_LAYOUT_ID_STORAGE_KEY } from "@applicaster/quick-brick-core/App/remoteContextReloader/consts";
|
|
20
21
|
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
21
22
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
@@ -24,19 +25,15 @@ import {
|
|
|
24
25
|
resolveObjectValues,
|
|
25
26
|
} from "../appUtils/contextKeysManager/contextResolver";
|
|
26
27
|
import { useNavigation } from "../reactHooks";
|
|
28
|
+
import { get } from "../utils";
|
|
27
29
|
|
|
28
30
|
import {
|
|
29
31
|
useContentTypes,
|
|
30
32
|
usePickFromState,
|
|
31
33
|
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
32
|
-
import {
|
|
34
|
+
import { TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT } from "./consts";
|
|
35
|
+
import { postEvent, useSubscriberFor } from "../reactHooks/useSubscriberFor";
|
|
33
36
|
import { APP_EVENTS } from "../appUtils/events";
|
|
34
|
-
import {
|
|
35
|
-
localStorageToggleFlag,
|
|
36
|
-
sessionStorageToggleFlag,
|
|
37
|
-
} from "./StorageActions";
|
|
38
|
-
|
|
39
|
-
import { screenSetVariable, screenToggleFlag } from "./ScreenActions";
|
|
40
37
|
|
|
41
38
|
export const { log_error, log_info, log_debug } = createLogger({
|
|
42
39
|
subsystem: "ActionExecutorContext",
|
|
@@ -85,6 +82,19 @@ function findParentComponent(
|
|
|
85
82
|
return null;
|
|
86
83
|
}
|
|
87
84
|
|
|
85
|
+
// send all data just in case (like for message string formatting)
|
|
86
|
+
// Type is not exported for now
|
|
87
|
+
type MaxTagsReachedEvent = {
|
|
88
|
+
selectedItems: string[];
|
|
89
|
+
maxItems: number;
|
|
90
|
+
tag: string;
|
|
91
|
+
keyNamespace: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
async function onMaxTagsReached(data: MaxTagsReachedEvent) {
|
|
95
|
+
postEvent(TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT, [data]);
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
const prepareDefaultActions = (actionExecutor) => {
|
|
89
99
|
actionExecutor.registerAction("localStorageSet", async (action) => {
|
|
90
100
|
const namespaces = action.options.content;
|
|
@@ -168,15 +178,10 @@ const prepareDefaultActions = (actionExecutor) => {
|
|
|
168
178
|
|
|
169
179
|
const entry = context?.entry || {};
|
|
170
180
|
const entryResolver = new EntryResolver(entry);
|
|
171
|
-
const screenData = context?.screenStateStore.getState().data || {};
|
|
172
|
-
const screenResolver = new EntryResolver(screenData || {});
|
|
173
181
|
|
|
174
182
|
const data =
|
|
175
183
|
options?.data && options.inflateData
|
|
176
|
-
? await resolveObjectValues(options.data, {
|
|
177
|
-
entry: entryResolver,
|
|
178
|
-
screen: screenResolver,
|
|
179
|
-
})
|
|
184
|
+
? await resolveObjectValues(options.data, { entry: entryResolver })
|
|
180
185
|
: options?.data || entry;
|
|
181
186
|
|
|
182
187
|
const cloudEvent = await createCloudEvent({
|
|
@@ -210,57 +215,81 @@ const prepareDefaultActions = (actionExecutor) => {
|
|
|
210
215
|
return ActionResult.Error;
|
|
211
216
|
});
|
|
212
217
|
|
|
213
|
-
actionExecutor.registerAction(
|
|
214
|
-
"sessionStorageToggleFlag",
|
|
215
|
-
async (
|
|
216
|
-
action: ActionType,
|
|
217
|
-
context?: Record<string, any>
|
|
218
|
-
): Promise<ActionResult> => {
|
|
219
|
-
return await sessionStorageToggleFlag(context, action);
|
|
220
|
-
}
|
|
221
|
-
);
|
|
222
|
-
|
|
223
218
|
actionExecutor.registerAction(
|
|
224
219
|
"localStorageToggleFlag",
|
|
225
220
|
async (
|
|
226
221
|
action: ActionType,
|
|
227
222
|
context?: Record<string, any>
|
|
228
223
|
): Promise<ActionResult> => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
224
|
+
if (!context) {
|
|
225
|
+
log_error(
|
|
226
|
+
"handleAction: localStorageToggleFlag action missing context"
|
|
227
|
+
);
|
|
232
228
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
async (
|
|
236
|
-
action: ActionType,
|
|
237
|
-
context?: Record<string, any>
|
|
238
|
-
): Promise<ActionResult> => {
|
|
239
|
-
const route = context?.screenRoute;
|
|
240
|
-
const { key, value } = action.options;
|
|
241
|
-
screenSetVariable(route, key, value);
|
|
229
|
+
return ActionResult.Error;
|
|
230
|
+
}
|
|
242
231
|
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
);
|
|
232
|
+
const entry = context?.entry as ZappEntry;
|
|
246
233
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
)
|
|
234
|
+
if (!entry) {
|
|
235
|
+
log_error(
|
|
236
|
+
"handleAction: localStorageToggleFlag action missing entry. Entry is required to get the tag."
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
return ActionResult.Error;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const tag = action.options?.selector
|
|
243
|
+
? get(entry, action.options.selector)
|
|
244
|
+
: (entry.extensions?.tag ?? entry.id);
|
|
245
|
+
|
|
246
|
+
const keyNamespace = action.options?.key;
|
|
247
|
+
|
|
248
|
+
if (keyNamespace && tag) {
|
|
249
|
+
const multiSelectProvider =
|
|
250
|
+
StorageMultiSelectProvider.getProvider(keyNamespace);
|
|
251
|
+
|
|
252
|
+
const selectedItems = await multiSelectProvider.getSelectedAsync();
|
|
253
|
+
const isTagInSelectedItems = selectedItems.includes(tag);
|
|
254
|
+
|
|
255
|
+
log_info(
|
|
256
|
+
`handleAction: localStorageToggleFlag event will ${
|
|
257
|
+
isTagInSelectedItems ? "remove" : "add"
|
|
258
|
+
} tag: ${tag} for keyNamespace: ${keyNamespace}, current selectedItems: ${selectedItems}`
|
|
259
|
+
);
|
|
262
260
|
|
|
263
|
-
|
|
261
|
+
if (selectedItems.includes(tag)) {
|
|
262
|
+
await multiSelectProvider.removeItem(tag);
|
|
263
|
+
} else {
|
|
264
|
+
const maxItems = action.options?.max_items;
|
|
265
|
+
|
|
266
|
+
if (maxItems && selectedItems.length >= maxItems) {
|
|
267
|
+
log_info(
|
|
268
|
+
`handleAction: localStorageToggleFlag event reached max items limit: ${maxItems}, cannot add tag: ${tag}`
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
await onMaxTagsReached({
|
|
272
|
+
selectedItems,
|
|
273
|
+
maxItems,
|
|
274
|
+
tag,
|
|
275
|
+
keyNamespace,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
return ActionResult.Cancel;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
await multiSelectProvider.addItem(tag);
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
log_error(
|
|
285
|
+
"handleAction: localStorageToggleFlag event missing keyNamespace or tag",
|
|
286
|
+
{ keyNamespace, tag }
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
return ActionResult.Error;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return ActionResult.Success;
|
|
264
293
|
}
|
|
265
294
|
);
|
|
266
295
|
};
|
|
@@ -3,7 +3,7 @@ import { accessibilityManagerLogger as logger } from "./logger";
|
|
|
3
3
|
import { TTSManager } from "../platform/platformUtils";
|
|
4
4
|
import { BUTTON_ACCESSIBILITY_KEYS } from "./const";
|
|
5
5
|
import { AccessibilityRole } from "react-native";
|
|
6
|
-
import
|
|
6
|
+
import { toString } from "../../utils";
|
|
7
7
|
|
|
8
8
|
export class AccessibilityManager {
|
|
9
9
|
private static _instance: AccessibilityManager | null = null;
|
|
@@ -137,7 +137,7 @@ export class AccessibilityManager {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
public getButtonAccessibilityProps(name: string): AccessibilityProps {
|
|
140
|
-
const buttonName =
|
|
140
|
+
const buttonName = toString(name);
|
|
141
141
|
|
|
142
142
|
const buttonConfig = BUTTON_ACCESSIBILITY_KEYS[buttonName];
|
|
143
143
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ContextKeysManager } from "./index";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface IResolver {
|
|
5
5
|
resolve: (string) => Promise<string | number | object>;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
// TODO: Rename to ObjectKeyResolver or similar
|
|
9
8
|
export class EntryResolver implements IResolver {
|
|
10
9
|
entry: ZappEntry;
|
|
11
10
|
|
|
@@ -22,18 +21,6 @@ export class EntryResolver implements IResolver {
|
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
// TODO: Move to proper place
|
|
26
|
-
|
|
27
|
-
export class ScreenStateResolver implements IResolver {
|
|
28
|
-
constructor(private screenStateStore: ScreenStateStore) {}
|
|
29
|
-
|
|
30
|
-
async resolve(key: string) {
|
|
31
|
-
const screenState = this.screenStateStore.getState().data;
|
|
32
|
-
|
|
33
|
-
return screenState?.[key];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
24
|
export class ContextResolver implements IResolver {
|
|
38
25
|
resolve = async (compositeKey: string) =>
|
|
39
26
|
ContextKeysManager.instance.getKey(compositeKey);
|
|
@@ -2985,6 +2985,14 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
2985
2985
|
type: "uploader",
|
|
2986
2986
|
default: "",
|
|
2987
2987
|
},
|
|
2988
|
+
{
|
|
2989
|
+
key: "audio_player_background_image_overlay",
|
|
2990
|
+
label: "Background Image Overlay",
|
|
2991
|
+
label_tooltip:
|
|
2992
|
+
"Add a semi-transparent color overlay to improve text readability over the background image.",
|
|
2993
|
+
type: "color_picker_rgba",
|
|
2994
|
+
initial_value: "rgba(17, 17, 17, 0.5)",
|
|
2995
|
+
},
|
|
2988
2996
|
{
|
|
2989
2997
|
type: "text_input",
|
|
2990
2998
|
label: "Item Image Key",
|
package/manifestUtils/keys.js
CHANGED
|
@@ -485,6 +485,18 @@ const TV_MENU_LABEL_FIELDS = [
|
|
|
485
485
|
type: ZAPPIFEST_FIELDS.number_input,
|
|
486
486
|
suffix: "LG letter spacing",
|
|
487
487
|
},
|
|
488
|
+
{
|
|
489
|
+
type: ZAPPIFEST_FIELDS.font_selector.roku,
|
|
490
|
+
suffix: "Roku font family",
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
494
|
+
suffix: "Roku font size",
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
498
|
+
suffix: "Roku line height",
|
|
499
|
+
},
|
|
488
500
|
{
|
|
489
501
|
type: ZAPPIFEST_FIELDS.select,
|
|
490
502
|
suffix: "text transform",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.1384310723",
|
|
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": "14.0.0-alpha.
|
|
30
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.1384310723",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
|
@@ -16,8 +16,7 @@ import { ActionExecutorContext } from "@applicaster/zapp-react-native-utils/acti
|
|
|
16
16
|
import { isFunction, noop } from "../../functionUtils";
|
|
17
17
|
import { useSendAnalyticsOnPress } from "../analytics";
|
|
18
18
|
import { logOnPress, warnEmptyContentType } from "./helpers";
|
|
19
|
-
import { useCurrentScreenData
|
|
20
|
-
import { useScreenStateStore } from "../navigation/useScreenStateStore";
|
|
19
|
+
import { useCurrentScreenData } from "../screen";
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* If onCellTap is defined execute the function and
|
|
@@ -43,12 +42,10 @@ export const useCellClick = ({
|
|
|
43
42
|
}: Props): onPressReturnFn => {
|
|
44
43
|
const { push, currentRoute } = useNavigation();
|
|
45
44
|
const { pathname } = useRoute();
|
|
46
|
-
const screenStateStore = useScreenStateStore();
|
|
47
45
|
|
|
48
46
|
const onCellTap: Option<Function> = React.useContext(CellTapContext);
|
|
49
47
|
const actionExecutor = React.useContext(ActionExecutorContext);
|
|
50
48
|
const screenData = useCurrentScreenData();
|
|
51
|
-
const screenState = useScreenContext()?.options;
|
|
52
49
|
|
|
53
50
|
const cellSelectable = toBooleanWithDefaultTrue(
|
|
54
51
|
component?.rules?.component_cells_selectable
|
|
@@ -86,9 +83,6 @@ export const useCellClick = ({
|
|
|
86
83
|
await actionExecutor?.handleEntryActions(selectedItem, {
|
|
87
84
|
component,
|
|
88
85
|
screenData,
|
|
89
|
-
screenState,
|
|
90
|
-
screenRoute: pathname,
|
|
91
|
-
screenStateStore,
|
|
92
86
|
});
|
|
93
87
|
}
|
|
94
88
|
|
|
@@ -123,7 +117,6 @@ export const useCellClick = ({
|
|
|
123
117
|
push,
|
|
124
118
|
sendAnalyticsOnPress,
|
|
125
119
|
screenData,
|
|
126
|
-
screenState,
|
|
127
120
|
]
|
|
128
121
|
);
|
|
129
122
|
|
|
@@ -138,11 +138,6 @@ describe("useFeedLoader", () => {
|
|
|
138
138
|
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
139
139
|
clearCache: true,
|
|
140
140
|
riverId: undefined,
|
|
141
|
-
resolvers: {
|
|
142
|
-
screen: {
|
|
143
|
-
screenStateStore: undefined,
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
141
|
});
|
|
147
142
|
|
|
148
143
|
const store2 = mockStore({
|
|
@@ -184,11 +179,6 @@ describe("useFeedLoader", () => {
|
|
|
184
179
|
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
185
180
|
clearCache: true,
|
|
186
181
|
riverId: undefined,
|
|
187
|
-
resolvers: {
|
|
188
|
-
screen: {
|
|
189
|
-
screenStateStore: undefined,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
182
|
});
|
|
193
183
|
|
|
194
184
|
const store2 = mockStore({
|
|
@@ -238,11 +228,6 @@ describe("useFeedLoader", () => {
|
|
|
238
228
|
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
239
229
|
clearCache: true,
|
|
240
230
|
silentRefresh: true,
|
|
241
|
-
resolvers: {
|
|
242
|
-
screen: {
|
|
243
|
-
screenStateStore: undefined,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
231
|
});
|
|
247
232
|
|
|
248
233
|
loadPipesDataSpy.mockRestore();
|
|
@@ -282,11 +267,6 @@ describe("useFeedLoader", () => {
|
|
|
282
267
|
expect(loadPipesDataSpy).toBeCalledWith(nextUrl, {
|
|
283
268
|
parentFeed: feedUrlWithNext,
|
|
284
269
|
silentRefresh: true,
|
|
285
|
-
resolvers: {
|
|
286
|
-
screen: {
|
|
287
|
-
screenStateStore: undefined,
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
270
|
});
|
|
291
271
|
|
|
292
272
|
loadPipesDataSpy.mockRestore();
|
|
@@ -8,7 +8,6 @@ import { reactHooksLogger } from "../logger";
|
|
|
8
8
|
import { shouldDispatchData, useIsInitialRender } from "../utils";
|
|
9
9
|
import { useInflatedUrl } from "./useInflatedUrl";
|
|
10
10
|
import { useRoute } from "../navigation";
|
|
11
|
-
import { useScreenResolvers } from "@applicaster/zapp-react-native-utils/actionsExecutor/screenResolver";
|
|
12
11
|
|
|
13
12
|
const logger = reactHooksLogger.addSubsystem("useFeedLoader");
|
|
14
13
|
|
|
@@ -52,7 +51,6 @@ export const useFeedLoader = ({
|
|
|
52
51
|
const isInitialRender = useIsInitialRender();
|
|
53
52
|
const dispatch = useDispatch();
|
|
54
53
|
const { screenData } = useRoute();
|
|
55
|
-
const resolvers = useScreenResolvers();
|
|
56
54
|
|
|
57
55
|
const callableFeedUrl = useInflatedUrl({ feedUrl, mapping });
|
|
58
56
|
|
|
@@ -71,12 +69,11 @@ export const useFeedLoader = ({
|
|
|
71
69
|
silentRefresh,
|
|
72
70
|
callback,
|
|
73
71
|
riverId,
|
|
74
|
-
resolvers,
|
|
75
72
|
})
|
|
76
73
|
);
|
|
77
74
|
}
|
|
78
75
|
},
|
|
79
|
-
[callableFeedUrl
|
|
76
|
+
[callableFeedUrl]
|
|
80
77
|
);
|
|
81
78
|
|
|
82
79
|
const loadNext: FeedLoaderResponse["loadNext"] = React.useCallback(() => {
|
|
@@ -89,12 +86,11 @@ export const useFeedLoader = ({
|
|
|
89
86
|
silentRefresh: true,
|
|
90
87
|
parentFeed: callableFeedUrl,
|
|
91
88
|
riverId,
|
|
92
|
-
resolvers,
|
|
93
89
|
})
|
|
94
90
|
);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
|
-
}, [callableFeedUrl, currentFeed?.data?.next
|
|
93
|
+
}, [callableFeedUrl, currentFeed?.data?.next]);
|
|
98
94
|
|
|
99
95
|
useEffect(() => {
|
|
100
96
|
if (
|
|
@@ -106,7 +102,6 @@ export const useFeedLoader = ({
|
|
|
106
102
|
...pipesOptions,
|
|
107
103
|
clearCache: true,
|
|
108
104
|
riverId,
|
|
109
|
-
resolvers,
|
|
110
105
|
})
|
|
111
106
|
);
|
|
112
107
|
} else if (!callableFeedUrl) {
|
|
@@ -131,16 +126,14 @@ export const useFeedLoader = ({
|
|
|
131
126
|
jsOnly: true,
|
|
132
127
|
});
|
|
133
128
|
}
|
|
134
|
-
}, [
|
|
129
|
+
}, []);
|
|
135
130
|
|
|
136
131
|
// Reload feed when feedUrl changes, unless skipLoading is true
|
|
137
132
|
useEffect(() => {
|
|
138
133
|
if (!isInitialRender && callableFeedUrl && !pipesOptions.skipLoading) {
|
|
139
|
-
dispatch(
|
|
140
|
-
loadPipesData(callableFeedUrl, { ...pipesOptions, riverId, resolvers })
|
|
141
|
-
);
|
|
134
|
+
dispatch(loadPipesData(callableFeedUrl, { ...pipesOptions, riverId }));
|
|
142
135
|
}
|
|
143
|
-
}, [callableFeedUrl
|
|
136
|
+
}, [callableFeedUrl]);
|
|
144
137
|
|
|
145
138
|
return React.useMemo(() => {
|
|
146
139
|
if (!callableFeedUrl || !feedUrl) {
|
|
@@ -28,19 +28,14 @@ const isHookPathname = (pathname: string) => /^\/hooks\//.test(pathname);
|
|
|
28
28
|
|
|
29
29
|
type VariousScreenData = LegacyNavigationScreenData | ZappRiver | ZappEntry;
|
|
30
30
|
|
|
31
|
-
export const useRoute = (
|
|
32
|
-
useLegacy = true
|
|
33
|
-
): {
|
|
31
|
+
export const useRoute = (): {
|
|
34
32
|
screenData: VariousScreenData;
|
|
35
33
|
pathname: string;
|
|
36
34
|
} => {
|
|
37
35
|
const pathname = usePathname() || "";
|
|
38
36
|
const navigator = useNavigation();
|
|
39
|
-
const screenContext = useContext(ScreenDataContext);
|
|
40
37
|
|
|
41
|
-
const screenDataContext =
|
|
42
|
-
? legacyScreenData(screenContext)
|
|
43
|
-
: screenContext;
|
|
38
|
+
const screenDataContext = legacyScreenData(useContext(ScreenDataContext));
|
|
44
39
|
|
|
45
40
|
const { plugins, contentTypes, rivers } = usePickFromState([
|
|
46
41
|
"plugins",
|
package/time/BackgroundTimer.ts
CHANGED
|
@@ -13,13 +13,15 @@ class BackgroundTimer {
|
|
|
13
13
|
|
|
14
14
|
const EventEmitter = platformSelect({
|
|
15
15
|
android: DeviceEventEmitter,
|
|
16
|
-
|
|
16
|
+
android_tv: DeviceEventEmitter,
|
|
17
|
+
amazon: DeviceEventEmitter, // probably does not exist and uses android_tv
|
|
17
18
|
default: undefined,
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
EventEmitter?.addListener("BackgroundTimer.timer.fired", (id: number) => {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const callback = this.callbacks[id];
|
|
23
|
+
|
|
24
|
+
if (callback) {
|
|
23
25
|
delete this.callbacks[id];
|
|
24
26
|
callback();
|
|
25
27
|
}
|
package/utils/index.ts
CHANGED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
|
|
2
|
-
|
|
3
|
-
import { log_error, log_info } from "./ActionExecutorContext";
|
|
4
|
-
import { ActionResult } from "./ActionExecutor";
|
|
5
|
-
import { get } from "lodash";
|
|
6
|
-
|
|
7
|
-
import { onMaxTagsReached } from "./StorageActions";
|
|
8
|
-
import { ScreenMultiSelectProvider } from "../storage/ScreenStateMultiSelectProvider";
|
|
9
|
-
|
|
10
|
-
export const screenSetVariable = (
|
|
11
|
-
_screenRoute: string,
|
|
12
|
-
_key: string,
|
|
13
|
-
_value: string
|
|
14
|
-
) => {};
|
|
15
|
-
|
|
16
|
-
export const screenToggleFlag = async (
|
|
17
|
-
screenRoute: string,
|
|
18
|
-
screenStateStore: ScreenStateStore,
|
|
19
|
-
context: Record<string, any>,
|
|
20
|
-
action: ActionType
|
|
21
|
-
) => {
|
|
22
|
-
if (!context) {
|
|
23
|
-
log_error("handleAction: screenToggleFlag action missing context");
|
|
24
|
-
|
|
25
|
-
return ActionResult.Error;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const entry = context?.entry as ZappEntry;
|
|
29
|
-
|
|
30
|
-
if (!entry) {
|
|
31
|
-
log_error(
|
|
32
|
-
"handleAction: screenToggleFlag action missing entry. Entry is required to get the tag."
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
return ActionResult.Error;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const tag = action.options?.selector
|
|
39
|
-
? get(entry, action.options.selector)
|
|
40
|
-
: (entry.extensions?.tag ?? entry.id);
|
|
41
|
-
|
|
42
|
-
const keyNamespace = action.options?.key;
|
|
43
|
-
|
|
44
|
-
if (keyNamespace && tag) {
|
|
45
|
-
const multiSelectProvider = ScreenMultiSelectProvider.getProvider(
|
|
46
|
-
keyNamespace,
|
|
47
|
-
screenRoute,
|
|
48
|
-
screenStateStore
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const selectedItems = await multiSelectProvider.getSelectedAsync();
|
|
52
|
-
const isTagInSelectedItems = selectedItems.includes(tag);
|
|
53
|
-
|
|
54
|
-
log_info(
|
|
55
|
-
`handleAction: screenToggleFlag event will ${
|
|
56
|
-
isTagInSelectedItems ? "remove" : "add"
|
|
57
|
-
} tag: ${tag} for keyNamespace: ${keyNamespace}, current selectedItems: ${selectedItems}`
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
if (selectedItems.includes(tag)) {
|
|
61
|
-
await multiSelectProvider.removeItem(tag);
|
|
62
|
-
} else {
|
|
63
|
-
const maxItems = action.options?.max_items;
|
|
64
|
-
|
|
65
|
-
if (maxItems && selectedItems.length >= maxItems) {
|
|
66
|
-
log_info(
|
|
67
|
-
`handleAction: screenToggleFlag event reached max items limit: ${maxItems}, cannot add tag: ${tag}`
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
await onMaxTagsReached({
|
|
71
|
-
selectedItems,
|
|
72
|
-
maxItems,
|
|
73
|
-
tag,
|
|
74
|
-
keyNamespace,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
return ActionResult.Cancel;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
await multiSelectProvider.addItem(tag);
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
log_error(
|
|
84
|
-
"handleAction: screenToggleFlag event missing keyNamespace or tag",
|
|
85
|
-
{ keyNamespace, tag }
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
return ActionResult.Error;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return ActionResult.Success;
|
|
92
|
-
};
|