expo-ads 0.1.2 → 0.1.3
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/android/build.gradle +32 -33
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/expo/modules/ads/meta/MetaAdsInitializer.kt +1 -1
- package/android/src/main/java/expo/modules/ads/meta/MetaAdsModule.kt +10 -6
- package/android/src/main/java/expo/modules/ads/meta/MetaBannerAdView.kt +28 -28
- package/build/meta/{ExpoAdsMetaModule.d.ts → MetaAdsModule.d.ts} +3 -3
- package/build/meta/MetaAdsModule.d.ts.map +1 -0
- package/build/meta/MetaAdsModule.js +3 -0
- package/build/meta/MetaAdsModule.js.map +1 -0
- package/build/meta/index.d.ts +1 -1
- package/build/meta/index.d.ts.map +1 -1
- package/build/meta/index.js +3 -3
- package/build/meta/index.js.map +1 -1
- package/expo-module.config.json +6 -18
- package/package.json +79 -83
- package/src/meta/{ExpoAdsMetaModule.ts → MetaAdsModule.ts} +44 -44
- package/src/meta/index.ts +12 -12
- package/android/src/main/java/expo/modules/ads/google/GoogleAdsModule.kt +0 -17
- package/build/google/ExpoAdsGoogleModule.d.ts +0 -6
- package/build/google/ExpoAdsGoogleModule.d.ts.map +0 -1
- package/build/google/ExpoAdsGoogleModule.js +0 -3
- package/build/google/ExpoAdsGoogleModule.js.map +0 -1
- package/build/google/index.d.ts +0 -2
- package/build/google/index.d.ts.map +0 -1
- package/build/google/index.js +0 -6
- package/build/google/index.js.map +0 -1
- package/build/meta/ExpoAdsMetaModule.d.ts.map +0 -1
- package/build/meta/ExpoAdsMetaModule.js +0 -3
- package/build/meta/ExpoAdsMetaModule.js.map +0 -1
- package/ios/Expo-ads.podspec +0 -23
- package/ios/Expo-adsModule.swift +0 -7
- package/src/google/ExpoAdsGoogleModule.ts +0 -6
- package/src/google/index.ts +0 -5
package/android/build.gradle
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import groovy.json.JsonSlurper
|
|
2
|
-
|
|
3
|
-
plugins {
|
|
4
|
-
id 'com.android.library'
|
|
5
|
-
id 'expo-module-gradle-plugin'
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
group = 'expo.modules.ads'
|
|
9
|
-
version = '0.1.
|
|
10
|
-
|
|
11
|
-
def packageJson = new JsonSlurper().parseText(file("${projectDir}/../package.json").text)
|
|
12
|
-
|
|
13
|
-
def metaAudienceNetworkVersion = packageJson.sdkVersions.android.metaAudienceNetwork
|
|
14
|
-
def playServicesAdsIdentifierVersion = packageJson.sdkVersions.android.playServicesAdsIdentifier
|
|
15
|
-
def playServicesBasementVersion = packageJson.sdkVersions.android.playServicesBasement
|
|
16
|
-
|
|
17
|
-
android {
|
|
18
|
-
namespace "expo.modules.ads"
|
|
19
|
-
defaultConfig {
|
|
20
|
-
versionCode 1
|
|
21
|
-
versionName "0.1.
|
|
22
|
-
}
|
|
23
|
-
lintOptions {
|
|
24
|
-
abortOnError false
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
implementation("com.
|
|
32
|
-
implementation("com.google.android.gms:play-services-
|
|
33
|
-
implementation("com.google.android.gms:play-services-basement:${playServicesBasementVersion}")
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
|
|
3
|
+
plugins {
|
|
4
|
+
id 'com.android.library'
|
|
5
|
+
id 'expo-module-gradle-plugin'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
group = 'expo.modules.ads'
|
|
9
|
+
version = '0.1.3'
|
|
10
|
+
|
|
11
|
+
def packageJson = new JsonSlurper().parseText(file("${projectDir}/../package.json").text)
|
|
12
|
+
|
|
13
|
+
def metaAudienceNetworkVersion = packageJson.sdkVersions.android.metaAudienceNetwork
|
|
14
|
+
def playServicesAdsIdentifierVersion = packageJson.sdkVersions.android.playServicesAdsIdentifier
|
|
15
|
+
def playServicesBasementVersion = packageJson.sdkVersions.android.playServicesBasement
|
|
16
|
+
|
|
17
|
+
android {
|
|
18
|
+
namespace "expo.modules.ads"
|
|
19
|
+
defaultConfig {
|
|
20
|
+
versionCode 1
|
|
21
|
+
versionName "0.1.3"
|
|
22
|
+
}
|
|
23
|
+
lintOptions {
|
|
24
|
+
abortOnError false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
dependencies {
|
|
30
|
+
implementation("com.facebook.android:audience-network-sdk:${metaAudienceNetworkVersion}")
|
|
31
|
+
implementation("com.google.android.gms:play-services-ads-identifier:${playServicesAdsIdentifierVersion}")
|
|
32
|
+
implementation("com.google.android.gms:play-services-basement:${playServicesBasementVersion}")
|
|
34
33
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<manifest>
|
|
2
|
-
</manifest>
|
|
1
|
+
<manifest>
|
|
2
|
+
</manifest>
|
|
@@ -7,8 +7,12 @@ import expo.modules.kotlin.modules.Module
|
|
|
7
7
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
8
8
|
|
|
9
9
|
class MetaAdsModule : Module() {
|
|
10
|
+
init {
|
|
11
|
+
Log.d("ExpoAdsMeta", "🔥 MetaAdsModule INSTANCE CREATED")
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
override fun definition() = ModuleDefinition {
|
|
11
|
-
Name("
|
|
15
|
+
Name("MetaAds") // the name JS uses to find this module (import from "expo-ads/meta")
|
|
12
16
|
|
|
13
17
|
// Runs automatically when the module loads (warm-up)
|
|
14
18
|
OnCreate {
|
|
@@ -21,7 +25,7 @@ class MetaAdsModule : Module() {
|
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
// Lets JS call: await
|
|
28
|
+
// Lets JS call: await MetaAds.initialize()
|
|
25
29
|
AsyncFunction("initialize") { promise: Promise ->
|
|
26
30
|
val ctx = appContext.reactContext
|
|
27
31
|
if (ctx == null) {
|
|
@@ -35,7 +39,7 @@ class MetaAdsModule : Module() {
|
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
// Lets JS call: await
|
|
42
|
+
// Lets JS call: await MetaAds.setTestMode(true)
|
|
39
43
|
//
|
|
40
44
|
// This is a plain static AdSettings toggle with no I/O, so it's a synchronous Function
|
|
41
45
|
// rather than an AsyncFunction — but it's still safe (and expected) to `await` it from
|
|
@@ -50,7 +54,7 @@ class MetaAdsModule : Module() {
|
|
|
50
54
|
AdSettings.setTestMode(enabled)
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
// Lets JS call: await
|
|
57
|
+
// Lets JS call: await MetaAds.addTestDevices(["HASHED_ID_1", "HASHED_ID_2"])
|
|
54
58
|
//
|
|
55
59
|
// Accepts a list so a single call can register every test device hash at once; each
|
|
56
60
|
// hash is normally copied from Logcat the first time a real ad request is made on that
|
|
@@ -60,7 +64,7 @@ class MetaAdsModule : Module() {
|
|
|
60
64
|
AdSettings.addTestDevices(deviceHashes)
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
// Lets JS call: await
|
|
67
|
+
// Lets JS call: await MetaAds.clearTestDevices()
|
|
64
68
|
//
|
|
65
69
|
// Mirrors Meta's documented "before shipping" cleanup step
|
|
66
70
|
// (AdSettings.setTestMode(false); AdSettings.clearTestDevices();). Exposed separately
|
|
@@ -77,7 +81,7 @@ class MetaAdsModule : Module() {
|
|
|
77
81
|
Prop("unitId") { view: MetaBannerAdView, value: String? ->
|
|
78
82
|
view.setUnitId(value)
|
|
79
83
|
}
|
|
80
|
-
|
|
84
|
+
|
|
81
85
|
Prop("size") { view: MetaBannerAdView, value: MetaBannerAdSize ->
|
|
82
86
|
view.setSize(value)
|
|
83
87
|
}
|
|
@@ -72,48 +72,48 @@ class MetaBannerAdView(context: Context, appContext: AppContext) : ExpoView(cont
|
|
|
72
72
|
val newAdView = AdView(context, currentUnitId, currentSize.toFacebookAdSize())
|
|
73
73
|
adView = newAdView
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"message" to adError.errorMessage,
|
|
83
|
-
)
|
|
75
|
+
val adListener = object : AdListener {
|
|
76
|
+
override fun onError(ad: Ad, adError: AdError) {
|
|
77
|
+
Log.e(TAG, "[Banner] onError: ${adError.errorCode} ${adError.errorMessage}")
|
|
78
|
+
onAdFailedToLoad(
|
|
79
|
+
mapOf(
|
|
80
|
+
"code" to adError.errorCode.toString(),
|
|
81
|
+
"message" to adError.errorMessage,
|
|
84
82
|
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
override fun onAdLoaded(ad: Ad) {
|
|
87
|
+
Log.d(TAG, "[Banner] onAdLoaded")
|
|
88
|
+
onAdLoaded(
|
|
89
|
+
mapOf(
|
|
90
|
+
"width" to currentSize.toFacebookAdSize().width,
|
|
91
|
+
"height" to currentSize.toFacebookAdSize().height,
|
|
94
92
|
)
|
|
95
|
-
|
|
93
|
+
)
|
|
94
|
+
}
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
override fun onAdClicked(ad: Ad) {
|
|
97
|
+
onAdClicked(emptyMap())
|
|
98
|
+
}
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
100
|
+
override fun onLoggingImpression(ad: Ad) {
|
|
101
|
+
onLoggingImpression(emptyMap())
|
|
104
102
|
}
|
|
105
|
-
|
|
103
|
+
}
|
|
106
104
|
|
|
107
105
|
addView(
|
|
108
106
|
newAdView,
|
|
109
107
|
ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
110
108
|
)
|
|
111
|
-
|
|
109
|
+
|
|
110
|
+
// AdView has no setAdListener(...) setter — the listener is attached through the
|
|
111
|
+
// load-config builder and only takes effect for this particular loadAd() call.
|
|
112
|
+
newAdView.loadAd(newAdView.buildLoadAdConfig().withAdListener(adListener).build())
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
private fun destroyAdView() {
|
|
115
116
|
adView?.let {
|
|
116
|
-
it.setAdListener(null)
|
|
117
117
|
removeView(it)
|
|
118
118
|
it.destroy()
|
|
119
119
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NativeModule } from 'expo';
|
|
2
|
-
declare class
|
|
2
|
+
declare class MetaAdsModule extends NativeModule<{}> {
|
|
3
3
|
/**
|
|
4
4
|
* Initializes the Meta Audience Network SDK. Resolves once the SDK reports
|
|
5
5
|
* it's ready (or was already ready); rejects with `ERR_META_INIT` if the
|
|
@@ -36,6 +36,6 @@ declare class ExpoAdsMetaModule extends NativeModule<{}> {
|
|
|
36
36
|
*/
|
|
37
37
|
clearTestDevices(): Promise<void>;
|
|
38
38
|
}
|
|
39
|
-
declare const _default:
|
|
39
|
+
declare const _default: MetaAdsModule;
|
|
40
40
|
export default _default;
|
|
41
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=MetaAdsModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaAdsModule.d.ts","sourceRoot":"","sources":["../../src/meta/MetaAdsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,OAAO,aAAc,SAAQ,YAAY,CAAC,EAAE,CAAC;IAClD;;;;;OAKG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAE7B;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE5C;;;;;;;OAOG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAErD;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAClC;;AAED,wBAA6D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaAdsModule.js","sourceRoot":"","sources":["../../src/meta/MetaAdsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AA2CzD,eAAe,mBAAmB,CAAgB,SAAS,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\ndeclare class MetaAdsModule extends NativeModule<{}> {\n /**\n * Initializes the Meta Audience Network SDK. Resolves once the SDK reports\n * it's ready (or was already ready); rejects with `ERR_META_INIT` if the\n * native `AudienceNetworkAds.initialize()` call fails, or `ERR_NO_CONTEXT`\n * if called before the React context is available.\n */\n initialize(): Promise<string>;\n\n /**\n * Enables or disables Audience Network test mode globally.\n *\n * Per Meta's docs, call this (and/or {@link addTestDevices}) *before* your\n * first ad request — not after. It does not depend on {@link initialize}\n * having resolved.\n *\n * Test mode returns test ads regardless of live auction availability, so\n * this must be turned back off (`setTestMode(false)`) before a release\n * build ships, or real users will be served test ads and you'll earn zero\n * revenue from those impressions.\n */\n setTestMode(enabled: boolean): Promise<void>;\n\n /**\n * Registers one or more test device hashes so those physical devices\n * receive test ads. Each hash is printed to Logcat the first time that\n * device makes a real ad request. Has no effect on emulators, which\n * always receive test ads automatically.\n *\n * Call before your first ad request, alongside {@link setTestMode}.\n */\n addTestDevices(deviceHashes: string[]): Promise<void>;\n\n /**\n * Clears every test device hash registered via {@link addTestDevices}.\n * Call this alongside `setTestMode(false)` before shipping a release\n * build, per Meta's \"disable test mode before shipping\" guidance.\n */\n clearTestDevices(): Promise<void>;\n}\n\nexport default requireNativeModule<MetaAdsModule>('MetaAds');\n"]}
|
package/build/meta/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/meta/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/meta/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,wBAAwB,GACzB,MAAM,qBAAqB,CAAC"}
|
package/build/meta/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Reexport the
|
|
2
|
-
//
|
|
3
|
-
export { default } from './
|
|
1
|
+
// Reexport the native module. On web, it will be resolved to ExpoAds2Module.web.ts
|
|
2
|
+
// and on native platforms to ExpoAds2Module.ts
|
|
3
|
+
export { default } from './MetaAdsModule';
|
|
4
4
|
export { MetaBannerAd } from './ads/BannerAd';
|
|
5
5
|
export { MetaBannerAdSize } from './ads/MetaBannerAdSize';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/build/meta/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/meta/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/meta/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,+CAA+C;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["// Reexport the native module. On web, it will be resolved to ExpoAds2Module.web.ts\n// and on native platforms to ExpoAds2Module.ts\nexport { default } from './MetaAdsModule';\n\nexport { MetaBannerAd } from './ads/BannerAd';\nexport { MetaBannerAdSize } from './ads/MetaBannerAdSize';\nexport type { MetaBannerAdProps } from './types/MetaBannerAdProps';\nexport type {\n MetaAdErrorPayload,\n MetaAdErrorCode,\n MetaAdRequestGuardReason,\n} from './types/MetaAdError';\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"platforms": [
|
|
3
|
-
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"modules": [
|
|
8
|
-
"ExpoAdsModule",
|
|
9
|
-
"MetaAdsModule"
|
|
10
|
-
]
|
|
11
|
-
},
|
|
12
|
-
"android": {
|
|
13
|
-
"modules": [
|
|
14
|
-
"expo.modules.ads.ExpoAdsModule",
|
|
15
|
-
"expo.modules.ads.meta.MetaAdsModule"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"platforms": ["android"],
|
|
3
|
+
"android": {
|
|
4
|
+
"modules": ["expo.modules.ads.meta.MetaAdsModule"]
|
|
5
|
+
}
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,83 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "expo-ads",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Expo Ads is a React Native / Expo native module for integrating mobile advertising networks into Expo applications.",
|
|
5
|
-
"main": "build/index.js",
|
|
6
|
-
"types": "build/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./build/index.d.ts",
|
|
10
|
-
"default": "./build/index.js"
|
|
11
|
-
},
|
|
12
|
-
"./meta": {
|
|
13
|
-
"types": "./build/meta/index.d.ts",
|
|
14
|
-
"default": "./build/meta/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"react": "*",
|
|
81
|
-
"react-native": "*"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "expo-ads",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Expo Ads is a React Native / Expo native module for integrating mobile advertising networks into Expo applications.",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./build/index.d.ts",
|
|
10
|
+
"default": "./build/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./meta": {
|
|
13
|
+
"types": "./build/meta/index.d.ts",
|
|
14
|
+
"default": "./build/meta/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"sdkVersions": {
|
|
19
|
+
"android": {
|
|
20
|
+
"metaAudienceNetwork": "6.22.0",
|
|
21
|
+
"playServicesAdsIdentifier": "18.3.0",
|
|
22
|
+
"playServicesBasement": "18.12.0"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node internal/module_scripts/build.js",
|
|
27
|
+
"clean": "node internal/module_scripts/clean.js",
|
|
28
|
+
"lint": "eslint src/",
|
|
29
|
+
"test": "node internal/module_scripts/test.js",
|
|
30
|
+
"prepare": "node internal/module_scripts/prepare.js",
|
|
31
|
+
"open:ios": "node internal/module_scripts/open-ios.js",
|
|
32
|
+
"open:android": "node internal/module_scripts/open-android.js"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"react-native",
|
|
36
|
+
"expo",
|
|
37
|
+
"expo-ads",
|
|
38
|
+
"Expo-ads",
|
|
39
|
+
"Facebook Ads",
|
|
40
|
+
"Google Admob",
|
|
41
|
+
"Google Ads",
|
|
42
|
+
"Meta Audience Network"
|
|
43
|
+
],
|
|
44
|
+
"repository": "https://github.com/vatsalpipalava/expo-ads.git",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/vatsalpipalava/expo-ads/issues"
|
|
47
|
+
},
|
|
48
|
+
"author": "Vatsal Pipalava <vatsalpipalava@gmail.com> (https://github.com/vatsalpipalava)",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"homepage": "https://github.com/vatsalpipalava/expo-ads#readme",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"expo-modules-core": "~57.0.19"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@babel/core": "^7.26.0",
|
|
56
|
+
"@types/jest": "^29.2.1",
|
|
57
|
+
"@types/react": "~19.2.4",
|
|
58
|
+
"babel-preset-expo": "~57.0.0",
|
|
59
|
+
"eslint": "~9.39.4",
|
|
60
|
+
"eslint-config-universe": "^15.0.3",
|
|
61
|
+
"expo": "^57.0.23",
|
|
62
|
+
"jest": "^29.7.0",
|
|
63
|
+
"jest-expo": "~57.0.5",
|
|
64
|
+
"prettier": "^3.0.0",
|
|
65
|
+
"react-native": "0.86.3",
|
|
66
|
+
"typescript": "~6.0.3"
|
|
67
|
+
},
|
|
68
|
+
"jest": {
|
|
69
|
+
"preset": "jest-expo",
|
|
70
|
+
"roots": [
|
|
71
|
+
"<rootDir>/src"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"expo": "*",
|
|
76
|
+
"react": "*",
|
|
77
|
+
"react-native": "*"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { NativeModule, requireNativeModule } from 'expo';
|
|
2
|
-
|
|
3
|
-
declare class
|
|
4
|
-
/**
|
|
5
|
-
* Initializes the Meta Audience Network SDK. Resolves once the SDK reports
|
|
6
|
-
* it's ready (or was already ready); rejects with `ERR_META_INIT` if the
|
|
7
|
-
* native `AudienceNetworkAds.initialize()` call fails, or `ERR_NO_CONTEXT`
|
|
8
|
-
* if called before the React context is available.
|
|
9
|
-
*/
|
|
10
|
-
initialize(): Promise<string>;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Enables or disables Audience Network test mode globally.
|
|
14
|
-
*
|
|
15
|
-
* Per Meta's docs, call this (and/or {@link addTestDevices}) *before* your
|
|
16
|
-
* first ad request — not after. It does not depend on {@link initialize}
|
|
17
|
-
* having resolved.
|
|
18
|
-
*
|
|
19
|
-
* Test mode returns test ads regardless of live auction availability, so
|
|
20
|
-
* this must be turned back off (`setTestMode(false)`) before a release
|
|
21
|
-
* build ships, or real users will be served test ads and you'll earn zero
|
|
22
|
-
* revenue from those impressions.
|
|
23
|
-
*/
|
|
24
|
-
setTestMode(enabled: boolean): Promise<void>;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Registers one or more test device hashes so those physical devices
|
|
28
|
-
* receive test ads. Each hash is printed to Logcat the first time that
|
|
29
|
-
* device makes a real ad request. Has no effect on emulators, which
|
|
30
|
-
* always receive test ads automatically.
|
|
31
|
-
*
|
|
32
|
-
* Call before your first ad request, alongside {@link setTestMode}.
|
|
33
|
-
*/
|
|
34
|
-
addTestDevices(deviceHashes: string[]): Promise<void>;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Clears every test device hash registered via {@link addTestDevices}.
|
|
38
|
-
* Call this alongside `setTestMode(false)` before shipping a release
|
|
39
|
-
* build, per Meta's "disable test mode before shipping" guidance.
|
|
40
|
-
*/
|
|
41
|
-
clearTestDevices(): Promise<void>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default requireNativeModule<
|
|
1
|
+
import { NativeModule, requireNativeModule } from 'expo';
|
|
2
|
+
|
|
3
|
+
declare class MetaAdsModule extends NativeModule<{}> {
|
|
4
|
+
/**
|
|
5
|
+
* Initializes the Meta Audience Network SDK. Resolves once the SDK reports
|
|
6
|
+
* it's ready (or was already ready); rejects with `ERR_META_INIT` if the
|
|
7
|
+
* native `AudienceNetworkAds.initialize()` call fails, or `ERR_NO_CONTEXT`
|
|
8
|
+
* if called before the React context is available.
|
|
9
|
+
*/
|
|
10
|
+
initialize(): Promise<string>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Enables or disables Audience Network test mode globally.
|
|
14
|
+
*
|
|
15
|
+
* Per Meta's docs, call this (and/or {@link addTestDevices}) *before* your
|
|
16
|
+
* first ad request — not after. It does not depend on {@link initialize}
|
|
17
|
+
* having resolved.
|
|
18
|
+
*
|
|
19
|
+
* Test mode returns test ads regardless of live auction availability, so
|
|
20
|
+
* this must be turned back off (`setTestMode(false)`) before a release
|
|
21
|
+
* build ships, or real users will be served test ads and you'll earn zero
|
|
22
|
+
* revenue from those impressions.
|
|
23
|
+
*/
|
|
24
|
+
setTestMode(enabled: boolean): Promise<void>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Registers one or more test device hashes so those physical devices
|
|
28
|
+
* receive test ads. Each hash is printed to Logcat the first time that
|
|
29
|
+
* device makes a real ad request. Has no effect on emulators, which
|
|
30
|
+
* always receive test ads automatically.
|
|
31
|
+
*
|
|
32
|
+
* Call before your first ad request, alongside {@link setTestMode}.
|
|
33
|
+
*/
|
|
34
|
+
addTestDevices(deviceHashes: string[]): Promise<void>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Clears every test device hash registered via {@link addTestDevices}.
|
|
38
|
+
* Call this alongside `setTestMode(false)` before shipping a release
|
|
39
|
+
* build, per Meta's "disable test mode before shipping" guidance.
|
|
40
|
+
*/
|
|
41
|
+
clearTestDevices(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default requireNativeModule<MetaAdsModule>('MetaAds');
|
package/src/meta/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Reexport the
|
|
2
|
-
//
|
|
3
|
-
export { default } from './
|
|
4
|
-
|
|
5
|
-
export { MetaBannerAd } from './ads/BannerAd';
|
|
6
|
-
export { MetaBannerAdSize } from './ads/MetaBannerAdSize';
|
|
7
|
-
export type { MetaBannerAdProps } from './types/MetaBannerAdProps';
|
|
8
|
-
export type {
|
|
9
|
-
MetaAdErrorPayload,
|
|
10
|
-
MetaAdErrorCode,
|
|
11
|
-
MetaAdRequestGuardReason,
|
|
12
|
-
} from './types/MetaAdError';
|
|
1
|
+
// Reexport the native module. On web, it will be resolved to ExpoAds2Module.web.ts
|
|
2
|
+
// and on native platforms to ExpoAds2Module.ts
|
|
3
|
+
export { default } from './MetaAdsModule';
|
|
4
|
+
|
|
5
|
+
export { MetaBannerAd } from './ads/BannerAd';
|
|
6
|
+
export { MetaBannerAdSize } from './ads/MetaBannerAdSize';
|
|
7
|
+
export type { MetaBannerAdProps } from './types/MetaBannerAdProps';
|
|
8
|
+
export type {
|
|
9
|
+
MetaAdErrorPayload,
|
|
10
|
+
MetaAdErrorCode,
|
|
11
|
+
MetaAdRequestGuardReason,
|
|
12
|
+
} from './types/MetaAdError';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
package expo.modules.ads.google
|
|
2
|
-
|
|
3
|
-
import expo.modules.kotlin.modules.Module
|
|
4
|
-
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Placeholder module for Google Mobile Ads support.
|
|
8
|
-
* Will be filled in once the Meta implementation is complete.
|
|
9
|
-
*/
|
|
10
|
-
class GoogleAdsModule : Module() {
|
|
11
|
-
override fun definition() = ModuleDefinition {
|
|
12
|
-
Name("ExpoAdsGoogle") // the name JS uses to find this module (import from "expo-ads/google")
|
|
13
|
-
|
|
14
|
-
// TODO: implement Google Mobile Ads initialization + functions here,
|
|
15
|
-
// mirroring the structure of MetaAdsModule / MetaAdsInitializer.
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAdsGoogleModule.d.ts","sourceRoot":"","sources":["../../src/google/ExpoAdsGoogleModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAGzD,OAAO,OAAO,mBAAoB,SAAQ,YAAY,CAAC,EAAE,CAAC;CAAG;;AAE7D,wBAAyE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAdsGoogleModule.js","sourceRoot":"","sources":["../../src/google/ExpoAdsGoogleModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAKzD,eAAe,mBAAmB,CAAsB,eAAe,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\r\n\r\n// TODO: fill in Google Mobile Ads API surface once implemented natively.\r\ndeclare class ExpoAdsGoogleModule extends NativeModule<{}> {}\r\n\r\nexport default requireNativeModule<ExpoAdsGoogleModule>('ExpoAdsGoogle');\r\n"]}
|
package/build/google/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/google/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
|
package/build/google/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Reexport the Google ads native module. On web, it will be resolved to
|
|
2
|
-
// ExpoAdsGoogleModule.web.ts and on native platforms to ExpoAdsGoogleModule.ts
|
|
3
|
-
//
|
|
4
|
-
// TODO: this is a placeholder until the Google Mobile Ads native module is implemented.
|
|
5
|
-
export { default } from './ExpoAdsGoogleModule';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/google/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,+EAA+E;AAC/E,EAAE;AACF,wFAAwF;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["// Reexport the Google ads native module. On web, it will be resolved to\r\n// ExpoAdsGoogleModule.web.ts and on native platforms to ExpoAdsGoogleModule.ts\r\n//\r\n// TODO: this is a placeholder until the Google Mobile Ads native module is implemented.\r\nexport { default } from './ExpoAdsGoogleModule';\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAdsMetaModule.d.ts","sourceRoot":"","sources":["../../src/meta/ExpoAdsMetaModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,OAAO,iBAAkB,SAAQ,YAAY,CAAC,EAAE,CAAC;IACtD;;;;;OAKG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAE7B;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE5C;;;;;;;OAOG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAErD;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAClC;;AAED,wBAAqE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAdsMetaModule.js","sourceRoot":"","sources":["../../src/meta/ExpoAdsMetaModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AA2CzD,eAAe,mBAAmB,CAAoB,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\r\n\r\ndeclare class ExpoAdsMetaModule extends NativeModule<{}> {\r\n /**\r\n * Initializes the Meta Audience Network SDK. Resolves once the SDK reports\r\n * it's ready (or was already ready); rejects with `ERR_META_INIT` if the\r\n * native `AudienceNetworkAds.initialize()` call fails, or `ERR_NO_CONTEXT`\r\n * if called before the React context is available.\r\n */\r\n initialize(): Promise<string>;\r\n\r\n /**\r\n * Enables or disables Audience Network test mode globally.\r\n *\r\n * Per Meta's docs, call this (and/or {@link addTestDevices}) *before* your\r\n * first ad request — not after. It does not depend on {@link initialize}\r\n * having resolved.\r\n *\r\n * Test mode returns test ads regardless of live auction availability, so\r\n * this must be turned back off (`setTestMode(false)`) before a release\r\n * build ships, or real users will be served test ads and you'll earn zero\r\n * revenue from those impressions.\r\n */\r\n setTestMode(enabled: boolean): Promise<void>;\r\n\r\n /**\r\n * Registers one or more test device hashes so those physical devices\r\n * receive test ads. Each hash is printed to Logcat the first time that\r\n * device makes a real ad request. Has no effect on emulators, which\r\n * always receive test ads automatically.\r\n *\r\n * Call before your first ad request, alongside {@link setTestMode}.\r\n */\r\n addTestDevices(deviceHashes: string[]): Promise<void>;\r\n\r\n /**\r\n * Clears every test device hash registered via {@link addTestDevices}.\r\n * Call this alongside `setTestMode(false)` before shipping a release\r\n * build, per Meta's \"disable test mode before shipping\" guidance.\r\n */\r\n clearTestDevices(): Promise<void>;\r\n}\r\n\r\nexport default requireNativeModule<ExpoAdsMetaModule>('ExpoAdsMeta');\r\n"]}
|
package/ios/Expo-ads.podspec
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Pod::Spec.new do |s|
|
|
2
|
-
s.name = 'Expo-ads'
|
|
3
|
-
s.version = '1.0.0'
|
|
4
|
-
s.summary = 'A sample project summary'
|
|
5
|
-
s.description = 'A sample project description'
|
|
6
|
-
s.author = ''
|
|
7
|
-
s.homepage = 'https://docs.expo.dev/modules/'
|
|
8
|
-
s.platforms = {
|
|
9
|
-
:ios => '16.4',
|
|
10
|
-
:tvos => '16.4'
|
|
11
|
-
}
|
|
12
|
-
s.source = { git: '' }
|
|
13
|
-
s.static_framework = true
|
|
14
|
-
|
|
15
|
-
s.dependency 'ExpoModulesCore'
|
|
16
|
-
|
|
17
|
-
# Swift/Objective-C compatibility
|
|
18
|
-
s.pod_target_xcconfig = {
|
|
19
|
-
'DEFINES_MODULE' => 'YES',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
|
|
23
|
-
end
|
package/ios/Expo-adsModule.swift
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { NativeModule, requireNativeModule } from 'expo';
|
|
2
|
-
|
|
3
|
-
// TODO: fill in Google Mobile Ads API surface once implemented natively.
|
|
4
|
-
declare class ExpoAdsGoogleModule extends NativeModule<{}> {}
|
|
5
|
-
|
|
6
|
-
export default requireNativeModule<ExpoAdsGoogleModule>('ExpoAdsGoogle');
|
package/src/google/index.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Reexport the Google ads native module. On web, it will be resolved to
|
|
2
|
-
// ExpoAdsGoogleModule.web.ts and on native platforms to ExpoAdsGoogleModule.ts
|
|
3
|
-
//
|
|
4
|
-
// TODO: this is a placeholder until the Google Mobile Ads native module is implemented.
|
|
5
|
-
export { default } from './ExpoAdsGoogleModule';
|