@jolibox/implement 1.1.19-beta.6 → 1.1.19
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/.rush/temp/package-deps_build.json +8 -8
- package/dist/common/context/index.d.ts +1 -0
- package/dist/index.js +22 -22
- package/dist/index.native.js +39 -39
- package/implement.build.log +2 -2
- package/package.json +5 -5
- package/src/common/context/index.ts +5 -1
- package/src/common/rewards/registers/utils/coins/index.ts +2 -0
- package/src/h5/api/ads.ts +1 -1
- package/src/h5/rewards/index.ts +1 -1
- package/src/native/api/ads.ts +1 -1
- package/src/native/api/navigate.ts +2 -0
- package/src/native/bootstrap/index.ts +28 -0
package/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.1.19
|
|
3
|
+
> @jolibox/implement@1.1.19 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.19
|
|
7
|
+
> @jolibox/implement@1.1.19 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.19
|
|
4
|
+
"version": "1.1.19",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.1.19
|
|
10
|
-
"@jolibox/types": "1.1.19
|
|
11
|
-
"@jolibox/native-bridge": "1.1.19
|
|
12
|
-
"@jolibox/ads": "1.1.19
|
|
9
|
+
"@jolibox/common": "1.1.19",
|
|
10
|
+
"@jolibox/types": "1.1.19",
|
|
11
|
+
"@jolibox/native-bridge": "1.1.19",
|
|
12
|
+
"@jolibox/ads": "1.1.19",
|
|
13
13
|
"localforage": "1.10.0",
|
|
14
14
|
"@jolibox/ui": "1.0.0",
|
|
15
15
|
"web-vitals": "4.2.4"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeArray, mergeWith } from '@jolibox/common';
|
|
1
|
+
import { getAdvertisingId, mergeArray, mergeWith } from '@jolibox/common';
|
|
2
2
|
import { DeviceInfo, HostInfo, HostUserInfo, SdkInfo } from './types';
|
|
3
3
|
import { Env } from '@jolibox/types';
|
|
4
4
|
import { parseUrlQuery, encodeJoliSourceQuery, QueryParams } from './url-parse';
|
|
@@ -16,6 +16,7 @@ const defaultEnv: Env = {
|
|
|
16
16
|
brand: 'UnknownBrand',
|
|
17
17
|
model: 'UnknownModel',
|
|
18
18
|
did: getDeviceId(),
|
|
19
|
+
adId: getAdvertisingId(),
|
|
19
20
|
pixelRatio: window.devicePixelRatio || 1,
|
|
20
21
|
platform: platform.isAndroid ? 'android' : platform.isiOS ? 'ios' : 'h5',
|
|
21
22
|
system: 'UnknownSystemVersion',
|
|
@@ -108,6 +109,9 @@ const wrapContext = () => {
|
|
|
108
109
|
get baseApiHost(): string {
|
|
109
110
|
return testMode ? 'https://stg-api.jolibox.com' : 'https://api.jolibox.com';
|
|
110
111
|
},
|
|
112
|
+
get adId(): string {
|
|
113
|
+
return env.deviceInfo.adId ?? env.deviceInfo.did;
|
|
114
|
+
},
|
|
111
115
|
onEnvConfigChanged: (newConfig: Partial<Env>) => {
|
|
112
116
|
mergeWith(env, newConfig, mergeArray);
|
|
113
117
|
},
|
package/src/h5/api/ads.ts
CHANGED
|
@@ -29,7 +29,7 @@ const adsContext: IAdsContext<'GAME'> = {
|
|
|
29
29
|
return {
|
|
30
30
|
hostAppId: context.hostInfo?.aid ?? '1',
|
|
31
31
|
deviceId: context.deviceInfo.did ?? '',
|
|
32
|
-
adId: context.deviceInfo.
|
|
32
|
+
adId: context.deviceInfo.adId ?? '',
|
|
33
33
|
sessionId: context.sessionId ?? '',
|
|
34
34
|
userId: context.hostUserInfo?.uid ?? '',
|
|
35
35
|
objectType: 'GAME',
|
package/src/h5/rewards/index.ts
CHANGED
|
@@ -24,7 +24,7 @@ const UseCoinEventMap: Record<string, IUseModalResultEvent['useModalResult']> =
|
|
|
24
24
|
CANCEL: 'CANCEL'
|
|
25
25
|
};
|
|
26
26
|
onCustomEvent('ON_JOLIBOX_JOLI_COIN_USE_RESULT', (data) => {
|
|
27
|
-
console.log('onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT', UseCoinEventMap[data.result]);
|
|
27
|
+
console.log('onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT', UseCoinEventMap[data.result], data.result);
|
|
28
28
|
|
|
29
29
|
rewardsEmitter.emit(UseModalResultEventName, {
|
|
30
30
|
useModalResult: UseCoinEventMap[data.result]
|
package/src/native/api/ads.ts
CHANGED
|
@@ -56,7 +56,7 @@ const adsContext: IAdsContext<'GAME'> = {
|
|
|
56
56
|
return {
|
|
57
57
|
hostAppId: context.hostInfo?.aid ?? '1',
|
|
58
58
|
deviceId: context.deviceInfo.did ?? '',
|
|
59
|
-
adId: context.deviceInfo.
|
|
59
|
+
adId: context.deviceInfo.adId ?? '',
|
|
60
60
|
sessionId: context.sessionId ?? '',
|
|
61
61
|
userId: context.hostUserInfo?.uid ?? '',
|
|
62
62
|
objectType: 'GAME',
|
|
@@ -48,6 +48,8 @@ const interceptSystemExitSync = createSyncAPI('interceptSystemExitSync', {
|
|
|
48
48
|
paramsSchema: t.tuple(t.boolean()),
|
|
49
49
|
implement: (intercept) => {
|
|
50
50
|
hostEmitter.emit('onInterceptSystemExit', { intercept });
|
|
51
|
+
// 同步拦截物理退出
|
|
52
|
+
hostEmitter.emit('onInterceptBackPress', { intercept });
|
|
51
53
|
}
|
|
52
54
|
});
|
|
53
55
|
|
|
@@ -17,6 +17,7 @@ declare const globalThis: {
|
|
|
17
17
|
doExit: (uuid: string) => void;
|
|
18
18
|
onDocumentReady: (path: string) => void;
|
|
19
19
|
env: (params: { onError: (error: Error) => void }) => Env | undefined;
|
|
20
|
+
doBackPress: (uuid: string) => void;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -47,6 +48,11 @@ let baskcMeta: IBasicMetaConfig | null = null;
|
|
|
47
48
|
*/
|
|
48
49
|
let isInterceptSystemExit = false;
|
|
49
50
|
|
|
51
|
+
/**
|
|
52
|
+
* android全局拦截物理按键
|
|
53
|
+
*/
|
|
54
|
+
let isInterceptBackPress = false;
|
|
55
|
+
|
|
50
56
|
RuntimeLoader.onReady(() => {
|
|
51
57
|
// TODO: merge some env config
|
|
52
58
|
});
|
|
@@ -75,6 +81,20 @@ function addInterceptSystemExitListener() {
|
|
|
75
81
|
});
|
|
76
82
|
}
|
|
77
83
|
|
|
84
|
+
/**
|
|
85
|
+
* android 全局拦截物理退出
|
|
86
|
+
*/
|
|
87
|
+
function addBackPressListener() {
|
|
88
|
+
hostEmitter.on('onInterceptBackPress', ({ intercept }) => {
|
|
89
|
+
isInterceptBackPress = intercept;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
onNative('onBeforeBackPress', ({ uuid }) => {
|
|
93
|
+
hostEmitter.emit('onBackPress', {});
|
|
94
|
+
globalThis.joliboxJSCore?.doBackPress?.(uuid);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
78
98
|
/**
|
|
79
99
|
* The DOMContentLoaded event might be triggered very early,
|
|
80
100
|
* so the global loaded listener should be executed during the bootstrap process.
|
|
@@ -172,6 +192,13 @@ function addDoExitLoader() {
|
|
|
172
192
|
doActualExit();
|
|
173
193
|
return false;
|
|
174
194
|
});
|
|
195
|
+
|
|
196
|
+
RuntimeLoader.onDoBackPress(async () => {
|
|
197
|
+
if (shouldInterceptSystemExit()) {
|
|
198
|
+
return true; // Forbid exit on watching ads
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
});
|
|
175
202
|
}
|
|
176
203
|
|
|
177
204
|
async function fetchMetaConfig() {
|
|
@@ -190,6 +217,7 @@ export function config(): void {
|
|
|
190
217
|
addGameServiceReadyListener();
|
|
191
218
|
addShowAdListener();
|
|
192
219
|
addInterceptSystemExitListener();
|
|
220
|
+
addBackPressListener();
|
|
193
221
|
addDoExitLoader();
|
|
194
222
|
addWebviewReadyListener();
|
|
195
223
|
addI18nChangedListener();
|