@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.d.cts
CHANGED
|
@@ -63,7 +63,7 @@ interface Location {
|
|
|
63
63
|
*/
|
|
64
64
|
timestamp: number;
|
|
65
65
|
/**
|
|
66
|
-
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/react-native/reference/
|
|
66
|
+
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/react-native/reference/native-modules/Types/LocationCoords.html)을 참고해주세요.
|
|
67
67
|
*/
|
|
68
68
|
coords: LocationCoords;
|
|
69
69
|
}
|
|
@@ -145,7 +145,7 @@ type UpdateLocationEventEmitter = EventEmitterSchema<'updateLocation', [Location
|
|
|
145
145
|
* @param {number} [options.accuracy] 위치 정확도를 설정해요.
|
|
146
146
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
147
147
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
148
|
-
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/react-native/reference/
|
|
148
|
+
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/react-native/reference/native-modules/Types/Location.html)을 참고해주세요.
|
|
149
149
|
*
|
|
150
150
|
* @example
|
|
151
151
|
* ### 위치 정보 변경 감지하기
|
|
@@ -198,12 +198,128 @@ declare function startUpdateLocation(eventParams: {
|
|
|
198
198
|
options: StartUpdateLocationOptions$1;
|
|
199
199
|
}): () => void;
|
|
200
200
|
|
|
201
|
+
/**
|
|
202
|
+
* @public
|
|
203
|
+
* @category 친구초대
|
|
204
|
+
* @name RewardFromContactsViralEvent
|
|
205
|
+
* @description 친구에게 공유하기를 완료했을 때 지급할 리워드 정보를 담는 타입이에요. 이 타입을 사용하면 공유가 완료됐을 때 지급할 리워드 정보를 확인할 수 있어요.
|
|
206
|
+
* @property {'sendViral'} type - 이벤트의 타입이에요. `'sendViral'`은 사용자가 친구에게 공유를 완료했을 때 돌아와요.
|
|
207
|
+
* @property {Object} data - 지급할 리워드 관련 정보를 담고 있어요.
|
|
208
|
+
* @property {number} data.rewardAmount - 지급할 리워드 수량이에요. 앱인토스 콘솔에서 설정한 수량 및 금액 값이에요.
|
|
209
|
+
* @property {string} data.rewardUnit - 리워드의 단위예요. 앱인토스 콘솔에 설정된 리워드 이름인 '하트', '보석' 등이 리워드 단위예요.
|
|
210
|
+
*/
|
|
211
|
+
type RewardFromContactsViralEvent = {
|
|
212
|
+
type: 'sendViral';
|
|
213
|
+
data: {
|
|
214
|
+
rewardAmount: number;
|
|
215
|
+
rewardUnit: string;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* @public
|
|
220
|
+
* @category 친구초대
|
|
221
|
+
* @name ContactsViralSuccessEvent
|
|
222
|
+
* @description 연락처 공유 모듈이 정상적으로 종료됐을 때 전달되는 이벤트 객체예요. 종료 이유와 함께 리워드 상태 및 남은 친구 수 등 관련 정보를 제공해요.
|
|
223
|
+
* @property {'close'} type - 이벤트의 타입이에요. `'close'`는 공유 모듈이 종료됐을 때 돌아와요.
|
|
224
|
+
* @property {Object} data - 모듈 종료와 관련된 세부 정보를 담고 있어요.
|
|
225
|
+
* @property {'clickBackButton' | 'noReward'} data.closeReason - 모듈이 종료된 이유예요. `'clickBackButton'`은 사용자가 뒤로 가기 버튼을 눌러 종료한 경우이고, `'noReward'`는 받을 수 있는 리워드가 없어서 종료된 경우예요.
|
|
226
|
+
* @property {number} data.sentRewardAmount - 사용자가 받은 전체 리워드 수량이에요.
|
|
227
|
+
* @property {number} data.sendableRewardsCount - 아직 공유할 수 있는 친구 수예요.
|
|
228
|
+
* @property {number} data.sentRewardsCount - 사용자가 공유를 완료한 친구 수예요.
|
|
229
|
+
* @property {string} data.rewardUnit - 리워드의 단위예요. 앱인토스 콘솔에 설정된 리워드 이름인 '하트', '보석' 등이 리워드 단위예요.
|
|
230
|
+
*/
|
|
231
|
+
type ContactsViralSuccessEvent = {
|
|
232
|
+
type: 'close';
|
|
233
|
+
data: {
|
|
234
|
+
closeReason: 'clickBackButton' | 'noReward';
|
|
235
|
+
sentRewardAmount?: number;
|
|
236
|
+
sendableRewardsCount?: number;
|
|
237
|
+
sentRewardsCount: number;
|
|
238
|
+
rewardUnit?: string;
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
type ContactsViralEvent = RewardFromContactsViralEvent | ContactsViralSuccessEvent;
|
|
242
|
+
/**
|
|
243
|
+
* @public
|
|
244
|
+
* @category 친구초대
|
|
245
|
+
* @name ContactsViralOption
|
|
246
|
+
* @description [연락처 공유 기능](/react-native/reference/native-modules/친구초대/contactsViral.html)을 사용할 때 필요한 옵션이에요.
|
|
247
|
+
* @property {string} moduleId - 공유 리워드를 구분하는 UUID 형식의 고유 ID예요. 앱인토스 콘솔의 미니앱 > 공유 리워드 메뉴에서 확인할 수 있어요.
|
|
248
|
+
*/
|
|
249
|
+
type ContactsViralOption = {
|
|
250
|
+
moduleId: string;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* @public
|
|
254
|
+
* @category 친구초대
|
|
255
|
+
* @name ContactsViralParams
|
|
256
|
+
* @description `ContactsViralParams`는 연락처 공유 기능을 사용할 때 전달해야 하는 파라미터 타입이에요. 옵션을 설정하고, 이벤트 및 에러 처리 콜백을 지정할 수 있어요.
|
|
257
|
+
* @property {ContactsViralOption} options - 공유 기능에 사용할 옵션 객체예요.
|
|
258
|
+
* @property {(event: ContactsViralEvent) => void} onEvent - 공유 이벤트가 발생했을 때 실행되는 함수예요. [`RewardFromContactsViralEvent`](/bedrock/reference/native-modules/친구초대/RewardFromContactsViralEvent.html) 또는 [`ContactsViralSuccessEvent`](/react-native/reference/native-modules/친구초대/ContactsViralSuccessEvent.html) 타입의 이벤트 객체가 전달돼요.
|
|
259
|
+
* @property {(error: unknown) => void} onError - 예기치 않은 에러가 발생했을 때 실행되는 함수예요.
|
|
260
|
+
*/
|
|
261
|
+
interface ContactsViralParams {
|
|
262
|
+
options: ContactsViralOption;
|
|
263
|
+
onEvent: (event: ContactsViralEvent) => void;
|
|
264
|
+
onError: (error: unknown) => void;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @public
|
|
268
|
+
* @category 친구초대
|
|
269
|
+
* @name contactsViral
|
|
270
|
+
* @description 친구에게 공유하고 리워드를 받을 수 있는 기능을 제공해요. 사용자가 친구에게 공유를 완료하면 앱브릿지가 이벤트를 통해 리워드 정보를 전달해요.
|
|
271
|
+
* @param {ContactsViralParams} params - 연락처 공유 기능을 실행할 때 사용하는 파라미터예요. 옵션 설정과 이벤트 핸들러를 포함해요. 자세한 내용은 [ContactsViralParams](/bedrock/reference/native-modules/친구초대/ContactsViralParams.html) 문서를 참고하세요.
|
|
272
|
+
* @returns {() => void} 앱브릿지 cleanup 함수를 반환해요. 공유 기능이 끝나면 반드시 이 함수를 호출해서 리소스를 해제해야 해요.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ### 친구에게 공유하고 리워드 받기
|
|
276
|
+
*
|
|
277
|
+
* ```tsx
|
|
278
|
+
* import { useCallback } from 'react';
|
|
279
|
+
* import { Button } from 'react-native';
|
|
280
|
+
* import { contactsViral } from '@apps-in-toss/framework';
|
|
281
|
+
*
|
|
282
|
+
* function ContactsViralButton({ moduleId }: { moduleId: string }) {
|
|
283
|
+
* const handleContactsViral = useCallback(() => {
|
|
284
|
+
* try {
|
|
285
|
+
* const cleanup = contactsViral({
|
|
286
|
+
* options: { moduleId: moduleId.trim() },
|
|
287
|
+
* onEvent: (event) => {
|
|
288
|
+
* if (event.type === 'sendViral') {
|
|
289
|
+
* console.log('리워드 지급:', event.data.rewardAmount, event.data.rewardUnit);
|
|
290
|
+
* } else if (event.type === 'close') {
|
|
291
|
+
* console.log('모듈 종료:', event.data.closeReason);
|
|
292
|
+
* }
|
|
293
|
+
* },
|
|
294
|
+
* onError: (error) => {
|
|
295
|
+
* console.error('에러 발생:', error);
|
|
296
|
+
* },
|
|
297
|
+
* });
|
|
298
|
+
*
|
|
299
|
+
* return cleanup;
|
|
300
|
+
* } catch (error) {
|
|
301
|
+
* console.error('실행 중 에러:', error);
|
|
302
|
+
* }
|
|
303
|
+
* }, [moduleId]);
|
|
304
|
+
*
|
|
305
|
+
* return <Button title="친구에게 공유하고 리워드 받기" onPress={handleContactsViral} />;
|
|
306
|
+
* }
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
declare function contactsViral(params: ContactsViralParams): () => void;
|
|
310
|
+
|
|
201
311
|
declare class EntryMessageExitedEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
202
312
|
name: "entryMessageExited";
|
|
203
313
|
remove(): void;
|
|
204
314
|
listener(_: undefined): void;
|
|
205
315
|
}
|
|
206
316
|
|
|
317
|
+
declare class HomeIconButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
318
|
+
name: "homeIconButtonClickEvent";
|
|
319
|
+
remove(): void;
|
|
320
|
+
listener(_: undefined): void;
|
|
321
|
+
}
|
|
322
|
+
|
|
207
323
|
interface StartUpdateLocationOptions {
|
|
208
324
|
/**
|
|
209
325
|
* 위치 정확도를 설정해요.
|
|
@@ -242,7 +358,44 @@ declare class AppBridgeCallbackEvent extends GraniteEventDefinition<void, AppBri
|
|
|
242
358
|
private ensureInvokeAppBridgeCallback;
|
|
243
359
|
}
|
|
244
360
|
|
|
245
|
-
|
|
361
|
+
interface VisibilityChangedByTransparentServiceWebOptions {
|
|
362
|
+
callbackId: string;
|
|
363
|
+
}
|
|
364
|
+
declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEventDefinition<VisibilityChangedByTransparentServiceWebOptions, boolean> {
|
|
365
|
+
name: "onVisibilityChangedByTransparentServiceWeb";
|
|
366
|
+
subscription: EmitterSubscription | null;
|
|
367
|
+
remove(): void;
|
|
368
|
+
listener(options: VisibilityChangedByTransparentServiceWebOptions, onEvent: (isVisible: boolean) => void, onError: (error: unknown) => void): void;
|
|
369
|
+
private isVisibilityChangedByTransparentServiceWebResult;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare const appsInTossEvent: GraniteEvent<EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
|
|
373
|
+
|
|
374
|
+
declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
|
|
375
|
+
options: {
|
|
376
|
+
callbackId: string;
|
|
377
|
+
};
|
|
378
|
+
onEvent: (isVisible: boolean) => void;
|
|
379
|
+
onError: (error: unknown) => void;
|
|
380
|
+
}): () => void;
|
|
381
|
+
|
|
382
|
+
interface AppBridgeCompatCallbacks<Result> {
|
|
383
|
+
onSuccess: (result: Result) => void;
|
|
384
|
+
onError: (reason: unknown) => void;
|
|
385
|
+
}
|
|
386
|
+
type AppBridgeCallback = (...args: any[]) => void;
|
|
387
|
+
declare function invokeAppBridgeCallback(id: string, ...args: any[]): boolean;
|
|
388
|
+
declare function invokeAppBridgeMethod<Result = any, Params = any>(methodName: string, params: Params, callbacks: AppBridgeCompatCallbacks<Result> & Record<string, AppBridgeCallback>): () => void;
|
|
389
|
+
declare function registerCallback(callback: AppBridgeCallback, name?: string): string;
|
|
390
|
+
declare function unregisterCallback(id: string): void;
|
|
391
|
+
declare function getCallbackIds(): string[];
|
|
392
|
+
declare const INTERNAL__appBridgeHandler: {
|
|
393
|
+
invokeAppBridgeCallback: typeof invokeAppBridgeCallback;
|
|
394
|
+
invokeAppBridgeMethod: typeof invokeAppBridgeMethod;
|
|
395
|
+
registerCallback: typeof registerCallback;
|
|
396
|
+
unregisterCallback: typeof unregisterCallback;
|
|
397
|
+
getCallbackIds: typeof getCallbackIds;
|
|
398
|
+
};
|
|
246
399
|
|
|
247
400
|
/**
|
|
248
401
|
* @public
|
|
@@ -293,6 +446,13 @@ type AdImpression = {
|
|
|
293
446
|
type AdShow = {
|
|
294
447
|
type: 'show';
|
|
295
448
|
};
|
|
449
|
+
type AdUserEarnedReward = {
|
|
450
|
+
type: 'userEarnedReward';
|
|
451
|
+
data: {
|
|
452
|
+
unitType: string;
|
|
453
|
+
unitAmount: number;
|
|
454
|
+
};
|
|
455
|
+
};
|
|
296
456
|
interface AdMobHandlerParams<Options = void, Event = AdMobFullScreenEvent> {
|
|
297
457
|
options: Options;
|
|
298
458
|
onEvent: (event: Event) => void;
|
|
@@ -336,7 +496,7 @@ interface AdNetworkResponseInfo {
|
|
|
336
496
|
* @name InterstitialAd
|
|
337
497
|
* @description 전면 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
|
|
338
498
|
* @property {string} adUnitId 광고 ID예요.
|
|
339
|
-
* @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/
|
|
499
|
+
* @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/native-modules/광고/ResponseInfo.html)를 참고하세요.
|
|
340
500
|
*/
|
|
341
501
|
interface InterstitialAd {
|
|
342
502
|
adUnitId: string;
|
|
@@ -348,12 +508,26 @@ interface InterstitialAd {
|
|
|
348
508
|
* @name RewardedAd
|
|
349
509
|
* @description 보상형 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
|
|
350
510
|
* @property {string} adUnitId 광고 ID예요.
|
|
351
|
-
* @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/
|
|
511
|
+
* @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/native-modules/광고/ResponseInfo.html)를 참고하세요.
|
|
352
512
|
*/
|
|
353
513
|
interface RewardedAd {
|
|
354
514
|
adUnitId: string;
|
|
355
515
|
responseInfo: ResponseInfo;
|
|
356
516
|
}
|
|
517
|
+
/**
|
|
518
|
+
* @public
|
|
519
|
+
* @category 광고
|
|
520
|
+
* @name AdMobLoadResult
|
|
521
|
+
* @description 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
|
|
522
|
+
* @property {string} adGroupId 광고 그룹 ID예요.
|
|
523
|
+
* @property {string} adUnitId 광고 ID예요.
|
|
524
|
+
* @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/native-modules/광고/ResponseInfo.html)를 참고하세요.
|
|
525
|
+
*/
|
|
526
|
+
interface AdMobLoadResult {
|
|
527
|
+
adGroupId: string;
|
|
528
|
+
adUnitId: string;
|
|
529
|
+
responseInfo: ResponseInfo;
|
|
530
|
+
}
|
|
357
531
|
|
|
358
532
|
interface LoadAdMobInterstitialAdOptions {
|
|
359
533
|
/**
|
|
@@ -365,7 +539,7 @@ interface LoadAdMobInterstitialAdOptions {
|
|
|
365
539
|
* @public
|
|
366
540
|
* @category 광고
|
|
367
541
|
* @name LoadAdMobInterstitialAdEvent
|
|
368
|
-
* @description 전면 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [InterstitialAd](/react-native/reference/
|
|
542
|
+
* @description 전면 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [InterstitialAd](/react-native/reference/native-modules/광고/InterstitialAd.html) 객체가 함께 반환돼요.
|
|
369
543
|
*/
|
|
370
544
|
type LoadAdMobInterstitialAdEvent = AdMobFullScreenEvent | {
|
|
371
545
|
type: 'loaded';
|
|
@@ -382,16 +556,10 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
|
|
|
382
556
|
* @public
|
|
383
557
|
* @category 광고
|
|
384
558
|
* @name loadAdMobInterstitialAd
|
|
385
|
-
* @
|
|
386
|
-
* @param {LoadAdMobInterstitialAdParams} params 광고를 불러올 때 사용할 설정 값이에요. 광고 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
387
|
-
* @param {LoadAdMobInterstitialAdOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요.
|
|
388
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. 발급받은 전면 광고용 ID를 입력해요.
|
|
389
|
-
* @param {(event: LoadAdMobInterstitialAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobInterstitialAdEvent](/react-native/reference/framework/광고/LoadAdMobInterstitialAdEvent.html)를 참고하세요.
|
|
390
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
391
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
559
|
+
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link GoogleAdMob.loadAppsInTossAdMob}를 사용해주세요.
|
|
392
560
|
*
|
|
393
561
|
* @example
|
|
394
|
-
* ### 버튼 눌러 불러온
|
|
562
|
+
* ### 버튼 눌러 불러온 광고 보여주기 (loadAppsInTossAdMob로 변경 예제)
|
|
395
563
|
* ```tsx
|
|
396
564
|
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
397
565
|
* import { useFocusEffect } from '@granite-js/native/@react-navigation/native';
|
|
@@ -399,20 +567,20 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
|
|
|
399
567
|
* import { useCallback, useState } from 'react';
|
|
400
568
|
* import { Button, Text, View } from 'react-native';
|
|
401
569
|
*
|
|
402
|
-
* const
|
|
570
|
+
* const AD_GROUP_ID = '<AD_GROUP_ID>';
|
|
403
571
|
*
|
|
404
|
-
* export function
|
|
572
|
+
* export function GoogleAdmobExample() {
|
|
405
573
|
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
406
574
|
* const navigation = useNavigation();
|
|
407
575
|
*
|
|
408
576
|
* const loadAd = useCallback(() => {
|
|
409
|
-
* if (GoogleAdMob.
|
|
577
|
+
* if (GoogleAdMob.loadAppsInTossAdMob.isSupported() !== true) {
|
|
410
578
|
* return;
|
|
411
579
|
* }
|
|
412
580
|
|
|
413
|
-
* const cleanup = GoogleAdMob.
|
|
581
|
+
* const cleanup = GoogleAdMob.loadAppsInTossAdMob({
|
|
414
582
|
* options: {
|
|
415
|
-
*
|
|
583
|
+
* adGroupId: AD_GROUP_ID,
|
|
416
584
|
* },
|
|
417
585
|
* onEvent: (event) => {
|
|
418
586
|
* switch (event.type) {
|
|
@@ -420,27 +588,6 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
|
|
|
420
588
|
* console.log('광고 로드 성공', event.data);
|
|
421
589
|
* setAdLoadStatus('loaded');
|
|
422
590
|
* break;
|
|
423
|
-
*
|
|
424
|
-
* case 'clicked':
|
|
425
|
-
* console.log('광고 클릭');
|
|
426
|
-
* break;
|
|
427
|
-
*
|
|
428
|
-
* case 'dismissed':
|
|
429
|
-
* console.log('광고 닫힘');
|
|
430
|
-
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
431
|
-
* break;
|
|
432
|
-
*
|
|
433
|
-
* case 'failedToShow':
|
|
434
|
-
* console.log('광고 보여주기 실패');
|
|
435
|
-
* break;
|
|
436
|
-
*
|
|
437
|
-
* case 'impression':
|
|
438
|
-
* console.log('광고 노출');
|
|
439
|
-
* break;
|
|
440
|
-
*
|
|
441
|
-
* case 'show':
|
|
442
|
-
* console.log('광고 컨텐츠 보여졌음');
|
|
443
|
-
* break;
|
|
444
591
|
* }
|
|
445
592
|
* },
|
|
446
593
|
* onError: (error) => {
|
|
@@ -452,19 +599,45 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
|
|
|
452
599
|
* }, [navigation]);
|
|
453
600
|
*
|
|
454
601
|
* const showAd = useCallback(() => {
|
|
455
|
-
* if (GoogleAdMob.
|
|
602
|
+
* if (GoogleAdMob.showAppsInTossAdMob.isSupported() !== true) {
|
|
456
603
|
* return;
|
|
457
604
|
* }
|
|
458
605
|
*
|
|
459
|
-
* GoogleAdMob.
|
|
606
|
+
* GoogleAdMob.showAppsInTossAdMob({
|
|
460
607
|
* options: {
|
|
461
|
-
*
|
|
608
|
+
* adGroupId: AD_GROUP_ID,
|
|
462
609
|
* },
|
|
463
610
|
* onEvent: (event) => {
|
|
464
611
|
* switch (event.type) {
|
|
465
612
|
* case 'requested':
|
|
466
613
|
* console.log('광고 보여주기 요청 완료');
|
|
467
614
|
* break;
|
|
615
|
+
*
|
|
616
|
+
* case 'clicked':
|
|
617
|
+
* console.log('광고 클릭');
|
|
618
|
+
* break;
|
|
619
|
+
*
|
|
620
|
+
* case 'dismissed':
|
|
621
|
+
* console.log('광고 닫힘');
|
|
622
|
+
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
623
|
+
* break;
|
|
624
|
+
*
|
|
625
|
+
* case 'failedToShow':
|
|
626
|
+
* console.log('광고 보여주기 실패');
|
|
627
|
+
* break;
|
|
628
|
+
*
|
|
629
|
+
* case 'impression':
|
|
630
|
+
* console.log('광고 노출');
|
|
631
|
+
* break;
|
|
632
|
+
*
|
|
633
|
+
* case 'userEarnedReward':
|
|
634
|
+
* console.log('광고 보상 획득 unitType:', event.data.unitType);
|
|
635
|
+
* console.log('광고 보상 획득 unitAmount:', event.data.unitAmount);
|
|
636
|
+
* break;
|
|
637
|
+
*
|
|
638
|
+
* case 'show':
|
|
639
|
+
* console.log('광고 컨텐츠 보여졌음');
|
|
640
|
+
* break;
|
|
468
641
|
* }
|
|
469
642
|
* },
|
|
470
643
|
* onError: (error) => {
|
|
@@ -519,16 +692,10 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
|
|
|
519
692
|
* @public
|
|
520
693
|
* @category 광고
|
|
521
694
|
* @name showAdMobInterstitialAd
|
|
522
|
-
* @
|
|
523
|
-
* @param {ShowAdMobInterstitialAdParams} params 광고를 보여주기 위해 사용할 설정 값이에요. 광고 ID와과 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
524
|
-
* @param {ShowAdMobInterstitialAdOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요.
|
|
525
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. `loadAdMobInterstitialAd` 로 불러온 전면 광고용 ID를 입력해요.
|
|
526
|
-
* @param {(event: ShowAdMobInterstitialAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobInterstitialAdEvent](/react-native/reference/framework/광고/ShowAdMobInterstitialAdEvent.html)를 참고하세요.
|
|
527
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 노출하지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
528
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
695
|
+
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link GoogleAdMob.showAppsInTossAdMob}를 사용해주세요.
|
|
529
696
|
*
|
|
530
697
|
* @example
|
|
531
|
-
* ### 버튼 눌러 불러온
|
|
698
|
+
* ### 버튼 눌러 불러온 광고 보여주기 (showAppsInTossAdMob로 변경 예제)
|
|
532
699
|
* ```tsx
|
|
533
700
|
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
534
701
|
* import { useFocusEffect } from '@granite-js/native/@react-navigation/native';
|
|
@@ -536,20 +703,20 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
|
|
|
536
703
|
* import { useCallback, useState } from 'react';
|
|
537
704
|
* import { Button, Text, View } from 'react-native';
|
|
538
705
|
*
|
|
539
|
-
* const
|
|
706
|
+
* const AD_GROUP_ID = '<AD_GROUP_ID>';
|
|
540
707
|
*
|
|
541
|
-
* export function
|
|
708
|
+
* export function GoogleAdmobExample() {
|
|
542
709
|
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
543
710
|
* const navigation = useNavigation();
|
|
544
711
|
*
|
|
545
712
|
* const loadAd = useCallback(() => {
|
|
546
|
-
* if (GoogleAdMob.
|
|
713
|
+
* if (GoogleAdMob.loadAppsInTossAdMob.isSupported() !== true) {
|
|
547
714
|
* return;
|
|
548
715
|
* }
|
|
549
716
|
|
|
550
|
-
* const cleanup = GoogleAdMob.
|
|
717
|
+
* const cleanup = GoogleAdMob.loadAppsInTossAdMob({
|
|
551
718
|
* options: {
|
|
552
|
-
*
|
|
719
|
+
* adGroupId: AD_GROUP_ID,
|
|
553
720
|
* },
|
|
554
721
|
* onEvent: (event) => {
|
|
555
722
|
* switch (event.type) {
|
|
@@ -557,27 +724,6 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
|
|
|
557
724
|
* console.log('광고 로드 성공', event.data);
|
|
558
725
|
* setAdLoadStatus('loaded');
|
|
559
726
|
* break;
|
|
560
|
-
*
|
|
561
|
-
* case 'clicked':
|
|
562
|
-
* console.log('광고 클릭');
|
|
563
|
-
* break;
|
|
564
|
-
*
|
|
565
|
-
* case 'dismissed':
|
|
566
|
-
* console.log('광고 닫힘');
|
|
567
|
-
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
568
|
-
* break;
|
|
569
|
-
*
|
|
570
|
-
* case 'failedToShow':
|
|
571
|
-
* console.log('광고 보여주기 실패');
|
|
572
|
-
* break;
|
|
573
|
-
*
|
|
574
|
-
* case 'impression':
|
|
575
|
-
* console.log('광고 노출');
|
|
576
|
-
* break;
|
|
577
|
-
*
|
|
578
|
-
* case 'show':
|
|
579
|
-
* console.log('광고 컨텐츠 보여졌음');
|
|
580
|
-
* break;
|
|
581
727
|
* }
|
|
582
728
|
* },
|
|
583
729
|
* onError: (error) => {
|
|
@@ -589,19 +735,45 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
|
|
|
589
735
|
* }, [navigation]);
|
|
590
736
|
*
|
|
591
737
|
* const showAd = useCallback(() => {
|
|
592
|
-
* if (GoogleAdMob.
|
|
738
|
+
* if (GoogleAdMob.showAppsInTossAdMob.isSupported() !== true) {
|
|
593
739
|
* return;
|
|
594
740
|
* }
|
|
595
741
|
*
|
|
596
|
-
* GoogleAdMob.
|
|
742
|
+
* GoogleAdMob.showAppsInTossAdMob({
|
|
597
743
|
* options: {
|
|
598
|
-
*
|
|
744
|
+
* adGroupId: AD_GROUP_ID,
|
|
599
745
|
* },
|
|
600
746
|
* onEvent: (event) => {
|
|
601
747
|
* switch (event.type) {
|
|
602
748
|
* case 'requested':
|
|
603
749
|
* console.log('광고 보여주기 요청 완료');
|
|
604
750
|
* break;
|
|
751
|
+
*
|
|
752
|
+
* case 'clicked':
|
|
753
|
+
* console.log('광고 클릭');
|
|
754
|
+
* break;
|
|
755
|
+
*
|
|
756
|
+
* case 'dismissed':
|
|
757
|
+
* console.log('광고 닫힘');
|
|
758
|
+
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
759
|
+
* break;
|
|
760
|
+
*
|
|
761
|
+
* case 'failedToShow':
|
|
762
|
+
* console.log('광고 보여주기 실패');
|
|
763
|
+
* break;
|
|
764
|
+
*
|
|
765
|
+
* case 'impression':
|
|
766
|
+
* console.log('광고 노출');
|
|
767
|
+
* break;
|
|
768
|
+
*
|
|
769
|
+
* case 'userEarnedReward':
|
|
770
|
+
* console.log('광고 보상 획득 unitType:', event.data.unitType);
|
|
771
|
+
* console.log('광고 보상 획득 unitAmount:', event.data.unitAmount);
|
|
772
|
+
* break;
|
|
773
|
+
*
|
|
774
|
+
* case 'show':
|
|
775
|
+
* console.log('광고 컨텐츠 보여졌음');
|
|
776
|
+
* break;
|
|
605
777
|
* }
|
|
606
778
|
* },
|
|
607
779
|
* onError: (error) => {
|
|
@@ -639,7 +811,7 @@ interface LoadAdMobRewardedAdOptions {
|
|
|
639
811
|
/**
|
|
640
812
|
* @public
|
|
641
813
|
* @category 광고
|
|
642
|
-
* @name
|
|
814
|
+
* @name LoadAdMobRewardedAdEvent
|
|
643
815
|
* @description 보상형 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [RewardedAd](/react-native/reference/native-modules/광고/RewardedAd.html) 객체가 함께 반환돼요. `userEarnedReward` 이벤트는 사용자가 광고를 끝까지 시청해, 보상 조건을 충족했을 때 발생해요.
|
|
644
816
|
*/
|
|
645
817
|
type LoadAdMobRewardedAdEvent = AdMobFullScreenEvent | {
|
|
@@ -659,44 +831,62 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
|
|
|
659
831
|
* @public
|
|
660
832
|
* @category 광고
|
|
661
833
|
* @name loadAdMobRewardedAd
|
|
662
|
-
* @
|
|
663
|
-
* @param {LoadAdMobRewardedAdParams} params 광고를 불러올 때 사용할 설정 값이에요. 광고 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
664
|
-
* @param {LoadAdMobRewardedAdOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요.
|
|
665
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. 발급받은 보상형 광고용 ID를 입력해요.
|
|
666
|
-
* @param {(event: LoadAdMobRewardedAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobRewardedAdEvent](/react-native/reference/framework/광고/LoadAdMobRewardedAdEvent.html)를 참고하세요.
|
|
667
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
668
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
834
|
+
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link GoogleAdMob.loadAppsInTossAdMob}를 사용해주세요.
|
|
669
835
|
*
|
|
670
836
|
* @example
|
|
671
|
-
*
|
|
672
|
-
* ### 버튼 눌러 불러온 보상형 광고 보여주기
|
|
673
|
-
*
|
|
837
|
+
* ### 버튼 눌러 불러온 광고 보여주기 (loadAppsInTossAdMob로 변경 예제)
|
|
674
838
|
* ```tsx
|
|
675
839
|
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
840
|
+
* import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
|
|
676
841
|
* import { useCallback, useState } from 'react';
|
|
677
842
|
* import { Button, Text, View } from 'react-native';
|
|
843
|
+
* import { useNavigation } from 'react-native-bedrock';
|
|
678
844
|
*
|
|
679
|
-
* const
|
|
845
|
+
* const AD_GROUP_ID = '<AD_GROUP_ID>';
|
|
680
846
|
*
|
|
681
|
-
* export function
|
|
847
|
+
* export function GoogleAdmobExample() {
|
|
682
848
|
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
849
|
+
* const navigation = useNavigation();
|
|
683
850
|
*
|
|
684
851
|
* const loadAd = useCallback(() => {
|
|
685
|
-
* if (GoogleAdMob.
|
|
852
|
+
* if (GoogleAdMob.loadAppsInTossAdMob.isSupported() !== true) {
|
|
686
853
|
* return;
|
|
687
854
|
* }
|
|
688
|
-
|
|
689
|
-
* const cleanup = GoogleAdMob.
|
|
855
|
+
|
|
856
|
+
* const cleanup = GoogleAdMob.loadAppsInTossAdMob({
|
|
690
857
|
* options: {
|
|
691
|
-
*
|
|
858
|
+
* adGroupId: AD_GROUP_ID,
|
|
692
859
|
* },
|
|
693
860
|
* onEvent: (event) => {
|
|
694
|
-
* console.log(event.type);
|
|
695
861
|
* switch (event.type) {
|
|
696
862
|
* case 'loaded':
|
|
697
863
|
* console.log('광고 로드 성공', event.data);
|
|
698
864
|
* setAdLoadStatus('loaded');
|
|
699
865
|
* break;
|
|
866
|
+
* }
|
|
867
|
+
* },
|
|
868
|
+
* onError: (error) => {
|
|
869
|
+
* console.error('광고 불러오기 실패', error);
|
|
870
|
+
* },
|
|
871
|
+
* });
|
|
872
|
+
*
|
|
873
|
+
* return cleanup;
|
|
874
|
+
* }, [navigation]);
|
|
875
|
+
*
|
|
876
|
+
* const showAd = useCallback(() => {
|
|
877
|
+
* if (GoogleAdMob.showAppsInTossAdMob.isSupported() !== true) {
|
|
878
|
+
* return;
|
|
879
|
+
* }
|
|
880
|
+
*
|
|
881
|
+
* GoogleAdMob.showAppsInTossAdMob({
|
|
882
|
+
* options: {
|
|
883
|
+
* adGroupId: AD_GROUP_ID,
|
|
884
|
+
* },
|
|
885
|
+
* onEvent: (event) => {
|
|
886
|
+
* switch (event.type) {
|
|
887
|
+
* case 'requested':
|
|
888
|
+
* console.log('광고 보여주기 요청 완료');
|
|
889
|
+
* break;
|
|
700
890
|
*
|
|
701
891
|
* case 'clicked':
|
|
702
892
|
* console.log('광고 클릭');
|
|
@@ -704,6 +894,7 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
|
|
|
704
894
|
*
|
|
705
895
|
* case 'dismissed':
|
|
706
896
|
* console.log('광고 닫힘');
|
|
897
|
+
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
707
898
|
* break;
|
|
708
899
|
*
|
|
709
900
|
* case 'failedToShow':
|
|
@@ -714,37 +905,13 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
|
|
|
714
905
|
* console.log('광고 노출');
|
|
715
906
|
* break;
|
|
716
907
|
*
|
|
717
|
-
* case 'show':
|
|
718
|
-
* console.log('광고 컨텐츠 보여졌음');
|
|
719
|
-
* break;
|
|
720
|
-
*
|
|
721
908
|
* case 'userEarnedReward':
|
|
722
|
-
* console.log('
|
|
909
|
+
* console.log('광고 보상 획득 unitType:', event.data.unitType);
|
|
910
|
+
* console.log('광고 보상 획득 unitAmount:', event.data.unitAmount);
|
|
723
911
|
* break;
|
|
724
|
-
* }
|
|
725
|
-
* },
|
|
726
|
-
* onError: (error) => {
|
|
727
|
-
* console.error('광고 불러오기 실패', error);
|
|
728
|
-
* },
|
|
729
|
-
* });
|
|
730
|
-
*
|
|
731
|
-
* return cleanup;
|
|
732
|
-
* }, []);
|
|
733
912
|
*
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
* return;
|
|
737
|
-
* }
|
|
738
|
-
*
|
|
739
|
-
* GoogleAdMob.showAdMobRewardedAd({
|
|
740
|
-
* options: {
|
|
741
|
-
* adUnitId: AD_UNIT_ID,
|
|
742
|
-
* },
|
|
743
|
-
* onEvent: (event) => {
|
|
744
|
-
* switch (event.type) {
|
|
745
|
-
* case 'requested':
|
|
746
|
-
* console.log('광고 보여주기 요청 완료');
|
|
747
|
-
* setAdLoadStatus('not_loaded');
|
|
913
|
+
* case 'show':
|
|
914
|
+
* console.log('광고 컨텐츠 보여졌음');
|
|
748
915
|
* break;
|
|
749
916
|
* }
|
|
750
917
|
* },
|
|
@@ -754,6 +921,8 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
|
|
|
754
921
|
* });
|
|
755
922
|
* }, []);
|
|
756
923
|
*
|
|
924
|
+
* useFocusEffect(loadAd);
|
|
925
|
+
*
|
|
757
926
|
* return (
|
|
758
927
|
* <View>
|
|
759
928
|
* <Text>
|
|
@@ -762,7 +931,6 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
|
|
|
762
931
|
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
763
932
|
* </Text>
|
|
764
933
|
*
|
|
765
|
-
* <Button title="Load Ad" onPress={loadAd} />
|
|
766
934
|
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
767
935
|
* </View>
|
|
768
936
|
* );
|
|
@@ -799,43 +967,62 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
|
|
|
799
967
|
* @public
|
|
800
968
|
* @category 광고
|
|
801
969
|
* @name showAdMobRewardedAd
|
|
802
|
-
* @
|
|
803
|
-
* @param {ShowAdMobRewardedAdParams} params 광고를 보여주기 위해 사용할 설정 값이에요. 광고 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
804
|
-
* @param {ShowAdMobRewardedAdOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요.
|
|
805
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. `loadAdMobRewardedAd` 로 불러온 보상형 광고용 ID를 입력해요.
|
|
806
|
-
* @param {(event: ShowAdMobRewardedAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobRewardedAdEvent](/react-native/reference/framework/광고/ShowAdMobRewardedAdEvent.html)를 참고하세요.
|
|
807
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
808
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
970
|
+
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link GoogleAdMob.showAppsInTossAdMob}를 사용해주세요.
|
|
809
971
|
*
|
|
810
972
|
* @example
|
|
811
|
-
* ### 버튼 눌러 불러온
|
|
812
|
-
*
|
|
973
|
+
* ### 버튼 눌러 불러온 광고 보여주기 (showAppsInTossAdMob로 변경 예제)
|
|
813
974
|
* ```tsx
|
|
814
975
|
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
976
|
+
* import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
|
|
815
977
|
* import { useCallback, useState } from 'react';
|
|
816
978
|
* import { Button, Text, View } from 'react-native';
|
|
979
|
+
* import { useNavigation } from 'react-native-bedrock';
|
|
817
980
|
*
|
|
818
|
-
* const
|
|
981
|
+
* const AD_GROUP_ID = '<AD_GROUP_ID>';
|
|
819
982
|
*
|
|
820
|
-
* export function
|
|
983
|
+
* export function GoogleAdmobExample() {
|
|
821
984
|
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
985
|
+
* const navigation = useNavigation();
|
|
822
986
|
*
|
|
823
987
|
* const loadAd = useCallback(() => {
|
|
824
|
-
* if (GoogleAdMob.
|
|
988
|
+
* if (GoogleAdMob.loadAppsInTossAdMob.isSupported() !== true) {
|
|
825
989
|
* return;
|
|
826
990
|
* }
|
|
827
|
-
|
|
828
|
-
* const cleanup = GoogleAdMob.
|
|
991
|
+
|
|
992
|
+
* const cleanup = GoogleAdMob.loadAppsInTossAdMob({
|
|
829
993
|
* options: {
|
|
830
|
-
*
|
|
994
|
+
* adGroupId: AD_GROUP_ID,
|
|
831
995
|
* },
|
|
832
996
|
* onEvent: (event) => {
|
|
833
|
-
* console.log(event.type);
|
|
834
997
|
* switch (event.type) {
|
|
835
998
|
* case 'loaded':
|
|
836
999
|
* console.log('광고 로드 성공', event.data);
|
|
837
1000
|
* setAdLoadStatus('loaded');
|
|
838
1001
|
* break;
|
|
1002
|
+
* }
|
|
1003
|
+
* },
|
|
1004
|
+
* onError: (error) => {
|
|
1005
|
+
* console.error('광고 불러오기 실패', error);
|
|
1006
|
+
* },
|
|
1007
|
+
* });
|
|
1008
|
+
*
|
|
1009
|
+
* return cleanup;
|
|
1010
|
+
* }, [navigation]);
|
|
1011
|
+
*
|
|
1012
|
+
* const showAd = useCallback(() => {
|
|
1013
|
+
* if (GoogleAdMob.showAppsInTossAdMob.isSupported() !== true) {
|
|
1014
|
+
* return;
|
|
1015
|
+
* }
|
|
1016
|
+
*
|
|
1017
|
+
* GoogleAdMob.showAppsInTossAdMob({
|
|
1018
|
+
* options: {
|
|
1019
|
+
* adGroupId: AD_GROUP_ID,
|
|
1020
|
+
* },
|
|
1021
|
+
* onEvent: (event) => {
|
|
1022
|
+
* switch (event.type) {
|
|
1023
|
+
* case 'requested':
|
|
1024
|
+
* console.log('광고 보여주기 요청 완료');
|
|
1025
|
+
* break;
|
|
839
1026
|
*
|
|
840
1027
|
* case 'clicked':
|
|
841
1028
|
* console.log('광고 클릭');
|
|
@@ -843,6 +1030,7 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
|
|
|
843
1030
|
*
|
|
844
1031
|
* case 'dismissed':
|
|
845
1032
|
* console.log('광고 닫힘');
|
|
1033
|
+
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
846
1034
|
* break;
|
|
847
1035
|
*
|
|
848
1036
|
* case 'failedToShow':
|
|
@@ -853,37 +1041,157 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
|
|
|
853
1041
|
* console.log('광고 노출');
|
|
854
1042
|
* break;
|
|
855
1043
|
*
|
|
856
|
-
* case '
|
|
857
|
-
* console.log('광고
|
|
1044
|
+
* case 'userEarnedReward':
|
|
1045
|
+
* console.log('광고 보상 획득 unitType:', event.data.unitType);
|
|
1046
|
+
* console.log('광고 보상 획득 unitAmount:', event.data.unitAmount);
|
|
858
1047
|
* break;
|
|
859
1048
|
*
|
|
860
|
-
* case '
|
|
861
|
-
* console.log('
|
|
1049
|
+
* case 'show':
|
|
1050
|
+
* console.log('광고 컨텐츠 보여졌음');
|
|
862
1051
|
* break;
|
|
863
1052
|
* }
|
|
864
1053
|
* },
|
|
865
1054
|
* onError: (error) => {
|
|
866
|
-
* console.error('광고
|
|
1055
|
+
* console.error('광고 보여주기 실패', error);
|
|
867
1056
|
* },
|
|
868
1057
|
* });
|
|
869
|
-
*
|
|
870
|
-
* return cleanup;
|
|
871
1058
|
* }, []);
|
|
872
1059
|
*
|
|
873
|
-
*
|
|
874
|
-
* if (GoogleAdMob.showAdMobRewardedAd.isSupported() !== true) {
|
|
875
|
-
* return;
|
|
876
|
-
* }
|
|
1060
|
+
* useFocusEffect(loadAd);
|
|
877
1061
|
*
|
|
878
|
-
*
|
|
1062
|
+
* return (
|
|
1063
|
+
* <View>
|
|
1064
|
+
* <Text>
|
|
1065
|
+
* {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
|
|
1066
|
+
* {adLoadStatus === 'loaded' && '광고 로드 완료'}
|
|
1067
|
+
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
1068
|
+
* </Text>
|
|
1069
|
+
*
|
|
1070
|
+
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
1071
|
+
* </View>
|
|
1072
|
+
* );
|
|
1073
|
+
* }
|
|
1074
|
+
* ```
|
|
1075
|
+
*/
|
|
1076
|
+
declare function showAdMobRewardedAd(params: ShowAdMobRewardedAdParams): () => void;
|
|
1077
|
+
declare namespace showAdMobRewardedAd {
|
|
1078
|
+
var isSupported: () => boolean;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
interface LoadAdMobOptions {
|
|
1082
|
+
/**
|
|
1083
|
+
* 광고 그룹 단위 ID
|
|
1084
|
+
*/
|
|
1085
|
+
adGroupId: string;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* @public
|
|
1089
|
+
* @category 광고
|
|
1090
|
+
* @name LoadAdMobEvent
|
|
1091
|
+
* @description 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [AdMobLoadResult](/react-native/reference/native-modules/광고/AdMobLoadResult.html) 객체가 함께 반환돼요.
|
|
1092
|
+
*/
|
|
1093
|
+
type LoadAdMobEvent = {
|
|
1094
|
+
type: 'loaded';
|
|
1095
|
+
data: AdMobLoadResult;
|
|
1096
|
+
};
|
|
1097
|
+
/**
|
|
1098
|
+
* @public
|
|
1099
|
+
* @category 광고
|
|
1100
|
+
* @name LoadAdMobParams
|
|
1101
|
+
* @description 광고를 불러오는 함수에 필요한 옵션 객체예요.
|
|
1102
|
+
*/
|
|
1103
|
+
type LoadAdMobParams = AdMobHandlerParams<LoadAdMobOptions, LoadAdMobEvent>;
|
|
1104
|
+
/**
|
|
1105
|
+
* @public
|
|
1106
|
+
* @category 광고
|
|
1107
|
+
* @name loadAppsInTossAdMob
|
|
1108
|
+
* @description 광고를 미리 불러와서, 광고가 필요한 시점에 바로 보여줄 수 있도록 준비하는 함수예요.
|
|
1109
|
+
* @param {LoadAdMobParams} params 광고를 불러올 때 사용할 설정 값이에요. 광고 그룹 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
1110
|
+
* @param {LoadAdMobOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요.
|
|
1111
|
+
* @param {string} params.options.adGroupId 광고 그룹 단위 ID예요. 콘솔에서 발급받은 ID를 입력해요.
|
|
1112
|
+
* @param {(event: LoadAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobEvent](/react-native/reference/native-modules/광고/LoadAdMobEvent.html)를 참고하세요.
|
|
1113
|
+
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
1114
|
+
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
1115
|
+
*
|
|
1116
|
+
* @example
|
|
1117
|
+
* ### 버튼 눌러 불러온 광고 보여주기
|
|
1118
|
+
* ```tsx
|
|
1119
|
+
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
1120
|
+
* import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
|
|
1121
|
+
* import { useCallback, useState } from 'react';
|
|
1122
|
+
* import { Button, Text, View } from 'react-native';
|
|
1123
|
+
* import { useNavigation } from 'react-native-bedrock';
|
|
1124
|
+
*
|
|
1125
|
+
* const AD_GROUP_ID = '<AD_GROUP_ID>';
|
|
1126
|
+
*
|
|
1127
|
+
* export function GoogleAdmobExample() {
|
|
1128
|
+
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
1129
|
+
* const navigation = useNavigation();
|
|
1130
|
+
*
|
|
1131
|
+
* const loadAd = useCallback(() => {
|
|
1132
|
+
* if (GoogleAdMob.loadAppsInTossAdMob.isSupported() !== true) {
|
|
1133
|
+
* return;
|
|
1134
|
+
* }
|
|
1135
|
+
|
|
1136
|
+
* const cleanup = GoogleAdMob.loadAppsInTossAdMob({
|
|
1137
|
+
* options: {
|
|
1138
|
+
* adGroupId: AD_GROUP_ID,
|
|
1139
|
+
* },
|
|
1140
|
+
* onEvent: (event) => {
|
|
1141
|
+
* switch (event.type) {
|
|
1142
|
+
* case 'loaded':
|
|
1143
|
+
* console.log('광고 로드 성공', event.data);
|
|
1144
|
+
* setAdLoadStatus('loaded');
|
|
1145
|
+
* break;
|
|
1146
|
+
* }
|
|
1147
|
+
* },
|
|
1148
|
+
* onError: (error) => {
|
|
1149
|
+
* console.error('광고 불러오기 실패', error);
|
|
1150
|
+
* },
|
|
1151
|
+
* });
|
|
1152
|
+
*
|
|
1153
|
+
* return cleanup;
|
|
1154
|
+
* }, [navigation]);
|
|
1155
|
+
*
|
|
1156
|
+
* const showAd = useCallback(() => {
|
|
1157
|
+
* if (GoogleAdMob.showAppsInTossAdMob.isSupported() !== true) {
|
|
1158
|
+
* return;
|
|
1159
|
+
* }
|
|
1160
|
+
*
|
|
1161
|
+
* GoogleAdMob.showAppsInTossAdMob({
|
|
879
1162
|
* options: {
|
|
880
|
-
*
|
|
1163
|
+
* adGroupId: AD_GROUP_ID,
|
|
881
1164
|
* },
|
|
882
1165
|
* onEvent: (event) => {
|
|
883
1166
|
* switch (event.type) {
|
|
884
1167
|
* case 'requested':
|
|
885
1168
|
* console.log('광고 보여주기 요청 완료');
|
|
886
|
-
*
|
|
1169
|
+
* break;
|
|
1170
|
+
*
|
|
1171
|
+
* case 'clicked':
|
|
1172
|
+
* console.log('광고 클릭');
|
|
1173
|
+
* break;
|
|
1174
|
+
*
|
|
1175
|
+
* case 'dismissed':
|
|
1176
|
+
* console.log('광고 닫힘');
|
|
1177
|
+
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
1178
|
+
* break;
|
|
1179
|
+
*
|
|
1180
|
+
* case 'failedToShow':
|
|
1181
|
+
* console.log('광고 보여주기 실패');
|
|
1182
|
+
* break;
|
|
1183
|
+
*
|
|
1184
|
+
* case 'impression':
|
|
1185
|
+
* console.log('광고 노출');
|
|
1186
|
+
* break;
|
|
1187
|
+
*
|
|
1188
|
+
* case 'userEarnedReward':
|
|
1189
|
+
* console.log('광고 보상 획득 unitType:', event.data.unitType);
|
|
1190
|
+
* console.log('광고 보상 획득 unitAmount:', event.data.unitAmount);
|
|
1191
|
+
* break;
|
|
1192
|
+
*
|
|
1193
|
+
* case 'show':
|
|
1194
|
+
* console.log('광고 컨텐츠 보여졌음');
|
|
887
1195
|
* break;
|
|
888
1196
|
* }
|
|
889
1197
|
* },
|
|
@@ -893,6 +1201,8 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
|
|
|
893
1201
|
* });
|
|
894
1202
|
* }, []);
|
|
895
1203
|
*
|
|
1204
|
+
* useFocusEffect(loadAd);
|
|
1205
|
+
*
|
|
896
1206
|
* return (
|
|
897
1207
|
* <View>
|
|
898
1208
|
* <Text>
|
|
@@ -901,15 +1211,156 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
|
|
|
901
1211
|
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
902
1212
|
* </Text>
|
|
903
1213
|
*
|
|
904
|
-
* <Button title="Load Ad" onPress={loadAd} />
|
|
905
1214
|
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
906
1215
|
* </View>
|
|
907
1216
|
* );
|
|
908
1217
|
* }
|
|
909
1218
|
* ```
|
|
910
1219
|
*/
|
|
911
|
-
declare function
|
|
912
|
-
declare namespace
|
|
1220
|
+
declare function loadAppsInTossAdMob(params: LoadAdMobParams): () => void;
|
|
1221
|
+
declare namespace loadAppsInTossAdMob {
|
|
1222
|
+
var isSupported: () => boolean;
|
|
1223
|
+
}
|
|
1224
|
+
interface ShowAdMobOptions {
|
|
1225
|
+
/**
|
|
1226
|
+
* 광고 그룹 단위 ID
|
|
1227
|
+
*/
|
|
1228
|
+
adGroupId: string;
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* @public
|
|
1232
|
+
* @category 광고
|
|
1233
|
+
* @name ShowAdMobEvent
|
|
1234
|
+
* @description 광고를 보여주는 함수에서 발생하는 이벤트 타입이에요. `requested` 이벤트가 발생하면 광고 노출 요청이 Google AdMob에 성공적으로 전달된 거예요.
|
|
1235
|
+
*/
|
|
1236
|
+
type ShowAdMobEvent = AdMobFullScreenEvent | AdUserEarnedReward | {
|
|
1237
|
+
type: 'requested';
|
|
1238
|
+
};
|
|
1239
|
+
/**
|
|
1240
|
+
* @public
|
|
1241
|
+
* @category 광고
|
|
1242
|
+
* @name ShowAdMobParams
|
|
1243
|
+
* @description 불러온 광고를 보여주는 함수에 필요한 옵션 객체예요.
|
|
1244
|
+
*/
|
|
1245
|
+
type ShowAdMobParams = AdMobHandlerParams<ShowAdMobOptions, ShowAdMobEvent>;
|
|
1246
|
+
/**
|
|
1247
|
+
* @public
|
|
1248
|
+
* @category 광고
|
|
1249
|
+
* @name showAppsInTossAdMob
|
|
1250
|
+
* @description 광고를 사용자에게 노출해요. 이 함수는 `loadAppsInTossAdMob` 로 미리 불러온 광고를 실제로 사용자에게 노출해요.
|
|
1251
|
+
* @param {ShowAdMobParams} params 광고를 보여주기 위해 사용할 설정 값이에요. 광고 그룹 ID와과 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
1252
|
+
* @param {ShowAdMobOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요.
|
|
1253
|
+
* @param {string} params.options.adUnitId 광고 그룹 단위 ID예요. `loadAppsInTossAdMob` 로 불러온 광고용 그룹 ID를 입력해요.
|
|
1254
|
+
* @param {(event: ShowAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobEvent](/react-native/reference/native-modules/광고/ShowAdMobEvent.html)를 참고하세요.
|
|
1255
|
+
* @param {(reason: unknown) => void} [params.onError] 광고를 노출하지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
1256
|
+
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
1257
|
+
*
|
|
1258
|
+
* @example
|
|
1259
|
+
* ### 버튼 눌러 불러온 광고 보여주기
|
|
1260
|
+
* ```tsx
|
|
1261
|
+
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
1262
|
+
* import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
|
|
1263
|
+
* import { useCallback, useState } from 'react';
|
|
1264
|
+
* import { Button, Text, View } from 'react-native';
|
|
1265
|
+
* import { useNavigation } from 'react-native-bedrock';
|
|
1266
|
+
*
|
|
1267
|
+
* const AD_GROUP_ID = '<AD_GROUP_ID>';
|
|
1268
|
+
*
|
|
1269
|
+
* export function GoogleAdmobExample() {
|
|
1270
|
+
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
1271
|
+
* const navigation = useNavigation();
|
|
1272
|
+
*
|
|
1273
|
+
* const loadAd = useCallback(() => {
|
|
1274
|
+
* if (GoogleAdMob.loadAppsInTossAdMob.isSupported() !== true) {
|
|
1275
|
+
* return;
|
|
1276
|
+
* }
|
|
1277
|
+
|
|
1278
|
+
* const cleanup = GoogleAdMob.loadAppsInTossAdMob({
|
|
1279
|
+
* options: {
|
|
1280
|
+
* adGroupId: AD_GROUP_ID,
|
|
1281
|
+
* },
|
|
1282
|
+
* onEvent: (event) => {
|
|
1283
|
+
* switch (event.type) {
|
|
1284
|
+
* case 'loaded':
|
|
1285
|
+
* console.log('광고 로드 성공', event.data);
|
|
1286
|
+
* setAdLoadStatus('loaded');
|
|
1287
|
+
* break;
|
|
1288
|
+
* }
|
|
1289
|
+
* },
|
|
1290
|
+
* onError: (error) => {
|
|
1291
|
+
* console.error('광고 불러오기 실패', error);
|
|
1292
|
+
* },
|
|
1293
|
+
* });
|
|
1294
|
+
*
|
|
1295
|
+
* return cleanup;
|
|
1296
|
+
* }, [navigation]);
|
|
1297
|
+
*
|
|
1298
|
+
* const showAd = useCallback(() => {
|
|
1299
|
+
* if (GoogleAdMob.showAppsInTossAdMob.isSupported() !== true) {
|
|
1300
|
+
* return;
|
|
1301
|
+
* }
|
|
1302
|
+
*
|
|
1303
|
+
* GoogleAdMob.showAppsInTossAdMob({
|
|
1304
|
+
* options: {
|
|
1305
|
+
* adGroupId: AD_GROUP_ID,
|
|
1306
|
+
* },
|
|
1307
|
+
* onEvent: (event) => {
|
|
1308
|
+
* switch (event.type) {
|
|
1309
|
+
* case 'requested':
|
|
1310
|
+
* console.log('광고 보여주기 요청 완료');
|
|
1311
|
+
* break;
|
|
1312
|
+
*
|
|
1313
|
+
* case 'clicked':
|
|
1314
|
+
* console.log('광고 클릭');
|
|
1315
|
+
* break;
|
|
1316
|
+
*
|
|
1317
|
+
* case 'dismissed':
|
|
1318
|
+
* console.log('광고 닫힘');
|
|
1319
|
+
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
1320
|
+
* break;
|
|
1321
|
+
*
|
|
1322
|
+
* case 'failedToShow':
|
|
1323
|
+
* console.log('광고 보여주기 실패');
|
|
1324
|
+
* break;
|
|
1325
|
+
*
|
|
1326
|
+
* case 'impression':
|
|
1327
|
+
* console.log('광고 노출');
|
|
1328
|
+
* break;
|
|
1329
|
+
*
|
|
1330
|
+
* case 'userEarnedReward':
|
|
1331
|
+
* console.log('광고 보상 획득 unitType:', event.data.unitType);
|
|
1332
|
+
* console.log('광고 보상 획득 unitAmount:', event.data.unitAmount);
|
|
1333
|
+
* break;
|
|
1334
|
+
*
|
|
1335
|
+
* case 'show':
|
|
1336
|
+
* console.log('광고 컨텐츠 보여졌음');
|
|
1337
|
+
* break;
|
|
1338
|
+
* }
|
|
1339
|
+
* },
|
|
1340
|
+
* onError: (error) => {
|
|
1341
|
+
* console.error('광고 보여주기 실패', error);
|
|
1342
|
+
* },
|
|
1343
|
+
* });
|
|
1344
|
+
* }, []);
|
|
1345
|
+
*
|
|
1346
|
+
* useFocusEffect(loadAd);
|
|
1347
|
+
*
|
|
1348
|
+
* return (
|
|
1349
|
+
* <View>
|
|
1350
|
+
* <Text>
|
|
1351
|
+
* {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
|
|
1352
|
+
* {adLoadStatus === 'loaded' && '광고 로드 완료'}
|
|
1353
|
+
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
1354
|
+
* </Text>
|
|
1355
|
+
*
|
|
1356
|
+
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
1357
|
+
* </View>
|
|
1358
|
+
* );
|
|
1359
|
+
* }
|
|
1360
|
+
* ```
|
|
1361
|
+
*/
|
|
1362
|
+
declare function showAppsInTossAdMob(params: ShowAdMobParams): () => void;
|
|
1363
|
+
declare namespace showAppsInTossAdMob {
|
|
913
1364
|
var isSupported: () => boolean;
|
|
914
1365
|
}
|
|
915
1366
|
|
|
@@ -1177,7 +1628,7 @@ interface GetCurrentLocationOptions {
|
|
|
1177
1628
|
*
|
|
1178
1629
|
* @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
|
|
1179
1630
|
* @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
|
|
1180
|
-
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/
|
|
1631
|
+
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/native-modules/Types/Location.html)을 참고해주세요.
|
|
1181
1632
|
*
|
|
1182
1633
|
* @example
|
|
1183
1634
|
* ### 디바이스의 현재 위치 정보 가져오기
|
|
@@ -1215,51 +1666,293 @@ interface GetCurrentLocationOptions {
|
|
|
1215
1666
|
*/
|
|
1216
1667
|
declare function getCurrentLocation(options: GetCurrentLocationOptions): Promise<Location>;
|
|
1217
1668
|
|
|
1218
|
-
interface OpenCameraOptions {
|
|
1219
|
-
/**
|
|
1220
|
-
* 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요.
|
|
1221
|
-
*
|
|
1222
|
-
* 기본값: `false`.
|
|
1223
|
-
*/
|
|
1224
|
-
base64?: boolean;
|
|
1225
|
-
/**
|
|
1226
|
-
* 이미지의 최대 너비를 나타내는 숫자 값이에요.
|
|
1227
|
-
*
|
|
1228
|
-
* 기본값: `1024`.
|
|
1229
|
-
*/
|
|
1230
|
-
maxWidth?: number;
|
|
1231
|
-
}
|
|
1232
1669
|
/**
|
|
1233
|
-
* @
|
|
1234
|
-
* @
|
|
1235
|
-
* @
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
* @
|
|
1239
|
-
* @
|
|
1240
|
-
* @
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1670
|
+
* @category 게임센터
|
|
1671
|
+
* @name GameCenterGameProfileResponse
|
|
1672
|
+
* @description 토스게임센터 프로필을 가져온 결과 타입이에요.
|
|
1673
|
+
* 앱에 프로필이 없는 경우, `statusCode`가 `'PROFILE_NOT_FOUND'`이고 다른 정보는 없어요.
|
|
1674
|
+
* 프로필이 있는 경우 `statusCode`가 `'SUCCESS'`이고, 닉네임과 프로필 이미지 주소가 함께 제공돼요.
|
|
1675
|
+
* @property {string} statusCode 프로필 조회 결과 상태예요. `'SUCCESS'` 또는 `'PROFILE_NOT_FOUND'` 중 하나예요.
|
|
1676
|
+
* @property {string} [nickname] 프로필 닉네임이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
|
|
1677
|
+
* @property {string} [profileImageUri] 프로필 이미지 URL이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
|
|
1678
|
+
*/
|
|
1679
|
+
type GameCenterGameProfileResponse = {
|
|
1680
|
+
statusCode: 'PROFILE_NOT_FOUND';
|
|
1681
|
+
} | {
|
|
1682
|
+
statusCode: 'SUCCESS';
|
|
1683
|
+
nickname: string;
|
|
1684
|
+
profileImageUri: string;
|
|
1685
|
+
};
|
|
1686
|
+
/**
|
|
1687
|
+
* @category 게임센터
|
|
1688
|
+
* @name getGameCenterGameProfile
|
|
1689
|
+
* @description 토스게임센터 프로필 정보를 가져와요.
|
|
1690
|
+
* 사용자가 프로필을 만들지 않았다면 `statusCode`가 `'PROFILE_NOT_FOUND'`인 응답이 반환돼요.
|
|
1691
|
+
* 앱 버전이 최소 지원 버전(안드로이드 5.221.0, iOS 5.221.0)보다 낮으면 `undefined`를 반환해요.
|
|
1692
|
+
* @returns {Promise<GameCenterGameProfileResponse | undefined>} 프로필 정보 또는 `undefined`를 반환해요.
|
|
1244
1693
|
*
|
|
1245
1694
|
* @example
|
|
1246
|
-
* ###
|
|
1247
|
-
*
|
|
1695
|
+
* ### 게임센터 프로필 가져오기
|
|
1248
1696
|
* ```tsx
|
|
1249
|
-
* import
|
|
1250
|
-
* import {
|
|
1251
|
-
* import {
|
|
1697
|
+
* import { getGameCenterGameProfile } from './getGameCenterGameProfile';
|
|
1698
|
+
* import { useState } from 'react';
|
|
1699
|
+
* import { View, Button } from 'react-native';
|
|
1252
1700
|
*
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
* // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
|
|
1256
|
-
* function Camera() {
|
|
1257
|
-
* const [image, setImage] = useState(null);
|
|
1701
|
+
* function GameProfile() {
|
|
1702
|
+
* const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);
|
|
1258
1703
|
*
|
|
1259
1704
|
* const handlePress = async () => {
|
|
1260
1705
|
* try {
|
|
1261
|
-
* const
|
|
1262
|
-
*
|
|
1706
|
+
* const result = await getGameCenterGameProfile();
|
|
1707
|
+
* if (result) {
|
|
1708
|
+
* setProfile(result);
|
|
1709
|
+
* }
|
|
1710
|
+
* } catch (error) {
|
|
1711
|
+
* console.error('게임센터 프로필 가져오기에 실패했어요.', error);
|
|
1712
|
+
* }
|
|
1713
|
+
* };
|
|
1714
|
+
*
|
|
1715
|
+
* return (
|
|
1716
|
+
* <View>
|
|
1717
|
+
* <Button title="게임센터 프로필 가져오기" onPress={handlePress} />
|
|
1718
|
+
* </View>
|
|
1719
|
+
* );
|
|
1720
|
+
* }
|
|
1721
|
+
* ```
|
|
1722
|
+
*/
|
|
1723
|
+
declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* @public
|
|
1727
|
+
* @category 인앱결제
|
|
1728
|
+
* @name IapCreateOneTimePurchaseOrderOptions
|
|
1729
|
+
* @description 인앱결제 1건을 요청할 때 필요한 정보예요.
|
|
1730
|
+
* @property {string} productId - 주문할 상품의 ID예요.
|
|
1731
|
+
*/
|
|
1732
|
+
interface IapCreateOneTimePurchaseOrderOptions {
|
|
1733
|
+
productId: string;
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* @public
|
|
1737
|
+
* @category 인앱결제
|
|
1738
|
+
* @name IapCreateOneTimePurchaseOrderResult
|
|
1739
|
+
* @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
|
|
1740
|
+
* @property {string} orderId - 결제 주문 ID이에요. 결제 완료 후 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 때 사용해요.
|
|
1741
|
+
* @property {string} displayName - 화면에 표시할 상품 이름이에요.
|
|
1742
|
+
* @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
|
|
1743
|
+
* @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
|
|
1744
|
+
* @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
|
|
1745
|
+
* @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
|
|
1746
|
+
* @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
|
|
1747
|
+
*/
|
|
1748
|
+
interface IapCreateOneTimePurchaseOrderResult {
|
|
1749
|
+
orderId: string;
|
|
1750
|
+
displayName: string;
|
|
1751
|
+
displayAmount: string;
|
|
1752
|
+
amount: number;
|
|
1753
|
+
currency: string;
|
|
1754
|
+
fraction: number;
|
|
1755
|
+
miniAppIconUrl: string | null;
|
|
1756
|
+
}
|
|
1757
|
+
/**
|
|
1758
|
+
* @public
|
|
1759
|
+
* @category 인앱결제
|
|
1760
|
+
* @name iapCreateOneTimePurchaseOrder
|
|
1761
|
+
* @description
|
|
1762
|
+
* 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
|
|
1763
|
+
* @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
|
|
1764
|
+
* @param {string} params.productId - 주문할 상품의 ID예요.
|
|
1765
|
+
* @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
|
|
1766
|
+
*
|
|
1767
|
+
* @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
|
|
1768
|
+
* @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
|
|
1769
|
+
* @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
|
|
1770
|
+
* @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요.
|
|
1771
|
+
* @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요.
|
|
1772
|
+
* @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요.
|
|
1773
|
+
* @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요.
|
|
1774
|
+
* @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
|
|
1775
|
+
* @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
|
|
1776
|
+
* @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
|
|
1777
|
+
*
|
|
1778
|
+
* @example
|
|
1779
|
+
* ### 특정 인앱결제 주문서 페이지로 이동하기
|
|
1780
|
+
*
|
|
1781
|
+
* ```tsx
|
|
1782
|
+
* import { IAP } from "@apps-in-toss/web-framework";
|
|
1783
|
+
* import { Button } from "@toss-design-system/react-native";
|
|
1784
|
+
*
|
|
1785
|
+
* interface Props {
|
|
1786
|
+
* productId: string;
|
|
1787
|
+
* }
|
|
1788
|
+
*
|
|
1789
|
+
* function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
|
|
1790
|
+
* async function handleClick() {
|
|
1791
|
+
* try {
|
|
1792
|
+
* await IAP.createOneTimePurchaseOrder({
|
|
1793
|
+
* productId,
|
|
1794
|
+
* });
|
|
1795
|
+
* console.error("인앱결제에 성공했어요");
|
|
1796
|
+
* } catch (error) {
|
|
1797
|
+
* console.error('인앱결제에 실패했어요:', error);
|
|
1798
|
+
* }
|
|
1799
|
+
* }
|
|
1800
|
+
*
|
|
1801
|
+
* return <Button onClick={handleClick}>구매하기</Button>;
|
|
1802
|
+
* }
|
|
1803
|
+
* ```
|
|
1804
|
+
*/
|
|
1805
|
+
declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): Promise<IapCreateOneTimePurchaseOrderResult | undefined>;
|
|
1806
|
+
/**
|
|
1807
|
+
* @public
|
|
1808
|
+
* @category 인앱결제
|
|
1809
|
+
* @name IapProductListItem
|
|
1810
|
+
* @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
|
|
1811
|
+
* @property {string} sku - 상품의 고유 ID예요. [IAP.createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html)를 호출할때 사용하는 `productId`와 동일한 값이에요.
|
|
1812
|
+
* @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
|
|
1813
|
+
* @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
|
|
1814
|
+
* @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
|
|
1815
|
+
* @property {string} description - 상품에 대한 설명이에요. 설명은 앱인토스 콘솔에서 설정한 값이에요.
|
|
1816
|
+
*/
|
|
1817
|
+
interface IapProductListItem {
|
|
1818
|
+
sku: string;
|
|
1819
|
+
displayAmount: string;
|
|
1820
|
+
displayName: string;
|
|
1821
|
+
iconUrl: string;
|
|
1822
|
+
description: string;
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* @public
|
|
1826
|
+
* @category 인앱결제
|
|
1827
|
+
* @name iapGetProductItemList
|
|
1828
|
+
* @description 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 상품 목록 화면에 진입할 때 호출해요.
|
|
1829
|
+
* @returns {Promise<{ products: IapProductListItem[] } | undefined>} 상품 목록을 포함한 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 `undefined`를 반환해요.
|
|
1830
|
+
*
|
|
1831
|
+
* @example
|
|
1832
|
+
* ### 구매 가능한 인앱결제 상품목록 가져오기
|
|
1833
|
+
*
|
|
1834
|
+
* ```tsx
|
|
1835
|
+
* import { IAP, IapProductListItem } from "@apps-in-toss/framework";
|
|
1836
|
+
* import { Button, List, ListRow } from "@toss-design-system/react-native";
|
|
1837
|
+
* import { useEffect, useState } from "react";
|
|
1838
|
+
*
|
|
1839
|
+
* function IapProductList() {
|
|
1840
|
+
* const [products, setProducts] = useState<IapProductListItem[]>([]);
|
|
1841
|
+
*
|
|
1842
|
+
* async function buyIapProduct(productId: string) {
|
|
1843
|
+
* try {
|
|
1844
|
+
* await IAP.createOneTimePurchaseOrder({
|
|
1845
|
+
* productId,
|
|
1846
|
+
* });
|
|
1847
|
+
*
|
|
1848
|
+
* console.error("인앱결제에 성공했어요");
|
|
1849
|
+
* } catch (error) {
|
|
1850
|
+
* console.error("인앱결제에 실패했어요:", error);
|
|
1851
|
+
* }
|
|
1852
|
+
* }
|
|
1853
|
+
*
|
|
1854
|
+
* useEffect(() => {
|
|
1855
|
+
* async function fetchProducts() {
|
|
1856
|
+
* try {
|
|
1857
|
+
* const response = await IAP.getProductItemList();
|
|
1858
|
+
* setProducts(response?.products ?? []);
|
|
1859
|
+
* } catch (error) {
|
|
1860
|
+
* console.error("상품 목록을 가져오는 데 실패했어요:", error);
|
|
1861
|
+
* }
|
|
1862
|
+
* }
|
|
1863
|
+
*
|
|
1864
|
+
* fetchProducts();
|
|
1865
|
+
* }, []);
|
|
1866
|
+
*
|
|
1867
|
+
* return (
|
|
1868
|
+
* <List>
|
|
1869
|
+
* {products.map((product) => (
|
|
1870
|
+
* <ListRow
|
|
1871
|
+
* key={product.sku}
|
|
1872
|
+
* left={
|
|
1873
|
+
* <ListRow.Image type="square" source={{ uri: product.iconUrl }} />
|
|
1874
|
+
* }
|
|
1875
|
+
* right={
|
|
1876
|
+
* <Button size="medium" onPress={() => buyIapProduct(product.sku)}>
|
|
1877
|
+
* 구매하기
|
|
1878
|
+
* </Button>
|
|
1879
|
+
* }
|
|
1880
|
+
* contents={
|
|
1881
|
+
* <ListRow.Texts
|
|
1882
|
+
* type="3RowTypeA"
|
|
1883
|
+
* top={product.displayName}
|
|
1884
|
+
* middle={product.description}
|
|
1885
|
+
* bottom={product.displayAmount}
|
|
1886
|
+
* />
|
|
1887
|
+
* }
|
|
1888
|
+
* />
|
|
1889
|
+
* ))}
|
|
1890
|
+
* </List>
|
|
1891
|
+
* );
|
|
1892
|
+
* }
|
|
1893
|
+
* ```
|
|
1894
|
+
*/
|
|
1895
|
+
declare function getProductItemList(): Promise<{
|
|
1896
|
+
products: IapProductListItem[];
|
|
1897
|
+
} | undefined>;
|
|
1898
|
+
/**
|
|
1899
|
+
* @public
|
|
1900
|
+
* @category 인앱결제
|
|
1901
|
+
* @name IAP
|
|
1902
|
+
* @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
|
|
1903
|
+
* @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
|
|
1904
|
+
* @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
|
|
1905
|
+
*/
|
|
1906
|
+
declare const IAP: {
|
|
1907
|
+
createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
|
|
1908
|
+
getProductItemList: typeof getProductItemList;
|
|
1909
|
+
};
|
|
1910
|
+
|
|
1911
|
+
interface OpenCameraOptions {
|
|
1912
|
+
/**
|
|
1913
|
+
* 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요.
|
|
1914
|
+
*
|
|
1915
|
+
* 기본값: `false`.
|
|
1916
|
+
*/
|
|
1917
|
+
base64?: boolean;
|
|
1918
|
+
/**
|
|
1919
|
+
* 이미지의 최대 너비를 나타내는 숫자 값이에요.
|
|
1920
|
+
*
|
|
1921
|
+
* 기본값: `1024`.
|
|
1922
|
+
*/
|
|
1923
|
+
maxWidth?: number;
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* @public
|
|
1927
|
+
* @category 카메라
|
|
1928
|
+
* @name openCamera
|
|
1929
|
+
* @description 카메라를 실행해서 촬영된 이미지를 반환하는 함수예요.
|
|
1930
|
+
* @param {OpenCameraOptions} options - 카메라 실행 시 사용되는 옵션 객체예요.
|
|
1931
|
+
* @param {boolean} [options.base64=false] - 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요. 기본값은 `false`예요. `true`로 설정하면 `dataUri` 대신 Base64 인코딩된 문자열을 반환해요.
|
|
1932
|
+
* @param {number} [options.maxWidth=1024] - 이미지의 최대 너비를 나타내는 숫자 값이에요. 기본값은 `1024`예요.
|
|
1933
|
+
* @returns {Promise<ImageResponse>}
|
|
1934
|
+
* 촬영된 이미지 정보를 포함한 객체를 반환해요. 반환 객체의 구성은 다음과 같아요:
|
|
1935
|
+
* - `id`: 이미지의 고유 식별자예요.
|
|
1936
|
+
* - `dataUri`: 이미지 데이터를 표현하는 데이터 URI예요.
|
|
1937
|
+
*
|
|
1938
|
+
* @example
|
|
1939
|
+
* ### 카메라 실행 후 촬영된 사진 가져오기
|
|
1940
|
+
*
|
|
1941
|
+
* ```tsx
|
|
1942
|
+
* import React, { useState } from 'react';
|
|
1943
|
+
* import { View, Text, Button, Image } from 'react-native';
|
|
1944
|
+
* import { openCamera } from '@apps-in-toss/framework';
|
|
1945
|
+
*
|
|
1946
|
+
* const base64 = true;
|
|
1947
|
+
*
|
|
1948
|
+
* // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
|
|
1949
|
+
* function Camera() {
|
|
1950
|
+
* const [image, setImage] = useState(null);
|
|
1951
|
+
*
|
|
1952
|
+
* const handlePress = async () => {
|
|
1953
|
+
* try {
|
|
1954
|
+
* const response = await openCamera({ base64 });
|
|
1955
|
+
* setImage(response);
|
|
1263
1956
|
* } catch (error) {
|
|
1264
1957
|
* console.error('사진을 가져오는 데 실패했어요:', error);
|
|
1265
1958
|
* }
|
|
@@ -1325,6 +2018,69 @@ interface SaveBase64DataParams {
|
|
|
1325
2018
|
*/
|
|
1326
2019
|
declare function saveBase64Data(params: SaveBase64DataParams): Promise<void>;
|
|
1327
2020
|
|
|
2021
|
+
/**
|
|
2022
|
+
* @public
|
|
2023
|
+
* @category 게임센터
|
|
2024
|
+
* @name SubmitGameCenterLeaderBoardScoreResponse
|
|
2025
|
+
* @description
|
|
2026
|
+
* 토스게임센터 리더보드에 점수를 제출한 결과 정보를 담아서 반환해요. 반환된 정보를 사용해서 점수 제출 결과에 따라 적절한 에러 처리를 할 수 있어요.
|
|
2027
|
+
* @property {'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE'} statusCode
|
|
2028
|
+
* 점수 제출 결과를 나타내는 상태 코드예요.
|
|
2029
|
+
* - `'SUCCESS'`: 점수 제출이 성공했어요.
|
|
2030
|
+
* - `'LEADERBOARD_NOT_FOUND'`: `gameId`에 해당하는 리더보드를 찾을 수 없어요.
|
|
2031
|
+
* - `'PROFILE_NOT_FOUND'`: 사용자의 프로필이 없어요.
|
|
2032
|
+
* - `'UNPARSABLE_SCORE'`: 점수를 해석할 수 없어요. 점수는 실수(float) 형태의 문자열로 전달해야 해요.
|
|
2033
|
+
*/
|
|
2034
|
+
interface SubmitGameCenterLeaderBoardScoreResponse {
|
|
2035
|
+
statusCode: 'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE';
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* @public
|
|
2039
|
+
* @category 게임센터
|
|
2040
|
+
* @name submitGameCenterLeaderBoardScore
|
|
2041
|
+
* @description
|
|
2042
|
+
* 사용자의 게임 점수를 토스게임센터 리더보드에 제출해요. 이 기능으로 사용자의 점수를 공식 리더보드에 기록하고 다른 사용자와 비교할 수 있어요.
|
|
2043
|
+
* @param {string} params.score
|
|
2044
|
+
* 제출할 게임 점수예요. 실수 형태의 숫자를 문자열로 전달해야 해요. 예를들어 `"123.45"` 또는 `"9999"` 예요.
|
|
2045
|
+
* @returns {Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>}
|
|
2046
|
+
* 점수 제출 결과를 반환해요. 앱 버전이 최소 지원 버전보다 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
|
|
2047
|
+
*
|
|
2048
|
+
* @example
|
|
2049
|
+
* ### 게임 점수를 토스게임센터 리더보드에 제출하기
|
|
2050
|
+
* ```tsx
|
|
2051
|
+
* import { Button } from 'react-native';
|
|
2052
|
+
* import { submitGameCenterLeaderBoardScore } from '@apps-in-toss/framework';
|
|
2053
|
+
*
|
|
2054
|
+
* function GameCenterLeaderBoardScoreSubmitButton() {
|
|
2055
|
+
* async function handlePress() {
|
|
2056
|
+
* try {
|
|
2057
|
+
* const result = await submitGameCenterLeaderBoardScore({ score: '123.45' });
|
|
2058
|
+
*
|
|
2059
|
+
* if (!result) {
|
|
2060
|
+
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
2061
|
+
* return;
|
|
2062
|
+
* }
|
|
2063
|
+
*
|
|
2064
|
+
* if (result.statusCode === 'SUCCESS') {
|
|
2065
|
+
* console.log('점수 제출 성공!');
|
|
2066
|
+
* } else {
|
|
2067
|
+
* console.error('점수 제출 실패:', result.statusCode);
|
|
2068
|
+
* }
|
|
2069
|
+
* } catch (error) {
|
|
2070
|
+
* console.error('점수 제출 중 오류가 발생했어요.', error);
|
|
2071
|
+
* }
|
|
2072
|
+
* }
|
|
2073
|
+
*
|
|
2074
|
+
* return (
|
|
2075
|
+
* <Button onPress={handlePress}>점수 제출하기</Button>
|
|
2076
|
+
* );
|
|
2077
|
+
* }
|
|
2078
|
+
* ```
|
|
2079
|
+
*/
|
|
2080
|
+
declare function submitGameCenterLeaderBoardScore(params: {
|
|
2081
|
+
score: string;
|
|
2082
|
+
}): Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;
|
|
2083
|
+
|
|
1328
2084
|
type CompatiblePlaceholderArgument = object;
|
|
1329
2085
|
/**
|
|
1330
2086
|
* TurboModule 타입 별칭 사용하는 이유?
|
|
@@ -1396,40 +2152,90 @@ interface Spec extends TurboModule {
|
|
|
1396
2152
|
type: 'portrait' | 'landscape';
|
|
1397
2153
|
}) => Promise<void>;
|
|
1398
2154
|
saveBase64Data: (params: SaveBase64DataParams) => Promise<void>;
|
|
2155
|
+
/** IAP */
|
|
2156
|
+
iapCreateOneTimePurchaseOrder: (params: IapCreateOneTimePurchaseOrderOptions) => Promise<IapCreateOneTimePurchaseOrderResult>;
|
|
2157
|
+
iapGetProductItemList: (arg: CompatiblePlaceholderArgument) => Promise<{
|
|
2158
|
+
products: IapProductListItem[];
|
|
2159
|
+
}>;
|
|
2160
|
+
getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
|
|
2161
|
+
submitGameCenterLeaderBoardScore: (params: {
|
|
2162
|
+
score: string;
|
|
2163
|
+
}) => Promise<SubmitGameCenterLeaderBoardScoreResponse>;
|
|
2164
|
+
contactsViral: (params: ContactsViralParams) => () => void;
|
|
1399
2165
|
}
|
|
1400
2166
|
declare const AppsInTossModuleInstance: any;
|
|
1401
2167
|
declare const AppsInTossModule: Spec;
|
|
1402
2168
|
|
|
1403
2169
|
/**
|
|
1404
2170
|
* @public
|
|
1405
|
-
* @category
|
|
1406
|
-
* @name
|
|
1407
|
-
* @description
|
|
1408
|
-
* @param {Promise<void>} text - 클립보드에 복사할 텍스트예요. 문자열 형식으로 입력해요.
|
|
1409
|
-
*
|
|
2171
|
+
* @category 로그인
|
|
2172
|
+
* @name appLogin
|
|
2173
|
+
* @description 토스 인증으로 로그인해요. 로그인이 완료되면 다시 토스 앱으로 이동해요.
|
|
1410
2174
|
* @example
|
|
1411
|
-
*
|
|
2175
|
+
*
|
|
2176
|
+
* ### 토스 인증을 통해 로그인을 하는 예제
|
|
1412
2177
|
*
|
|
1413
2178
|
* ```tsx
|
|
1414
2179
|
* import { Button } from 'react-native';
|
|
1415
|
-
* import {
|
|
2180
|
+
* import { appLogin } from '@apps-in-toss/framework';
|
|
1416
2181
|
*
|
|
1417
|
-
*
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1420
|
-
* try {
|
|
1421
|
-
* await setClipboardText('복사할 텍스트');
|
|
1422
|
-
* console.log('텍스트가 복사됐어요!');
|
|
1423
|
-
* } catch (error) {
|
|
1424
|
-
* console.error('텍스트 복사에 실패했어요:', error);
|
|
1425
|
-
* }
|
|
1426
|
-
* };
|
|
2182
|
+
* function Page() {
|
|
2183
|
+
* const handleLogin = async () => {
|
|
2184
|
+
* const { authorizationCode, referrer } = await appLogin();
|
|
1427
2185
|
*
|
|
1428
|
-
*
|
|
2186
|
+
* // 획득한 인가 코드(`authorizationCode`)와 `referrer`를 서버로 전달해요.
|
|
2187
|
+
* }
|
|
2188
|
+
*
|
|
2189
|
+
* return <Button title="로그인" onPress={handleLogin} />;
|
|
1429
2190
|
* }
|
|
1430
2191
|
* ```
|
|
1431
2192
|
*/
|
|
1432
|
-
declare function
|
|
2193
|
+
declare function appLogin(): Promise<{
|
|
2194
|
+
authorizationCode: string;
|
|
2195
|
+
referrer: 'DEFAULT' | 'SANDBOX';
|
|
2196
|
+
}>;
|
|
2197
|
+
|
|
2198
|
+
interface EventLogParams {
|
|
2199
|
+
log_name: string;
|
|
2200
|
+
log_type: 'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click';
|
|
2201
|
+
params: Record<string, Primitive>;
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2204
|
+
* @category 로깅
|
|
2205
|
+
* @kind function
|
|
2206
|
+
* @name eventLog
|
|
2207
|
+
* @description
|
|
2208
|
+
* 이벤트 로그를 기록하는 함수예요.
|
|
2209
|
+
*
|
|
2210
|
+
* 이 함수는 앱 내에서 발생하는 다양한 이벤트를 로깅하는 데 사용돼요. 디버깅, 정보 제공, 경고, 오류 등 다양한 유형의 로그를 기록할 수 있어요. 샌드박스 환경에서는 콘솔에 로그가 출력되고, 실제 환경에서는 로그 시스템에 기록돼요.
|
|
2211
|
+
*
|
|
2212
|
+
* @param {Object} params 로그 기록에 필요한 매개변수 객체예요.
|
|
2213
|
+
* @param {string} params.log_name 로그의 이름이에요.
|
|
2214
|
+
* @param {'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click'} params.log_type 로그의 유형이에요.
|
|
2215
|
+
* @param {Record<string, Primitive>} params.params 로그에 포함할 추가 매개변수 객체예요.
|
|
2216
|
+
*
|
|
2217
|
+
* @returns {Promise<void>} 로그 기록이 완료되면 해결되는 Promise예요.
|
|
2218
|
+
*
|
|
2219
|
+
* @example
|
|
2220
|
+
* ### 이벤트 로그 기록하기
|
|
2221
|
+
*
|
|
2222
|
+
* ```tsx
|
|
2223
|
+
* import { eventLog } from '@apps-in-toss/framework';
|
|
2224
|
+
*
|
|
2225
|
+
* function logUserAction() {
|
|
2226
|
+
* eventLog({
|
|
2227
|
+
* log_name: 'user_action',
|
|
2228
|
+
* log_type: 'info',
|
|
2229
|
+
* params: {
|
|
2230
|
+
* action: 'button_click',
|
|
2231
|
+
* screen: 'main',
|
|
2232
|
+
* userId: 12345
|
|
2233
|
+
* }
|
|
2234
|
+
* });
|
|
2235
|
+
* }
|
|
2236
|
+
* ```
|
|
2237
|
+
*/
|
|
2238
|
+
declare function eventLog(params: EventLogParams): Promise<void>;
|
|
1433
2239
|
|
|
1434
2240
|
/**
|
|
1435
2241
|
* @public
|
|
@@ -1472,32 +2278,33 @@ declare function getClipboardText(): Promise<string>;
|
|
|
1472
2278
|
|
|
1473
2279
|
/**
|
|
1474
2280
|
* @public
|
|
1475
|
-
* @category
|
|
1476
|
-
* @
|
|
1477
|
-
* @
|
|
1478
|
-
* @
|
|
2281
|
+
* @category 환경 확인
|
|
2282
|
+
* @kind function
|
|
2283
|
+
* @name getDeviceId
|
|
2284
|
+
* @description
|
|
2285
|
+
* 사용 중인 기기의 고유 식별자를 문자열로 반환해요.
|
|
1479
2286
|
*
|
|
1480
|
-
*
|
|
2287
|
+
* 이 함수는 현재 사용 중인 기기의 고유 식별자를 문자열로 반환해요. 기기별로 설정이나 데이터를 저장하거나 사용자의 기기를 식별해서 로그를 기록하고 분석하는 데 사용할 수 있어요. 같은 사용자의 여러 기기를 구분하는 데도 유용해요.
|
|
1481
2288
|
*
|
|
1482
|
-
*
|
|
1483
|
-
* import { Button } from 'react-native';
|
|
1484
|
-
* import { appLogin } from '@apps-in-toss/framework';
|
|
2289
|
+
* @returns {string} 기기의 고유 식별자를 나타내는 문자열이에요.
|
|
1485
2290
|
*
|
|
1486
|
-
*
|
|
1487
|
-
*
|
|
1488
|
-
* const { authorizationCode, referrer } = await appLogin();
|
|
2291
|
+
* @example
|
|
2292
|
+
* ### 기기 고유 식별자 가져오기
|
|
1489
2293
|
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
2294
|
+
* ```tsx
|
|
2295
|
+
* import { getDeviceId } from '@apps-in-toss/framework';
|
|
2296
|
+
* import { Text } from 'react-native';
|
|
1492
2297
|
*
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1495
|
-
*
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
2298
|
+
* function MyPage() {
|
|
2299
|
+
* const id = getDeviceId();
|
|
2300
|
+
*
|
|
2301
|
+
* return (
|
|
2302
|
+
* <Text>사용자의 기기 고유 식별자: {id}</Text>
|
|
2303
|
+
* );
|
|
2304
|
+
* }
|
|
2305
|
+
* ```
|
|
2306
|
+
*/
|
|
2307
|
+
declare function getDeviceId(): string;
|
|
1501
2308
|
|
|
1502
2309
|
/**
|
|
1503
2310
|
* @public
|
|
@@ -1565,117 +2372,34 @@ declare function getTossAppVersion(): string;
|
|
|
1565
2372
|
|
|
1566
2373
|
/**
|
|
1567
2374
|
* @public
|
|
1568
|
-
* @category
|
|
2375
|
+
* @category 공유
|
|
1569
2376
|
* @kind function
|
|
1570
|
-
* @name
|
|
2377
|
+
* @name getTossShareLink
|
|
1571
2378
|
* @description
|
|
1572
|
-
*
|
|
1573
|
-
*
|
|
1574
|
-
* 이 함수는 현재 사용 중인 기기의 고유 식별자를 문자열로 반환해요. 기기별로 설정이나 데이터를 저장하거나 사용자의 기기를 식별해서 로그를 기록하고 분석하는 데 사용할 수 있어요. 같은 사용자의 여러 기기를 구분하는 데도 유용해요.
|
|
1575
|
-
*
|
|
1576
|
-
* @returns {string} 기기의 고유 식별자를 나타내는 문자열이에요.
|
|
1577
|
-
*
|
|
1578
|
-
* @example
|
|
1579
|
-
* ### 기기 고유 식별자 가져오기
|
|
1580
|
-
*
|
|
1581
|
-
* ```tsx
|
|
1582
|
-
* import { getDeviceId } from '@apps-in-toss/framework';
|
|
1583
|
-
* import { Text } from 'react-native';
|
|
1584
|
-
*
|
|
1585
|
-
* function MyPage() {
|
|
1586
|
-
* const id = getDeviceId();
|
|
1587
|
-
*
|
|
1588
|
-
* return (
|
|
1589
|
-
* <Text>사용자의 기기 고유 식별자: {id}</Text>
|
|
1590
|
-
* );
|
|
1591
|
-
* }
|
|
1592
|
-
* ```
|
|
1593
|
-
*/
|
|
1594
|
-
declare function getDeviceId(): string;
|
|
1595
|
-
|
|
1596
|
-
/**
|
|
1597
|
-
* @public
|
|
1598
|
-
* @category 저장소
|
|
1599
|
-
* @name getItem
|
|
1600
|
-
* @description 모바일 앱의 로컬 저장소에서 문자열 데이터를 가져와요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
|
|
1601
|
-
* @param {string} key - 가져올 아이템의 키를 입력해요.
|
|
1602
|
-
* @returns {Promise<string | null>} 지정한 키에 저장된 문자열 값을 반환해요. 값이 없으면 `null`을 반환해요.
|
|
1603
|
-
* @example
|
|
1604
|
-
*
|
|
1605
|
-
* ### `my-key`에 저장된 아이템 가져오기
|
|
1606
|
-
* ```ts
|
|
1607
|
-
* const value = await Storage.getItem('my-key');
|
|
1608
|
-
* console.log(value); // 'value'
|
|
1609
|
-
* ```
|
|
1610
|
-
*/
|
|
1611
|
-
declare function getItem(key: string): Promise<string | null>;
|
|
1612
|
-
/**
|
|
1613
|
-
* @public
|
|
1614
|
-
* @category 저장소
|
|
1615
|
-
* @name setItem
|
|
1616
|
-
* @description 모바일 앱의 로컬 저장소에 문자열 데이터를 저장해요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
|
|
1617
|
-
* @param {string} key - 저장할 아이템의 키를 입력해요.
|
|
1618
|
-
* @param {string} value - 저장할 아이템의 값을 입력해요.
|
|
1619
|
-
* @returns {Promise<void>} 아이템을 성공적으로 저장하면 아무 값도 반환하지 않아요.
|
|
1620
|
-
* @example
|
|
2379
|
+
* `getTossShareLink` 함수는 사용자가 지정한 경로를 토스 앱에서 열 수 있는 공유 링크를 반환해요.
|
|
2380
|
+
* 이 링크를 다른 사람과 공유하면 토스 앱이 실행되면서 지정한 경로로 진입해요. 토스앱이 없는 사람은 iOS 일 때는 앱스토어로 이동하고, Android 일 때는 플레이스토어로 이동해요.
|
|
1621
2381
|
*
|
|
1622
|
-
*
|
|
1623
|
-
*
|
|
1624
|
-
* import { Storage } from '@apps-in-toss/framework';
|
|
2382
|
+
* 경로는 토스 앱 내부 특정 화면을 나타내는 딥링크(deep link) 형식이어야 해요.
|
|
2383
|
+
* 예를 들어 `intoss://<앱 이름>`이나 `intoss://<앱 이름>/about?name=test`처럼 작성해요.
|
|
1625
2384
|
*
|
|
1626
|
-
*
|
|
1627
|
-
* ```
|
|
1628
|
-
*/
|
|
1629
|
-
declare function setItem(key: string, value: string): Promise<void>;
|
|
1630
|
-
/**
|
|
1631
|
-
* @public
|
|
1632
|
-
* @category 저장소
|
|
1633
|
-
* @name removeItem
|
|
1634
|
-
* @description 모바일 앱의 로컬 저장소에서 특정 키에 해당하는 아이템을 삭제해요.
|
|
1635
|
-
* @param {string} key - 삭제할 아이템의 키를 입력해요.
|
|
1636
|
-
* @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않아요.
|
|
1637
|
-
* @example
|
|
2385
|
+
* 이 함수를 사용하면 `deep_link_value`를 포함한 완성된 공유 링크를 만들 수 있어요.
|
|
1638
2386
|
*
|
|
1639
|
-
*
|
|
1640
|
-
*
|
|
1641
|
-
* import { Storage } from '@apps-in-toss/framework';
|
|
2387
|
+
* @param path - 딥링크로 열고 싶은 경로예요. `intoss://`로 시작하는 문자열이어야 해요.
|
|
2388
|
+
* @returns {Promise<string>} `deep_link_value`가 포함된 토스 공유 링크를 반환해요.
|
|
1642
2389
|
*
|
|
1643
|
-
* await Storage.removeItem('my-key');
|
|
1644
|
-
* ```
|
|
1645
|
-
*/
|
|
1646
|
-
declare function removeItem(key: string): Promise<void>;
|
|
1647
|
-
/**
|
|
1648
|
-
* @public
|
|
1649
|
-
* @category 저장소
|
|
1650
|
-
* @name clearItems
|
|
1651
|
-
* @description 모바일 앱의 로컬 저장소의 모든 아이템을 삭제해요.
|
|
1652
|
-
* @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않고 저장소가 초기화돼요.
|
|
1653
2390
|
* @example
|
|
2391
|
+
* ```tsx
|
|
2392
|
+
* import { share } from '@granite-js/react-native';
|
|
2393
|
+
* import { getTossShareLink } from '@apps-in-toss/framework';
|
|
1654
2394
|
*
|
|
1655
|
-
*
|
|
1656
|
-
*
|
|
1657
|
-
* import { Storage } from '@apps-in-toss/framework';
|
|
2395
|
+
* // '/' 경로를 딥링크로 포함한 토스 공유 링크를 생성해요.
|
|
2396
|
+
* const tossLink = await getTossShareLink('intoss://my-app');
|
|
1658
2397
|
*
|
|
1659
|
-
*
|
|
2398
|
+
* // 생성한 링크를 메시지로 공유해요.
|
|
2399
|
+
* await share({ message: tossLink });
|
|
1660
2400
|
* ```
|
|
1661
2401
|
*/
|
|
1662
|
-
declare function
|
|
1663
|
-
/**
|
|
1664
|
-
* @public
|
|
1665
|
-
* @category 저장소
|
|
1666
|
-
* @name Storage
|
|
1667
|
-
* @description 네이티브의 저장소를 사용해요.
|
|
1668
|
-
* @property {typeof getItem} [getItem] 모바일 앱의 로컬 저장소에서 아이템을 가져오는 함수예요. 자세한 내용은 [getItem](/react-native/reference/framework/저장소/getItem.html)을 참고하세요.
|
|
1669
|
-
* @property {typeof setItem} [setItem] 모바일 앱의 로컬 저장소에 아이템을 저장하는 함수예요. 자세한 내용은 [setItem](/react-native/reference/framework/저장소/setItem.html)을 참고하셰요.
|
|
1670
|
-
* @property {typeof removeItem} [removeItem] 모바일 앱의 로컬 저장소에서 아이템을 삭제하는 함수예요. 자세한 내용은 [removeItem](/react-native/reference/framework/저장소/removeItem.html)을 참고하세요.
|
|
1671
|
-
* @property {typeof clearItems} [clearItems] 모바일 앱의 로컬 저장소를 초기화하는 함수예요. 자세한 내용은 [clearItems](/react-native/reference/framework/저장소/clearItems.html)을 참고하세요.
|
|
1672
|
-
*/
|
|
1673
|
-
declare const Storage: {
|
|
1674
|
-
getItem: typeof getItem;
|
|
1675
|
-
setItem: typeof setItem;
|
|
1676
|
-
removeItem: typeof removeItem;
|
|
1677
|
-
clearItems: typeof clearItems;
|
|
1678
|
-
};
|
|
2402
|
+
declare function getTossShareLink(path: string): Promise<string>;
|
|
1679
2403
|
|
|
1680
2404
|
/**
|
|
1681
2405
|
* @public
|
|
@@ -1720,78 +2444,36 @@ declare function isMinVersionSupported(minVersions: {
|
|
|
1720
2444
|
ios: `${number}.${number}.${number}` | 'always' | 'never';
|
|
1721
2445
|
}): boolean;
|
|
1722
2446
|
|
|
1723
|
-
interface EventLogParams {
|
|
1724
|
-
log_name: string;
|
|
1725
|
-
log_type: 'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click';
|
|
1726
|
-
params: Record<string, Primitive>;
|
|
1727
|
-
}
|
|
1728
2447
|
/**
|
|
1729
|
-
* @
|
|
1730
|
-
* @
|
|
1731
|
-
* @name
|
|
1732
|
-
* @description
|
|
1733
|
-
*
|
|
1734
|
-
*
|
|
1735
|
-
* 이 함수는 앱 내에서 발생하는 다양한 이벤트를 로깅하는 데 사용돼요. 디버깅, 정보 제공, 경고, 오류 등 다양한 유형의 로그를 기록할 수 있어요. 샌드박스 환경에서는 콘솔에 로그가 출력되고, 실제 환경에서는 로그 시스템에 기록돼요.
|
|
1736
|
-
*
|
|
1737
|
-
* @param {Object} params 로그 기록에 필요한 매개변수 객체예요.
|
|
1738
|
-
* @param {string} params.log_name 로그의 이름이에요.
|
|
1739
|
-
* @param {'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click'} params.log_type 로그의 유형이에요.
|
|
1740
|
-
* @param {Record<string, Primitive>} params.params 로그에 포함할 추가 매개변수 객체예요.
|
|
1741
|
-
*
|
|
1742
|
-
* @returns {Promise<void>} 로그 기록이 완료되면 해결되는 Promise예요.
|
|
2448
|
+
* @public
|
|
2449
|
+
* @category 클립보드
|
|
2450
|
+
* @name setClipboardText
|
|
2451
|
+
* @description 텍스트를 클립보드에 복사해서 사용자가 다른 곳에 붙여 넣기 할 수 있어요.
|
|
2452
|
+
* @param {Promise<void>} text - 클립보드에 복사할 텍스트예요. 문자열 형식으로 입력해요.
|
|
1743
2453
|
*
|
|
1744
2454
|
* @example
|
|
1745
|
-
* ###
|
|
2455
|
+
* ### 텍스트를 클립보드에 복사하기
|
|
1746
2456
|
*
|
|
1747
2457
|
* ```tsx
|
|
1748
|
-
* import {
|
|
2458
|
+
* import { Button } from 'react-native';
|
|
2459
|
+
* import { setClipboardText } from '@apps-in-toss/framework';
|
|
1749
2460
|
*
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
2461
|
+
* // '복사' 버튼을 누르면 "복사할 텍스트"가 클립보드에 복사돼요.
|
|
2462
|
+
* function CopyButton() {
|
|
2463
|
+
* const handleCopy = async () => {
|
|
2464
|
+
* try {
|
|
2465
|
+
* await setClipboardText('복사할 텍스트');
|
|
2466
|
+
* console.log('텍스트가 복사됐어요!');
|
|
2467
|
+
* } catch (error) {
|
|
2468
|
+
* console.error('텍스트 복사에 실패했어요:', error);
|
|
1758
2469
|
* }
|
|
1759
|
-
* }
|
|
1760
|
-
* }
|
|
1761
|
-
* ```
|
|
1762
|
-
*/
|
|
1763
|
-
declare function eventLog(params: EventLogParams): Promise<void>;
|
|
1764
|
-
|
|
1765
|
-
/**
|
|
1766
|
-
* @public
|
|
1767
|
-
* @category 공유
|
|
1768
|
-
* @kind function
|
|
1769
|
-
* @name getTossShareLink
|
|
1770
|
-
* @description
|
|
1771
|
-
* `getTossShareLink` 함수는 사용자가 지정한 경로를 토스 앱에서 열 수 있는 공유 링크를 반환해요.
|
|
1772
|
-
* 이 링크를 다른 사람과 공유하면 토스 앱이 실행되면서 지정한 경로로 진입해요. 토스앱이 없는 사람은 iOS 일 때는 앱스토어로 이동하고, Android 일 때는 플레이스토어로 이동해요.
|
|
1773
|
-
*
|
|
1774
|
-
* 경로는 토스 앱 내부 특정 화면을 나타내는 딥링크(deep link) 형식이어야 해요.
|
|
1775
|
-
* 예를 들어 `intoss://<앱 이름>`이나 `intoss://<앱 이름>/about?name=test`처럼 작성해요.
|
|
1776
|
-
*
|
|
1777
|
-
* 이 함수를 사용하면 `deep_link_value`를 포함한 완성된 공유 링크를 만들 수 있어요.
|
|
1778
|
-
*
|
|
1779
|
-
* @param path - 딥링크로 열고 싶은 경로예요. `intoss://`로 시작하는 문자열이어야 해요.
|
|
1780
|
-
* @returns {Promise<string>} `deep_link_value`가 포함된 토스 공유 링크를 반환해요.
|
|
1781
|
-
*
|
|
1782
|
-
* @example
|
|
1783
|
-
* ```tsx
|
|
1784
|
-
* import { share } from '@granite-js/react-native';
|
|
1785
|
-
* import { getTossShareLink } from '@apps-in-toss/framework';
|
|
1786
|
-
*
|
|
1787
|
-
* // '/' 경로를 딥링크로 포함한 토스 공유 링크를 생성해요.
|
|
1788
|
-
* const tossLink = await getTossShareLink('intoss://my-app');
|
|
2470
|
+
* };
|
|
1789
2471
|
*
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
2472
|
+
* return <Button title="복사" onPress={handleCopy} />;
|
|
2473
|
+
* }
|
|
1792
2474
|
* ```
|
|
1793
2475
|
*/
|
|
1794
|
-
declare function
|
|
2476
|
+
declare function setClipboardText(text: string): Promise<void>;
|
|
1795
2477
|
|
|
1796
2478
|
/**
|
|
1797
2479
|
* @public
|
|
@@ -1857,12 +2539,120 @@ declare function setDeviceOrientation(options: {
|
|
|
1857
2539
|
type: 'portrait' | 'landscape';
|
|
1858
2540
|
}): Promise<void>;
|
|
1859
2541
|
|
|
2542
|
+
/**
|
|
2543
|
+
* @public
|
|
2544
|
+
* @category 저장소
|
|
2545
|
+
* @name getItem
|
|
2546
|
+
* @description 모바일 앱의 로컬 저장소에서 문자열 데이터를 가져와요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
|
|
2547
|
+
* @param {string} key - 가져올 아이템의 키를 입력해요.
|
|
2548
|
+
* @returns {Promise<string | null>} 지정한 키에 저장된 문자열 값을 반환해요. 값이 없으면 `null`을 반환해요.
|
|
2549
|
+
* @example
|
|
2550
|
+
*
|
|
2551
|
+
* ### `my-key`에 저장된 아이템 가져오기
|
|
2552
|
+
* ```ts
|
|
2553
|
+
* const value = await Storage.getItem('my-key');
|
|
2554
|
+
* console.log(value); // 'value'
|
|
2555
|
+
* ```
|
|
2556
|
+
*/
|
|
2557
|
+
declare function getItem(key: string): Promise<string | null>;
|
|
2558
|
+
/**
|
|
2559
|
+
* @public
|
|
2560
|
+
* @category 저장소
|
|
2561
|
+
* @name setItem
|
|
2562
|
+
* @description 모바일 앱의 로컬 저장소에 문자열 데이터를 저장해요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
|
|
2563
|
+
* @param {string} key - 저장할 아이템의 키를 입력해요.
|
|
2564
|
+
* @param {string} value - 저장할 아이템의 값을 입력해요.
|
|
2565
|
+
* @returns {Promise<void>} 아이템을 성공적으로 저장하면 아무 값도 반환하지 않아요.
|
|
2566
|
+
* @example
|
|
2567
|
+
*
|
|
2568
|
+
* ### `my-key`에 아이템 저장하기
|
|
2569
|
+
* ```ts
|
|
2570
|
+
* import { Storage } from '@apps-in-toss/framework';
|
|
2571
|
+
*
|
|
2572
|
+
* await Storage.setItem('my-key', 'value');
|
|
2573
|
+
* ```
|
|
2574
|
+
*/
|
|
2575
|
+
declare function setItem(key: string, value: string): Promise<void>;
|
|
2576
|
+
/**
|
|
2577
|
+
* @public
|
|
2578
|
+
* @category 저장소
|
|
2579
|
+
* @name removeItem
|
|
2580
|
+
* @description 모바일 앱의 로컬 저장소에서 특정 키에 해당하는 아이템을 삭제해요.
|
|
2581
|
+
* @param {string} key - 삭제할 아이템의 키를 입력해요.
|
|
2582
|
+
* @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않아요.
|
|
2583
|
+
* @example
|
|
2584
|
+
*
|
|
2585
|
+
* ### `my-key`에 저장된 아이템 삭제하기
|
|
2586
|
+
* ```ts
|
|
2587
|
+
* import { Storage } from '@apps-in-toss/framework';
|
|
2588
|
+
*
|
|
2589
|
+
* await Storage.removeItem('my-key');
|
|
2590
|
+
* ```
|
|
2591
|
+
*/
|
|
2592
|
+
declare function removeItem(key: string): Promise<void>;
|
|
2593
|
+
/**
|
|
2594
|
+
* @public
|
|
2595
|
+
* @category 저장소
|
|
2596
|
+
* @name clearItems
|
|
2597
|
+
* @description 모바일 앱의 로컬 저장소의 모든 아이템을 삭제해요.
|
|
2598
|
+
* @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않고 저장소가 초기화돼요.
|
|
2599
|
+
* @example
|
|
2600
|
+
*
|
|
2601
|
+
* ### 저장소 초기화하기
|
|
2602
|
+
* ```ts
|
|
2603
|
+
* import { Storage } from '@apps-in-toss/framework';
|
|
2604
|
+
*
|
|
2605
|
+
* await Storage.clearItems();
|
|
2606
|
+
* ```
|
|
2607
|
+
*/
|
|
2608
|
+
declare function clearItems(): Promise<void>;
|
|
2609
|
+
/**
|
|
2610
|
+
* @public
|
|
2611
|
+
* @category 저장소
|
|
2612
|
+
* @name Storage
|
|
2613
|
+
* @description 네이티브의 저장소를 사용해요.
|
|
2614
|
+
* @property {typeof getItem} [getItem] 모바일 앱의 로컬 저장소에서 아이템을 가져오는 함수예요. 자세한 내용은 [getItem](/react-native/reference/native-modules/저장소/getItem.html)을 참고하세요.
|
|
2615
|
+
* @property {typeof setItem} [setItem] 모바일 앱의 로컬 저장소에 아이템을 저장하는 함수예요. 자세한 내용은 [setItem](/react-native/reference/native-modules/저장소/setItem.html)을 참고하셰요.
|
|
2616
|
+
* @property {typeof removeItem} [removeItem] 모바일 앱의 로컬 저장소에서 아이템을 삭제하는 함수예요. 자세한 내용은 [removeItem](/react-native/reference/native-modules/저장소/removeItem.html)을 참고하세요.
|
|
2617
|
+
* @property {typeof clearItems} [clearItems] 모바일 앱의 로컬 저장소를 초기화하는 함수예요. 자세한 내용은 [clearItems](/react-native/reference/native-modules/저장소/clearItems.html)을 참고하세요.
|
|
2618
|
+
*/
|
|
2619
|
+
declare const Storage: {
|
|
2620
|
+
getItem: typeof getItem;
|
|
2621
|
+
setItem: typeof setItem;
|
|
2622
|
+
removeItem: typeof removeItem;
|
|
2623
|
+
clearItems: typeof clearItems;
|
|
2624
|
+
};
|
|
2625
|
+
|
|
2626
|
+
/**
|
|
2627
|
+
* @public
|
|
2628
|
+
* @category 게임센터
|
|
2629
|
+
* @name openGameCenterLeaderboard
|
|
2630
|
+
* @description 게임센터 리더보드 웹뷰를 열어요.
|
|
2631
|
+
* 앱 버전이 최소 지원 버전(`5.221.0`)보다 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
|
|
2632
|
+
* 게임센터를 사용하는 사용자는 반드시 최소 지원 버전 이상이어야 게임을 실행할 수 있어요.
|
|
2633
|
+
* @returns 리더보드 웹뷰를 호출해요. 앱 버전이 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
|
|
2634
|
+
*
|
|
2635
|
+
* @example
|
|
2636
|
+
* import { Button } from 'react-native';
|
|
2637
|
+
* import { openGameCenterLeaderboard } from '@apps-in-toss/framework';
|
|
2638
|
+
*
|
|
2639
|
+
* // '리더보드' 버튼을 누르면 게임센터 리더보드 웹뷰가 열려요.
|
|
2640
|
+
* function LeaderboardButton() {
|
|
2641
|
+
* const onPress = () => {
|
|
2642
|
+
* openGameCenterLeaderboard();
|
|
2643
|
+
* };
|
|
2644
|
+
*
|
|
2645
|
+
* return <Button title="리더보드 웹뷰 호출" onPress={onPress} />;
|
|
2646
|
+
* }
|
|
2647
|
+
*/
|
|
2648
|
+
declare function openGameCenterLeaderboard(): Promise<void>;
|
|
2649
|
+
|
|
1860
2650
|
/**
|
|
1861
2651
|
* @public
|
|
1862
2652
|
* @category 토스페이
|
|
1863
2653
|
* @name TossPay
|
|
1864
2654
|
* @description 토스페이 결제 관련 함수를 모아둔 객체예요.
|
|
1865
|
-
* @property {typeof checkoutPayment} [checkoutPayment] 토스페이 결제를 인증하는 함수예요. 자세한 내용은 [checkoutPayment](/react-native/reference/
|
|
2655
|
+
* @property {typeof checkoutPayment} [checkoutPayment] 토스페이 결제를 인증하는 함수예요. 자세한 내용은 [checkoutPayment](/react-native/reference/native-modules/토스페이/checkoutPayment)를 참고하세요.
|
|
1866
2656
|
*/
|
|
1867
2657
|
declare const TossPay: {
|
|
1868
2658
|
checkoutPayment: typeof checkoutPayment;
|
|
@@ -1872,16 +2662,20 @@ declare const TossPay: {
|
|
|
1872
2662
|
* @category 광고
|
|
1873
2663
|
* @name GoogleAdMob
|
|
1874
2664
|
* @description Google AdMob 광고 관련 함수를 모아둔 객체예요.
|
|
1875
|
-
* @property {typeof loadAdMobInterstitialAd} [loadAdMobInterstitialAd] 전면 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobInterstitialAd](/react-native/reference/
|
|
1876
|
-
* @property {typeof showAdMobInterstitialAd} [showAdMobInterstitialAd] 로드한 전면 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobInterstitialAd](/react-native/reference/
|
|
1877
|
-
* @property {typeof loadAdMobRewardedAd} [loadAdMobRewardedAd] 보상형 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobRewardedAd](/react-native/reference/
|
|
1878
|
-
* @property {typeof showAdMobRewardedAd} [showAdMobRewardedAd] 로드한 보상형 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobRewardedAd](/react-native/reference/
|
|
2665
|
+
* @property {typeof loadAdMobInterstitialAd} [loadAdMobInterstitialAd] 전면 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobInterstitialAd](/react-native/reference/native-modules/광고/loadAdMobInterstitialAd.html)를 참고하세요.
|
|
2666
|
+
* @property {typeof showAdMobInterstitialAd} [showAdMobInterstitialAd] 로드한 전면 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobInterstitialAd](/react-native/reference/native-modules/광고/showAdMobInterstitialAd.html)를 참고하세요.
|
|
2667
|
+
* @property {typeof loadAdMobRewardedAd} [loadAdMobRewardedAd] 보상형 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobRewardedAd](/react-native/reference/native-modules/광고/loadAdMobRewardedAd.html)를 참고하세요.
|
|
2668
|
+
* @property {typeof showAdMobRewardedAd} [showAdMobRewardedAd] 로드한 보상형 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobRewardedAd](/react-native/reference/native-modules/광고/showAdMobRewardedAd.html)를 참고하세요.
|
|
2669
|
+
* @property {typeof loadAppsInTossAdMob} [loadAppsInTossAdMob] 광고를 로드하는 함수예요. 자세한 내용은 [loadAppsInTossAdMob](/react-native/reference/native-modules/광고/loadAppsInTossAdMob.html)를 참고하세요.
|
|
2670
|
+
* @property {typeof showAppsInTossAdMob} [showAppsInTossAdMob] 로드한 광고를 보여주는 함수예요. 자세한 내용은 [showAppsInTossAdMob](/react-native/reference/native-modules/광고/showAppsInTossAdMob.html)를 참고하세요.
|
|
1879
2671
|
*/
|
|
1880
2672
|
declare const GoogleAdMob: {
|
|
1881
2673
|
loadAdMobInterstitialAd: typeof loadAdMobInterstitialAd;
|
|
1882
2674
|
showAdMobInterstitialAd: typeof showAdMobInterstitialAd;
|
|
1883
2675
|
loadAdMobRewardedAd: typeof loadAdMobRewardedAd;
|
|
1884
2676
|
showAdMobRewardedAd: typeof showAdMobRewardedAd;
|
|
2677
|
+
loadAppsInTossAdMob: typeof loadAppsInTossAdMob;
|
|
2678
|
+
showAppsInTossAdMob: typeof showAppsInTossAdMob;
|
|
1885
2679
|
};
|
|
1886
2680
|
|
|
1887
2681
|
/**
|
|
@@ -1897,7 +2691,7 @@ declare const GoogleAdMob: {
|
|
|
1897
2691
|
*
|
|
1898
2692
|
* ```tsx
|
|
1899
2693
|
* import { Button } from 'react-native';
|
|
1900
|
-
* import { closeView } from '
|
|
2694
|
+
* import { closeView } from '@apps-in-toss/native-modules';
|
|
1901
2695
|
*
|
|
1902
2696
|
* function CloseButton() {
|
|
1903
2697
|
* return <Button title="닫기" onPress={closeView} />;
|
|
@@ -1920,7 +2714,7 @@ declare function closeView(): Promise<void>;
|
|
|
1920
2714
|
* ### 현재 사용자의 로케일 정보 가져오기
|
|
1921
2715
|
*
|
|
1922
2716
|
* ```tsx
|
|
1923
|
-
* import { getLocale } from '
|
|
2717
|
+
* import { getLocale } from '@apps-in-toss/native-modules';
|
|
1924
2718
|
* import { Text } from 'react-native';
|
|
1925
2719
|
*
|
|
1926
2720
|
* function MyPage() {
|
|
@@ -1947,7 +2741,7 @@ declare function getLocale(): string;
|
|
|
1947
2741
|
* ### 처음 진입한 스킴 값 가져오기
|
|
1948
2742
|
*
|
|
1949
2743
|
* ```tsx
|
|
1950
|
-
* import { getSchemeUri } from '
|
|
2744
|
+
* import { getSchemeUri } from '@apps-in-toss/native-modules';
|
|
1951
2745
|
* import { Text } from 'react-native';
|
|
1952
2746
|
*
|
|
1953
2747
|
* function MyPage() {
|
|
@@ -1999,7 +2793,7 @@ interface HapticFeedbackOptions {
|
|
|
1999
2793
|
*
|
|
2000
2794
|
* ```tsx
|
|
2001
2795
|
* import { Button } from 'react-native';
|
|
2002
|
-
* import { generateHapticFeedback } from '
|
|
2796
|
+
* import { generateHapticFeedback } from '@apps-in-toss/native-modules';
|
|
2003
2797
|
*
|
|
2004
2798
|
* function GenerateHapticFeedback() {
|
|
2005
2799
|
* return <Button title="햅틱" onPress={() => { generateHapticFeedback( { type: "tickWeak"}) }} />;
|
|
@@ -2026,7 +2820,7 @@ declare function generateHapticFeedback(options: HapticFeedbackOptions): Promise
|
|
|
2026
2820
|
* 아래는 버튼을 클릭하면 메시지를 공유하는 간단한 예제예요.
|
|
2027
2821
|
*
|
|
2028
2822
|
* ```tsx
|
|
2029
|
-
* import { share } from '
|
|
2823
|
+
* import { share } from '@apps-in-toss/native-modules';
|
|
2030
2824
|
* import { Button } from 'react-native';
|
|
2031
2825
|
*
|
|
2032
2826
|
* function MyPage() {
|
|
@@ -2060,7 +2854,7 @@ declare function share(message: {
|
|
|
2060
2854
|
*
|
|
2061
2855
|
* ```tsx
|
|
2062
2856
|
* import { Button } from 'react-native';
|
|
2063
|
-
* import { setSecureScreen } from '
|
|
2857
|
+
* import { setSecureScreen } from '@apps-in-toss/native-modules';
|
|
2064
2858
|
*
|
|
2065
2859
|
* function SetSecureScreen() {
|
|
2066
2860
|
* return <Button title="캡쳐 막기" onPress={async () => {
|
|
@@ -2102,7 +2896,7 @@ declare function setSecureScreen(options: {
|
|
|
2102
2896
|
*
|
|
2103
2897
|
* ```tsx
|
|
2104
2898
|
* import { Button } from 'react-native';
|
|
2105
|
-
* import { setScreenAwakeMode } from '
|
|
2899
|
+
* import { setScreenAwakeMode } from '@apps-in-toss/native-modules';
|
|
2106
2900
|
*
|
|
2107
2901
|
* function SetScreenAwakeMode() {
|
|
2108
2902
|
* return (
|
|
@@ -2121,7 +2915,7 @@ declare function setSecureScreen(options: {
|
|
|
2121
2915
|
*
|
|
2122
2916
|
* ```tsx
|
|
2123
2917
|
* import { useEffect } from 'react';
|
|
2124
|
-
* import { setScreenAwakeMode, cleanUp } from '
|
|
2918
|
+
* import { setScreenAwakeMode, cleanUp } from '@apps-in-toss/native-modules';
|
|
2125
2919
|
*
|
|
2126
2920
|
* function MediaScreen() {
|
|
2127
2921
|
* useEffect(() => {
|
|
@@ -2172,7 +2966,7 @@ type NetworkStatus = 'OFFLINE' | 'WIFI' | '2G' | '3G' | '4G' | '5G' | 'WWAN' | '
|
|
|
2172
2966
|
* ```tsx
|
|
2173
2967
|
* import { useState, useEffect } from 'react';
|
|
2174
2968
|
* import { Text, View } from 'react-native';
|
|
2175
|
-
* import { getNetworkStatus, NetworkStatus } from '
|
|
2969
|
+
* import { getNetworkStatus, NetworkStatus } from '@apps-in-toss/native-modules';
|
|
2176
2970
|
*
|
|
2177
2971
|
* function GetNetworkStatus() {
|
|
2178
2972
|
* const [status, setStatus] = useState<NetworkStatus | ''>('');
|
|
@@ -2216,7 +3010,7 @@ declare function getNetworkStatus(): Promise<NetworkStatus>;
|
|
|
2216
3010
|
*
|
|
2217
3011
|
*
|
|
2218
3012
|
* ```tsx
|
|
2219
|
-
* import { setIosSwipeGestureEnabled } from '
|
|
3013
|
+
* import { setIosSwipeGestureEnabled } from '@apps-in-toss/native-modules';
|
|
2220
3014
|
* import { Button } from 'react-native';
|
|
2221
3015
|
*
|
|
2222
3016
|
* function Page() {
|
|
@@ -2257,7 +3051,7 @@ declare function setIosSwipeGestureEnabled(options: {
|
|
|
2257
3051
|
* ### 외부 URL 열기
|
|
2258
3052
|
*
|
|
2259
3053
|
* ```tsx
|
|
2260
|
-
* import { openURL } from '
|
|
3054
|
+
* import { openURL } from '@apps-in-toss/native-modules';
|
|
2261
3055
|
* import { Button } from 'react-native';
|
|
2262
3056
|
*
|
|
2263
3057
|
* function Page() {
|
|
@@ -2293,7 +3087,7 @@ declare function openURL(url: string): Promise<any>;
|
|
|
2293
3087
|
* ### 현재 실행중인 OS 플랫폼 확인하기
|
|
2294
3088
|
*
|
|
2295
3089
|
* ```tsx
|
|
2296
|
-
* import { getPlatformOS } from '
|
|
3090
|
+
* import { getPlatformOS } from '@apps-in-toss/native-modules';
|
|
2297
3091
|
* import { Text } 'react-native';
|
|
2298
3092
|
*
|
|
2299
3093
|
* function Page() {
|
|
@@ -2349,4 +3143,4 @@ declare const INTERNAL__module: {
|
|
|
2349
3143
|
tossCoreEventLog: typeof tossCoreEventLog;
|
|
2350
3144
|
};
|
|
2351
3145
|
|
|
2352
|
-
export { Accuracy, AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactEntity, type ContactResult, type EventLogParams, type FetchAlbumPhotosOptions, type GetCurrentLocationOptions, GoogleAdMob, type HapticFeedbackType, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__module, type ImageResponse, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type Location, type LocationCoords, type NetworkStatus, type OpenCameraOptions, type PermissionAccess, type PermissionName, type PermissionStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, type StartUpdateLocationOptions$1 as StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, isMinVersionSupported, openCamera, openURL, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation };
|
|
3146
|
+
export { Accuracy, AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactEntity, type ContactResult, type ContactsViralParams, type EventLogParams, type FetchAlbumPhotosOptions, type GameCenterGameProfileResponse, type GetCurrentLocationOptions, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type ImageResponse, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type Location, type LocationCoords, type NetworkStatus, type OpenCameraOptions, type PermissionAccess, type PermissionName, type PermissionStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, type StartUpdateLocationOptions$1 as StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
|