@24i/smartapps-bigscreen-rnv-build-engine 0.18.2-test.0 → 0.18.2
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/dist/src/__tests__/engine.spec.js +1 -0
- package/dist/src/__tests__/resolvers/resolveBaseUrl.spec.js +19 -14
- package/dist/src/__tests__/resolvers/resolveBuildFileName.spec.js +1 -0
- package/dist/src/__tests__/resolvers/resolveDeployLocations.spec.js +3 -0
- package/dist/src/__tests__/resolvers/resolveZippedPlatformBuildsRelativeFilePath.spec.js +1 -1
- package/dist/src/__tests__/utils/zipBuildsByPlatforms.spec.js +7 -0
- package/dist/src/sdks/sdk-androidtv/sdkAndroidtv.js +5 -0
- package/dist/src/sdks/sdk-vegaos/sdkVegaOS.js +22 -5
- package/dist/templates/platforms/androidtv/project/app/build.gradle +3 -1
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/configuration/BridgeConfig.kt +1 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/global/utils/PlayerFactoryBitmovinCustomized.kt +3 -1
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/webview/model/MediaEventType.kt +1 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +11 -0
- package/dist/templates/platforms/vegaos/project/manifest.toml +14 -0
- package/dist/templates/platforms/vegaos/project/package-lock.json +5838 -608
- package/dist/templates/platforms/vegaos/project/package.json +2 -0
- package/dist/templates/platforms/vegaos/project/src/App.tsx +5 -4
- package/dist/templates/platforms/vegaos/project/src/deviceApi/adInfo.ts +16 -0
- package/dist/templates/platforms/vegaos/project/src/deviceApi/index.ts +3 -0
- package/dist/templates/platforms/vegaos/project/src/deviceApi/purchase.ts +61 -0
- package/dist/templates/platforms/vegaos/project/src/inject.ts +13 -2
- package/dist/templates/platforms/vegaos/project/src/messageHandler.ts +24 -7
- package/package.json +2 -3
- /package/dist/templates/platforms/vegaos/project/src/{deviceInfo.ts → deviceApi/deviceInfo.ts} +0 -0
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
"release": "npm-run-all lint test build:app"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@amazon-devices/kepler-adid-retriever": "^1.0.14",
|
|
23
|
+
"@amazon-devices/keplerscript-appstore-iap-lib": "^2.12.13",
|
|
22
24
|
"@amazon-devices/react-native-device-info": "^2.0.1758683737",
|
|
23
25
|
"@amazon-devices/react-native-kepler": "^2.0.0",
|
|
24
26
|
"@amazon-devices/react-native-localize": "^2.0.1758683737",
|
|
@@ -2,8 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRef, useState, useEffect } from 'react';
|
|
3
3
|
import { View, StyleSheet } from 'react-native';
|
|
4
4
|
import { WebView } from '@amazon-devices/webview';
|
|
5
|
-
import {
|
|
6
|
-
import { DeviceInfo, getDeviceInfo } from './deviceInfo';
|
|
5
|
+
import { createMessageHandler } from './messageHandler';
|
|
6
|
+
import { DeviceInfo, getDeviceInfo } from './deviceApi/deviceInfo';
|
|
7
|
+
import { getAdInfo } from './deviceApi';
|
|
7
8
|
import { getVegaOSBridge } from './inject';
|
|
8
9
|
import { WebViewMethods } from '@amazon-devices/webview/dist/types/WebViewTypes';
|
|
9
10
|
|
|
@@ -35,7 +36,7 @@ export const App = () => {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const handleLoad = () => {
|
|
38
|
-
webRef.current?.injectJavaScript(getVegaOSBridge(deviceInfo));
|
|
39
|
+
webRef.current?.injectJavaScript(getVegaOSBridge(deviceInfo, getAdInfo()));
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
return (
|
|
@@ -52,7 +53,7 @@ export const App = () => {
|
|
|
52
53
|
mediaPlaybackRequiresUserAction={false}
|
|
53
54
|
mixedContentMode="always"
|
|
54
55
|
onLoad={handleLoad}
|
|
55
|
-
onMessage={
|
|
56
|
+
onMessage={createMessageHandler(webRef)}
|
|
56
57
|
/>
|
|
57
58
|
</View>
|
|
58
59
|
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AdIdRetriever } from '@amazon-devices/kepler-adid-retriever';
|
|
2
|
+
|
|
3
|
+
export type AdInfo = {
|
|
4
|
+
adId: string;
|
|
5
|
+
latEnabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const getAdInfo = (): AdInfo => {
|
|
9
|
+
try {
|
|
10
|
+
const adId = AdIdRetriever.fetchAdvertisingId();
|
|
11
|
+
const latEnabled = !AdIdRetriever.isAdvertisingTrackingEnabled();
|
|
12
|
+
return { adId, latEnabled };
|
|
13
|
+
} catch {
|
|
14
|
+
return { adId: '', latEnabled: true };
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { WebViewMethods } from '@amazon-devices/webview/dist/types/WebViewTypes';
|
|
3
|
+
import {
|
|
4
|
+
FulfillmentResult,
|
|
5
|
+
PurchaseResponseCode,
|
|
6
|
+
PurchasingService,
|
|
7
|
+
} from '@amazon-devices/keplerscript-appstore-iap-lib';
|
|
8
|
+
|
|
9
|
+
type WebViewRef = RefObject<WebViewMethods | null>;
|
|
10
|
+
|
|
11
|
+
const dispatchEvent = (webRef: WebViewRef, eventName: string, detail: object) => {
|
|
12
|
+
const detailString = JSON.stringify(detail);
|
|
13
|
+
webRef.current?.injectJavaScript(`
|
|
14
|
+
document.dispatchEvent(new CustomEvent('${eventName}', { detail: ${detailString} }));
|
|
15
|
+
true;
|
|
16
|
+
`);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const getErrorDetail = (error: unknown) => {
|
|
20
|
+
if (error instanceof Error) {
|
|
21
|
+
return {
|
|
22
|
+
name: error.name,
|
|
23
|
+
message: error.message,
|
|
24
|
+
stack: error.stack,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
value: String(error),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const handlePurchase = async (webRef: WebViewRef, sku: string) => {
|
|
34
|
+
try {
|
|
35
|
+
const response = await PurchasingService.purchase({ sku });
|
|
36
|
+
if (response.responseCode === PurchaseResponseCode.SUCCESSFUL) {
|
|
37
|
+
dispatchEvent(webRef, 'iapSuccess', {
|
|
38
|
+
userId: response.userData.userId,
|
|
39
|
+
receipt: JSON.stringify(response.receipt),
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
dispatchEvent(webRef, 'iapError', {
|
|
43
|
+
message: `Purchase failed with response code: ${response.responseCode}`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
const message = error instanceof Error ? error.message : 'Purchase failed with unknown error';
|
|
48
|
+
dispatchEvent(webRef, 'iapError', { message });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const handleNotifyFulfillment = async (receiptId: string) => {
|
|
53
|
+
try {
|
|
54
|
+
await PurchasingService.notifyFulfillment({
|
|
55
|
+
receiptId,
|
|
56
|
+
fulfillmentResult: FulfillmentResult.FULFILLED,
|
|
57
|
+
});
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error('[VegaOS] Failed to notify fulfillment', error);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import { DeviceInfo } from './
|
|
1
|
+
import { AdInfo, DeviceInfo } from './deviceApi';
|
|
2
2
|
|
|
3
|
-
export const getVegaOSBridge = (deviceInfo: DeviceInfo) => {
|
|
3
|
+
export const getVegaOSBridge = (deviceInfo: DeviceInfo, adInfo: AdInfo) => {
|
|
4
4
|
const deviceInfoString = JSON.stringify(deviceInfo);
|
|
5
|
+
const adInfoString = JSON.stringify(adInfo);
|
|
5
6
|
return `
|
|
6
7
|
window.VegaOSBridge = {
|
|
7
8
|
deviceInfo: ${deviceInfoString},
|
|
9
|
+
adInfo: ${adInfoString},
|
|
8
10
|
getDeviceInfo: function() {
|
|
9
11
|
return window.VegaOSBridge.deviceInfo;
|
|
10
12
|
},
|
|
13
|
+
getAdInfo: function() {
|
|
14
|
+
return window.VegaOSBridge.adInfo;
|
|
15
|
+
},
|
|
11
16
|
exit: function() {
|
|
12
17
|
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'EXIT_APP' }));
|
|
18
|
+
},
|
|
19
|
+
purchase: function(sku) {
|
|
20
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'PURCHASE', sku: sku }));
|
|
21
|
+
},
|
|
22
|
+
notifyFulfillment: function(receiptId) {
|
|
23
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'NOTIFY_FULFILLMENT', receiptId: receiptId }));
|
|
13
24
|
}
|
|
14
25
|
};
|
|
15
26
|
true; // Přidání 'true;' na konec zabraňuje chybám, kdy WebView padá při vracení nedefinovaného objektu
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
WebViewMessageEvent,
|
|
4
|
+
WebViewMethods,
|
|
5
|
+
} from '@amazon-devices/webview/dist/types/WebViewTypes';
|
|
2
6
|
import { BackHandler } from 'react-native';
|
|
7
|
+
import { handlePurchase, handleNotifyFulfillment } from './deviceApi';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
const message = JSON.parse(event.nativeEvent.data);
|
|
9
|
+
type WebViewRef = RefObject<WebViewMethods | null>;
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export const createMessageHandler =
|
|
12
|
+
(webRef: WebViewRef) => (event: WebViewMessageEvent) => {
|
|
13
|
+
const message = JSON.parse(event.nativeEvent.data);
|
|
14
|
+
switch (message.type) {
|
|
15
|
+
case 'EXIT_APP':
|
|
16
|
+
BackHandler.exitApp();
|
|
17
|
+
break;
|
|
18
|
+
case 'PURCHASE':
|
|
19
|
+
handlePurchase(webRef, message.sku);
|
|
20
|
+
break;
|
|
21
|
+
case 'NOTIFY_FULFILLMENT':
|
|
22
|
+
handleNotifyFulfillment(message.receiptId);
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/smartapps-bigscreen-rnv-build-engine",
|
|
3
|
-
"version": "0.18.2
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "Package with build engine for SmartApps BIGscreen projects...",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -87,6 +87,5 @@
|
|
|
87
87
|
},
|
|
88
88
|
"keywords": [],
|
|
89
89
|
"author": "24i",
|
|
90
|
-
"license": "ISC"
|
|
91
|
-
"gitHead": "e2d768806787e222c8e6f5bdf25cd6e97a1167cd"
|
|
90
|
+
"license": "ISC"
|
|
92
91
|
}
|
/package/dist/templates/platforms/vegaos/project/src/{deviceInfo.ts → deviceApi/deviceInfo.ts}
RENAMED
|
File without changes
|