expo-ads-admob
Advanced tools
Comparing version 6.0.0 to 7.0.0-rc.0
@@ -28,2 +28,16 @@ import PropTypes from 'prop-types'; | ||
/** | ||
* Additional request params added to underlying request for the ad. | ||
*/ | ||
additionalRequestParams?: { | ||
[key: string]: string; | ||
}; | ||
/** | ||
* Whether the SDK should serve personalized ads (use only with user's consent). If this value is | ||
* `false` or `undefined`, this sets the `npa` key of `additionalRequestParams` to `'1'` following | ||
* https://developers.google.com/admob/ios/eu-consent#forward_consent_to_the_google_mobile_ads_sdk | ||
* and | ||
* https://developers.google.com/admob/android/eu-consent#forward_consent_to_the_google_mobile_ads_sdk. | ||
*/ | ||
servePersonalizedAds?: boolean; | ||
/** | ||
* AdMob iOS library events | ||
@@ -86,4 +100,5 @@ */ | ||
accessibilityLabel?: PropTypes.Validator<string | undefined> | undefined; | ||
accessibilityRole?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | undefined> | undefined; | ||
accessibilityStates?: PropTypes.Validator<import("react-native").AccessibilityState[] | undefined> | undefined; | ||
accessibilityRole?: PropTypes.Validator<"button" | "header" | "link" | "menu" | "menuitem" | "summary" | "image" | "switch" | "text" | "none" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | "alert" | "checkbox" | "combobox" | "menubar" | "progressbar" | "radio" | "radiogroup" | "scrollbar" | "spinbutton" | "tab" | "tablist" | "timer" | "toolbar" | undefined> | undefined; | ||
accessibilityStates?: PropTypes.Validator<import("react-native").AccessibilityStates[] | undefined> | undefined; | ||
accessibilityState?: PropTypes.Validator<import("react-native").AccessibilityState | undefined> | undefined; | ||
accessibilityHint?: PropTypes.Validator<string | undefined> | undefined; | ||
@@ -94,3 +109,3 @@ accessibilityComponentType?: PropTypes.Validator<"button" | "none" | "radiobutton_checked" | "radiobutton_unchecked" | undefined> | undefined; | ||
accessibilityElementsHidden?: PropTypes.Validator<boolean | undefined> | undefined; | ||
accessibilityTraits?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "adjustable" | "selected" | "disabled" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; | ||
accessibilityTraits?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "adjustable" | "disabled" | "selected" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; | ||
onAccessibilityTap?: PropTypes.Validator<(() => void) | undefined> | undefined; | ||
@@ -102,3 +117,5 @@ onMagicTap?: PropTypes.Validator<(() => void) | undefined> | undefined; | ||
testDeviceID: PropTypes.Requireable<string>; | ||
servePersonalizedAds: PropTypes.Requireable<boolean>; | ||
onAdViewDidReceiveAd: PropTypes.Requireable<(...args: any[]) => any>; | ||
additionalRequestParams: PropTypes.Requireable<object>; | ||
onDidFailToReceiveAdWithError: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -105,0 +122,0 @@ onAdViewWillPresentScreen: PropTypes.Requireable<(...args: any[]) => any>; |
@@ -17,4 +17,8 @@ import { requireNativeViewManager } from '@unimodules/core'; | ||
render() { | ||
let additionalRequestParams = { ...this.props.additionalRequestParams }; | ||
if (!this.props.servePersonalizedAds) { | ||
additionalRequestParams.npa = "1"; | ||
} | ||
return (<View style={this.props.style}> | ||
<ExpoBannerView style={this.state.style} adUnitID={this.props.adUnitID} bannerSize={this.props.bannerSize} testDeviceID={this.props.testDeviceID} onSizeChange={this._handleSizeChange} onAdViewDidReceiveAd={this.props.onAdViewDidReceiveAd} onDidFailToReceiveAdWithError={this._handleDidFailToReceiveAdWithError} onAdViewWillPresentScreen={this.props.onAdViewWillPresentScreen} onAdViewWillDismissScreen={this.props.onAdViewWillDismissScreen} onAdViewDidDismissScreen={this.props.onAdViewDidDismissScreen} onAdViewWillLeaveApplication={this.props.onAdViewWillLeaveApplication}/> | ||
<ExpoBannerView style={this.state.style} adUnitID={this.props.adUnitID} bannerSize={this.props.bannerSize} testDeviceID={this.props.testDeviceID} onSizeChange={this._handleSizeChange} additionalRequestParams={additionalRequestParams} onAdViewDidReceiveAd={this.props.onAdViewDidReceiveAd} onDidFailToReceiveAdWithError={this._handleDidFailToReceiveAdWithError} onAdViewWillPresentScreen={this.props.onAdViewWillPresentScreen} onAdViewWillDismissScreen={this.props.onAdViewWillDismissScreen} onAdViewDidDismissScreen={this.props.onAdViewDidDismissScreen} onAdViewWillLeaveApplication={this.props.onAdViewWillLeaveApplication}/> | ||
</View>); | ||
@@ -35,3 +39,5 @@ } | ||
testDeviceID: PropTypes.string, | ||
servePersonalizedAds: PropTypes.bool, | ||
onAdViewDidReceiveAd: PropTypes.func, | ||
additionalRequestParams: PropTypes.object, | ||
onDidFailToReceiveAdWithError: PropTypes.func, | ||
@@ -38,0 +44,0 @@ onAdViewWillPresentScreen: PropTypes.func, |
@@ -6,3 +6,8 @@ declare type EventNameType = 'interstitialDidLoad' | 'interstitialDidFailToLoad' | 'interstitialDidOpen' | 'interstitialDidClose' | 'interstitialWillLeaveApplication'; | ||
setTestDeviceID(id: string): Promise<void>; | ||
requestAdAsync(): Promise<void>; | ||
requestAdAsync(options?: { | ||
servePersonalizedAds?: boolean | undefined; | ||
additionalRequestParams?: { | ||
[key: string]: string; | ||
} | undefined; | ||
}): Promise<void>; | ||
showAdAsync(): Promise<void>; | ||
@@ -9,0 +14,0 @@ dismissAdAsync(): Promise<void>; |
@@ -1,3 +0,2 @@ | ||
import { EventEmitter } from '@unimodules/core'; | ||
import { UnavailabilityError } from '@unimodules/core'; | ||
import { EventEmitter, UnavailabilityError } from '@unimodules/core'; | ||
import AdMobNativeModule from './ExpoAdsAdMobInterstitialManager'; | ||
@@ -30,7 +29,13 @@ const moduleName = 'AdMobInterstitial'; | ||
}, | ||
async requestAdAsync() { | ||
async requestAdAsync(options = {}) { | ||
if (!AdMobNativeModule.requestAd) { | ||
throw new UnavailabilityError(moduleName, 'requestAdAsync'); | ||
} | ||
await AdMobNativeModule.requestAd(); | ||
const params = { | ||
...options.additionalRequestParams, | ||
}; | ||
if (!options.servePersonalizedAds) { | ||
params.npa = '1'; | ||
} | ||
await AdMobNativeModule.requestAd(params); | ||
}, | ||
@@ -37,0 +42,0 @@ async showAdAsync() { |
@@ -6,3 +6,8 @@ declare type EventNameType = 'rewardedVideoDidRewardUser' | 'rewardedVideoDidLoad' | 'rewardedVideoDidFailToLoad' | 'rewardedVideoDidOpen' | 'rewardedVideoDidStart' | 'rewardedVideoDidClose' | 'rewardedVideoWillLeaveApplication'; | ||
setTestDeviceID(id: string): Promise<void>; | ||
requestAdAsync(): Promise<void>; | ||
requestAdAsync(options?: { | ||
servePersonalizedAds?: boolean | undefined; | ||
additionalRequestParams?: { | ||
[key: string]: string; | ||
} | undefined; | ||
}): Promise<void>; | ||
showAdAsync(): Promise<void>; | ||
@@ -9,0 +14,0 @@ dismissAdAsync(): Promise<void>; |
@@ -1,3 +0,2 @@ | ||
import { EventEmitter } from '@unimodules/core'; | ||
import { UnavailabilityError } from '@unimodules/core'; | ||
import { EventEmitter, UnavailabilityError } from '@unimodules/core'; | ||
import AdMobNativeModule from './ExpoAdsAdMobRewardedVideoAdManager'; | ||
@@ -32,7 +31,13 @@ const moduleName = 'AdMobRewarded'; | ||
}, | ||
async requestAdAsync() { | ||
async requestAdAsync(options = {}) { | ||
if (!AdMobNativeModule.requestAd) { | ||
throw new UnavailabilityError(moduleName, 'requestAdAsync'); | ||
} | ||
await AdMobNativeModule.requestAd(); | ||
const params = { | ||
...options.additionalRequestParams, | ||
}; | ||
if (!options.servePersonalizedAds) { | ||
params.npa = '1'; | ||
} | ||
await AdMobNativeModule.requestAd(params); | ||
}, | ||
@@ -39,0 +44,0 @@ async showAdAsync() { |
@@ -31,2 +31,16 @@ import PropTypes from 'prop-types'; | ||
/** | ||
* Additional request params added to underlying request for the ad. | ||
*/ | ||
additionalRequestParams?: { | ||
[key: string]: string; | ||
}; | ||
/** | ||
* Whether the SDK should serve personalized ads (use only with user's consent). If this value is | ||
* `false` or `undefined`, this sets the `npa` key of `additionalRequestParams` to `'1'` following | ||
* https://developers.google.com/admob/ios/eu-consent#forward_consent_to_the_google_mobile_ads_sdk | ||
* and | ||
* https://developers.google.com/admob/android/eu-consent#forward_consent_to_the_google_mobile_ads_sdk. | ||
*/ | ||
servePersonalizedAds?: boolean; | ||
/** | ||
* AdMob iOS library events | ||
@@ -90,4 +104,5 @@ */ | ||
accessibilityLabel?: PropTypes.Validator<string | undefined> | undefined; | ||
accessibilityRole?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | undefined> | undefined; | ||
accessibilityStates?: PropTypes.Validator<import("react-native").AccessibilityState[] | undefined> | undefined; | ||
accessibilityRole?: PropTypes.Validator<"button" | "header" | "link" | "menu" | "menuitem" | "summary" | "image" | "switch" | "text" | "none" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | "alert" | "checkbox" | "combobox" | "menubar" | "progressbar" | "radio" | "radiogroup" | "scrollbar" | "spinbutton" | "tab" | "tablist" | "timer" | "toolbar" | undefined> | undefined; | ||
accessibilityStates?: PropTypes.Validator<import("react-native").AccessibilityStates[] | undefined> | undefined; | ||
accessibilityState?: PropTypes.Validator<import("react-native").AccessibilityState | undefined> | undefined; | ||
accessibilityHint?: PropTypes.Validator<string | undefined> | undefined; | ||
@@ -98,3 +113,3 @@ accessibilityComponentType?: PropTypes.Validator<"button" | "none" | "radiobutton_checked" | "radiobutton_unchecked" | undefined> | undefined; | ||
accessibilityElementsHidden?: PropTypes.Validator<boolean | undefined> | undefined; | ||
accessibilityTraits?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "adjustable" | "selected" | "disabled" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; | ||
accessibilityTraits?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "adjustable" | "disabled" | "selected" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; | ||
onAccessibilityTap?: PropTypes.Validator<(() => void) | undefined> | undefined; | ||
@@ -106,3 +121,5 @@ onMagicTap?: PropTypes.Validator<(() => void) | undefined> | undefined; | ||
testDeviceID: PropTypes.Requireable<string>; | ||
servePersonalizedAds: PropTypes.Requireable<boolean>; | ||
onAdViewDidReceiveAd: PropTypes.Requireable<(...args: any[]) => any>; | ||
additionalRequestParams: PropTypes.Requireable<object>; | ||
onDidFailToReceiveAdWithError: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -109,0 +126,0 @@ onAdViewWillPresentScreen: PropTypes.Requireable<(...args: any[]) => any>; |
@@ -17,4 +17,8 @@ import { requireNativeViewManager } from '@unimodules/core'; | ||
render() { | ||
let additionalRequestParams = { ...this.props.additionalRequestParams }; | ||
if (!this.props.servePersonalizedAds) { | ||
additionalRequestParams.npa = "1"; | ||
} | ||
return (<View style={this.props.style}> | ||
<ExpoBannerView style={this.state.style} adUnitID={this.props.adUnitID} bannerSize={this.props.bannerSize} testDeviceID={this.props.testDeviceID} onSizeChange={this._handleSizeChange} onAdViewDidReceiveAd={this.props.onAdViewDidReceiveAd} onDidFailToReceiveAdWithError={this._handleDidFailToReceiveAdWithError} onAdViewWillPresentScreen={this.props.onAdViewWillPresentScreen} onAdViewWillDismissScreen={this.props.onAdViewWillDismissScreen} onAdViewDidDismissScreen={this.props.onAdViewDidDismissScreen} onAdViewWillLeaveApplication={this.props.onAdViewWillLeaveApplication} onAdmobDispatchAppEvent={this.props.onAdMobDispatchAppEvent}/> | ||
<ExpoBannerView style={this.state.style} adUnitID={this.props.adUnitID} bannerSize={this.props.bannerSize} testDeviceID={this.props.testDeviceID} onSizeChange={this._handleSizeChange} additionalRequestParams={additionalRequestParams} onAdViewDidReceiveAd={this.props.onAdViewDidReceiveAd} onDidFailToReceiveAdWithError={this._handleDidFailToReceiveAdWithError} onAdViewWillPresentScreen={this.props.onAdViewWillPresentScreen} onAdViewWillDismissScreen={this.props.onAdViewWillDismissScreen} onAdViewDidDismissScreen={this.props.onAdViewDidDismissScreen} onAdViewWillLeaveApplication={this.props.onAdViewWillLeaveApplication} onAdmobDispatchAppEvent={this.props.onAdMobDispatchAppEvent}/> | ||
</View>); | ||
@@ -35,3 +39,5 @@ } | ||
testDeviceID: PropTypes.string, | ||
servePersonalizedAds: PropTypes.bool, | ||
onAdViewDidReceiveAd: PropTypes.func, | ||
additionalRequestParams: PropTypes.object, | ||
onDidFailToReceiveAdWithError: PropTypes.func, | ||
@@ -38,0 +44,0 @@ onAdViewWillPresentScreen: PropTypes.func, |
{ | ||
"name": "expo-ads-admob", | ||
"version": "6.0.0", | ||
"version": "7.0.0-rc.0", | ||
"description": "Provides support for the Google AdMob SDK (https://www.google.com/admob/) for mobile advertising. This module is largely based of the react-native-admob (https://github.com/sbugert/react-native-admob) module, as the documentation and questions surrounding that module may prove helpful. A simple example implementing AdMob SDK can be found at https://github.com/deadcoder0904/expo-google-admob", | ||
@@ -11,2 +11,3 @@ "main": "build/index.js", | ||
"clean": "expo-module clean", | ||
"lint": "expo-module lint", | ||
"test": "expo-module test", | ||
@@ -25,3 +26,4 @@ "prepare": "expo-module prepare", | ||
"type": "git", | ||
"url": "https://github.com/expo/expo.git" | ||
"url": "https://github.com/expo/expo.git", | ||
"directory": "packages/expo-ads-admob" | ||
}, | ||
@@ -44,5 +46,5 @@ "author": "650 Industries, Inc.", | ||
"devDependencies": { | ||
"expo-module-scripts": "^1.0.0" | ||
"expo-module-scripts": "~1.1.1-rc.0" | ||
}, | ||
"gitHead": "9518929d6f2ba9cf8e0aae81d34cc1eb52f7093a" | ||
"gitHead": "5d4fcf318390f59cecd1ae5d191afb15488a4447" | ||
} |
@@ -10,6 +10,8 @@ # expo-ads-admob | ||
# Installation | ||
# Installation in managed Expo projects | ||
This package is pre-installed in [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects. You may skip the rest of the installation guide if this applies to you. | ||
For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release. | ||
# Installation in bare React Native projects | ||
For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/unimodules/react-native-unimodules) before continuing. | ||
@@ -16,0 +18,0 @@ |
@@ -1,3 +0,2 @@ | ||
import { EventEmitter, Subscription } from '@unimodules/core'; | ||
import { UnavailabilityError } from '@unimodules/core'; | ||
import { EventEmitter, Subscription, UnavailabilityError } from '@unimodules/core'; | ||
@@ -48,3 +47,8 @@ import AdMobNativeModule from './ExpoAdsAdMobInterstitialManager'; | ||
}, | ||
async requestAdAsync(): Promise<void> { | ||
async requestAdAsync( | ||
options: { | ||
servePersonalizedAds?: boolean; | ||
additionalRequestParams?: { [key: string]: string }; | ||
} = {} | ||
): Promise<void> { | ||
if (!AdMobNativeModule.requestAd) { | ||
@@ -54,3 +58,10 @@ throw new UnavailabilityError(moduleName, 'requestAdAsync'); | ||
await AdMobNativeModule.requestAd(); | ||
const params: { [key: string]: string } = { | ||
...options.additionalRequestParams, | ||
}; | ||
if (!options.servePersonalizedAds) { | ||
params.npa = '1'; | ||
} | ||
await AdMobNativeModule.requestAd(params); | ||
}, | ||
@@ -57,0 +68,0 @@ async showAdAsync(): Promise<void> { |
@@ -1,3 +0,2 @@ | ||
import { EventEmitter, Subscription } from '@unimodules/core'; | ||
import { UnavailabilityError } from '@unimodules/core'; | ||
import { EventEmitter, Subscription, UnavailabilityError } from '@unimodules/core'; | ||
@@ -52,3 +51,8 @@ import AdMobNativeModule from './ExpoAdsAdMobRewardedVideoAdManager'; | ||
}, | ||
async requestAdAsync(): Promise<void> { | ||
async requestAdAsync( | ||
options: { | ||
servePersonalizedAds?: boolean; | ||
additionalRequestParams?: { [key: string]: string }; | ||
} = {} | ||
): Promise<void> { | ||
if (!AdMobNativeModule.requestAd) { | ||
@@ -58,3 +62,10 @@ throw new UnavailabilityError(moduleName, 'requestAdAsync'); | ||
await AdMobNativeModule.requestAd(); | ||
const params: { [key: string]: string } = { | ||
...options.additionalRequestParams, | ||
}; | ||
if (!options.servePersonalizedAds) { | ||
params.npa = '1'; | ||
} | ||
await AdMobNativeModule.requestAd(params); | ||
}, | ||
@@ -61,0 +72,0 @@ async showAdAsync(): Promise<void> { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
152122
81
1217
41
0
1