From 5ad458f1a884cc3199eb13942d3062d6c70e51b2 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Mon, 28 Oct 2024 16:24:35 +0100 Subject: [PATCH 01/28] fix codegenConfig --- package.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 60cf8c2..17a9285 100644 --- a/package.json +++ b/package.json @@ -257,12 +257,8 @@ ] }, "codegenConfig": { - "libraries": [ - { - "name": "rnaps", - "type": "modules", - "jsSrcsDir": "./src/turbomodules" - } - ] + "name": "rnaps", + "type": "modules", + "jsSrcsDir": "./src/turbomodules" } } From 9f25d8543915986411921060a7cb41054df9c00e Mon Sep 17 00:00:00 2001 From: oromis300 Date: Mon, 28 Oct 2024 16:40:48 +0100 Subject: [PATCH 02/28] upgrade version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 17a9285..df7c292 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-aps", - "version": "2.0.1", + "version": "2.0.2", "author": "AdversportTeam (https://github.com/AdversportTeam)", "contributors": [ "Jay Kim (https://github.com/wjaykim)" From 42496f8f6ce95068cefd060e44494e175eb95822 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Mon, 28 Oct 2024 16:55:39 +0100 Subject: [PATCH 03/28] try change adtype --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 76b1d99..1d79b27 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -18,12 +18,12 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -import type { AdLoaderOptions, AdType, BannerAdLoaderOptions } from '../types'; +import type { AdLoaderOptions, BannerAdLoaderOptions } from '../types'; export interface Spec extends TurboModule { loadAd: ( loaderId: number, - adType: AdType, + adType: string, options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; From 53e5b870ef1e09bf2b2a616d4f147f157eab3caf Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 09:19:55 +0100 Subject: [PATCH 04/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 7 ++++++- src/turbomodules/NativeRNAPSAdsModule.ts | 20 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 1d79b27..4133c99 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -20,10 +20,15 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; import type { AdLoaderOptions, BannerAdLoaderOptions } from '../types'; +type AdType = { + BANNER: 'banner', + INTERSTITIAL: 'interstitial', +}; + export interface Spec extends TurboModule { loadAd: ( loaderId: number, - adType: string, + adType: AdType, options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index 7e3e265..be2ee22 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -18,7 +18,25 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -import type { AdNetworkInfo, MRAIDPolicy } from '../types'; +import type { MRAIDPolicy } from '../types'; + +type AdNetwork = { + GOOGLE_AD_MANAGER: 'GOOGLE_AD_MANAGER', + ADMOB: 'ADMOB', + AD_GENERATION: 'AD_GENERATION', + IRON_SOURCE: 'IRON_SOURCE', + MAX: 'MAX', + NIMBUS: 'NIMBUS', + OTHER: 'OTHER', +}; + +interface AdNetworkInfo { + /** + * The name of the primary ad server or mediator + */ + adNetwork: AdNetwork; + adNetworkProperties?: { [key: string]: string }; +} /** * @internal From bc9adb0e36f2169b44bcde54122e862dccea972d Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 09:31:29 +0100 Subject: [PATCH 05/28] upgrade version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index df7c292..66a8eca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-aps", - "version": "2.0.2", + "version": "2.0.3", "author": "AdversportTeam (https://github.com/AdversportTeam)", "contributors": [ "Jay Kim (https://github.com/wjaykim)" From c0b6c8db3c137a4b2e53d8cfd0fcac9103fc82fb Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 09:35:28 +0100 Subject: [PATCH 06/28] try fix wrong type --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 4133c99..76b1d99 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -18,12 +18,7 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -import type { AdLoaderOptions, BannerAdLoaderOptions } from '../types'; - -type AdType = { - BANNER: 'banner', - INTERSTITIAL: 'interstitial', -}; +import type { AdLoaderOptions, AdType, BannerAdLoaderOptions } from '../types'; export interface Spec extends TurboModule { loadAd: ( From 329b545f33a62206dc4751bbb46d5e60dced8e09 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 09:37:08 +0100 Subject: [PATCH 07/28] try fix wrong type --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 76b1d99..6dd425d 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -18,12 +18,17 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -import type { AdLoaderOptions, AdType, BannerAdLoaderOptions } from '../types'; +import type { AdLoaderOptions, BannerAdLoaderOptions } from '../types'; + +const AdType = { + BANNER: 'banner', + INTERSTITIAL: 'interstitial', +} export interface Spec extends TurboModule { loadAd: ( loaderId: number, - adType: AdType, + adType: typeof AdType, options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; From ae762d637c90674c17cd041edceb197290c8b1d4 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 09:49:09 +0100 Subject: [PATCH 08/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 8 +++++--- src/turbomodules/NativeRNAPSAdsModule.ts | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 6dd425d..24e5c88 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -20,15 +20,17 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; import type { AdLoaderOptions, BannerAdLoaderOptions } from '../types'; -const AdType = { +export const AdType = { BANNER: 'banner', INTERSTITIAL: 'interstitial', -} +} as const; + +export type AdType = typeof AdType[keyof typeof AdType]; export interface Spec extends TurboModule { loadAd: ( loaderId: number, - adType: typeof AdType, + adType: AdType, options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index be2ee22..5d93e7b 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -20,7 +20,7 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; import type { MRAIDPolicy } from '../types'; -type AdNetwork = { +export const AdNetwork = { GOOGLE_AD_MANAGER: 'GOOGLE_AD_MANAGER', ADMOB: 'ADMOB', AD_GENERATION: 'AD_GENERATION', @@ -28,9 +28,11 @@ type AdNetwork = { MAX: 'MAX', NIMBUS: 'NIMBUS', OTHER: 'OTHER', -}; +} as const; -interface AdNetworkInfo { +export type AdNetwork = typeof AdNetwork[keyof typeof AdNetwork]; + +export interface AdNetworkInfo { /** * The name of the primary ad server or mediator */ From 87a9b11470b8cce267648e6f50f4121a857c9253 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 10:00:14 +0100 Subject: [PATCH 09/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 24e5c88..a359870 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -18,8 +18,6 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -import type { AdLoaderOptions, BannerAdLoaderOptions } from '../types'; - export const AdType = { BANNER: 'banner', INTERSTITIAL: 'interstitial', @@ -27,6 +25,34 @@ export const AdType = { export type AdType = typeof AdType[keyof typeof AdType]; +export interface AdLoaderOptions { + /** + * The slotUUID of the ad slot. + */ + slotUUID: string; + /** + * The optional custom targeting key value pairs for the bid request. + */ + customTargeting?: { [key: string]: string }; +} + +export interface BannerAdLoaderOptions extends AdLoaderOptions { + /** + * The size of the banner ad slot. Required for banner ad slots. + */ + size: string; + + /** + * Whether the banner ad to be automatically refreshed. Defaults to `false`. + */ + autoRefresh?: boolean; + + /** + * The time interval in seconds between refreshes. Defaults to `60` seconds if autoRefresh enabled. The minimum auto-refresh time supported is `20` seconds. + */ + refreshInterval?: number; +} + export interface Spec extends TurboModule { loadAd: ( loaderId: number, From 2cecf85d7d7d51b0ae023a1b16faa0c025e1eac5 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 10:12:12 +0100 Subject: [PATCH 10/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index a359870..75c00fb 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -18,13 +18,6 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -export const AdType = { - BANNER: 'banner', - INTERSTITIAL: 'interstitial', -} as const; - -export type AdType = typeof AdType[keyof typeof AdType]; - export interface AdLoaderOptions { /** * The slotUUID of the ad slot. @@ -56,7 +49,7 @@ export interface BannerAdLoaderOptions extends AdLoaderOptions { export interface Spec extends TurboModule { loadAd: ( loaderId: number, - adType: AdType, + adType: string, options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; From c9727e32a9131ac51eb63937f98f2b2782326f26 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 10:22:10 +0100 Subject: [PATCH 11/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 75c00fb..97e1222 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -18,39 +18,12 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; -export interface AdLoaderOptions { - /** - * The slotUUID of the ad slot. - */ - slotUUID: string; - /** - * The optional custom targeting key value pairs for the bid request. - */ - customTargeting?: { [key: string]: string }; -} - -export interface BannerAdLoaderOptions extends AdLoaderOptions { - /** - * The size of the banner ad slot. Required for banner ad slots. - */ - size: string; - - /** - * Whether the banner ad to be automatically refreshed. Defaults to `false`. - */ - autoRefresh?: boolean; - - /** - * The time interval in seconds between refreshes. Defaults to `60` seconds if autoRefresh enabled. The minimum auto-refresh time supported is `20` seconds. - */ - refreshInterval?: number; -} export interface Spec extends TurboModule { loadAd: ( loaderId: number, adType: string, - options: AdLoaderOptions | BannerAdLoaderOptions + //options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; stopAutoRefresh: (loaderId: number) => void; From bdd829310a8fd71c490401e6048d425adb26fdef Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 10:31:33 +0100 Subject: [PATCH 12/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 97e1222..9bb481e 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -23,7 +23,7 @@ export interface Spec extends TurboModule { loadAd: ( loaderId: number, adType: string, - //options: AdLoaderOptions | BannerAdLoaderOptions + options: string, ) => Promise<{ [key: string]: string }>; stopAutoRefresh: (loaderId: number) => void; From 0c42add763e129033f3c7b35fb845f1ccd3969b8 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 10:33:03 +0100 Subject: [PATCH 13/28] add type inside module file --- src/AdLoader.ts | 2 +- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AdLoader.ts b/src/AdLoader.ts index 1973b19..69e2305 100644 --- a/src/AdLoader.ts +++ b/src/AdLoader.ts @@ -135,7 +135,7 @@ export class AdLoader { return await AdLoader._nativeModule.loadAd( this.loaderId, this.adType, - this.adLoaderOptions + //this.adLoaderOptions ); } catch (error) { if ((error as any).userInfo) { diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 9bb481e..97e1222 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -23,7 +23,7 @@ export interface Spec extends TurboModule { loadAd: ( loaderId: number, adType: string, - options: string, + //options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; stopAutoRefresh: (loaderId: number) => void; From 863ed6808c1c5d4cca2211601e582cea641c8fdb Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 10:56:33 +0100 Subject: [PATCH 14/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 40 +++++++++++++++++-- src/turbomodules/NativeRNAPSAdsModule.ts | 2 +- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 97e1222..cdf5620 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -18,12 +18,46 @@ import { TurboModule, TurboModuleRegistry } from 'react-native'; +export const AdType = { + BANNER: 'banner', + INTERSTITIAL: 'interstitial', +} as const; + +export type AdType = typeof AdType[keyof typeof AdType]; + +export interface AdLoaderOptions { + /** + * The slotUUID of the ad slot. + */ + slotUUID: string; + /** + * The optional custom targeting key value pairs for the bid request. + */ + customTargeting?: { [key: string]: string }; +} + +export interface BannerAdLoaderOptions extends AdLoaderOptions { + /** + * The size of the banner ad slot. Required for banner ad slots. + */ + size: string; + + /** + * Whether the banner ad to be automatically refreshed. Defaults to `false`. + */ + autoRefresh?: boolean; + + /** + * The time interval in seconds between refreshes. Defaults to `60` seconds if autoRefresh enabled. The minimum auto-refresh time supported is `20` seconds. + */ + refreshInterval?: number; +} export interface Spec extends TurboModule { loadAd: ( loaderId: number, - adType: string, - //options: AdLoaderOptions | BannerAdLoaderOptions + adType: AdType, + options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; stopAutoRefresh: (loaderId: number) => void; @@ -31,4 +65,4 @@ export interface Spec extends TurboModule { skadnHelper: (name: string, info?: string) => void; } -export default TurboModuleRegistry.get('RNAPSAdLoaderModule'); +export default TurboModuleRegistry.getEnforcing('RNAPSAdLoaderModule'); diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index 5d93e7b..d6514a7 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -61,4 +61,4 @@ export interface Spec extends TurboModule { removeCustomAttribute: (key: string) => void; } -export default TurboModuleRegistry.get('RNAPSAdsModule'); +export default TurboModuleRegistry.getEnforcing('RNAPSAdsModule'); From 9a332b5b7111f80e87082fa64766c01716d959b6 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 10:58:19 +0100 Subject: [PATCH 15/28] add type inside module file --- src/AdLoader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AdLoader.ts b/src/AdLoader.ts index 69e2305..1973b19 100644 --- a/src/AdLoader.ts +++ b/src/AdLoader.ts @@ -135,7 +135,7 @@ export class AdLoader { return await AdLoader._nativeModule.loadAd( this.loaderId, this.adType, - //this.adLoaderOptions + this.adLoaderOptions ); } catch (error) { if ((error as any).userInfo) { From 6103478a33b2725260d0ddc225c550624f8c9b18 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 11:15:37 +0100 Subject: [PATCH 16/28] add type inside module file --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index cdf5620..f65212d 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -17,41 +17,7 @@ */ import { TurboModule, TurboModuleRegistry } from 'react-native'; - -export const AdType = { - BANNER: 'banner', - INTERSTITIAL: 'interstitial', -} as const; - -export type AdType = typeof AdType[keyof typeof AdType]; - -export interface AdLoaderOptions { - /** - * The slotUUID of the ad slot. - */ - slotUUID: string; - /** - * The optional custom targeting key value pairs for the bid request. - */ - customTargeting?: { [key: string]: string }; -} - -export interface BannerAdLoaderOptions extends AdLoaderOptions { - /** - * The size of the banner ad slot. Required for banner ad slots. - */ - size: string; - - /** - * Whether the banner ad to be automatically refreshed. Defaults to `false`. - */ - autoRefresh?: boolean; - - /** - * The time interval in seconds between refreshes. Defaults to `60` seconds if autoRefresh enabled. The minimum auto-refresh time supported is `20` seconds. - */ - refreshInterval?: number; -} +import type { AdLoaderOptions, AdType, BannerAdLoaderOptions } from 'src/types'; export interface Spec extends TurboModule { loadAd: ( From c29d9e1af7f74185a4669f1e95d61132db556282 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 11:26:21 +0100 Subject: [PATCH 17/28] remove annotations --- src/APSAds.ts | 28 --------------- src/AdError.ts | 11 ------ src/AdLoader.ts | 21 ----------- src/TestIds.ts | 3 -- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 36 ++++++++++++++++++- src/types/AdLoaderEvent.ts | 9 ----- src/types/AdLoaderOptions.ts | 12 ------- src/types/AdNetwork.ts | 9 ----- src/types/AdNetworkInfo.ts | 6 ---- src/types/AdType.ts | 11 +----- src/types/MRAIDPolicy.ts | 9 ----- 11 files changed, 36 insertions(+), 119 deletions(-) diff --git a/src/APSAds.ts b/src/APSAds.ts index cd23734..ba89e45 100644 --- a/src/APSAds.ts +++ b/src/APSAds.ts @@ -20,17 +20,11 @@ import AdsModule from './internal/AdsModule'; import { AdNetworkInfo, validateAdNetworkInfo } from './types/AdNetworkInfo'; import { isMRAIDPolicy, MRAIDPolicy } from './types/MRAIDPolicy'; -/** - * @public - */ export class APSAds { private static _nativeModule = AdsModule; /** * Initializes the APSAds SDK. - * @param appKey - Generated APS app key from the APS portal - * - * @public */ static initialize(appKey: string): Promise { if (typeof appKey !== 'string') { @@ -41,9 +35,6 @@ export class APSAds { /** * Sets the primary ad server or mediator. - * @param adNetworkInfo - `AdNetworkInfo` object containing the primary ad network and its properties - * - * @public */ static setAdNetworkInfo(adNetworkInfo: AdNetworkInfo): void { try { @@ -58,9 +49,6 @@ export class APSAds { /** * Sets the MRAID versions supported by user ad server. - * @param versions - Array of supported versions - * - * @public */ static setMRAIDSupportedVersions(versions: string[]): void { if ( @@ -76,9 +64,6 @@ export class APSAds { /** * Sets the MRAID policy. - * @param policy - MRAIDPolicy value. `MRAIDPolicy.DFP` for Google Ad Manager and `MRAIDPolicy.CUSTOM` for other ad server / mediation. - * - * @public */ static setMRAIDPolicy(policy: MRAIDPolicy): void { if (!isMRAIDPolicy(policy)) { @@ -91,9 +76,6 @@ export class APSAds { /** * Enable / disable the test mode for APSAds. - * @param enabled - Whether to enable or disable the test mode. - * - * @public */ static setTestMode(enabled: boolean): void { if (typeof enabled !== 'boolean') { @@ -106,9 +88,6 @@ export class APSAds { /** * Enable / disable the geo location tracking for APSAds. - * @param enabled - Whether to enable or disable the geo location tracking. - * - * @public */ static setUseGeoLocation(enabled: boolean): void { if (typeof enabled !== 'boolean') { @@ -121,10 +100,6 @@ export class APSAds { /** * Adds a custom attribute to the APSAds SDK. - * @param key - The key of the custom attribute - * @param value - The value of the custom attribute - * - * @public */ static addCustomAttribute(key: string, value: string): void { if (typeof key !== 'string') { @@ -142,9 +117,6 @@ export class APSAds { /** * Removes a custom attribute from the APSAds SDK. - * @param key - The key of the custom attribute - * - * @public */ static removeCustomAttribute(key: string): void { if (typeof key !== 'string') { diff --git a/src/AdError.ts b/src/AdError.ts index e110f7b..fd85fec 100644 --- a/src/AdError.ts +++ b/src/AdError.ts @@ -19,20 +19,13 @@ /** * AdError class * - * @public */ export class AdError extends Error { - /** - * @internal - */ constructor(readonly code: string, message: string) { super(message); this.name = 'AdError'; } - /** - * @internal - */ static fromNativeError(error: any): AdError { const { code, message } = error.userInfo; return new AdError(code, message); @@ -41,10 +34,6 @@ export class AdError extends Error { /** * Type guard for AdError. - * @param error - Uknown error object - * @returns Whether the error is an AdError - * - * @public */ export function isAdError(error: unknown): error is AdError { return error instanceof AdError; diff --git a/src/AdLoader.ts b/src/AdLoader.ts index 1973b19..412de13 100644 --- a/src/AdLoader.ts +++ b/src/AdLoader.ts @@ -29,9 +29,6 @@ import { } from './types/AdLoaderOptions'; import { AdType } from './types/AdType'; -/** - * @public - */ export class AdLoader { private static readonly _nativeModule = AdLoaderModule; private static readonly _eventEmitter = new NativeEventEmitter( @@ -49,8 +46,6 @@ export class AdLoader { /** * Create a banner AdLoader instance. - * @param adLoaderOptions - `BannerAdLoaderOptions` object used to configure the bid request. - * @returns AdLoader instance. */ static createBannerAdLoader(adLoaderOptions: BannerAdLoaderOptions) { try { @@ -66,8 +61,6 @@ export class AdLoader { /** * Create a interstitial AdLoader instance. - * @param adLoaderOptions - `AdLoaderOptions` object used to configure the bid request. - * @returns AdLoader instance. */ static createInterstitialAdLoader(adLoaderOptions: AdLoaderOptions) { try { @@ -85,12 +78,6 @@ export class AdLoader { * Add a listener for the bid response. Supported events are: * - `AdLoaderEvent.SUCCESS` * - `AdLoaderEvent.FAILURE` - * @param eventName - The name of the event to listen. - * @param listener - The listener to be called when the event is fired. - * - * @returns Unsubscribe function. - * - * @public */ addListener( eventName: E, @@ -126,9 +113,6 @@ export class AdLoader { * Request APS for a bid. Only a single ad size and slotUUID is supported per bid request. * This method will return a promise that resolves a bid response requested by this call. * In order to receive further bid responses returned by auto refresh, you must register listeners via `addListener()`. - * @returns Promise of key value pairs from returned bid response. - * - * @public */ async loadAd() { try { @@ -149,7 +133,6 @@ export class AdLoader { /** * Stop the auto refresh of the ad. * - * @public */ stopAutoRefresh() { AdLoader._nativeModule.stopAutoRefresh(this.loaderId); @@ -157,10 +140,6 @@ export class AdLoader { /** * In order for SKAdNetwork to work, pass the app event. - * @param name - The name of the event. - * @param info - The data/info with the event. - * - * @public */ static skadnHelper(name: string, info?: string) { if (typeof name !== 'string') { diff --git a/src/TestIds.ts b/src/TestIds.ts index 564fd14..c1802b3 100644 --- a/src/TestIds.ts +++ b/src/TestIds.ts @@ -18,9 +18,6 @@ import { Platform } from 'react-native'; -/** - * @public - */ export const TestIds = { APS_APP_KEY: '', APS_SLOT_BANNER_320x50: '', diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index f65212d..cdf5620 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -17,7 +17,41 @@ */ import { TurboModule, TurboModuleRegistry } from 'react-native'; -import type { AdLoaderOptions, AdType, BannerAdLoaderOptions } from 'src/types'; + +export const AdType = { + BANNER: 'banner', + INTERSTITIAL: 'interstitial', +} as const; + +export type AdType = typeof AdType[keyof typeof AdType]; + +export interface AdLoaderOptions { + /** + * The slotUUID of the ad slot. + */ + slotUUID: string; + /** + * The optional custom targeting key value pairs for the bid request. + */ + customTargeting?: { [key: string]: string }; +} + +export interface BannerAdLoaderOptions extends AdLoaderOptions { + /** + * The size of the banner ad slot. Required for banner ad slots. + */ + size: string; + + /** + * Whether the banner ad to be automatically refreshed. Defaults to `false`. + */ + autoRefresh?: boolean; + + /** + * The time interval in seconds between refreshes. Defaults to `60` seconds if autoRefresh enabled. The minimum auto-refresh time supported is `20` seconds. + */ + refreshInterval?: number; +} export interface Spec extends TurboModule { loadAd: ( diff --git a/src/types/AdLoaderEvent.ts b/src/types/AdLoaderEvent.ts index aeb8e90..593741a 100644 --- a/src/types/AdLoaderEvent.ts +++ b/src/types/AdLoaderEvent.ts @@ -16,22 +16,13 @@ * along with Foobar. If not, see . */ -/** - * @public - */ export const AdLoaderEvent = { SUCCESS: 'onSuccess', FAILURE: 'onFailure', } as const; -/** - * @public - */ export type AdLoaderEvent = typeof AdLoaderEvent[keyof typeof AdLoaderEvent]; -/** - * @internal - */ export function isAdLoaderEvent(value: any): value is AdLoaderEvent { return Object.values(AdLoaderEvent).includes(value); } diff --git a/src/types/AdLoaderOptions.ts b/src/types/AdLoaderOptions.ts index 55bb055..01d95c5 100644 --- a/src/types/AdLoaderOptions.ts +++ b/src/types/AdLoaderOptions.ts @@ -16,9 +16,6 @@ * along with Foobar. If not, see . */ -/** - * @public - */ export interface AdLoaderOptions { /** * The slotUUID of the ad slot. @@ -30,9 +27,6 @@ export interface AdLoaderOptions { customTargeting?: { [key: string]: string }; } -/** - * @public - */ export interface BannerAdLoaderOptions extends AdLoaderOptions { /** * The size of the banner ad slot. Required for banner ad slots. @@ -52,9 +46,6 @@ export interface BannerAdLoaderOptions extends AdLoaderOptions { const sizeRegex = /([0-9]+)x([0-9]+)/; -/** - * @internal - */ export function validateAdLoaderOptions(adLoaderOptions: AdLoaderOptions) { if (typeof adLoaderOptions !== 'object') { throw new Error("'adLoaderOptions' expected an object value"); @@ -64,9 +55,6 @@ export function validateAdLoaderOptions(adLoaderOptions: AdLoaderOptions) { } } -/** - * @internal - */ export function validateBannerAdLoaderOptions( adLoaderOptions: BannerAdLoaderOptions ) { diff --git a/src/types/AdNetwork.ts b/src/types/AdNetwork.ts index b72b83f..d76b431 100644 --- a/src/types/AdNetwork.ts +++ b/src/types/AdNetwork.ts @@ -16,9 +16,6 @@ * along with Foobar. If not, see . */ -/** - * @public - */ export const AdNetwork = { GOOGLE_AD_MANAGER: 'GOOGLE_AD_MANAGER', ADMOB: 'ADMOB', @@ -29,14 +26,8 @@ export const AdNetwork = { OTHER: 'OTHER', } as const; -/** - * @public - */ export type AdNetwork = typeof AdNetwork[keyof typeof AdNetwork]; -/** - * @internal - */ export function isAdNetwork(value: any): value is AdNetwork { return Object.values(AdNetwork).includes(value); } diff --git a/src/types/AdNetworkInfo.ts b/src/types/AdNetworkInfo.ts index a04137c..eabe1ac 100644 --- a/src/types/AdNetworkInfo.ts +++ b/src/types/AdNetworkInfo.ts @@ -18,9 +18,6 @@ import { AdNetwork, isAdNetwork } from './AdNetwork'; -/** - * @public - */ export interface AdNetworkInfo { /** * The name of the primary ad server or mediator @@ -29,9 +26,6 @@ export interface AdNetworkInfo { adNetworkProperties?: { [key: string]: string }; } -/** - * @internal - */ export function validateAdNetworkInfo(adNetworkInfo: AdNetworkInfo) { if (typeof adNetworkInfo !== 'object') { throw new Error("'adNetworkInfo' expected an object value"); diff --git a/src/types/AdType.ts b/src/types/AdType.ts index 5a5357e..5ba70d5 100644 --- a/src/types/AdType.ts +++ b/src/types/AdType.ts @@ -16,22 +16,13 @@ * along with Foobar. If not, see . */ -/** - * @public - */ export const AdType = { BANNER: 'banner', INTERSTITIAL: 'interstitial', } as const; -/** - * @public - */ export type AdType = typeof AdType[keyof typeof AdType]; -/** - * @internal - */ -export function isAdType(value: any): value is AdType { +function isAdType(value: any): value is AdType { return Object.values(AdType).includes(value); } diff --git a/src/types/MRAIDPolicy.ts b/src/types/MRAIDPolicy.ts index ffcc197..ff0b805 100644 --- a/src/types/MRAIDPolicy.ts +++ b/src/types/MRAIDPolicy.ts @@ -16,23 +16,14 @@ * along with Foobar. If not, see . */ -/** - * @public - */ export const MRAIDPolicy = { NONE: 'NONE', DFP: 'DFP', CUSTOM: 'CUSTOM', } as const; -/** - * @public - */ export type MRAIDPolicy = typeof MRAIDPolicy[keyof typeof MRAIDPolicy]; -/** - * @internal - */ export function isMRAIDPolicy(value: any): value is MRAIDPolicy { return Object.values(MRAIDPolicy).includes(value); } From 4f01a567ddfb3e2f6a6af8987b338570192e280d Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 11:27:43 +0100 Subject: [PATCH 18/28] remove annotations --- src/types/AdType.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/AdType.ts b/src/types/AdType.ts index 5ba70d5..70103e2 100644 --- a/src/types/AdType.ts +++ b/src/types/AdType.ts @@ -23,6 +23,6 @@ export const AdType = { export type AdType = typeof AdType[keyof typeof AdType]; -function isAdType(value: any): value is AdType { +export function isAdType(value: any): value is AdType { return Object.values(AdType).includes(value); } From 9f037a9a9c03793e73832ca432b01e2a62783e0e Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 11:40:11 +0100 Subject: [PATCH 19/28] remove annotations --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 3 ++- src/turbomodules/NativeRNAPSAdsModule.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index cdf5620..4004045 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -16,7 +16,8 @@ * along with Foobar. If not, see . */ -import { TurboModule, TurboModuleRegistry } from 'react-native'; +import type { TurboModule } from 'react-native'; +import { TurboModuleRegistry } from 'react-native'; export const AdType = { BANNER: 'banner', diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index d6514a7..cc6070b 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -15,8 +15,8 @@ * You should have received a copy of the GNU Lesser General Public License * along with Foobar. If not, see . */ - -import { TurboModule, TurboModuleRegistry } from 'react-native'; +import type { TurboModule } from 'react-native'; +import { TurboModuleRegistry } from 'react-native'; import type { MRAIDPolicy } from '../types'; From 8f4cf7d0aada7dd7b69b3d938f34b154a2e88342 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 15:12:21 +0100 Subject: [PATCH 20/28] try remove TSIndexedAccessType --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 8 +++----- src/types/AdType.ts | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 4004045..87bdbfb 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -19,12 +19,10 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; -export const AdType = { +export type AdType = { BANNER: 'banner', INTERSTITIAL: 'interstitial', -} as const; - -export type AdType = typeof AdType[keyof typeof AdType]; +}; export interface AdLoaderOptions { /** @@ -59,7 +57,7 @@ export interface Spec extends TurboModule { loaderId: number, adType: AdType, options: AdLoaderOptions | BannerAdLoaderOptions - ) => Promise<{ [key: string]: string }>; + ) => void; stopAutoRefresh: (loaderId: number) => void; diff --git a/src/types/AdType.ts b/src/types/AdType.ts index 70103e2..cf49612 100644 --- a/src/types/AdType.ts +++ b/src/types/AdType.ts @@ -16,13 +16,11 @@ * along with Foobar. If not, see . */ -export const AdType = { +export type AdType = { BANNER: 'banner', INTERSTITIAL: 'interstitial', -} as const; - -export type AdType = typeof AdType[keyof typeof AdType]; +} export function isAdType(value: any): value is AdType { - return Object.values(AdType).includes(value); + return value === 'banner' || value === 'interstitial'; } From 4f2d1bf59696e29b2cfc659c32dc35109683ca62 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 15:22:35 +0100 Subject: [PATCH 21/28] transform adType to enum --- src/AdLoader.ts | 2 +- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 8 ++++---- src/types/AdType.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/AdLoader.ts b/src/AdLoader.ts index 412de13..bc0c440 100644 --- a/src/AdLoader.ts +++ b/src/AdLoader.ts @@ -27,7 +27,7 @@ import { validateAdLoaderOptions, validateBannerAdLoaderOptions, } from './types/AdLoaderOptions'; -import { AdType } from './types/AdType'; +import { AdType } from './types'; export class AdLoader { private static readonly _nativeModule = AdLoaderModule; diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 87bdbfb..995bb3a 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -19,10 +19,10 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; -export type AdType = { - BANNER: 'banner', - INTERSTITIAL: 'interstitial', -}; +export enum AdType { + BANNER = 'banner', + INTERSTITIAL = 'interstitial', +} export interface AdLoaderOptions { /** diff --git a/src/types/AdType.ts b/src/types/AdType.ts index cf49612..ff6ca70 100644 --- a/src/types/AdType.ts +++ b/src/types/AdType.ts @@ -16,9 +16,9 @@ * along with Foobar. If not, see . */ -export type AdType = { - BANNER: 'banner', - INTERSTITIAL: 'interstitial', +export enum AdType { + BANNER = 'banner', + INTERSTITIAL = 'interstitial', } export function isAdType(value: any): value is AdType { From 34903d2fd5ac33401945415584f66c758e14a2b7 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 15:36:27 +0100 Subject: [PATCH 22/28] transform adNetwork to enum --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 2 +- src/turbomodules/NativeRNAPSAdsModule.ts | 19 +++++++++--------- src/types/AdNetwork.ts | 20 +++++++++---------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 995bb3a..45a5b09 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -57,7 +57,7 @@ export interface Spec extends TurboModule { loaderId: number, adType: AdType, options: AdLoaderOptions | BannerAdLoaderOptions - ) => void; + ) => Promise<{ [key: string]: string }>; stopAutoRefresh: (loaderId: number) => void; diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index cc6070b..6ffb724 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -20,17 +20,16 @@ import { TurboModuleRegistry } from 'react-native'; import type { MRAIDPolicy } from '../types'; -export const AdNetwork = { - GOOGLE_AD_MANAGER: 'GOOGLE_AD_MANAGER', - ADMOB: 'ADMOB', - AD_GENERATION: 'AD_GENERATION', - IRON_SOURCE: 'IRON_SOURCE', - MAX: 'MAX', - NIMBUS: 'NIMBUS', - OTHER: 'OTHER', -} as const; +export enum AdNetwork { + GOOGLE_AD_MANAGER = 'GOOGLE_AD_MANAGER', + ADMOB = 'ADMOB', + AD_GENERATION = 'AD_GENERATION', + IRON_SOURCE = 'IRON_SOURCE', + MAX = 'MAX', + NIMBUS = 'NIMBUS', + OTHER = 'OTHER', +}; -export type AdNetwork = typeof AdNetwork[keyof typeof AdNetwork]; export interface AdNetworkInfo { /** diff --git a/src/types/AdNetwork.ts b/src/types/AdNetwork.ts index d76b431..be76bf8 100644 --- a/src/types/AdNetwork.ts +++ b/src/types/AdNetwork.ts @@ -16,17 +16,15 @@ * along with Foobar. If not, see . */ -export const AdNetwork = { - GOOGLE_AD_MANAGER: 'GOOGLE_AD_MANAGER', - ADMOB: 'ADMOB', - AD_GENERATION: 'AD_GENERATION', - IRON_SOURCE: 'IRON_SOURCE', - MAX: 'MAX', - NIMBUS: 'NIMBUS', - OTHER: 'OTHER', -} as const; - -export type AdNetwork = typeof AdNetwork[keyof typeof AdNetwork]; +export enum AdNetwork { + GOOGLE_AD_MANAGER = 'GOOGLE_AD_MANAGER', + ADMOB = 'ADMOB', + AD_GENERATION = 'AD_GENERATION', + IRON_SOURCE = 'IRON_SOURCE', + MAX = 'MAX', + NIMBUS = 'NIMBUS', + OTHER = 'OTHER', +}; export function isAdNetwork(value: any): value is AdNetwork { return Object.values(AdNetwork).includes(value); From 3f2f5b83aa9121c5260869d07437ecd48e7c6623 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 15:47:28 +0100 Subject: [PATCH 23/28] transform MRAIDPolicy to enum --- src/turbomodules/NativeRNAPSAdsModule.ts | 7 ++++++- src/types/MRAIDPolicy.ts | 12 +++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index 6ffb724..86e903e 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -18,7 +18,12 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; -import type { MRAIDPolicy } from '../types'; + +export enum MRAIDPolicy { + NONE = 'NONE', + DFP = 'DFP', + CUSTOM = 'CUSTOM', +}; export enum AdNetwork { GOOGLE_AD_MANAGER = 'GOOGLE_AD_MANAGER', diff --git a/src/types/MRAIDPolicy.ts b/src/types/MRAIDPolicy.ts index ff0b805..04fcfe1 100644 --- a/src/types/MRAIDPolicy.ts +++ b/src/types/MRAIDPolicy.ts @@ -16,13 +16,11 @@ * along with Foobar. If not, see . */ -export const MRAIDPolicy = { - NONE: 'NONE', - DFP: 'DFP', - CUSTOM: 'CUSTOM', -} as const; - -export type MRAIDPolicy = typeof MRAIDPolicy[keyof typeof MRAIDPolicy]; +export enum MRAIDPolicy { + NONE = 'NONE', + DFP = 'DFP', + CUSTOM = 'CUSTOM', +}; export function isMRAIDPolicy(value: any): value is MRAIDPolicy { return Object.values(MRAIDPolicy).includes(value); From 37cc80340a9ad5ff3845d8cf68bc0659b0ff422a Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 16:04:44 +0100 Subject: [PATCH 24/28] remove enum --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 7 +----- src/turbomodules/NativeRNAPSAdsModule.ts | 22 ++----------------- src/types/AdType.ts | 2 +- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 45a5b09..cc3e41f 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -19,11 +19,6 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; -export enum AdType { - BANNER = 'banner', - INTERSTITIAL = 'interstitial', -} - export interface AdLoaderOptions { /** * The slotUUID of the ad slot. @@ -55,7 +50,7 @@ export interface BannerAdLoaderOptions extends AdLoaderOptions { export interface Spec extends TurboModule { loadAd: ( loaderId: number, - adType: AdType, + adType: string, options: AdLoaderOptions | BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index 86e903e..7711d4d 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -18,29 +18,11 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; - -export enum MRAIDPolicy { - NONE = 'NONE', - DFP = 'DFP', - CUSTOM = 'CUSTOM', -}; - -export enum AdNetwork { - GOOGLE_AD_MANAGER = 'GOOGLE_AD_MANAGER', - ADMOB = 'ADMOB', - AD_GENERATION = 'AD_GENERATION', - IRON_SOURCE = 'IRON_SOURCE', - MAX = 'MAX', - NIMBUS = 'NIMBUS', - OTHER = 'OTHER', -}; - - export interface AdNetworkInfo { /** * The name of the primary ad server or mediator */ - adNetwork: AdNetwork; + adNetwork: string; adNetworkProperties?: { [key: string]: string }; } @@ -54,7 +36,7 @@ export interface Spec extends TurboModule { setMRAIDSupportedVersions: (supportedVersions: string[]) => void; - setMRAIDPolicy: (policy: MRAIDPolicy) => void; + setMRAIDPolicy: (policy: string) => void; setTestMode: (enabled: boolean) => void; diff --git a/src/types/AdType.ts b/src/types/AdType.ts index ff6ca70..1e960db 100644 --- a/src/types/AdType.ts +++ b/src/types/AdType.ts @@ -22,5 +22,5 @@ export enum AdType { } export function isAdType(value: any): value is AdType { - return value === 'banner' || value === 'interstitial'; + return Object.values(AdType).includes(value); } From 2e14304c8de73e518ddbfee37b68f0eecb0ea0b1 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 16:16:39 +0100 Subject: [PATCH 25/28] remove union type --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index cc3e41f..91f0c7d 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -51,7 +51,7 @@ export interface Spec extends TurboModule { loadAd: ( loaderId: number, adType: string, - options: AdLoaderOptions | BannerAdLoaderOptions + options: BannerAdLoaderOptions ) => Promise<{ [key: string]: string }>; stopAutoRefresh: (loaderId: number) => void; From 0d8f37745c6e745c7677ad9fcae9cba490f3a019 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 16:19:29 +0100 Subject: [PATCH 26/28] optional size --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 2 +- src/types/AdLoaderOptions.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 91f0c7d..5386c2e 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -34,7 +34,7 @@ export interface BannerAdLoaderOptions extends AdLoaderOptions { /** * The size of the banner ad slot. Required for banner ad slots. */ - size: string; + size?: string; /** * Whether the banner ad to be automatically refreshed. Defaults to `false`. diff --git a/src/types/AdLoaderOptions.ts b/src/types/AdLoaderOptions.ts index 01d95c5..ec13c6e 100644 --- a/src/types/AdLoaderOptions.ts +++ b/src/types/AdLoaderOptions.ts @@ -31,7 +31,7 @@ export interface BannerAdLoaderOptions extends AdLoaderOptions { /** * The size of the banner ad slot. Required for banner ad slots. */ - size: string; + size?: string; /** * Whether the banner ad to be automatically refreshed. Defaults to `false`. From 831f107a8a8fa573a5593d56cc0178892a124193 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 16:42:25 +0100 Subject: [PATCH 27/28] remove doubled export --- src/turbomodules/NativeRNAPSAdLoaderModule.ts | 4 ++-- src/turbomodules/NativeRNAPSAdsModule.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/turbomodules/NativeRNAPSAdLoaderModule.ts b/src/turbomodules/NativeRNAPSAdLoaderModule.ts index 5386c2e..b6be6c7 100644 --- a/src/turbomodules/NativeRNAPSAdLoaderModule.ts +++ b/src/turbomodules/NativeRNAPSAdLoaderModule.ts @@ -19,7 +19,7 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; -export interface AdLoaderOptions { +interface AdLoaderOptions { /** * The slotUUID of the ad slot. */ @@ -30,7 +30,7 @@ export interface AdLoaderOptions { customTargeting?: { [key: string]: string }; } -export interface BannerAdLoaderOptions extends AdLoaderOptions { +interface BannerAdLoaderOptions extends AdLoaderOptions { /** * The size of the banner ad slot. Required for banner ad slots. */ diff --git a/src/turbomodules/NativeRNAPSAdsModule.ts b/src/turbomodules/NativeRNAPSAdsModule.ts index 7711d4d..bbcbf61 100644 --- a/src/turbomodules/NativeRNAPSAdsModule.ts +++ b/src/turbomodules/NativeRNAPSAdsModule.ts @@ -18,7 +18,7 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; -export interface AdNetworkInfo { +interface AdNetworkInfo { /** * The name of the primary ad server or mediator */ From 69b9695e0360195bf19370260aec9d69b81cb530 Mon Sep 17 00:00:00 2001 From: oromis300 Date: Tue, 29 Oct 2024 16:59:50 +0100 Subject: [PATCH 28/28] change folly version --- RNAmazonPublisherServices.podspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RNAmazonPublisherServices.podspec b/RNAmazonPublisherServices.podspec index 6fcb9bd..608b443 100644 --- a/RNAmazonPublisherServices.podspec +++ b/RNAmazonPublisherServices.podspec @@ -21,7 +21,8 @@ Pod::Spec.new do |s| # folly_version must match the version used in React Native # See folly_version in react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec - folly_version = '2021.06.28.00-v2' + folly_config = get_folly_config() + folly_version = folly_config[:version] folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' s.compiler_flags = folly_compiler_flags