@apps-in-toss/native-modules 0.0.0-dev.1752115036458 → 0.0.0-dev.1757056983098
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/bridges-meta.json +36 -13
- package/dist/index.cjs +343 -129
- package/dist/index.d.cts +1212 -418
- package/dist/index.d.ts +1212 -418
- package/dist/index.js +315 -108
- package/package.json +7 -8
- package/src/AppsInTossModule/constants.ts +6 -0
- package/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts +15 -0
- package/src/AppsInTossModule/native-event-emitter/contactsViral.ts +140 -0
- package/src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts +10 -0
- package/src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts +10 -0
- package/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts +60 -0
- package/src/AppsInTossModule/native-event-emitter/index.ts +6 -0
- package/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts +45 -0
- package/src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts +50 -0
- package/src/AppsInTossModule/native-event-emitter/internal/appBridge.spec.ts +135 -0
- package/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts +79 -0
- package/src/AppsInTossModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts +20 -0
- package/src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts +35 -0
- package/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts +98 -0
- package/src/AppsInTossModule/native-event-emitter/types.ts +4 -0
- package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +89 -0
- package/src/AppsInTossModule/native-modules/ads/googleAdMob.ts +681 -0
- package/src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts +363 -0
- package/src/AppsInTossModule/native-modules/ads/types.ts +123 -0
- package/src/AppsInTossModule/native-modules/appLogin.ts +29 -0
- package/src/AppsInTossModule/native-modules/checkoutPayment.ts +80 -0
- package/src/AppsInTossModule/native-modules/eventLog.spec.ts +300 -0
- package/src/AppsInTossModule/native-modules/eventLog.ts +77 -0
- package/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts +88 -0
- package/src/AppsInTossModule/native-modules/fetchContacts.ts +121 -0
- package/src/AppsInTossModule/native-modules/getClipboardText.ts +47 -0
- package/src/AppsInTossModule/native-modules/getCurrentLocation.ts +65 -0
- package/src/AppsInTossModule/native-modules/getDeviceId.ts +33 -0
- package/src/AppsInTossModule/native-modules/getGameCenterGameProfile.ts +68 -0
- package/src/AppsInTossModule/native-modules/getOperationalEnvironment.ts +37 -0
- package/src/AppsInTossModule/native-modules/getPermission.ts +58 -0
- package/src/AppsInTossModule/native-modules/getTossAppVersion.ts +33 -0
- package/src/AppsInTossModule/native-modules/getTossShareLink.ts +39 -0
- package/src/AppsInTossModule/native-modules/iap.ts +213 -0
- package/src/AppsInTossModule/native-modules/index.ts +104 -0
- package/src/AppsInTossModule/native-modules/isMinVersionSupported.spec.ts +190 -0
- package/src/AppsInTossModule/native-modules/isMinVersionSupported.ts +68 -0
- package/src/AppsInTossModule/native-modules/openCamera.ts +81 -0
- package/src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts +44 -0
- package/src/AppsInTossModule/native-modules/openPermissionDialog.ts +54 -0
- package/src/AppsInTossModule/native-modules/requestPermission.ts +63 -0
- package/src/AppsInTossModule/native-modules/saveBase64Data.ts +57 -0
- package/src/AppsInTossModule/native-modules/setClipboardText.ts +39 -0
- package/src/AppsInTossModule/native-modules/setDeviceOrientation.ts +74 -0
- package/src/AppsInTossModule/native-modules/storage.ts +100 -0
- package/src/AppsInTossModule/native-modules/submitGameCenterLeaderBoardScore.ts +74 -0
- package/src/AppsInTossModule/native-modules/tossCore.ts +29 -0
- package/src/BedrockModule/native-modules/core/BedrockCoreModule.ts +8 -0
- package/src/BedrockModule/native-modules/index.ts +4 -0
- package/src/BedrockModule/native-modules/natives/BedrockModule.ts +20 -0
- package/src/BedrockModule/native-modules/natives/closeView.ts +25 -0
- package/src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts +27 -0
- package/src/BedrockModule/native-modules/natives/generateHapticFeedback/types.ts +38 -0
- package/src/BedrockModule/native-modules/natives/getLocale.ts +46 -0
- package/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts +59 -0
- package/src/BedrockModule/native-modules/natives/getNetworkStatus/types.ts +1 -0
- package/src/BedrockModule/native-modules/natives/getPlatformOS.ts +37 -0
- package/src/BedrockModule/native-modules/natives/getSchemeUri.ts +27 -0
- package/src/BedrockModule/native-modules/natives/index.ts +11 -0
- package/src/BedrockModule/native-modules/natives/openURL.ts +40 -0
- package/src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts +43 -0
- package/src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts +66 -0
- package/src/BedrockModule/native-modules/natives/setSecureScreen.ts +31 -0
- package/src/BedrockModule/native-modules/natives/share.ts +36 -0
- package/src/async-bridges.ts +3 -0
- package/src/event-bridges.ts +2 -0
- package/src/index.ts +16 -0
- package/src/types.ts +108 -0
- package/src/utils/compareVersion.spec.ts +176 -0
- package/src/utils/compareVersion.ts +104 -0
- package/src/utils/generateUUID.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -12,8 +12,19 @@ var EntryMessageExitedEvent = class extends GraniteEventDefinition {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/
|
|
15
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts
|
|
16
16
|
import { GraniteEventDefinition as GraniteEventDefinition2 } from "@granite-js/react-native";
|
|
17
|
+
var HomeIconButtonClickHandleEvent = class extends GraniteEventDefinition2 {
|
|
18
|
+
name = "homeIconButtonClickEvent";
|
|
19
|
+
remove() {
|
|
20
|
+
}
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
+
listener(_) {
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
27
|
+
import { GraniteEventDefinition as GraniteEventDefinition3 } from "@granite-js/react-native";
|
|
17
28
|
|
|
18
29
|
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
19
30
|
import { TurboModuleRegistry } from "react-native";
|
|
@@ -48,7 +59,7 @@ import { NativeEventEmitter } from "react-native";
|
|
|
48
59
|
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
49
60
|
|
|
50
61
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
51
|
-
var UpdateLocationEvent = class extends
|
|
62
|
+
var UpdateLocationEvent = class extends GraniteEventDefinition3 {
|
|
52
63
|
name = "updateLocationEvent";
|
|
53
64
|
subscriptionCount = 0;
|
|
54
65
|
ref = {
|
|
@@ -78,7 +89,7 @@ var UpdateLocationEvent = class extends GraniteEventDefinition2 {
|
|
|
78
89
|
};
|
|
79
90
|
|
|
80
91
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
81
|
-
import { GraniteEventDefinition as
|
|
92
|
+
import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
|
|
82
93
|
|
|
83
94
|
// src/utils/generateUUID.ts
|
|
84
95
|
function generateUUID(placeholder) {
|
|
@@ -135,7 +146,7 @@ var INTERNAL__appBridgeHandler = {
|
|
|
135
146
|
|
|
136
147
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
137
148
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
138
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
149
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition4 {
|
|
139
150
|
static INTERNAL__appBridgeSubscription;
|
|
140
151
|
name = "appBridgeCallbackEvent";
|
|
141
152
|
constructor() {
|
|
@@ -164,11 +175,40 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventD
|
|
|
164
175
|
}
|
|
165
176
|
};
|
|
166
177
|
|
|
178
|
+
// src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
179
|
+
import { GraniteEventDefinition as GraniteEventDefinition5 } from "@granite-js/react-native";
|
|
180
|
+
var VisibilityChangedByTransparentServiceWebEvent = class extends GraniteEventDefinition5 {
|
|
181
|
+
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
182
|
+
subscription = null;
|
|
183
|
+
remove() {
|
|
184
|
+
this.subscription?.remove();
|
|
185
|
+
this.subscription = null;
|
|
186
|
+
}
|
|
187
|
+
listener(options, onEvent, onError) {
|
|
188
|
+
const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
|
|
189
|
+
if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
|
|
190
|
+
if (params.callbackId === options.callbackId) {
|
|
191
|
+
onEvent(params.isVisible);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
onError(new Error("Invalid visibility changed by transparent service web result"));
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
this.subscription = subscription;
|
|
198
|
+
}
|
|
199
|
+
isVisibilityChangedByTransparentServiceWebResult(params) {
|
|
200
|
+
return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
167
204
|
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
168
205
|
var appsInTossEvent = new GraniteEvent([
|
|
169
|
-
new AppBridgeCallbackEvent(),
|
|
170
206
|
new UpdateLocationEvent(),
|
|
171
|
-
new EntryMessageExitedEvent()
|
|
207
|
+
new EntryMessageExitedEvent(),
|
|
208
|
+
new HomeIconButtonClickHandleEvent(),
|
|
209
|
+
// Internal events
|
|
210
|
+
new AppBridgeCallbackEvent(),
|
|
211
|
+
new VisibilityChangedByTransparentServiceWebEvent()
|
|
172
212
|
]);
|
|
173
213
|
|
|
174
214
|
// src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
|
|
@@ -176,14 +216,6 @@ function startUpdateLocation(eventParams) {
|
|
|
176
216
|
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
177
217
|
}
|
|
178
218
|
|
|
179
|
-
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
180
|
-
import { noop } from "es-toolkit";
|
|
181
|
-
|
|
182
|
-
// src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
|
|
183
|
-
function getOperationalEnvironment() {
|
|
184
|
-
return AppsInTossModule.operationalEnvironment;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
219
|
// src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
188
220
|
import { Platform } from "react-native";
|
|
189
221
|
|
|
@@ -275,6 +307,42 @@ function isMinVersionSupported(minVersions) {
|
|
|
275
307
|
return compareVersions(currentVersion, minVersion) >= 0;
|
|
276
308
|
}
|
|
277
309
|
|
|
310
|
+
// src/AppsInTossModule/native-event-emitter/contactsViral.ts
|
|
311
|
+
function contactsViral(params) {
|
|
312
|
+
const isSupported = isMinVersionSupported({
|
|
313
|
+
android: "5.223.0",
|
|
314
|
+
ios: "5.223.0"
|
|
315
|
+
});
|
|
316
|
+
if (!isSupported) {
|
|
317
|
+
return () => {
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
const { onEvent, onError, options } = params;
|
|
321
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
|
|
322
|
+
onRewardFromContactsViral: (result) => {
|
|
323
|
+
onEvent({ type: "sendViral", data: result });
|
|
324
|
+
},
|
|
325
|
+
onSuccess: (result) => {
|
|
326
|
+
onEvent({ type: "close", data: result });
|
|
327
|
+
},
|
|
328
|
+
onError
|
|
329
|
+
});
|
|
330
|
+
return unregisterCallbacks;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// src/AppsInTossModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
334
|
+
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
335
|
+
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
339
|
+
import { noop } from "es-toolkit";
|
|
340
|
+
|
|
341
|
+
// src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
|
|
342
|
+
function getOperationalEnvironment() {
|
|
343
|
+
return AppsInTossModule.operationalEnvironment;
|
|
344
|
+
}
|
|
345
|
+
|
|
278
346
|
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
279
347
|
function loadAdMobInterstitialAd(params) {
|
|
280
348
|
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
@@ -377,27 +445,121 @@ loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
|
377
445
|
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
378
446
|
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
379
447
|
|
|
448
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
449
|
+
import { noop as noop2 } from "es-toolkit";
|
|
450
|
+
function loadAppsInTossAdMob(params) {
|
|
451
|
+
if (!loadAppsInTossAdMob.isSupported()) {
|
|
452
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
453
|
+
return noop2;
|
|
454
|
+
}
|
|
455
|
+
const { onEvent, onError, options } = params;
|
|
456
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAppsInTossAdmob", options, {
|
|
457
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
458
|
+
onError
|
|
459
|
+
});
|
|
460
|
+
return unregisterCallbacks;
|
|
461
|
+
}
|
|
462
|
+
function showAppsInTossAdMob(params) {
|
|
463
|
+
if (!showAppsInTossAdMob.isSupported()) {
|
|
464
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
465
|
+
return noop2;
|
|
466
|
+
}
|
|
467
|
+
const { onEvent, onError, options } = params;
|
|
468
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAppsInTossAdmob", options, {
|
|
469
|
+
onAdClicked: () => {
|
|
470
|
+
onEvent({ type: "clicked" });
|
|
471
|
+
},
|
|
472
|
+
onAdDismissed: () => {
|
|
473
|
+
onEvent({ type: "dismissed" });
|
|
474
|
+
},
|
|
475
|
+
onAdFailedToShow: () => {
|
|
476
|
+
onEvent({ type: "failedToShow" });
|
|
477
|
+
},
|
|
478
|
+
onAdImpression: () => {
|
|
479
|
+
onEvent({ type: "impression" });
|
|
480
|
+
},
|
|
481
|
+
onAdShow: () => {
|
|
482
|
+
onEvent({ type: "show" });
|
|
483
|
+
},
|
|
484
|
+
onUserEarnedReward: (data) => {
|
|
485
|
+
onEvent({ type: "userEarnedReward", data });
|
|
486
|
+
},
|
|
487
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
488
|
+
onError
|
|
489
|
+
});
|
|
490
|
+
return unregisterCallbacks;
|
|
491
|
+
}
|
|
492
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
|
|
493
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
|
|
494
|
+
var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
|
|
495
|
+
var ENVIRONMENT2 = getOperationalEnvironment();
|
|
496
|
+
function createIsSupported2() {
|
|
497
|
+
return () => {
|
|
498
|
+
if (ENVIRONMENT2 !== "toss") {
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
return isMinVersionSupported({
|
|
502
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2,
|
|
503
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2
|
|
504
|
+
});
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
loadAppsInTossAdMob.isSupported = createIsSupported2();
|
|
508
|
+
showAppsInTossAdMob.isSupported = createIsSupported2();
|
|
509
|
+
|
|
380
510
|
// src/AppsInTossModule/native-modules/checkoutPayment.ts
|
|
381
511
|
async function checkoutPayment(options) {
|
|
382
512
|
return AppsInTossModule.checkoutPayment({ params: options });
|
|
383
513
|
}
|
|
384
514
|
|
|
385
|
-
// src/AppsInTossModule/native-modules/
|
|
386
|
-
async function
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
515
|
+
// src/AppsInTossModule/native-modules/appLogin.ts
|
|
516
|
+
async function appLogin() {
|
|
517
|
+
return AppsInTossModule.appLogin({});
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// src/AppsInTossModule/native-modules/eventLog.ts
|
|
521
|
+
function normalizeParams(params) {
|
|
522
|
+
return Object.fromEntries(
|
|
523
|
+
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
async function eventLog(params) {
|
|
527
|
+
if (AppsInTossModule.operationalEnvironment === "sandbox") {
|
|
528
|
+
console.log("[eventLogDebug]", {
|
|
529
|
+
log_name: params.log_name,
|
|
530
|
+
log_type: params.log_type,
|
|
531
|
+
params: normalizeParams(params.params)
|
|
532
|
+
});
|
|
533
|
+
return;
|
|
390
534
|
}
|
|
391
|
-
|
|
535
|
+
const isSupported = isMinVersionSupported({
|
|
536
|
+
android: "5.208.0",
|
|
537
|
+
ios: "5.208.0"
|
|
538
|
+
});
|
|
539
|
+
if (!isSupported) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
return AppsInTossModule.eventLog({
|
|
543
|
+
log_name: params.log_name,
|
|
544
|
+
log_type: params.log_type,
|
|
545
|
+
params: normalizeParams(params.params)
|
|
546
|
+
});
|
|
392
547
|
}
|
|
393
548
|
|
|
394
|
-
// src/AppsInTossModule/native-modules/
|
|
395
|
-
|
|
396
|
-
|
|
549
|
+
// src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
|
|
550
|
+
var DEFAULT_MAX_COUNT = 10;
|
|
551
|
+
var DEFAULT_MAX_WIDTH = 1024;
|
|
552
|
+
async function fetchAlbumPhotos(options) {
|
|
553
|
+
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
397
554
|
if (permissionStatus === "denied") {
|
|
398
|
-
throw new Error("\
|
|
555
|
+
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
399
556
|
}
|
|
400
|
-
|
|
557
|
+
const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
|
|
558
|
+
...options,
|
|
559
|
+
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
560
|
+
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
561
|
+
});
|
|
562
|
+
return albumPhotos;
|
|
401
563
|
}
|
|
402
564
|
|
|
403
565
|
// src/AppsInTossModule/native-modules/fetchContacts.ts
|
|
@@ -414,20 +576,13 @@ async function fetchContacts(options) {
|
|
|
414
576
|
};
|
|
415
577
|
}
|
|
416
578
|
|
|
417
|
-
// src/AppsInTossModule/native-modules/
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
async function fetchAlbumPhotos(options) {
|
|
421
|
-
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
579
|
+
// src/AppsInTossModule/native-modules/getClipboardText.ts
|
|
580
|
+
async function getClipboardText() {
|
|
581
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
|
|
422
582
|
if (permissionStatus === "denied") {
|
|
423
|
-
throw new Error("\
|
|
583
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
424
584
|
}
|
|
425
|
-
|
|
426
|
-
...options,
|
|
427
|
-
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
428
|
-
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
429
|
-
});
|
|
430
|
-
return albumPhotos;
|
|
585
|
+
return AppsInTossModule.getClipboardText({});
|
|
431
586
|
}
|
|
432
587
|
|
|
433
588
|
// src/AppsInTossModule/native-modules/getCurrentLocation.ts
|
|
@@ -440,6 +595,51 @@ async function getCurrentLocation(options) {
|
|
|
440
595
|
return position;
|
|
441
596
|
}
|
|
442
597
|
|
|
598
|
+
// src/AppsInTossModule/native-modules/getDeviceId.ts
|
|
599
|
+
function getDeviceId() {
|
|
600
|
+
return AppsInTossModule.deviceId;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// src/AppsInTossModule/native-modules/getTossAppVersion.ts
|
|
604
|
+
function getTossAppVersion() {
|
|
605
|
+
return AppsInTossModule.tossAppVersion;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// src/AppsInTossModule/native-modules/getTossShareLink.ts
|
|
609
|
+
async function getTossShareLink(path) {
|
|
610
|
+
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
611
|
+
const shareUrl = new URL(shareLink);
|
|
612
|
+
shareUrl.searchParams.set("deep_link_value", path);
|
|
613
|
+
shareUrl.searchParams.set("af_dp", path);
|
|
614
|
+
return shareUrl.toString();
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// src/AppsInTossModule/native-modules/iap.ts
|
|
618
|
+
async function createOneTimePurchaseOrder(params) {
|
|
619
|
+
const isSupported = isMinVersionSupported({
|
|
620
|
+
android: "5.219.0",
|
|
621
|
+
ios: "5.219.0"
|
|
622
|
+
});
|
|
623
|
+
if (!isSupported) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
|
|
627
|
+
}
|
|
628
|
+
async function getProductItemList() {
|
|
629
|
+
const isSupported = isMinVersionSupported({
|
|
630
|
+
android: "5.219.0",
|
|
631
|
+
ios: "5.219.0"
|
|
632
|
+
});
|
|
633
|
+
if (!isSupported) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
return AppsInTossModule.iapGetProductItemList({});
|
|
637
|
+
}
|
|
638
|
+
var IAP = {
|
|
639
|
+
createOneTimePurchaseOrder,
|
|
640
|
+
getProductItemList
|
|
641
|
+
};
|
|
642
|
+
|
|
443
643
|
// src/AppsInTossModule/native-modules/openCamera.ts
|
|
444
644
|
async function openCamera(options) {
|
|
445
645
|
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
@@ -450,19 +650,38 @@ async function openCamera(options) {
|
|
|
450
650
|
return photo;
|
|
451
651
|
}
|
|
452
652
|
|
|
453
|
-
// src/AppsInTossModule/native-modules/
|
|
454
|
-
async function
|
|
455
|
-
|
|
653
|
+
// src/AppsInTossModule/native-modules/saveBase64Data.ts
|
|
654
|
+
async function saveBase64Data(params) {
|
|
655
|
+
const isSupported = isMinVersionSupported({
|
|
656
|
+
android: "5.218.0",
|
|
657
|
+
ios: "5.216.0"
|
|
658
|
+
});
|
|
659
|
+
if (!isSupported) {
|
|
660
|
+
console.warn("saveBase64Data is not supported in this app version");
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
await AppsInTossModule.saveBase64Data(params);
|
|
456
664
|
}
|
|
457
665
|
|
|
458
|
-
// src/AppsInTossModule/native-modules/
|
|
459
|
-
function
|
|
460
|
-
|
|
666
|
+
// src/AppsInTossModule/native-modules/setClipboardText.ts
|
|
667
|
+
async function setClipboardText(text) {
|
|
668
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
669
|
+
if (permissionStatus === "denied") {
|
|
670
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
671
|
+
}
|
|
672
|
+
return AppsInTossModule.setClipboardText({ text });
|
|
461
673
|
}
|
|
462
674
|
|
|
463
|
-
// src/AppsInTossModule/native-modules/
|
|
464
|
-
function
|
|
465
|
-
|
|
675
|
+
// src/AppsInTossModule/native-modules/setDeviceOrientation.ts
|
|
676
|
+
async function setDeviceOrientation(options) {
|
|
677
|
+
const isSupported = isMinVersionSupported({
|
|
678
|
+
android: "5.215.0",
|
|
679
|
+
ios: "5.215.0"
|
|
680
|
+
});
|
|
681
|
+
if (!isSupported) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
return AppsInTossModule.setDeviceOrientation(options);
|
|
466
685
|
}
|
|
467
686
|
|
|
468
687
|
// src/AppsInTossModule/native-modules/storage.ts
|
|
@@ -488,67 +707,46 @@ var Storage = {
|
|
|
488
707
|
clearItems
|
|
489
708
|
};
|
|
490
709
|
|
|
491
|
-
// src/AppsInTossModule/native-modules/
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
});
|
|
710
|
+
// src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts
|
|
711
|
+
import { openURL } from "@granite-js/react-native";
|
|
712
|
+
|
|
713
|
+
// src/AppsInTossModule/constants.ts
|
|
714
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
715
|
+
android: "5.221.0",
|
|
716
|
+
ios: "5.221.0"
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts
|
|
720
|
+
async function openGameCenterLeaderboard() {
|
|
721
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
504
722
|
return;
|
|
505
723
|
}
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
});
|
|
510
|
-
if (!isSupported) {
|
|
511
|
-
return;
|
|
724
|
+
const appName = global.__granite?.app?.name;
|
|
725
|
+
if (appName == null) {
|
|
726
|
+
throw new Error("Cannot get app name");
|
|
512
727
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
});
|
|
728
|
+
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
729
|
+
url.searchParams.set("appName", appName);
|
|
730
|
+
url.searchParams.set("referrer", `appsintoss.${appName}`);
|
|
731
|
+
return openURL(url.toString());
|
|
518
732
|
}
|
|
519
733
|
|
|
520
|
-
// src/AppsInTossModule/native-modules/
|
|
521
|
-
async function
|
|
522
|
-
const
|
|
523
|
-
const shareUrl = new URL(shareLink);
|
|
524
|
-
shareUrl.searchParams.set("deep_link_value", path);
|
|
525
|
-
shareUrl.searchParams.set("af_dp", path);
|
|
526
|
-
return shareUrl.toString();
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// src/AppsInTossModule/native-modules/setDeviceOrientation.ts
|
|
530
|
-
async function setDeviceOrientation(options) {
|
|
531
|
-
const isSupported = isMinVersionSupported({
|
|
532
|
-
android: "5.215.0",
|
|
533
|
-
ios: "5.215.0"
|
|
534
|
-
});
|
|
734
|
+
// src/AppsInTossModule/native-modules/getGameCenterGameProfile.ts
|
|
735
|
+
async function getGameCenterGameProfile() {
|
|
736
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
535
737
|
if (!isSupported) {
|
|
536
738
|
return;
|
|
537
739
|
}
|
|
538
|
-
return AppsInTossModule.
|
|
740
|
+
return AppsInTossModule.getGameCenterGameProfile({});
|
|
539
741
|
}
|
|
540
742
|
|
|
541
|
-
// src/AppsInTossModule/native-modules/
|
|
542
|
-
async function
|
|
543
|
-
const isSupported = isMinVersionSupported(
|
|
544
|
-
android: "5.218.0",
|
|
545
|
-
ios: "5.216.0"
|
|
546
|
-
});
|
|
743
|
+
// src/AppsInTossModule/native-modules/submitGameCenterLeaderBoardScore.ts
|
|
744
|
+
async function submitGameCenterLeaderBoardScore(params) {
|
|
745
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
547
746
|
if (!isSupported) {
|
|
548
|
-
console.warn("saveBase64Data is not supported in this app version");
|
|
549
747
|
return;
|
|
550
748
|
}
|
|
551
|
-
|
|
749
|
+
return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
|
|
552
750
|
}
|
|
553
751
|
|
|
554
752
|
// src/AppsInTossModule/native-modules/index.ts
|
|
@@ -559,7 +757,9 @@ var GoogleAdMob = {
|
|
|
559
757
|
loadAdMobInterstitialAd,
|
|
560
758
|
showAdMobInterstitialAd,
|
|
561
759
|
loadAdMobRewardedAd,
|
|
562
|
-
showAdMobRewardedAd
|
|
760
|
+
showAdMobRewardedAd,
|
|
761
|
+
loadAppsInTossAdMob,
|
|
762
|
+
showAppsInTossAdMob
|
|
563
763
|
};
|
|
564
764
|
|
|
565
765
|
// src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
@@ -624,7 +824,7 @@ async function setIosSwipeGestureEnabled(options) {
|
|
|
624
824
|
|
|
625
825
|
// src/BedrockModule/native-modules/natives/openURL.ts
|
|
626
826
|
import { Linking } from "react-native";
|
|
627
|
-
function
|
|
827
|
+
function openURL2(url) {
|
|
628
828
|
return Linking.openURL(url);
|
|
629
829
|
}
|
|
630
830
|
|
|
@@ -639,15 +839,15 @@ import { NativeModules as NativeModules2 } from "react-native";
|
|
|
639
839
|
var BedrockCoreModule = NativeModules2.BedrockCoreModule;
|
|
640
840
|
|
|
641
841
|
// src/types.ts
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
return
|
|
650
|
-
})(
|
|
842
|
+
var Accuracy = /* @__PURE__ */ ((Accuracy2) => {
|
|
843
|
+
Accuracy2[Accuracy2["Lowest"] = 1] = "Lowest";
|
|
844
|
+
Accuracy2[Accuracy2["Low"] = 2] = "Low";
|
|
845
|
+
Accuracy2[Accuracy2["Balanced"] = 3] = "Balanced";
|
|
846
|
+
Accuracy2[Accuracy2["High"] = 4] = "High";
|
|
847
|
+
Accuracy2[Accuracy2["Highest"] = 5] = "Highest";
|
|
848
|
+
Accuracy2[Accuracy2["BestForNavigation"] = 6] = "BestForNavigation";
|
|
849
|
+
return Accuracy2;
|
|
850
|
+
})(Accuracy || {});
|
|
651
851
|
|
|
652
852
|
// src/AppsInTossModule/native-modules/tossCore.ts
|
|
653
853
|
import { NativeModules as NativeModules3 } from "react-native";
|
|
@@ -672,18 +872,21 @@ var INTERNAL__module = {
|
|
|
672
872
|
tossCoreEventLog
|
|
673
873
|
};
|
|
674
874
|
export {
|
|
675
|
-
|
|
875
|
+
Accuracy,
|
|
676
876
|
AppsInTossModule,
|
|
677
877
|
BedrockCoreModule,
|
|
678
878
|
BedrockModule,
|
|
679
879
|
GoogleAdMob,
|
|
880
|
+
IAP,
|
|
680
881
|
AppsInTossModuleInstance as INTERNAL__AppsInTossModule,
|
|
882
|
+
INTERNAL__appBridgeHandler,
|
|
681
883
|
INTERNAL__module,
|
|
682
884
|
Storage,
|
|
683
885
|
TossPay,
|
|
684
886
|
appLogin,
|
|
685
887
|
appsInTossEvent,
|
|
686
888
|
closeView,
|
|
889
|
+
contactsViral,
|
|
687
890
|
eventLog,
|
|
688
891
|
fetchAlbumPhotos,
|
|
689
892
|
fetchContacts,
|
|
@@ -691,6 +894,7 @@ export {
|
|
|
691
894
|
getClipboardText,
|
|
692
895
|
getCurrentLocation,
|
|
693
896
|
getDeviceId,
|
|
897
|
+
getGameCenterGameProfile,
|
|
694
898
|
getLocale,
|
|
695
899
|
getNetworkStatus,
|
|
696
900
|
getOperationalEnvironment,
|
|
@@ -699,8 +903,10 @@ export {
|
|
|
699
903
|
getTossAppVersion,
|
|
700
904
|
getTossShareLink,
|
|
701
905
|
isMinVersionSupported,
|
|
906
|
+
onVisibilityChangedByTransparentServiceWeb,
|
|
702
907
|
openCamera,
|
|
703
|
-
|
|
908
|
+
openGameCenterLeaderboard,
|
|
909
|
+
openURL2 as openURL,
|
|
704
910
|
saveBase64Data,
|
|
705
911
|
setClipboardText,
|
|
706
912
|
setDeviceOrientation,
|
|
@@ -708,5 +914,6 @@ export {
|
|
|
708
914
|
setScreenAwakeMode,
|
|
709
915
|
setSecureScreen,
|
|
710
916
|
share,
|
|
711
|
-
startUpdateLocation
|
|
917
|
+
startUpdateLocation,
|
|
918
|
+
submitGameCenterLeaderBoardScore
|
|
712
919
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/native-modules",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-dev.
|
|
4
|
+
"version": "0.0.0-dev.1757056983098",
|
|
5
5
|
"description": "Native Modules for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -26,16 +26,15 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
|
-
"src
|
|
30
|
-
"src/constant-bridges.ts",
|
|
31
|
-
"src/event-bridges.ts"
|
|
29
|
+
"src"
|
|
32
30
|
],
|
|
33
31
|
"devDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@granite-js/
|
|
32
|
+
"@babel/runtime": "^7",
|
|
33
|
+
"@granite-js/native": "0.1.21",
|
|
34
|
+
"@granite-js/react-native": "0.1.21",
|
|
36
35
|
"@types/react": "18.3.3",
|
|
37
36
|
"dts-bundle-generator": "^9.5.1",
|
|
38
|
-
"esbuild": "
|
|
37
|
+
"esbuild": "0.25.5",
|
|
39
38
|
"picocolors": "^1.1.1",
|
|
40
39
|
"react": "18.2.0",
|
|
41
40
|
"react-native": "0.72.6",
|
|
@@ -54,5 +53,5 @@
|
|
|
54
53
|
"publishConfig": {
|
|
55
54
|
"access": "public"
|
|
56
55
|
},
|
|
57
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "0f2c2e8b658e8b1de27a48e128583b1ea82b5ceb"
|
|
58
57
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GraniteEvent } from '@granite-js/react-native';
|
|
2
|
+
import { EntryMessageExitedEvent } from './event-plugins/EntryMessageExitedEvent';
|
|
3
|
+
import { HomeIconButtonClickHandleEvent } from './event-plugins/HomeIconButtonClickHandleEvent';
|
|
4
|
+
import { UpdateLocationEvent } from './event-plugins/UpdateLocationEvent';
|
|
5
|
+
import { AppBridgeCallbackEvent } from './internal/AppBridgeCallbackEvent';
|
|
6
|
+
import { VisibilityChangedByTransparentServiceWebEvent } from './internal/VisibilityChangedByTransparentServiceWebEvent';
|
|
7
|
+
|
|
8
|
+
export const appsInTossEvent = new GraniteEvent([
|
|
9
|
+
new UpdateLocationEvent(),
|
|
10
|
+
new EntryMessageExitedEvent(),
|
|
11
|
+
new HomeIconButtonClickHandleEvent(),
|
|
12
|
+
// Internal events
|
|
13
|
+
new AppBridgeCallbackEvent(),
|
|
14
|
+
new VisibilityChangedByTransparentServiceWebEvent(),
|
|
15
|
+
]);
|