@inappstory/game-center-api 1.2.0 → 1.2.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/README.md +66 -1
- package/lib/index.d.ts +3 -7
- package/lib/index.js +1 -3
- package/lib/sdkApi/initGame.d.ts +1 -6
- package/lib/sdkApi/initGame.js +87 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,16 +30,81 @@ createSdkApi({
|
|
|
30
30
|
onBackGesture: () => {
|
|
31
31
|
/* Call on Android back gesture */
|
|
32
32
|
},
|
|
33
|
+
gameShouldForeground: () => {
|
|
34
|
+
/* splash animation finished, now we can start bg music and etc */
|
|
35
|
+
},
|
|
33
36
|
});
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
## Game first render
|
|
37
40
|
|
|
38
41
|
```tsx
|
|
42
|
+
const gameLoaded = () => {
|
|
43
|
+
if (GameCenterApi.isSdkSupportGameShouldForegroundCallback()) {
|
|
44
|
+
GameCenterApi.gameLoadedSdkCallback();
|
|
45
|
+
} else {
|
|
46
|
+
// fallback for old sdk versions
|
|
47
|
+
gameShouldForeground();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const gameStarted = () => {
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
// Wait for render complete - then remove native loader screen
|
|
54
|
+
if (GameCenterApi.isSdkSupportGameShouldForegroundCallback()) {
|
|
55
|
+
GameCenterApi.gameShouldForegroundCallback();
|
|
56
|
+
} else {
|
|
57
|
+
GameCenterApi.gameLoadedSdkCallback();
|
|
58
|
+
}
|
|
59
|
+
}, 50);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const gameShouldForeground = () => {
|
|
63
|
+
// splash animation finished, now we can start bg music and etc
|
|
64
|
+
gameStarted();
|
|
65
|
+
};
|
|
66
|
+
|
|
39
67
|
// calling gameLoadedSdkCallback removes the loading screen
|
|
40
68
|
import { gameLoadedSdkCallback } from "@inappstory/game-center-api";
|
|
41
69
|
|
|
42
70
|
const rootElement = document.getElementById("root");
|
|
43
71
|
const root = createRoot(rootElement!);
|
|
44
|
-
root.render(<AppWithCallbackAfterRender cb={
|
|
72
|
+
root.render(<AppWithCallbackAfterRender cb={gameLoaded} />);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Get user ID
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import GameCenterApi from "@inappstory/game-center-api";
|
|
79
|
+
// call only after mounted event (from GameCenterApi.createSdkApi
|
|
80
|
+
const getUserId = () => GameCenterApi.gameLaunchConfig.clientConfig.userId;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Get placeholder
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import GameCenterApi, { type PlaceholderType, Placeholder } from "@inappstory/game-center-api";
|
|
87
|
+
// call only after mounted event (from GameCenterApi.createSdkApi
|
|
88
|
+
const getPlaceholder = (name: string, type: PlaceholderType): Placeholder | undefined => {
|
|
89
|
+
return GameCenterApi.gameLaunchConfig.clientConfig.placeholders.find(placeholder => placeholder.name === name && placeholder.type === type);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const avatarUrl = getPlaceholder("avatar", PlaceholderType.IMAGE);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Open url
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import GameCenterApi from "@inappstory/game-center-api";
|
|
99
|
+
|
|
100
|
+
// closeGameReader - close or not GameReader
|
|
101
|
+
const openUrl = (url: string) => GameCenterApi.openUrl({ url, closeGameReader: true });
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Close game
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import GameCenterApi from "@inappstory/game-center-api";
|
|
108
|
+
|
|
109
|
+
const closeGame = () => GameCenterApi.closeGameReader();
|
|
45
110
|
```
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { getDynamicResourceAsset, getDynamicResourceFont, getProjectFontFamilySt
|
|
|
4
4
|
import { sendIasApiRequest } from "./iasApi";
|
|
5
5
|
import { gameLocalData } from "./localData";
|
|
6
6
|
import { closeGameReader, createSdkApi, reloadGameReader } from "./sdkApi";
|
|
7
|
-
import { gameLoadedSdkCallback, gameLoadFailedSdkCallback, gameShouldForegroundCallback,
|
|
7
|
+
import { gameLoadedSdkCallback, gameLoadFailedSdkCallback, gameShouldForegroundCallback, gameOnForeground } from "./sdkApi/initGame";
|
|
8
8
|
import { openUrl } from "./sdkApi/openUrl";
|
|
9
9
|
import { share } from "./sdkApi/share";
|
|
10
10
|
import { vibrate } from "./sdkApi/vibrate";
|
|
@@ -23,7 +23,7 @@ export type { RequestInfo as APIRequestInfo, Response as APIResponse } from "./i
|
|
|
23
23
|
export type { Placeholder, GameLaunchConfig };
|
|
24
24
|
export type { ProjectFontFamily } from "./gameResources";
|
|
25
25
|
export type { ResourceInterface } from "./ResourceManager";
|
|
26
|
-
export { createSdkApi, closeGameReader, gameLoadedSdkCallback, gameLoadFailedSdkCallback, gameLaunchConfig, isIos, isWeb, isAndroid, isDev, getSdkVersion, getSemverSdkVersion, gameLocalData, sendIasApiRequest, openUrl, share, vibrate, getDynamicResourceAsset, getDynamicResourceFont, getProjectFontFamilyStylesheet, getIsDemoMode, getSessionId, getApiBaseUrl, ScreenOrientation, PlaceholderType, fetchLocalFile, openStory, ResourceManager, dynamicResourceAssets, dynamicResourceFonts, staticResourcesImagePlaceholders, StaticResourceList, eventGame, reloadGameReader, openFilePicker, FilePickerResultType, isFilePickerResultFileList, isFilePickerResultLocalFileList, isLocalFile, hasFilePickerApi, gameShouldForegroundCallback,
|
|
26
|
+
export { createSdkApi, closeGameReader, gameLoadedSdkCallback, gameLoadFailedSdkCallback, gameLaunchConfig, isIos, isWeb, isAndroid, isDev, getSdkVersion, getSemverSdkVersion, gameLocalData, sendIasApiRequest, openUrl, share, vibrate, getDynamicResourceAsset, getDynamicResourceFont, getProjectFontFamilyStylesheet, getIsDemoMode, getSessionId, getApiBaseUrl, ScreenOrientation, PlaceholderType, fetchLocalFile, openStory, ResourceManager, dynamicResourceAssets, dynamicResourceFonts, staticResourcesImagePlaceholders, StaticResourceList, eventGame, reloadGameReader, openFilePicker, FilePickerResultType, isFilePickerResultFileList, isFilePickerResultLocalFileList, isLocalFile, hasFilePickerApi, gameShouldForegroundCallback, gameOnForeground, };
|
|
27
27
|
declare const GameCenterApi: {
|
|
28
28
|
createSdkApi: ({ mounted, beforeUnmount: beforeUnmountCb, onSdkCloseGameReaderIntent, onPause, onResume, onBackGesture, onAudioFocusChange, filterPlaceholders, gameShouldForeground, }: Partial<{
|
|
29
29
|
mounted: () => void;
|
|
@@ -37,10 +37,7 @@ declare const GameCenterApi: {
|
|
|
37
37
|
gameShouldForeground: () => void;
|
|
38
38
|
}>) => void;
|
|
39
39
|
closeGameReader: (data?: import("./sdkApi").CloseGameReaderOptions | undefined) => void;
|
|
40
|
-
gameLoadedSdkCallback: (
|
|
41
|
-
showClose: boolean;
|
|
42
|
-
backGesture: boolean;
|
|
43
|
-
}>> | undefined) => void;
|
|
40
|
+
gameLoadedSdkCallback: () => void;
|
|
44
41
|
gameLoadFailedSdkCallback: (reason: string, canTryReload: boolean) => void;
|
|
45
42
|
gameLaunchConfig: GameLaunchConfig;
|
|
46
43
|
isIos: any;
|
|
@@ -90,7 +87,6 @@ declare const GameCenterApi: {
|
|
|
90
87
|
showClose: boolean;
|
|
91
88
|
backGesture: boolean;
|
|
92
89
|
}>> | undefined) => void;
|
|
93
|
-
isSdkSupportGameShouldForegroundCallback: () => boolean | undefined;
|
|
94
90
|
gameOnForeground: Promise<void>;
|
|
95
91
|
};
|
|
96
92
|
export { GameCenterApi as default };
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = exports.gameOnForeground = exports.
|
|
3
|
+
exports.default = exports.gameOnForeground = exports.gameShouldForegroundCallback = exports.hasFilePickerApi = exports.isLocalFile = exports.isFilePickerResultLocalFileList = exports.isFilePickerResultFileList = exports.FilePickerResultType = exports.openFilePicker = exports.reloadGameReader = exports.eventGame = exports.StaticResourceList = exports.staticResourcesImagePlaceholders = exports.dynamicResourceFonts = exports.dynamicResourceAssets = exports.ResourceManager = exports.openStory = exports.fetchLocalFile = exports.PlaceholderType = exports.ScreenOrientation = exports.getApiBaseUrl = exports.getSessionId = exports.getIsDemoMode = exports.getProjectFontFamilyStylesheet = exports.getDynamicResourceFont = exports.getDynamicResourceAsset = exports.vibrate = exports.share = exports.openUrl = exports.sendIasApiRequest = exports.gameLocalData = exports.getSemverSdkVersion = exports.getSdkVersion = exports.isDev = exports.isAndroid = exports.isWeb = exports.isIos = exports.gameLaunchConfig = exports.gameLoadFailedSdkCallback = exports.gameLoadedSdkCallback = exports.closeGameReader = exports.createSdkApi = void 0;
|
|
4
4
|
const env_1 = require("./env");
|
|
5
5
|
Object.defineProperty(exports, "getSdkVersion", { enumerable: true, get: function () { return env_1.getSdkVersion; } });
|
|
6
6
|
Object.defineProperty(exports, "getSemverSdkVersion", { enumerable: true, get: function () { return env_1.getSemverSdkVersion; } });
|
|
@@ -33,7 +33,6 @@ const initGame_1 = require("./sdkApi/initGame");
|
|
|
33
33
|
Object.defineProperty(exports, "gameLoadedSdkCallback", { enumerable: true, get: function () { return initGame_1.gameLoadedSdkCallback; } });
|
|
34
34
|
Object.defineProperty(exports, "gameLoadFailedSdkCallback", { enumerable: true, get: function () { return initGame_1.gameLoadFailedSdkCallback; } });
|
|
35
35
|
Object.defineProperty(exports, "gameShouldForegroundCallback", { enumerable: true, get: function () { return initGame_1.gameShouldForegroundCallback; } });
|
|
36
|
-
Object.defineProperty(exports, "isSdkSupportGameShouldForegroundCallback", { enumerable: true, get: function () { return initGame_1.isSdkSupportGameShouldForegroundCallback; } });
|
|
37
36
|
Object.defineProperty(exports, "gameOnForeground", { enumerable: true, get: function () { return initGame_1.gameOnForeground; } });
|
|
38
37
|
const openUrl_1 = require("./sdkApi/openUrl");
|
|
39
38
|
Object.defineProperty(exports, "openUrl", { enumerable: true, get: function () { return openUrl_1.openUrl; } });
|
|
@@ -101,7 +100,6 @@ const GameCenterApi = {
|
|
|
101
100
|
isLocalFile: filePicker_h_1.isLocalFile,
|
|
102
101
|
hasFilePickerApi: filePicker_1.hasFilePickerApi,
|
|
103
102
|
gameShouldForegroundCallback: initGame_1.gameShouldForegroundCallback,
|
|
104
|
-
isSdkSupportGameShouldForegroundCallback: initGame_1.isSdkSupportGameShouldForegroundCallback,
|
|
105
103
|
gameOnForeground: initGame_1.gameOnForeground,
|
|
106
104
|
};
|
|
107
105
|
exports.default = GameCenterApi;
|
package/lib/sdkApi/initGame.d.ts
CHANGED
|
@@ -27,14 +27,10 @@ type GameReaderInit = {
|
|
|
27
27
|
ready: (cb: () => void) => void;
|
|
28
28
|
};
|
|
29
29
|
export declare const createInitGame: (initLocalData: () => Promise<void>, mounted?: () => void) => void;
|
|
30
|
-
type GameLoadedSdkConfig = Partial<{
|
|
31
|
-
showClose: boolean;
|
|
32
|
-
backGesture: boolean;
|
|
33
|
-
}>;
|
|
34
30
|
/**
|
|
35
31
|
* API method for remove loader screen from Reader
|
|
36
32
|
*/
|
|
37
|
-
export declare const gameLoadedSdkCallback: (
|
|
33
|
+
export declare const gameLoadedSdkCallback: () => void;
|
|
38
34
|
export declare const gameLoadFailedSdkCallback: (reason: string, canTryReload: boolean) => void;
|
|
39
35
|
export declare const createGameShouldForeground: (gameShouldForeground: () => void) => void;
|
|
40
36
|
type GameShouldForegroundConfig = Partial<{
|
|
@@ -45,6 +41,5 @@ type GameShouldForegroundConfig = Partial<{
|
|
|
45
41
|
* API method for remove loader screen from Reader
|
|
46
42
|
*/
|
|
47
43
|
export declare const gameShouldForegroundCallback: (config?: Partial<GameShouldForegroundConfig>) => void;
|
|
48
|
-
export declare const isSdkSupportGameShouldForegroundCallback: () => boolean | undefined;
|
|
49
44
|
export declare const gameOnForeground: Promise<void>;
|
|
50
45
|
export {};
|
package/lib/sdkApi/initGame.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gameOnForeground = exports.
|
|
3
|
+
exports.gameOnForeground = exports.gameShouldForegroundCallback = exports.createGameShouldForeground = exports.gameLoadFailedSdkCallback = exports.gameLoadedSdkCallback = exports.createInitGame = void 0;
|
|
4
4
|
const isObject_1 = require("../helpers/isObject");
|
|
5
5
|
const gameLaunchConfig_1 = require("../gameLaunchConfig");
|
|
6
6
|
const env_1 = require("../env");
|
|
@@ -17,7 +17,7 @@ const gameReader = (function () {
|
|
|
17
17
|
const self = (window.gameReader || {});
|
|
18
18
|
self._e = self._e || [];
|
|
19
19
|
if (self._e) {
|
|
20
|
-
for (let i = 0; i < self._e.length; i
|
|
20
|
+
for (let i = 0; i < self._e.length; ++i) {
|
|
21
21
|
setTimeout((function (cb, i) {
|
|
22
22
|
return function () {
|
|
23
23
|
try {
|
|
@@ -29,13 +29,54 @@ const gameReader = (function () {
|
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
31
31
|
window._sendErrorLog &&
|
|
32
|
-
window._sendErrorLog({
|
|
32
|
+
window._sendErrorLog({
|
|
33
|
+
src: "gameReaderInit queue",
|
|
34
|
+
message: e.message,
|
|
35
|
+
stack: e.stack,
|
|
36
|
+
});
|
|
33
37
|
console.error(e);
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
40
|
})(self._e[i], i));
|
|
37
41
|
}
|
|
38
42
|
}
|
|
43
|
+
if (window.Android && window.sessionStorage != null) {
|
|
44
|
+
try {
|
|
45
|
+
/**
|
|
46
|
+
* _initQueue in session storage
|
|
47
|
+
* it is fallback for case when initCode runs before window changed from _blank to game associated window
|
|
48
|
+
*/
|
|
49
|
+
const _initQueue = JSON.parse(window.sessionStorage.getItem("_initQueue") || "[]");
|
|
50
|
+
if (Array.isArray(_initQueue)) {
|
|
51
|
+
for (let i = 0; i < _initQueue.length; ++i) {
|
|
52
|
+
setTimeout((function (cb, i) {
|
|
53
|
+
return function () {
|
|
54
|
+
try {
|
|
55
|
+
window.gameLoadingInfo.state = "before call gameReaderInit sessionStorage queue";
|
|
56
|
+
window.gameLoadingInfo.description = "index: " + i;
|
|
57
|
+
eval(cb);
|
|
58
|
+
window.gameLoadingInfo.state = "after call gameReaderInit sessionStorage queue";
|
|
59
|
+
window.gameLoadingInfo.description = "index: " + i;
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
window._sendErrorLog &&
|
|
63
|
+
window._sendErrorLog({
|
|
64
|
+
src: "gameReaderInit sessionStorage queue",
|
|
65
|
+
message: e.message,
|
|
66
|
+
stack: e.stack,
|
|
67
|
+
});
|
|
68
|
+
console.error(e);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
})(_initQueue[i], i));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
window.sessionStorage.removeItem("_initQueue");
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
console.error(e);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
39
80
|
self.ready = function (cb) {
|
|
40
81
|
setTimeout(function () {
|
|
41
82
|
try {
|
|
@@ -46,7 +87,12 @@ const gameReader = (function () {
|
|
|
46
87
|
window.gameLoadingInfo.description = "";
|
|
47
88
|
}
|
|
48
89
|
catch (e) {
|
|
49
|
-
window._sendErrorLog &&
|
|
90
|
+
window._sendErrorLog &&
|
|
91
|
+
window._sendErrorLog({
|
|
92
|
+
src: "gameReaderInit ready",
|
|
93
|
+
message: e.message,
|
|
94
|
+
stack: e.stack,
|
|
95
|
+
});
|
|
50
96
|
console.error(e);
|
|
51
97
|
}
|
|
52
98
|
});
|
|
@@ -78,7 +124,12 @@ const createInitGame = (initLocalData, mounted = () => { }) => {
|
|
|
78
124
|
window.gameLoadingInfo.description = JSON.stringify(config);
|
|
79
125
|
}
|
|
80
126
|
catch (e) {
|
|
81
|
-
window._sendErrorLog &&
|
|
127
|
+
window._sendErrorLog &&
|
|
128
|
+
window._sendErrorLog({
|
|
129
|
+
src: "initGame",
|
|
130
|
+
message: e.message,
|
|
131
|
+
stack: e.stack,
|
|
132
|
+
});
|
|
82
133
|
console.error(e);
|
|
83
134
|
}
|
|
84
135
|
};
|
|
@@ -87,7 +138,17 @@ exports.createInitGame = createInitGame;
|
|
|
87
138
|
/**
|
|
88
139
|
* API method for remove loader screen from Reader
|
|
89
140
|
*/
|
|
90
|
-
const gameLoadedSdkCallback = (
|
|
141
|
+
const gameLoadedSdkCallback = () => {
|
|
142
|
+
if (isSdkSupportGameShouldForegroundCallback()) {
|
|
143
|
+
gameLoadedSdkCallbackInternal();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
/** Old sdk - call shouldForeground, emulate new sdk */
|
|
147
|
+
window.gameShouldForeground();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
exports.gameLoadedSdkCallback = gameLoadedSdkCallback;
|
|
151
|
+
const gameLoadedSdkCallbackInternal = (config) => {
|
|
91
152
|
window.gameLoadingInfo.state = "before call gameLoadedSdkCallback";
|
|
92
153
|
window.gameLoadingInfo.description = "";
|
|
93
154
|
try {
|
|
@@ -101,7 +162,7 @@ const gameLoadedSdkCallback = (config) => {
|
|
|
101
162
|
}
|
|
102
163
|
if (env_1.isAndroid) {
|
|
103
164
|
if (window.Android.gameLoaded !== undefined) {
|
|
104
|
-
if (
|
|
165
|
+
if (isSdkSupportGameShouldForegroundCallback()) {
|
|
105
166
|
window.Android.gameLoaded();
|
|
106
167
|
}
|
|
107
168
|
else {
|
|
@@ -112,7 +173,7 @@ const gameLoadedSdkCallback = (config) => {
|
|
|
112
173
|
}
|
|
113
174
|
else if (env_1.isIos) {
|
|
114
175
|
if (env_1.iosMh.gameLoaded !== undefined) {
|
|
115
|
-
if (
|
|
176
|
+
if (isSdkSupportGameShouldForegroundCallback()) {
|
|
116
177
|
env_1.iosMh.gameLoaded.postMessage("");
|
|
117
178
|
}
|
|
118
179
|
else {
|
|
@@ -123,7 +184,7 @@ const gameLoadedSdkCallback = (config) => {
|
|
|
123
184
|
}
|
|
124
185
|
else if (env_1.isWeb) {
|
|
125
186
|
if (Source_1.webSource.sourceWindow && Source_1.webSource.sourceWindowOrigin) {
|
|
126
|
-
if (
|
|
187
|
+
if (isSdkSupportGameShouldForegroundCallback()) {
|
|
127
188
|
Source_1.webSource.sourceWindow.postMessage(["gameLoaded"], Source_1.webSource.sourceWindowOrigin);
|
|
128
189
|
}
|
|
129
190
|
else {
|
|
@@ -141,16 +202,20 @@ const gameLoadedSdkCallback = (config) => {
|
|
|
141
202
|
window.gameLoadingInfo.state = "after call gameLoadedSdkCallback";
|
|
142
203
|
window.gameLoadingInfo.description = "";
|
|
143
204
|
window.gameLoadingInfo.loaded = true;
|
|
144
|
-
if (!
|
|
205
|
+
if (!isSdkSupportGameShouldForegroundCallback()) {
|
|
145
206
|
gameOnForegroundResolve();
|
|
146
207
|
}
|
|
147
208
|
}
|
|
148
209
|
catch (e) {
|
|
149
|
-
window._sendErrorLog &&
|
|
210
|
+
window._sendErrorLog &&
|
|
211
|
+
window._sendErrorLog({
|
|
212
|
+
src: "gameLoadedSdkCallback",
|
|
213
|
+
message: e.message,
|
|
214
|
+
stack: e.stack,
|
|
215
|
+
});
|
|
150
216
|
console.error(e);
|
|
151
217
|
}
|
|
152
218
|
};
|
|
153
|
-
exports.gameLoadedSdkCallback = gameLoadedSdkCallback;
|
|
154
219
|
window.gameLoadingInfo = {
|
|
155
220
|
loaded: false,
|
|
156
221
|
state: "gameReader API created",
|
|
@@ -189,6 +254,16 @@ exports.createGameShouldForeground = createGameShouldForeground;
|
|
|
189
254
|
* API method for remove loader screen from Reader
|
|
190
255
|
*/
|
|
191
256
|
const gameShouldForegroundCallback = (config) => {
|
|
257
|
+
if (isSdkSupportGameShouldForegroundCallback()) {
|
|
258
|
+
gameShouldForegroundCallbackInternal(config);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
/** For old sdk - use gameLoadedSdkCallbackInternal with config (for remove splash) */
|
|
262
|
+
gameLoadedSdkCallbackInternal(config);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
exports.gameShouldForegroundCallback = gameShouldForegroundCallback;
|
|
266
|
+
const gameShouldForegroundCallbackInternal = (config) => {
|
|
192
267
|
let showClose = config?.showClose;
|
|
193
268
|
if (showClose == null) {
|
|
194
269
|
showClose = false;
|
|
@@ -220,7 +295,6 @@ const gameShouldForegroundCallback = (config) => {
|
|
|
220
295
|
}
|
|
221
296
|
gameOnForegroundResolve();
|
|
222
297
|
};
|
|
223
|
-
exports.gameShouldForegroundCallback = gameShouldForegroundCallback;
|
|
224
298
|
const isSdkSupportGameShouldForegroundCallback = () => {
|
|
225
299
|
if (env_1.isAndroid) {
|
|
226
300
|
return "gameShouldForegroundCallback" in window.Android;
|
|
@@ -240,7 +314,6 @@ const isSdkSupportGameShouldForegroundCallback = () => {
|
|
|
240
314
|
return support;
|
|
241
315
|
}
|
|
242
316
|
};
|
|
243
|
-
exports.isSdkSupportGameShouldForegroundCallback = isSdkSupportGameShouldForegroundCallback;
|
|
244
317
|
let gameOnForegroundResolve = () => { };
|
|
245
318
|
let gameOnForegroundReject = () => { };
|
|
246
319
|
exports.gameOnForeground = new Promise((resolve, reject) => {
|