@applicaster/zapp-react-dom-app 15.0.0-rc.99 → 16.0.0-alpha.6593152532
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/App/InteractionManager/hoc/__tests__/withBacktoTopActionHOC.test.tsx +78 -96
- package/App/InteractionManager/hoc/hooks/index.ts +10 -0
- package/App/InteractionManager/hoc/index.ts +1 -4
- package/App/InteractionManager/hoc/withBackToTopAction.tsx +29 -23
- package/App/InteractionManager/index.tsx +17 -18
- package/App/Loader/utils/platform.js +6 -4
- package/main.css +1 -1
- package/package.json +6 -6
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
3
4
|
import { withBackToTopActionHOC } from "../withBackToTopAction";
|
|
5
|
+
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
6
|
+
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
7
|
+
import {
|
|
8
|
+
useCurrentScreenIsHome,
|
|
9
|
+
useCurrentScreenIsRoot,
|
|
10
|
+
useCurrentScreenIsTabs,
|
|
11
|
+
useIsStandaloneFullscreen,
|
|
12
|
+
} from "../hooks";
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
useCurrentScreenIsHook,
|
|
16
|
+
useCurrentScreenIsStartupHook,
|
|
17
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
4
18
|
|
|
5
|
-
// Mock focusManager and hook
|
|
6
19
|
jest.mock("@applicaster/zapp-react-native-utils/appUtils", () => ({
|
|
7
20
|
focusManager: {
|
|
8
21
|
isFocusOnMenu: jest.fn(),
|
|
@@ -11,26 +24,17 @@ jest.mock("@applicaster/zapp-react-native-utils/appUtils", () => ({
|
|
|
11
24
|
},
|
|
12
25
|
}));
|
|
13
26
|
|
|
14
|
-
jest.mock("
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
useCurrentScreenIsTabs: jest.fn(),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
21
|
-
import {
|
|
22
|
-
useCurrentScreenIsHome,
|
|
23
|
-
useCurrentScreenIsRoot,
|
|
24
|
-
useCurrentScreenIsTabs,
|
|
25
|
-
} from "../hooks";
|
|
27
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor");
|
|
28
|
+
jest.mock("../hooks");
|
|
29
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/screen");
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
useNavigation: jest.fn(),
|
|
29
|
-
}));
|
|
31
|
+
const mockUseSubscriberFor = useSubscriberFor as jest.Mock;
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
const setupFocusManager = (overrides: Partial<typeof focusManager>) => {
|
|
34
|
+
Object.assign(focusManager, overrides);
|
|
35
|
+
};
|
|
32
36
|
|
|
33
|
-
describe("withBackToTopActionHOC", () => {
|
|
37
|
+
describe("withBackToTopActionHOC - backToTopAction", () => {
|
|
34
38
|
let receivedProps: any;
|
|
35
39
|
|
|
36
40
|
const BaseComponent = (props) => {
|
|
@@ -43,141 +47,119 @@ describe("withBackToTopActionHOC", () => {
|
|
|
43
47
|
|
|
44
48
|
beforeEach(() => {
|
|
45
49
|
jest.clearAllMocks();
|
|
50
|
+
|
|
51
|
+
mockUseSubscriberFor.mockImplementation(() => jest.fn());
|
|
52
|
+
|
|
53
|
+
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(false);
|
|
54
|
+
(useCurrentScreenIsRoot as jest.Mock).mockReturnValue(false);
|
|
55
|
+
(useCurrentScreenIsTabs as jest.Mock).mockReturnValue(false);
|
|
56
|
+
(useIsStandaloneFullscreen as jest.Mock).mockReturnValue(false);
|
|
57
|
+
(useCurrentScreenIsHook as jest.Mock).mockReturnValue(false);
|
|
58
|
+
(useCurrentScreenIsStartupHook as jest.Mock).mockReturnValue(false);
|
|
59
|
+
|
|
60
|
+
setupFocusManager({
|
|
61
|
+
isFocusOnMenu: () => false,
|
|
62
|
+
isFocusOnContent: () => false,
|
|
63
|
+
isTabsScreenContentFocused: () => false,
|
|
64
|
+
});
|
|
46
65
|
});
|
|
47
66
|
|
|
48
|
-
it("returns
|
|
67
|
+
it("returns PLATFORM_TO_BACKGROUND for startup hook", () => {
|
|
49
68
|
expect.assertions(1);
|
|
50
69
|
|
|
51
|
-
(
|
|
52
|
-
|
|
53
|
-
(useNavigation as jest.Mock).mockReturnValue({
|
|
54
|
-
startUpHooks: ["some_startup_hook"],
|
|
55
|
-
});
|
|
70
|
+
(useCurrentScreenIsStartupHook as jest.Mock).mockReturnValue(true);
|
|
56
71
|
|
|
57
72
|
render(<Wrapped />);
|
|
58
73
|
|
|
59
|
-
expect(receivedProps.backToTopAction()).toBe("
|
|
74
|
+
expect(receivedProps.backToTopAction()).toBe("PLATFORM_TO_BACKGROUND");
|
|
60
75
|
});
|
|
61
76
|
|
|
62
|
-
it("returns
|
|
77
|
+
it("returns GO_BACK_FROM_HOOK when isHook", () => {
|
|
63
78
|
expect.assertions(1);
|
|
64
79
|
|
|
65
|
-
(
|
|
66
|
-
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(true);
|
|
67
|
-
(useCurrentScreenIsTabs as jest.Mock).mockReturnValue(false);
|
|
80
|
+
(useCurrentScreenIsHook as jest.Mock).mockReturnValue(true);
|
|
68
81
|
|
|
69
|
-
(
|
|
70
|
-
startUpHooks: [],
|
|
71
|
-
});
|
|
82
|
+
render(<Wrapped />);
|
|
72
83
|
|
|
73
|
-
(
|
|
74
|
-
|
|
84
|
+
expect(receivedProps.backToTopAction()).toBe("GO_BACK_FROM_HOOK");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("returns GO_HOME for standalone full screen", () => {
|
|
88
|
+
expect.assertions(1);
|
|
89
|
+
|
|
90
|
+
(useIsStandaloneFullscreen as jest.Mock).mockReturnValue(true);
|
|
75
91
|
|
|
76
92
|
render(<Wrapped />);
|
|
77
93
|
|
|
78
|
-
expect(receivedProps.backToTopAction()).toBe("
|
|
94
|
+
expect(receivedProps.backToTopAction()).toBe("GO_HOME");
|
|
79
95
|
});
|
|
80
96
|
|
|
81
|
-
it("returns
|
|
97
|
+
it("returns PLATFORM_TO_BACKGROUND when root + menu focus + home", () => {
|
|
82
98
|
expect.assertions(1);
|
|
83
99
|
|
|
84
100
|
(useCurrentScreenIsRoot as jest.Mock).mockReturnValue(true);
|
|
85
|
-
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(
|
|
86
|
-
(useCurrentScreenIsTabs as jest.Mock).mockReturnValue(false);
|
|
101
|
+
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(true);
|
|
87
102
|
|
|
88
|
-
(
|
|
89
|
-
|
|
103
|
+
setupFocusManager({
|
|
104
|
+
isFocusOnMenu: () => true,
|
|
90
105
|
});
|
|
91
106
|
|
|
92
|
-
(focusManager.isFocusOnMenu as jest.Mock).mockReturnValue(true);
|
|
93
|
-
(focusManager.isFocusOnContent as jest.Mock).mockReturnValue(false);
|
|
94
|
-
|
|
95
107
|
render(<Wrapped />);
|
|
96
|
-
|
|
108
|
+
|
|
109
|
+
expect(receivedProps.backToTopAction()).toBe("PLATFORM_TO_BACKGROUND");
|
|
97
110
|
});
|
|
98
111
|
|
|
99
|
-
it("returns
|
|
112
|
+
it("returns GO_HOME when root + menu focus + NOT home", () => {
|
|
113
|
+
expect.assertions(1);
|
|
114
|
+
|
|
100
115
|
(useCurrentScreenIsRoot as jest.Mock).mockReturnValue(true);
|
|
101
116
|
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(false);
|
|
102
|
-
(useCurrentScreenIsTabs as jest.Mock).mockReturnValue(false);
|
|
103
117
|
|
|
104
|
-
(
|
|
105
|
-
|
|
118
|
+
setupFocusManager({
|
|
119
|
+
isFocusOnMenu: () => true,
|
|
106
120
|
});
|
|
107
121
|
|
|
108
|
-
(focusManager.isFocusOnMenu as jest.Mock).mockReturnValue(false);
|
|
109
|
-
(focusManager.isFocusOnContent as jest.Mock).mockReturnValue(true);
|
|
110
|
-
|
|
111
122
|
render(<Wrapped />);
|
|
112
123
|
|
|
113
|
-
expect(receivedProps.backToTopAction()).toBe(
|
|
114
|
-
"FOCUS_ON_SELECTED_TOP_MENU_ITEM"
|
|
115
|
-
);
|
|
124
|
+
expect(receivedProps.backToTopAction()).toBe("GO_HOME");
|
|
116
125
|
});
|
|
117
126
|
|
|
118
|
-
it("returns FOCUS_ON_SELECTED_TAB_ITEM when
|
|
127
|
+
it("returns FOCUS_ON_SELECTED_TAB_ITEM when tabs content focused", () => {
|
|
128
|
+
expect.assertions(1);
|
|
129
|
+
|
|
119
130
|
(useCurrentScreenIsRoot as jest.Mock).mockReturnValue(true);
|
|
120
|
-
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(false);
|
|
121
131
|
(useCurrentScreenIsTabs as jest.Mock).mockReturnValue(true);
|
|
122
132
|
|
|
123
|
-
(
|
|
124
|
-
|
|
133
|
+
setupFocusManager({
|
|
134
|
+
isTabsScreenContentFocused: () => true,
|
|
125
135
|
});
|
|
126
136
|
|
|
127
|
-
(focusManager.isFocusOnMenu as jest.Mock).mockReturnValue(false);
|
|
128
|
-
(focusManager.isFocusOnContent as jest.Mock).mockReturnValue(true);
|
|
129
|
-
|
|
130
|
-
(focusManager.isTabsScreenContentFocused as jest.Mock).mockReturnValue(
|
|
131
|
-
true
|
|
132
|
-
);
|
|
133
|
-
|
|
134
137
|
render(<Wrapped />);
|
|
135
138
|
|
|
136
139
|
expect(receivedProps.backToTopAction()).toBe("FOCUS_ON_SELECTED_TAB_ITEM");
|
|
137
140
|
});
|
|
138
141
|
|
|
139
|
-
it("returns
|
|
142
|
+
it("returns FOCUS_ON_SELECTED_TOP_MENU_ITEM when content focused", () => {
|
|
140
143
|
expect.assertions(1);
|
|
141
144
|
|
|
142
|
-
(useCurrentScreenIsRoot as jest.Mock).mockReturnValue(
|
|
143
|
-
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(false);
|
|
144
|
-
(useCurrentScreenIsTabs as jest.Mock).mockReturnValue(false);
|
|
145
|
+
(useCurrentScreenIsRoot as jest.Mock).mockReturnValue(true);
|
|
145
146
|
|
|
146
|
-
(
|
|
147
|
-
|
|
147
|
+
setupFocusManager({
|
|
148
|
+
isFocusOnContent: () => true,
|
|
148
149
|
});
|
|
149
150
|
|
|
150
|
-
(
|
|
151
|
-
(focusManager.isFocusOnContent as jest.Mock).mockReturnValue(false);
|
|
151
|
+
render(<Wrapped />);
|
|
152
152
|
|
|
153
|
-
(
|
|
154
|
-
|
|
153
|
+
expect(receivedProps.backToTopAction()).toBe(
|
|
154
|
+
"FOCUS_ON_SELECTED_TOP_MENU_ITEM"
|
|
155
155
|
);
|
|
156
|
-
|
|
157
|
-
render(<Wrapped />);
|
|
158
|
-
expect(receivedProps.backToTopAction()).toBe("GO_BACK");
|
|
159
156
|
});
|
|
160
157
|
|
|
161
|
-
it("returns
|
|
158
|
+
it("returns default GO_BACK", () => {
|
|
162
159
|
expect.assertions(1);
|
|
163
160
|
|
|
164
|
-
(useCurrentScreenIsRoot as jest.Mock).mockReturnValue(false);
|
|
165
|
-
(useCurrentScreenIsHome as jest.Mock).mockReturnValue(false);
|
|
166
|
-
(useCurrentScreenIsTabs as jest.Mock).mockReturnValue(false);
|
|
167
|
-
|
|
168
|
-
(useNavigation as jest.Mock).mockReturnValue({
|
|
169
|
-
startUpHooks: [],
|
|
170
|
-
currentRoute: "/hooks/some_route",
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
(focusManager.isFocusOnMenu as jest.Mock).mockReturnValue(false);
|
|
174
|
-
(focusManager.isFocusOnContent as jest.Mock).mockReturnValue(false);
|
|
175
|
-
|
|
176
|
-
(focusManager.isTabsScreenContentFocused as jest.Mock).mockReturnValue(
|
|
177
|
-
false
|
|
178
|
-
);
|
|
179
|
-
|
|
180
161
|
render(<Wrapped />);
|
|
181
|
-
|
|
162
|
+
|
|
163
|
+
expect(receivedProps.backToTopAction()).toBe("GO_BACK");
|
|
182
164
|
});
|
|
183
165
|
});
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useRivers,
|
|
5
5
|
} from "@applicaster/zapp-react-native-utils/reactHooks/state";
|
|
6
6
|
import { last } from "@applicaster/zapp-react-native-utils/utils";
|
|
7
|
+
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
7
8
|
|
|
8
9
|
export const useCurrentScreenIsHome = (): boolean => {
|
|
9
10
|
const navigator = useNavigation();
|
|
@@ -32,3 +33,12 @@ export const useCurrentScreenIsTabs = (): boolean => {
|
|
|
32
33
|
|
|
33
34
|
return river?.type === "tabs_screen";
|
|
34
35
|
};
|
|
36
|
+
|
|
37
|
+
export const useIsStandaloneFullscreen = (): boolean => {
|
|
38
|
+
const navigator = useNavigation();
|
|
39
|
+
|
|
40
|
+
return toBooleanWithDefaultFalse(
|
|
41
|
+
!navigator?.canGoBack() &&
|
|
42
|
+
navigator?.screenData?.general?.allow_screen_plugin_presentation
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { isFilledArray } from "@applicaster/zapp-react-native-utils/arrayUtils";
|
|
3
2
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
4
3
|
|
|
5
4
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
@@ -9,18 +8,13 @@ import {
|
|
|
9
8
|
useCurrentScreenIsHome,
|
|
10
9
|
useCurrentScreenIsRoot,
|
|
11
10
|
useCurrentScreenIsTabs,
|
|
11
|
+
useIsStandaloneFullscreen,
|
|
12
12
|
} from "./hooks";
|
|
13
|
-
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| "FOCUS_ON_SELECTED_TOP_MENU_ITEM"
|
|
20
|
-
| "FORCE_GO_BACK"
|
|
21
|
-
| "FOCUS_ON_SELECTED_TAB_ITEM";
|
|
22
|
-
|
|
23
|
-
export type BackToTopAction = () => BACK_TO_TOP_ACTION;
|
|
14
|
+
import {
|
|
15
|
+
useCurrentScreenIsHook,
|
|
16
|
+
useCurrentScreenIsStartupHook,
|
|
17
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
24
18
|
|
|
25
19
|
export function withBackToTopActionHOC(Component) {
|
|
26
20
|
return function WrappedComponent(props) {
|
|
@@ -28,11 +22,11 @@ export function withBackToTopActionHOC(Component) {
|
|
|
28
22
|
const isRoot = useCurrentScreenIsRoot();
|
|
29
23
|
const isTabsScreen = useCurrentScreenIsTabs();
|
|
30
24
|
|
|
31
|
-
const
|
|
25
|
+
const isStartUpHook = useCurrentScreenIsStartupHook();
|
|
32
26
|
|
|
33
|
-
const
|
|
27
|
+
const isHook = useCurrentScreenIsHook();
|
|
34
28
|
|
|
35
|
-
const
|
|
29
|
+
const isStandaloneFullscreen = useIsStandaloneFullscreen();
|
|
36
30
|
|
|
37
31
|
const emitFocusOnSelectedTab = useSubscriberFor(
|
|
38
32
|
QBUIComponentEvents.focusOnSelectedTab
|
|
@@ -42,13 +36,22 @@ export function withBackToTopActionHOC(Component) {
|
|
|
42
36
|
QBUIComponentEvents.focusOnSelectedTopMenuItem
|
|
43
37
|
);
|
|
44
38
|
|
|
45
|
-
const backToTopAction = React.useCallback(():
|
|
46
|
-
if (
|
|
47
|
-
return "
|
|
39
|
+
const backToTopAction = React.useCallback((): BackToTopAction => {
|
|
40
|
+
if (isStartUpHook) {
|
|
41
|
+
return "PLATFORM_TO_BACKGROUND";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (isHook) {
|
|
45
|
+
return "GO_BACK_FROM_HOOK";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Handling case where is not top menu visible
|
|
49
|
+
if (isStandaloneFullscreen) {
|
|
50
|
+
return "GO_HOME";
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
if (isRoot && focusManager.isFocusOnMenu() && isHome) {
|
|
51
|
-
return "
|
|
54
|
+
return "PLATFORM_TO_BACKGROUND";
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
if (isRoot && focusManager.isFocusOnMenu() && !isHome) {
|
|
@@ -63,13 +66,16 @@ export function withBackToTopActionHOC(Component) {
|
|
|
63
66
|
return "FOCUS_ON_SELECTED_TOP_MENU_ITEM";
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
if (isHook) {
|
|
67
|
-
return "FORCE_GO_BACK";
|
|
68
|
-
}
|
|
69
|
-
|
|
70
69
|
// default
|
|
71
70
|
return "GO_BACK";
|
|
72
|
-
}, [
|
|
71
|
+
}, [
|
|
72
|
+
isHome,
|
|
73
|
+
isRoot,
|
|
74
|
+
isTabsScreen,
|
|
75
|
+
isStartUpHook,
|
|
76
|
+
isHook,
|
|
77
|
+
isStandaloneFullscreen,
|
|
78
|
+
]);
|
|
73
79
|
|
|
74
80
|
return (
|
|
75
81
|
<Component
|
|
@@ -3,11 +3,6 @@ import * as R from "ramda";
|
|
|
3
3
|
|
|
4
4
|
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
QUICK_BRICK_EVENTS,
|
|
8
|
-
sendQuickBrickEvent,
|
|
9
|
-
} from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
10
|
-
|
|
11
6
|
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
12
7
|
|
|
13
8
|
import {
|
|
@@ -50,11 +45,13 @@ import {
|
|
|
50
45
|
isVizioPlatform,
|
|
51
46
|
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
52
47
|
|
|
48
|
+
import { platformToBackground as sendAppToBackground } from "@applicaster/zapp-react-native-utils/appUtils/platform";
|
|
49
|
+
|
|
53
50
|
import { OnScreenKeyboard } from "@applicaster/zapp-react-dom-ui-components/Components/OnScreenKeyboard";
|
|
54
51
|
import { KeyboardLongPressManager } from "@applicaster/zapp-react-dom-ui-components/Utils/KeyboardLongPressManager";
|
|
55
52
|
import { KeyInputHandler } from "@applicaster/zapp-react-native-utils/appUtils/keyInputHandler/KeyInputHandler";
|
|
56
53
|
import { getHomeRiver } from "@applicaster/zapp-react-native-utils/reactHooks/state";
|
|
57
|
-
import { withBackToTopActionHOC
|
|
54
|
+
import { withBackToTopActionHOC } from "./hoc";
|
|
58
55
|
|
|
59
56
|
const { withXray } = getXray();
|
|
60
57
|
const globalAny: any = global;
|
|
@@ -76,7 +73,7 @@ type Props = {
|
|
|
76
73
|
rivers: {};
|
|
77
74
|
xray: XRayContext;
|
|
78
75
|
confirmDialog: typeof confirmationDialogStore;
|
|
79
|
-
backToTopAction: BackToTopAction;
|
|
76
|
+
backToTopAction: () => BackToTopAction;
|
|
80
77
|
emitFocusOnSelectedTopMenuItem: Callback;
|
|
81
78
|
emitFocusOnSelectedTab: Callback;
|
|
82
79
|
};
|
|
@@ -242,7 +239,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
242
239
|
performExit() {
|
|
243
240
|
if (isSamsungPlatform()) {
|
|
244
241
|
this.onConfirmDialogClose();
|
|
245
|
-
|
|
242
|
+
sendAppToBackground();
|
|
246
243
|
}
|
|
247
244
|
|
|
248
245
|
if (isLgPlatform()) {
|
|
@@ -256,7 +253,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
256
253
|
}
|
|
257
254
|
|
|
258
255
|
handleWebOsBack() {
|
|
259
|
-
const systemBack = globalAny?.webOS?.
|
|
256
|
+
const systemBack = globalAny?.webOS?.platformToBackground;
|
|
260
257
|
|
|
261
258
|
if (systemBack) {
|
|
262
259
|
systemBack();
|
|
@@ -277,7 +274,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
277
274
|
* WebOS behavior depends on the SDK version, WebOS 4 would pull up the launcher menu
|
|
278
275
|
* following versions would show a native exit prompt
|
|
279
276
|
*/
|
|
280
|
-
|
|
277
|
+
platformToBackground() {
|
|
281
278
|
try {
|
|
282
279
|
// TODO: temporary hack until this code is refactored
|
|
283
280
|
if (isSamsungPlatform() || isVizioPlatform()) {
|
|
@@ -294,9 +291,11 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
294
291
|
}
|
|
295
292
|
} else if (isLgPlatform()) {
|
|
296
293
|
this.handleWebOsBack();
|
|
294
|
+
} else {
|
|
295
|
+
sendAppToBackground();
|
|
297
296
|
}
|
|
298
297
|
} catch (e) {
|
|
299
|
-
log_warning("Failed to execute
|
|
298
|
+
log_warning("Failed to execute platformToBackground", e);
|
|
300
299
|
}
|
|
301
300
|
}
|
|
302
301
|
|
|
@@ -425,10 +424,10 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
425
424
|
|
|
426
425
|
switch (displayState) {
|
|
427
426
|
case DISPLAY_STATES.DEFAULT:
|
|
428
|
-
if (action === "
|
|
427
|
+
if (action === "PLATFORM_TO_BACKGROUND") {
|
|
429
428
|
log_info(action);
|
|
430
429
|
|
|
431
|
-
this.
|
|
430
|
+
this.platformToBackground();
|
|
432
431
|
}
|
|
433
432
|
|
|
434
433
|
if (action === "GO_HOME") {
|
|
@@ -461,7 +460,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
461
460
|
}
|
|
462
461
|
}
|
|
463
462
|
|
|
464
|
-
if (action === "
|
|
463
|
+
if (action === "GO_BACK_FROM_HOOK") {
|
|
465
464
|
log_info(action);
|
|
466
465
|
|
|
467
466
|
const fallbackToHome = false;
|
|
@@ -477,11 +476,11 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
477
476
|
} else if (navigator.canGoBack()) {
|
|
478
477
|
navigator.goBack();
|
|
479
478
|
} else if (this.isHomeScreen()) {
|
|
480
|
-
this.
|
|
479
|
+
this.platformToBackground();
|
|
481
480
|
} else if (navigator.currentRoute.includes("hook")) {
|
|
482
481
|
// If code reaches this block navigator cant go back, it is not home,
|
|
483
482
|
// and this is a login plugin that was pushed on top of the home
|
|
484
|
-
// Treat it like a home screen and run
|
|
483
|
+
// Treat it like a home screen and run platformToBackground()
|
|
485
484
|
const entryData = navigator?.data?.entry;
|
|
486
485
|
const isHookInHomescreen = entryData?.payload?.home;
|
|
487
486
|
|
|
@@ -491,7 +490,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
491
490
|
: entryData?.hookPlugin?.module?.isFlowBlocker;
|
|
492
491
|
|
|
493
492
|
if (isHookInHomescreen && isHookFlowBlocker) {
|
|
494
|
-
this.
|
|
493
|
+
this.platformToBackground();
|
|
495
494
|
} else {
|
|
496
495
|
navigator.goBack(false, true);
|
|
497
496
|
}
|
|
@@ -640,7 +639,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
|
|
|
640
639
|
return;
|
|
641
640
|
}
|
|
642
641
|
|
|
643
|
-
this.
|
|
642
|
+
this.platformToBackground();
|
|
644
643
|
}
|
|
645
644
|
|
|
646
645
|
if (keyCode(event).matchesAny(...ARROW_KEYS)) {
|
|
@@ -271,10 +271,11 @@ export const getDeviceData = async () => {
|
|
|
271
271
|
]);
|
|
272
272
|
|
|
273
273
|
deviceData = {
|
|
274
|
-
platform: "lg_tv",
|
|
275
274
|
...webOSInfo,
|
|
276
275
|
...webOSConnectionInfo,
|
|
277
|
-
|
|
276
|
+
platform: "lg_tv",
|
|
277
|
+
deviceMake: "LG",
|
|
278
|
+
deviceType: getDeviceType(),
|
|
278
279
|
...deviceDimensions,
|
|
279
280
|
};
|
|
280
281
|
} else if (isSamsungPlatform()) {
|
|
@@ -284,10 +285,11 @@ export const getDeviceData = async () => {
|
|
|
284
285
|
]);
|
|
285
286
|
|
|
286
287
|
deviceData = {
|
|
287
|
-
platform: "samsung_tv",
|
|
288
288
|
...tizenInfo,
|
|
289
289
|
...tizenConnectionInfo,
|
|
290
|
-
|
|
290
|
+
platform: "samsung_tv",
|
|
291
|
+
deviceMake: "Samsung",
|
|
292
|
+
deviceType: getDeviceType(),
|
|
291
293
|
...deviceDimensions,
|
|
292
294
|
};
|
|
293
295
|
} else if (isVizioPlatform()) {
|
package/main.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-dom-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0-alpha.6593152532",
|
|
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": "
|
|
26
|
-
"@applicaster/zapp-react-native-bridge": "
|
|
27
|
-
"@applicaster/zapp-react-native-redux": "
|
|
28
|
-
"@applicaster/zapp-react-native-ui-components": "
|
|
29
|
-
"@applicaster/zapp-react-native-utils": "
|
|
25
|
+
"@applicaster/zapp-react-dom-ui-components": "16.0.0-alpha.6593152532",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "16.0.0-alpha.6593152532",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "16.0.0-alpha.6593152532",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "16.0.0-alpha.6593152532",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-alpha.6593152532",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
31
|
"typeface-montserrat": "^0.0.54",
|
|
32
32
|
"video.js": "7.14.3",
|