@applicaster/zapp-react-native-ui-components 12.0.4-alpha.7221603725 → 12.0.4-alpha.7284824515
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.
|
@@ -244,25 +244,27 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
244
244
|
}, [item.id]);
|
|
245
245
|
|
|
246
246
|
React.useEffect(() => {
|
|
247
|
-
if (playerManager) {
|
|
248
|
-
|
|
247
|
+
if (isMeasurement(item) || !playerManager) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
249
250
|
|
|
250
|
-
|
|
251
|
-
log_error(
|
|
252
|
-
`PlayerLiveImageComponent: player ${playerId} already registered`
|
|
253
|
-
);
|
|
254
|
-
} else {
|
|
255
|
-
playerManager.registerPlayer({
|
|
256
|
-
id: playerId,
|
|
257
|
-
playerController: controller,
|
|
258
|
-
});
|
|
251
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
|
|
259
252
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
253
|
+
if (isPlayerRegistered) {
|
|
254
|
+
log_error(
|
|
255
|
+
`PlayerLiveImageComponent: player ${playerId} already registered`
|
|
256
|
+
);
|
|
257
|
+
} else {
|
|
258
|
+
playerManager.registerPlayer({
|
|
259
|
+
id: playerId,
|
|
260
|
+
playerController: controller,
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
return () => {
|
|
264
|
+
playerManager.unregisterPlayer(playerId);
|
|
265
|
+
};
|
|
264
266
|
}
|
|
265
|
-
}, [liveImageItem, playerId, controller]);
|
|
267
|
+
}, [liveImageItem, playerId, controller, item.id]);
|
|
266
268
|
|
|
267
269
|
const onPositionUpdated = React.useCallback(
|
|
268
270
|
(data) => {
|
|
@@ -5,6 +5,7 @@ import * as PlayerFactory from "@applicaster/zapp-react-native-utils/appUtils/pl
|
|
|
5
5
|
import { Player } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/player";
|
|
6
6
|
import { ThemeContext } from "@applicaster/zapp-react-native-utils/theme";
|
|
7
7
|
import * as navigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
8
|
+
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
8
9
|
|
|
9
10
|
import { PlayerLiveImage } from "../PlayerLiveImageComponent";
|
|
10
11
|
import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
@@ -33,7 +34,7 @@ const mockStore = configureStore();
|
|
|
33
34
|
|
|
34
35
|
const store = mockStore({ appData: {} });
|
|
35
36
|
|
|
36
|
-
const Wrapper = ({ children }: { children: React.
|
|
37
|
+
const Wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
37
38
|
/* @ts-ignore */
|
|
38
39
|
<Provider store={store}>
|
|
39
40
|
<ThemeContext.Provider
|
|
@@ -113,4 +114,53 @@ describe("PlayerLiveImageComponent", () => {
|
|
|
113
114
|
|
|
114
115
|
// TODO: implement this test
|
|
115
116
|
});
|
|
117
|
+
|
|
118
|
+
it("should register the player for normal item", () => {
|
|
119
|
+
render(
|
|
120
|
+
<Wrapper>
|
|
121
|
+
<PlayerLiveImage {...defaultProps} />
|
|
122
|
+
</Wrapper>
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(
|
|
126
|
+
defaultProps.playerId
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
expect(isPlayerRegistered).toBe(true);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("should unregister the player for normal item", () => {
|
|
133
|
+
const component = render(
|
|
134
|
+
<Wrapper>
|
|
135
|
+
<PlayerLiveImage {...defaultProps} />
|
|
136
|
+
</Wrapper>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
component.unmount();
|
|
140
|
+
|
|
141
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(
|
|
142
|
+
defaultProps.playerId
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
expect(isPlayerRegistered).toBe(false);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("should not register the player for 'pre-measurement' item", () => {
|
|
149
|
+
const props = {
|
|
150
|
+
...defaultProps,
|
|
151
|
+
item: {
|
|
152
|
+
...defaultProps.item,
|
|
153
|
+
id: "pre-measurement-1",
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
render(
|
|
158
|
+
<Wrapper>
|
|
159
|
+
<PlayerLiveImage {...props} />
|
|
160
|
+
</Wrapper>
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(props.playerId);
|
|
164
|
+
expect(isPlayerRegistered).toBe(false);
|
|
165
|
+
});
|
|
116
166
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.4-alpha.
|
|
3
|
+
"version": "12.0.4-alpha.7284824515",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"redux-mock-store": "^1.5.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@applicaster/applicaster-types": "12.0.4-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.4-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.4-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.4-alpha.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.4-alpha.7284824515",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.4-alpha.7284824515",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.4-alpha.7284824515",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.4-alpha.7284824515",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|