@apps-in-toss/native-modules 0.0.0-dev.1757056983098 → 0.0.0-dev.1757939087965
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 +24 -12
- package/dist/index.cjs +212 -154
- package/dist/index.d.cts +640 -588
- package/dist/index.d.ts +640 -588
- package/dist/index.js +190 -132
- package/package.json +5 -4
- package/src/AppsInTossModule/native-event-emitter/StartUpdateLocationPermissionError.ts +1 -0
- package/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts +5 -0
- package/src/AppsInTossModule/native-event-emitter/event-plugins/BackButtonClickHandleEvent.ts +10 -0
- package/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts +3 -3
- package/src/AppsInTossModule/native-event-emitter/index.ts +1 -0
- package/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts +7 -1
- package/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts +64 -44
- package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +22 -27
- package/src/AppsInTossModule/native-modules/getPermission.ts +1 -1
- package/src/AppsInTossModule/native-modules/index.ts +9 -6
- package/src/AppsInTossModule/native-modules/permissions/createPermissionFunction.ts +25 -0
- package/src/AppsInTossModule/native-modules/permissions/fetchAlbumPhotos/fetchAlbumPhotos.ts +109 -0
- package/src/AppsInTossModule/native-modules/{fetchContacts.ts → permissions/fetchContacts/fetchContacts.ts} +51 -40
- package/src/AppsInTossModule/native-modules/permissions/getClipboardText/getClipboardText.ts +87 -0
- package/src/AppsInTossModule/native-modules/permissions/getCurrentLocation/getCurrentLocation.ts +88 -0
- package/src/AppsInTossModule/native-modules/permissions/openCamera/openCamera.ts +99 -0
- package/src/AppsInTossModule/native-modules/{openPermissionDialog.ts → permissions/openPermissionDialog.ts} +3 -3
- package/src/AppsInTossModule/native-modules/{requestPermission.ts → permissions/requestPermission.ts} +2 -2
- package/src/AppsInTossModule/native-modules/permissions/setClipboardText/setClipboardText.ts +75 -0
- package/src/AppsInTossModule/native-modules/saveBase64Data.ts +1 -1
- package/src/async-bridges.ts +9 -6
- package/src/types.ts +0 -106
- package/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts +0 -88
- package/src/AppsInTossModule/native-modules/getClipboardText.ts +0 -47
- package/src/AppsInTossModule/native-modules/getCurrentLocation.ts +0 -65
- package/src/AppsInTossModule/native-modules/openCamera.ts +0 -81
- package/src/AppsInTossModule/native-modules/setClipboardText.ts +0 -39
package/dist/index.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
2
2
|
import { GraniteEvent } from "@granite-js/react-native";
|
|
3
3
|
|
|
4
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/
|
|
4
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/BackButtonClickHandleEvent.ts
|
|
5
5
|
import { GraniteEventDefinition } from "@granite-js/react-native";
|
|
6
|
-
var
|
|
6
|
+
var BackButtonClickHandleEvent = class extends GraniteEventDefinition {
|
|
7
|
+
name = "backButtonClickEvent";
|
|
8
|
+
remove() {
|
|
9
|
+
}
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
listener(_) {
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
16
|
+
import { GraniteEventDefinition as GraniteEventDefinition2 } from "@granite-js/react-native";
|
|
17
|
+
var EntryMessageExitedEvent = class extends GraniteEventDefinition2 {
|
|
7
18
|
name = "entryMessageExited";
|
|
8
19
|
remove() {
|
|
9
20
|
}
|
|
@@ -13,8 +24,8 @@ var EntryMessageExitedEvent = class extends GraniteEventDefinition {
|
|
|
13
24
|
};
|
|
14
25
|
|
|
15
26
|
// src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts
|
|
16
|
-
import { GraniteEventDefinition as
|
|
17
|
-
var HomeIconButtonClickHandleEvent = class extends
|
|
27
|
+
import { GraniteEventDefinition as GraniteEventDefinition3 } from "@granite-js/react-native";
|
|
28
|
+
var HomeIconButtonClickHandleEvent = class extends GraniteEventDefinition3 {
|
|
18
29
|
name = "homeIconButtonClickEvent";
|
|
19
30
|
remove() {
|
|
20
31
|
}
|
|
@@ -24,7 +35,8 @@ var HomeIconButtonClickHandleEvent = class extends GraniteEventDefinition2 {
|
|
|
24
35
|
};
|
|
25
36
|
|
|
26
37
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
27
|
-
import {
|
|
38
|
+
import { GetCurrentLocationPermissionError } from "@apps-in-toss/types";
|
|
39
|
+
import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
|
|
28
40
|
|
|
29
41
|
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
30
42
|
import { TurboModuleRegistry } from "react-native";
|
|
@@ -32,17 +44,17 @@ var Module = TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
|
32
44
|
var AppsInTossModuleInstance = Module;
|
|
33
45
|
var AppsInTossModule = Module;
|
|
34
46
|
|
|
47
|
+
// src/AppsInTossModule/native-modules/permissions/openPermissionDialog.ts
|
|
48
|
+
function openPermissionDialog(permission) {
|
|
49
|
+
return AppsInTossModule.openPermissionDialog(permission);
|
|
50
|
+
}
|
|
51
|
+
|
|
35
52
|
// src/AppsInTossModule/native-modules/getPermission.ts
|
|
36
53
|
function getPermission(permission) {
|
|
37
54
|
return AppsInTossModule.getPermission(permission);
|
|
38
55
|
}
|
|
39
56
|
|
|
40
|
-
// src/AppsInTossModule/native-modules/
|
|
41
|
-
function openPermissionDialog(permission) {
|
|
42
|
-
return AppsInTossModule.openPermissionDialog(permission);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// src/AppsInTossModule/native-modules/requestPermission.ts
|
|
57
|
+
// src/AppsInTossModule/native-modules/permissions/requestPermission.ts
|
|
46
58
|
async function requestPermission(permission) {
|
|
47
59
|
const permissionStatus = await getPermission(permission);
|
|
48
60
|
switch (permissionStatus) {
|
|
@@ -59,7 +71,7 @@ import { NativeEventEmitter } from "react-native";
|
|
|
59
71
|
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
60
72
|
|
|
61
73
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
62
|
-
var UpdateLocationEvent = class extends
|
|
74
|
+
var UpdateLocationEvent = class extends GraniteEventDefinition4 {
|
|
63
75
|
name = "updateLocationEvent";
|
|
64
76
|
subscriptionCount = 0;
|
|
65
77
|
ref = {
|
|
@@ -75,7 +87,7 @@ var UpdateLocationEvent = class extends GraniteEventDefinition3 {
|
|
|
75
87
|
listener(options, onEvent, onError) {
|
|
76
88
|
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
77
89
|
if (permissionStatus === "denied") {
|
|
78
|
-
onError(new
|
|
90
|
+
onError(new GetCurrentLocationPermissionError());
|
|
79
91
|
return;
|
|
80
92
|
}
|
|
81
93
|
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
@@ -89,7 +101,7 @@ var UpdateLocationEvent = class extends GraniteEventDefinition3 {
|
|
|
89
101
|
};
|
|
90
102
|
|
|
91
103
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
92
|
-
import { GraniteEventDefinition as
|
|
104
|
+
import { GraniteEventDefinition as GraniteEventDefinition5 } from "@granite-js/react-native";
|
|
93
105
|
|
|
94
106
|
// src/utils/generateUUID.ts
|
|
95
107
|
function generateUUID(placeholder) {
|
|
@@ -106,7 +118,12 @@ function invokeAppBridgeCallback(id, ...args) {
|
|
|
106
118
|
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
107
119
|
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
108
120
|
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
109
|
-
const
|
|
121
|
+
const method = AppsInTossModuleInstance[methodName];
|
|
122
|
+
if (method == null) {
|
|
123
|
+
onError(new Error(`'${methodName}' is not defined in AppsInTossModule`));
|
|
124
|
+
return unregisterAll;
|
|
125
|
+
}
|
|
126
|
+
const promise = method({
|
|
110
127
|
params,
|
|
111
128
|
callbacks: callbackMap
|
|
112
129
|
});
|
|
@@ -146,7 +163,7 @@ var INTERNAL__appBridgeHandler = {
|
|
|
146
163
|
|
|
147
164
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
148
165
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
149
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
166
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition5 {
|
|
150
167
|
static INTERNAL__appBridgeSubscription;
|
|
151
168
|
name = "appBridgeCallbackEvent";
|
|
152
169
|
constructor() {
|
|
@@ -176,8 +193,8 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventD
|
|
|
176
193
|
};
|
|
177
194
|
|
|
178
195
|
// src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
179
|
-
import { GraniteEventDefinition as
|
|
180
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends
|
|
196
|
+
import { GraniteEventDefinition as GraniteEventDefinition6 } from "@granite-js/react-native";
|
|
197
|
+
var VisibilityChangedByTransparentServiceWebEvent = class extends GraniteEventDefinition6 {
|
|
181
198
|
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
182
199
|
subscription = null;
|
|
183
200
|
remove() {
|
|
@@ -205,15 +222,20 @@ var VisibilityChangedByTransparentServiceWebEvent = class extends GraniteEventDe
|
|
|
205
222
|
var appsInTossEvent = new GraniteEvent([
|
|
206
223
|
new UpdateLocationEvent(),
|
|
207
224
|
new EntryMessageExitedEvent(),
|
|
225
|
+
// Navigation Bar events
|
|
208
226
|
new HomeIconButtonClickHandleEvent(),
|
|
227
|
+
new BackButtonClickHandleEvent(),
|
|
209
228
|
// Internal events
|
|
210
229
|
new AppBridgeCallbackEvent(),
|
|
211
230
|
new VisibilityChangedByTransparentServiceWebEvent()
|
|
212
231
|
]);
|
|
213
232
|
|
|
214
|
-
// src/AppsInTossModule/native-
|
|
215
|
-
|
|
216
|
-
|
|
233
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
234
|
+
import { noop } from "es-toolkit";
|
|
235
|
+
|
|
236
|
+
// src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
|
|
237
|
+
function getOperationalEnvironment() {
|
|
238
|
+
return AppsInTossModule.operationalEnvironment;
|
|
217
239
|
}
|
|
218
240
|
|
|
219
241
|
// src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
@@ -307,42 +329,6 @@ function isMinVersionSupported(minVersions) {
|
|
|
307
329
|
return compareVersions(currentVersion, minVersion) >= 0;
|
|
308
330
|
}
|
|
309
331
|
|
|
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
|
-
|
|
346
332
|
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
347
333
|
function loadAdMobInterstitialAd(params) {
|
|
348
334
|
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
@@ -546,54 +532,118 @@ async function eventLog(params) {
|
|
|
546
532
|
});
|
|
547
533
|
}
|
|
548
534
|
|
|
549
|
-
// src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
|
|
550
|
-
|
|
551
|
-
var DEFAULT_MAX_WIDTH = 1024;
|
|
552
|
-
async function fetchAlbumPhotos(options) {
|
|
553
|
-
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
554
|
-
if (permissionStatus === "denied") {
|
|
555
|
-
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
556
|
-
}
|
|
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;
|
|
563
|
-
}
|
|
535
|
+
// src/AppsInTossModule/native-modules/permissions/fetchAlbumPhotos/fetchAlbumPhotos.ts
|
|
536
|
+
import { FetchAlbumPhotosPermissionError } from "@apps-in-toss/types";
|
|
564
537
|
|
|
565
|
-
// src/AppsInTossModule/native-modules/
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
538
|
+
// src/AppsInTossModule/native-modules/permissions/createPermissionFunction.ts
|
|
539
|
+
function createPermissionFunction({
|
|
540
|
+
handler,
|
|
541
|
+
permission,
|
|
542
|
+
error
|
|
543
|
+
}) {
|
|
544
|
+
const permissionFunction = async (...args) => {
|
|
545
|
+
const permissionStatus = await requestPermission(permission);
|
|
546
|
+
if (permissionStatus === "denied") {
|
|
547
|
+
throw new error();
|
|
548
|
+
}
|
|
549
|
+
return handler(...args);
|
|
576
550
|
};
|
|
551
|
+
permissionFunction.getPermission = () => getPermission(permission);
|
|
552
|
+
permissionFunction.openPermissionDialog = () => openPermissionDialog(permission);
|
|
553
|
+
return permissionFunction;
|
|
577
554
|
}
|
|
578
555
|
|
|
579
|
-
// src/AppsInTossModule/native-modules/
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
556
|
+
// src/AppsInTossModule/native-modules/permissions/fetchAlbumPhotos/fetchAlbumPhotos.ts
|
|
557
|
+
var DEFAULT_MAX_COUNT = 10;
|
|
558
|
+
var DEFAULT_MAX_WIDTH = 1024;
|
|
559
|
+
var fetchAlbumPhotos = createPermissionFunction({
|
|
560
|
+
handler: async (options) => {
|
|
561
|
+
return AppsInTossModule.fetchAlbumPhotos({
|
|
562
|
+
...options,
|
|
563
|
+
maxCount: options?.maxCount ?? DEFAULT_MAX_COUNT,
|
|
564
|
+
maxWidth: options?.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
565
|
+
});
|
|
566
|
+
},
|
|
567
|
+
permission: {
|
|
568
|
+
name: "photos",
|
|
569
|
+
access: "read"
|
|
570
|
+
},
|
|
571
|
+
error: FetchAlbumPhotosPermissionError
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// src/AppsInTossModule/native-modules/permissions/fetchContacts/fetchContacts.ts
|
|
575
|
+
import { FetchContactsPermissionError } from "@apps-in-toss/types";
|
|
576
|
+
var fetchContacts = createPermissionFunction({
|
|
577
|
+
handler: async (options) => {
|
|
578
|
+
const contacts = await AppsInTossModule.fetchContacts(options);
|
|
579
|
+
return {
|
|
580
|
+
result: contacts.result,
|
|
581
|
+
nextOffset: contacts.nextOffset ?? null,
|
|
582
|
+
done: contacts.done
|
|
583
|
+
};
|
|
584
|
+
},
|
|
585
|
+
permission: {
|
|
586
|
+
name: "contacts",
|
|
587
|
+
access: "read"
|
|
588
|
+
},
|
|
589
|
+
error: FetchContactsPermissionError
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
// src/AppsInTossModule/native-modules/permissions/getClipboardText/getClipboardText.ts
|
|
593
|
+
import { GetClipboardTextPermissionError } from "@apps-in-toss/types";
|
|
594
|
+
var getClipboardText = createPermissionFunction({
|
|
595
|
+
handler: () => {
|
|
596
|
+
return AppsInTossModule.getClipboardText({});
|
|
597
|
+
},
|
|
598
|
+
permission: {
|
|
599
|
+
name: "clipboard",
|
|
600
|
+
access: "read"
|
|
601
|
+
},
|
|
602
|
+
error: GetClipboardTextPermissionError
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
// src/AppsInTossModule/native-modules/permissions/getCurrentLocation/getCurrentLocation.ts
|
|
606
|
+
import { GetCurrentLocationPermissionError as GetCurrentLocationPermissionError2 } from "@apps-in-toss/types";
|
|
607
|
+
var getCurrentLocation = createPermissionFunction({
|
|
608
|
+
handler: async (options) => {
|
|
609
|
+
return AppsInTossModule.getCurrentLocation(options);
|
|
610
|
+
},
|
|
611
|
+
permission: {
|
|
612
|
+
name: "geolocation",
|
|
613
|
+
access: "access"
|
|
614
|
+
},
|
|
615
|
+
error: GetCurrentLocationPermissionError2
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// src/AppsInTossModule/native-modules/permissions/setClipboardText/setClipboardText.ts
|
|
619
|
+
import { SetClipboardTextPermissionError } from "@apps-in-toss/types";
|
|
620
|
+
var setClipboardText = createPermissionFunction({
|
|
621
|
+
handler: (text) => {
|
|
622
|
+
return AppsInTossModule.setClipboardText({ text });
|
|
623
|
+
},
|
|
624
|
+
permission: {
|
|
625
|
+
name: "clipboard",
|
|
626
|
+
access: "write"
|
|
627
|
+
},
|
|
628
|
+
error: SetClipboardTextPermissionError
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
// src/AppsInTossModule/native-modules/permissions/openCamera/openCamera.ts
|
|
632
|
+
import { OpenCameraPermissionError } from "@apps-in-toss/types";
|
|
633
|
+
var openCamera = createPermissionFunction({
|
|
634
|
+
handler: (options) => {
|
|
635
|
+
return AppsInTossModule.openCamera({
|
|
636
|
+
base64: false,
|
|
637
|
+
maxWidth: 1024,
|
|
638
|
+
...options
|
|
639
|
+
});
|
|
640
|
+
},
|
|
641
|
+
permission: {
|
|
642
|
+
name: "camera",
|
|
643
|
+
access: "access"
|
|
644
|
+
},
|
|
645
|
+
error: OpenCameraPermissionError
|
|
646
|
+
});
|
|
597
647
|
|
|
598
648
|
// src/AppsInTossModule/native-modules/getDeviceId.ts
|
|
599
649
|
function getDeviceId() {
|
|
@@ -640,16 +690,6 @@ var IAP = {
|
|
|
640
690
|
getProductItemList
|
|
641
691
|
};
|
|
642
692
|
|
|
643
|
-
// src/AppsInTossModule/native-modules/openCamera.ts
|
|
644
|
-
async function openCamera(options) {
|
|
645
|
-
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
646
|
-
if (permissionStatus === "denied") {
|
|
647
|
-
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
648
|
-
}
|
|
649
|
-
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
650
|
-
return photo;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
693
|
// src/AppsInTossModule/native-modules/saveBase64Data.ts
|
|
654
694
|
async function saveBase64Data(params) {
|
|
655
695
|
const isSupported = isMinVersionSupported({
|
|
@@ -663,15 +703,6 @@ async function saveBase64Data(params) {
|
|
|
663
703
|
await AppsInTossModule.saveBase64Data(params);
|
|
664
704
|
}
|
|
665
705
|
|
|
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 });
|
|
673
|
-
}
|
|
674
|
-
|
|
675
706
|
// src/AppsInTossModule/native-modules/setDeviceOrientation.ts
|
|
676
707
|
async function setDeviceOrientation(options) {
|
|
677
708
|
const isSupported = isMinVersionSupported({
|
|
@@ -749,6 +780,29 @@ async function submitGameCenterLeaderBoardScore(params) {
|
|
|
749
780
|
return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
|
|
750
781
|
}
|
|
751
782
|
|
|
783
|
+
// src/AppsInTossModule/native-event-emitter/contactsViral.ts
|
|
784
|
+
function contactsViral(params) {
|
|
785
|
+
const isSupported = isMinVersionSupported({
|
|
786
|
+
android: "5.223.0",
|
|
787
|
+
ios: "5.223.0"
|
|
788
|
+
});
|
|
789
|
+
if (!isSupported) {
|
|
790
|
+
return () => {
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
const { onEvent, onError, options } = params;
|
|
794
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
|
|
795
|
+
onRewardFromContactsViral: (result) => {
|
|
796
|
+
onEvent({ type: "sendViral", data: result });
|
|
797
|
+
},
|
|
798
|
+
onSuccess: (result) => {
|
|
799
|
+
onEvent({ type: "close", data: result });
|
|
800
|
+
},
|
|
801
|
+
onError
|
|
802
|
+
});
|
|
803
|
+
return unregisterCallbacks;
|
|
804
|
+
}
|
|
805
|
+
|
|
752
806
|
// src/AppsInTossModule/native-modules/index.ts
|
|
753
807
|
var TossPay = {
|
|
754
808
|
checkoutPayment
|
|
@@ -762,6 +816,21 @@ var GoogleAdMob = {
|
|
|
762
816
|
showAppsInTossAdMob
|
|
763
817
|
};
|
|
764
818
|
|
|
819
|
+
// src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
|
|
820
|
+
function startUpdateLocation(eventParams) {
|
|
821
|
+
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
822
|
+
}
|
|
823
|
+
startUpdateLocation.openPermissionDialog = getCurrentLocation.openPermissionDialog;
|
|
824
|
+
startUpdateLocation.getPermission = getCurrentLocation.getPermission;
|
|
825
|
+
|
|
826
|
+
// src/AppsInTossModule/native-event-emitter/StartUpdateLocationPermissionError.ts
|
|
827
|
+
import { StartUpdateLocationPermissionError } from "@apps-in-toss/types";
|
|
828
|
+
|
|
829
|
+
// src/AppsInTossModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
830
|
+
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
831
|
+
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
832
|
+
}
|
|
833
|
+
|
|
765
834
|
// src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
766
835
|
import { NativeModules } from "react-native";
|
|
767
836
|
var BedrockModule = NativeModules.BedrockModule;
|
|
@@ -838,17 +907,6 @@ function getPlatformOS() {
|
|
|
838
907
|
import { NativeModules as NativeModules2 } from "react-native";
|
|
839
908
|
var BedrockCoreModule = NativeModules2.BedrockCoreModule;
|
|
840
909
|
|
|
841
|
-
// src/types.ts
|
|
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 || {});
|
|
851
|
-
|
|
852
910
|
// src/AppsInTossModule/native-modules/tossCore.ts
|
|
853
911
|
import { NativeModules as NativeModules3 } from "react-native";
|
|
854
912
|
var TossCoreModule = NativeModules3.TossCoreModule;
|
|
@@ -872,7 +930,6 @@ var INTERNAL__module = {
|
|
|
872
930
|
tossCoreEventLog
|
|
873
931
|
};
|
|
874
932
|
export {
|
|
875
|
-
Accuracy,
|
|
876
933
|
AppsInTossModule,
|
|
877
934
|
BedrockCoreModule,
|
|
878
935
|
BedrockModule,
|
|
@@ -881,6 +938,7 @@ export {
|
|
|
881
938
|
AppsInTossModuleInstance as INTERNAL__AppsInTossModule,
|
|
882
939
|
INTERNAL__appBridgeHandler,
|
|
883
940
|
INTERNAL__module,
|
|
941
|
+
StartUpdateLocationPermissionError,
|
|
884
942
|
Storage,
|
|
885
943
|
TossPay,
|
|
886
944
|
appLogin,
|
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.1757939087965",
|
|
5
5
|
"description": "Native Modules for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/runtime": "^7",
|
|
33
|
-
"@granite-js/native": "0.1.
|
|
34
|
-
"@granite-js/react-native": "0.1.
|
|
33
|
+
"@granite-js/native": "0.1.22",
|
|
34
|
+
"@granite-js/react-native": "0.1.22",
|
|
35
35
|
"@types/react": "18.3.3",
|
|
36
36
|
"dts-bundle-generator": "^9.5.1",
|
|
37
37
|
"esbuild": "0.25.5",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"vitest": "^3.2.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
+
"@apps-in-toss/types": "^0.0.0-dev.1757939087965",
|
|
46
47
|
"es-toolkit": "^1.39.3"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
@@ -53,5 +54,5 @@
|
|
|
53
54
|
"publishConfig": {
|
|
54
55
|
"access": "public"
|
|
55
56
|
},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bcf7590b1627e3798923c1862faef3dea713f824"
|
|
57
58
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StartUpdateLocationPermissionError } from '@apps-in-toss/types';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GraniteEvent } from '@granite-js/react-native';
|
|
2
|
+
import { BackButtonClickHandleEvent } from './event-plugins/BackButtonClickHandleEvent';
|
|
2
3
|
import { EntryMessageExitedEvent } from './event-plugins/EntryMessageExitedEvent';
|
|
3
4
|
import { HomeIconButtonClickHandleEvent } from './event-plugins/HomeIconButtonClickHandleEvent';
|
|
4
5
|
import { UpdateLocationEvent } from './event-plugins/UpdateLocationEvent';
|
|
@@ -8,7 +9,11 @@ import { VisibilityChangedByTransparentServiceWebEvent } from './internal/Visibi
|
|
|
8
9
|
export const appsInTossEvent = new GraniteEvent([
|
|
9
10
|
new UpdateLocationEvent(),
|
|
10
11
|
new EntryMessageExitedEvent(),
|
|
12
|
+
|
|
13
|
+
// Navigation Bar events
|
|
11
14
|
new HomeIconButtonClickHandleEvent(),
|
|
15
|
+
new BackButtonClickHandleEvent(),
|
|
16
|
+
|
|
12
17
|
// Internal events
|
|
13
18
|
new AppBridgeCallbackEvent(),
|
|
14
19
|
new VisibilityChangedByTransparentServiceWebEvent(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GraniteEventDefinition } from '@granite-js/react-native';
|
|
2
|
+
|
|
3
|
+
export class BackButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
4
|
+
name = 'backButtonClickEvent' as const;
|
|
5
|
+
|
|
6
|
+
remove() {}
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
+
listener(_: undefined) {}
|
|
10
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Accuracy, GetCurrentLocationPermissionError, Location } from '@apps-in-toss/types';
|
|
1
2
|
import { GraniteEventDefinition } from '@granite-js/react-native';
|
|
2
|
-
import { Accuracy, Location } from '../../../types';
|
|
3
3
|
import { AppsInTossModuleInstance } from '../../native-modules/AppsInTossModule';
|
|
4
|
-
import { requestPermission } from '../../native-modules/requestPermission';
|
|
4
|
+
import { requestPermission } from '../../native-modules/permissions/requestPermission';
|
|
5
5
|
import { nativeEventEmitter } from '../nativeEventEmitter';
|
|
6
6
|
|
|
7
7
|
export interface StartUpdateLocationOptions {
|
|
@@ -42,7 +42,7 @@ export class UpdateLocationEvent extends GraniteEventDefinition<StartUpdateLocat
|
|
|
42
42
|
requestPermission({ name: 'geolocation', access: 'access' })
|
|
43
43
|
.then((permissionStatus) => {
|
|
44
44
|
if (permissionStatus === 'denied') {
|
|
45
|
-
onError(new
|
|
45
|
+
onError(new GetCurrentLocationPermissionError());
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -27,8 +27,14 @@ function invokeAppBridgeMethod<Result = any, Params = any>(
|
|
|
27
27
|
) {
|
|
28
28
|
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
29
29
|
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
30
|
+
const method = AppsInTossModuleInstance[methodName];
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
if (method == null) {
|
|
33
|
+
onError(new Error(`'${methodName}' is not defined in AppsInTossModule`));
|
|
34
|
+
return unregisterAll;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const promise = method({
|
|
32
38
|
params,
|
|
33
39
|
callbacks: callbackMap,
|
|
34
40
|
}) as Promise<Result>;
|