Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Commit

Permalink
feat: add loadOnDismissed option for AppOpenAd
Browse files Browse the repository at this point in the history
  • Loading branch information
wjaykim committed Nov 29, 2021
1 parent 2f613e7 commit a9f88b9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ public void onAdDismissedFullScreenContent() {
boolean haveToRequest = false;
if (options.hasKey("loadOnDismissed")) {
haveToRequest = options.getBoolean("loadOnDismissed");
} else if (getAdType().equals(RNAdMobAppOpenAdModule.AD_TYPE)) {
haveToRequest = true;
}

if (haveToRequest) {
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/api/classes/AppOpenAd.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Properties :

- `showOnAppForeground` : Whether to show ad on app becomes foreground. Defaults to `true`.

- `loadOnDismissed` : Whether App Open Ad to load new ad on dismissed. Defaults to `true`.

- `requestOptions` : [RequestOptions](/docs/api/types/RequestOptions) used to load the ad.

**Returns**
Expand Down
1 change: 1 addition & 0 deletions docs/docs/api/components/AppOpenAdProvider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ Properties:
| :------------------ | :----------------------------------------------- | :------ | :--------------------------------------------------------------------------------------------------------- |
| showOnColdStart | boolean | `false` | Whether to show ad on app [coldstart](https://developers.google.com/admob/android/app-open-ads#coldstart). |
| showOnAppForeground | boolean | `true` | Whether to show ad on app becomes foreground. |
| loadOnDismissed | boolean | `true` | Whether to load new ad when ad is dismissed. |
| requestOptions | [RequestOptions](/docs/api/types/RequestOptions) | {} | Optional RequestOptions used to load the ad. |
2 changes: 0 additions & 2 deletions ios/Ads/FullScreen/RNAdMobFullScreenAd.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ class RNAdMobFullScreenAd<T>: NSObject {
var haveToRequest = false
if (options["loadOnDismissed"] != nil) {
haveToRequest = options["loadOnDismissed"] as! Bool
} else if (module.getAdType() == RNAdMobAppOpen.AD_TYPE) {
haveToRequest = true
}

if (haveToRequest) {
Expand Down
1 change: 1 addition & 0 deletions src/ads/fullscreen/AppOpenAd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import FullScreenAd from './FullScreenAd';
const defaultOptions: AppOpenAdOptions = {
showOnColdStart: false,
showOnAppForeground: true,
loadOnDismissed: true,
requestOptions: {},
};

Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ export interface AppOpenAdOptions {
* Whether to show App Open Ad on app becomes foreground. Defaults to `true`.
*/
showOnAppForeground?: boolean;
/**
* Whether App Open Ad to load new ad automatically on dismissed. Defaults to `true`.
*/
loadOnDismissed?: boolean;
/**
* Optional RequestOptions used to load the ad.
*/
Expand Down

0 comments on commit a9f88b9

Please sign in to comment.