@24i/smartapps-bigscreen-rnv-build-engine 0.18.2-alpha.2846 → 0.18.2-test.0
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/sdks/sdk-androidtv/sdkAndroidtv.js +0 -5
- package/dist/src/sdks/sdk-vegaos/sdkVegaOS.js +5 -22
- package/dist/templates/platforms/androidtv/project/app/build.gradle +1 -3
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/configuration/BridgeConfig.kt +0 -1
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/global/utils/PlayerFactoryBitmovinCustomized.kt +1 -3
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/webview/model/MediaEventType.kt +0 -1
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +0 -11
- package/dist/templates/platforms/vegaos/project/manifest.toml +0 -14
- package/dist/templates/platforms/vegaos/project/package-lock.json +605 -5835
- package/dist/templates/platforms/vegaos/project/package.json +0 -2
- package/dist/templates/platforms/vegaos/project/src/App.tsx +4 -5
- package/dist/templates/platforms/vegaos/project/src/inject.ts +2 -13
- package/dist/templates/platforms/vegaos/project/src/messageHandler.ts +7 -24
- package/package.json +1 -1
- package/dist/templates/platforms/vegaos/project/src/deviceApi/adInfo.ts +0 -16
- package/dist/templates/platforms/vegaos/project/src/deviceApi/index.ts +0 -3
- package/dist/templates/platforms/vegaos/project/src/deviceApi/purchase.ts +0 -61
- /package/dist/templates/platforms/vegaos/project/src/{deviceApi/deviceInfo.ts → deviceInfo.ts} +0 -0
|
@@ -19,8 +19,6 @@
|
|
|
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",
|
|
24
22
|
"@amazon-devices/react-native-device-info": "^2.0.1758683737",
|
|
25
23
|
"@amazon-devices/react-native-kepler": "^2.0.0",
|
|
26
24
|
"@amazon-devices/react-native-localize": "^2.0.1758683737",
|
|
@@ -2,9 +2,8 @@ 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 './
|
|
7
|
-
import { getAdInfo } from './deviceApi';
|
|
5
|
+
import { onMessage } from './messageHandler';
|
|
6
|
+
import { DeviceInfo, getDeviceInfo } from './deviceInfo';
|
|
8
7
|
import { getVegaOSBridge } from './inject';
|
|
9
8
|
import { WebViewMethods } from '@amazon-devices/webview/dist/types/WebViewTypes';
|
|
10
9
|
|
|
@@ -36,7 +35,7 @@ export const App = () => {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
const handleLoad = () => {
|
|
39
|
-
webRef.current?.injectJavaScript(getVegaOSBridge(deviceInfo
|
|
38
|
+
webRef.current?.injectJavaScript(getVegaOSBridge(deviceInfo));
|
|
40
39
|
};
|
|
41
40
|
|
|
42
41
|
return (
|
|
@@ -53,7 +52,7 @@ export const App = () => {
|
|
|
53
52
|
mediaPlaybackRequiresUserAction={false}
|
|
54
53
|
mixedContentMode="always"
|
|
55
54
|
onLoad={handleLoad}
|
|
56
|
-
onMessage={
|
|
55
|
+
onMessage={onMessage}
|
|
57
56
|
/>
|
|
58
57
|
</View>
|
|
59
58
|
);
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeviceInfo } from './deviceInfo';
|
|
2
2
|
|
|
3
|
-
export const getVegaOSBridge = (deviceInfo: DeviceInfo
|
|
3
|
+
export const getVegaOSBridge = (deviceInfo: DeviceInfo) => {
|
|
4
4
|
const deviceInfoString = JSON.stringify(deviceInfo);
|
|
5
|
-
const adInfoString = JSON.stringify(adInfo);
|
|
6
5
|
return `
|
|
7
6
|
window.VegaOSBridge = {
|
|
8
7
|
deviceInfo: ${deviceInfoString},
|
|
9
|
-
adInfo: ${adInfoString},
|
|
10
8
|
getDeviceInfo: function() {
|
|
11
9
|
return window.VegaOSBridge.deviceInfo;
|
|
12
10
|
},
|
|
13
|
-
getAdInfo: function() {
|
|
14
|
-
return window.VegaOSBridge.adInfo;
|
|
15
|
-
},
|
|
16
11
|
exit: function() {
|
|
17
12
|
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 }));
|
|
24
13
|
}
|
|
25
14
|
};
|
|
26
15
|
true; // Přidání 'true;' na konec zabraňuje chybám, kdy WebView padá při vracení nedefinovaného objektu
|
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
WebViewMessageEvent,
|
|
4
|
-
WebViewMethods,
|
|
5
|
-
} from '@amazon-devices/webview/dist/types/WebViewTypes';
|
|
1
|
+
import { WebViewMessageEvent } from '@amazon-devices/webview/dist/types/WebViewTypes';
|
|
6
2
|
import { BackHandler } from 'react-native';
|
|
7
|
-
import { handlePurchase, handleNotifyFulfillment } from './deviceApi';
|
|
8
3
|
|
|
9
|
-
|
|
4
|
+
export const onMessage = (event: WebViewMessageEvent) => {
|
|
5
|
+
const message = JSON.parse(event.nativeEvent.data);
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
};
|
|
7
|
+
if (message.type === 'EXIT_APP') {
|
|
8
|
+
BackHandler.exitApp();
|
|
9
|
+
}
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
};
|
/package/dist/templates/platforms/vegaos/project/src/{deviceApi/deviceInfo.ts → deviceInfo.ts}
RENAMED
|
File without changes
|