@capacitor-community/admob 5.3.1 → 6.1.0
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/CapacitorCommunityAdmob.podspec +1 -1
- package/README.md +292 -87
- package/android/build.gradle +6 -6
- package/android/src/main/java/com/getcapacitor/community/admob/AdMob.java +17 -0
- package/android/src/main/java/com/getcapacitor/community/admob/models/AdOptions.java +10 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/AdRewardInterstitialExecutor.java +84 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardInterstitialAdPluginEvents.kt +12 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardedInterstitialAdCallbackAndListeners.kt +50 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/models/SsvInfo.kt +20 -0
- package/dist/docs.json +374 -34
- package/dist/esm/banner/banner-definitions.interface.d.ts +18 -18
- package/dist/esm/definitions.d.ts +2 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interstitial/interstitial-definitions.interface.d.ts +5 -5
- package/dist/esm/private/validate-all-events-implemented.type.d.ts +1 -1
- package/dist/esm/reward/reward-definitions.interface.d.ts +12 -12
- package/dist/esm/reward-interstitial/index.d.ts +4 -0
- package/dist/esm/reward-interstitial/index.js +5 -0
- package/dist/esm/reward-interstitial/index.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.d.ts +25 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.js +2 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.d.ts +32 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js +35 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.d.ts +30 -0
- package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.js +2 -0
- package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-item.interface.d.ts +14 -0
- package/dist/esm/reward-interstitial/reward-interstitial-item.interface.js +2 -0
- package/dist/esm/reward-interstitial/reward-interstitial-item.interface.js.map +1 -0
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +12 -9
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +47 -9
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +47 -9
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Banner/BannerExecutor.swift +11 -23
- package/ios/Plugin/Consent/ConsentExecutor.swift +1 -1
- package/ios/Plugin/Interstitial/AdInterstitialExecutor.swift +4 -4
- package/ios/Plugin/Plugin.m +2 -0
- package/ios/Plugin/Plugin.swift +28 -6
- package/ios/Plugin/Rewarded/AdRewardExecutor.swift +4 -4
- package/ios/Plugin/RewardedInterstitial/AdRewardInterstitialExecutor.swift +86 -0
- package/ios/Plugin/RewardedInterstitial/RewardInterstitialAdPluginEvents.swift +8 -0
- package/package.json +9 -9
package/dist/plugin.js
CHANGED
|
@@ -129,6 +129,41 @@ var AdMobPlugin = (function (exports, core) {
|
|
|
129
129
|
InterstitialAdPluginEvents["Dismissed"] = "interstitialAdDismissed";
|
|
130
130
|
})(exports.InterstitialAdPluginEvents || (exports.InterstitialAdPluginEvents = {}));
|
|
131
131
|
|
|
132
|
+
// This enum should be keep in sync with their native equivalents with the same name
|
|
133
|
+
exports.RewardInterstitialAdPluginEvents = void 0;
|
|
134
|
+
(function (RewardInterstitialAdPluginEvents) {
|
|
135
|
+
/**
|
|
136
|
+
* Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show
|
|
137
|
+
*/
|
|
138
|
+
RewardInterstitialAdPluginEvents["Loaded"] = "onRewardedInterstitialAdLoaded";
|
|
139
|
+
/**
|
|
140
|
+
* Emits after trying to prepare a RewardAd when it could not be loaded
|
|
141
|
+
*/
|
|
142
|
+
RewardInterstitialAdPluginEvents["FailedToLoad"] = "onRewardedInterstitialAdFailedToLoad";
|
|
143
|
+
/**
|
|
144
|
+
* Emits when the AdReward video is visible to the user
|
|
145
|
+
*/
|
|
146
|
+
RewardInterstitialAdPluginEvents["Showed"] = "onRewardedInterstitialAdShowed";
|
|
147
|
+
/**
|
|
148
|
+
* Emits when the AdReward video is failed to show
|
|
149
|
+
*/
|
|
150
|
+
RewardInterstitialAdPluginEvents["FailedToShow"] = "onRewardedInterstitialAdFailedToShow";
|
|
151
|
+
/**
|
|
152
|
+
* Emits when the AdReward video is not visible to the user anymore.
|
|
153
|
+
*
|
|
154
|
+
* **Important**: This has nothing to do with the reward it self. This event
|
|
155
|
+
* will emits in this two cases:
|
|
156
|
+
* 1. The user starts the video ad but close it before the reward emit.
|
|
157
|
+
* 2. The user start the video and see it until end, then gets the reward
|
|
158
|
+
* and after that the ad is closed.
|
|
159
|
+
*/
|
|
160
|
+
RewardInterstitialAdPluginEvents["Dismissed"] = "onRewardedInterstitialAdDismissed";
|
|
161
|
+
/**
|
|
162
|
+
* Emits when user get rewarded from AdReward
|
|
163
|
+
*/
|
|
164
|
+
RewardInterstitialAdPluginEvents["Rewarded"] = "onRewardedInterstitialAdReward";
|
|
165
|
+
})(exports.RewardInterstitialAdPluginEvents || (exports.RewardInterstitialAdPluginEvents = {}));
|
|
166
|
+
|
|
132
167
|
// This enum should be keep in sync with their native equivalents with the same name
|
|
133
168
|
exports.RewardAdPluginEvents = void 0;
|
|
134
169
|
(function (RewardAdPluginEvents) {
|
|
@@ -215,18 +250,9 @@ var AdMobPlugin = (function (exports, core) {
|
|
|
215
250
|
});
|
|
216
251
|
|
|
217
252
|
class AdMobWeb extends core.WebPlugin {
|
|
218
|
-
constructor() {
|
|
219
|
-
super({
|
|
220
|
-
name: 'AdMob',
|
|
221
|
-
platforms: ['web'],
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
253
|
async initialize() {
|
|
225
254
|
console.log('initialize');
|
|
226
255
|
}
|
|
227
|
-
async targetSettings() {
|
|
228
|
-
console.log('targetSettings');
|
|
229
|
-
}
|
|
230
256
|
async requestTrackingAuthorization() {
|
|
231
257
|
console.log('requestTrackingAuthorization');
|
|
232
258
|
}
|
|
@@ -293,6 +319,18 @@ var AdMobPlugin = (function (exports, core) {
|
|
|
293
319
|
amount: 0,
|
|
294
320
|
};
|
|
295
321
|
}
|
|
322
|
+
async prepareRewardInterstitialAd(options) {
|
|
323
|
+
console.log(options);
|
|
324
|
+
return {
|
|
325
|
+
adUnitId: options.adId,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
async showRewardInterstitialAd() {
|
|
329
|
+
return {
|
|
330
|
+
type: '',
|
|
331
|
+
amount: 0,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
296
334
|
}
|
|
297
335
|
|
|
298
336
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/banner/banner-ad-plugin-events.enum.js","esm/banner/banner-ad-position.enum.js","esm/banner/banner-ad-size.enum.js","esm/interstitial/interstitial-ad-plugin-events.enum.js","esm/reward/reward-ad-plugin-events.enum.js","esm/consent/consent-status.enum.js","esm/consent/consent-debug-geography.enum.js","esm/index.js","esm/web.js"],"sourcesContent":["export var MaxAdContentRating;\n(function (MaxAdContentRating) {\n /**\n * Content suitable for general audiences, including families.\n */\n MaxAdContentRating[\"General\"] = \"General\";\n /**\n * Content suitable for most audiences with parental guidance.\n */\n MaxAdContentRating[\"ParentalGuidance\"] = \"ParentalGuidance\";\n /**\n * Content suitable for teen and older audiences.\n */\n MaxAdContentRating[\"Teen\"] = \"Teen\";\n /**\n * Content suitable only for mature audiences.\n */\n MaxAdContentRating[\"MatureAudience\"] = \"MatureAudience\";\n})(MaxAdContentRating || (MaxAdContentRating = {}));\n//# sourceMappingURL=definitions.js.map","// This enum should be keep in sync with their native equivalents with the same name\nexport var BannerAdPluginEvents;\n(function (BannerAdPluginEvents) {\n BannerAdPluginEvents[\"SizeChanged\"] = \"bannerAdSizeChanged\";\n BannerAdPluginEvents[\"Loaded\"] = \"bannerAdLoaded\";\n BannerAdPluginEvents[\"FailedToLoad\"] = \"bannerAdFailedToLoad\";\n /**\n * Open \"Adsense\" Event after user click banner\n */\n BannerAdPluginEvents[\"Opened\"] = \"bannerAdOpened\";\n /**\n * Close \"Adsense\" Event after user click banner\n */\n BannerAdPluginEvents[\"Closed\"] = \"bannerAdClosed\";\n /**\n * Similarly, this method should be called when an impression is recorded for the ad by the mediated SDK.\n */\n BannerAdPluginEvents[\"AdImpression\"] = \"bannerAdImpression\";\n})(BannerAdPluginEvents || (BannerAdPluginEvents = {}));\n//# sourceMappingURL=banner-ad-plugin-events.enum.js.map","/**\n * @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity\n */\nexport var BannerAdPosition;\n(function (BannerAdPosition) {\n /**\n * Banner position be top-center\n */\n BannerAdPosition[\"TOP_CENTER\"] = \"TOP_CENTER\";\n /**\n * Banner position be center\n */\n BannerAdPosition[\"CENTER\"] = \"CENTER\";\n /**\n * Banner position be bottom-center(default)\n */\n BannerAdPosition[\"BOTTOM_CENTER\"] = \"BOTTOM_CENTER\";\n})(BannerAdPosition || (BannerAdPosition = {}));\n//# sourceMappingURL=banner-ad-position.enum.js.map","/**\n * For more information:\n * https://developers.google.com/admob/ios/banner#banner_sizes\n * https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize\n *\n * */\nexport var BannerAdSize;\n(function (BannerAdSize) {\n /**\n * Mobile Marketing Association (MMA)\n * banner ad size (320x50 density-independent pixels).\n */\n BannerAdSize[\"BANNER\"] = \"BANNER\";\n /**\n * Interactive Advertising Bureau (IAB)\n * full banner ad size (468x60 density-independent pixels).\n */\n BannerAdSize[\"FULL_BANNER\"] = \"FULL_BANNER\";\n /**\n * Large banner ad size (320x100 density-independent pixels).\n */\n BannerAdSize[\"LARGE_BANNER\"] = \"LARGE_BANNER\";\n /**\n * Interactive Advertising Bureau (IAB)\n * medium rectangle ad size (300x250 density-independent pixels).\n */\n BannerAdSize[\"MEDIUM_RECTANGLE\"] = \"MEDIUM_RECTANGLE\";\n /**\n * Interactive Advertising Bureau (IAB)\n * leaderboard ad size (728x90 density-independent pixels).\n */\n BannerAdSize[\"LEADERBOARD\"] = \"LEADERBOARD\";\n /**\n * A dynamically sized banner that is full-width and auto-height.\n */\n BannerAdSize[\"ADAPTIVE_BANNER\"] = \"ADAPTIVE_BANNER\";\n /**\n * @deprecated\n * Will be removed in next AdMob versions use `ADAPTIVE_BANNER`\n * Screen width x 32|50|90\n */\n BannerAdSize[\"SMART_BANNER\"] = \"SMART_BANNER\";\n})(BannerAdSize || (BannerAdSize = {}));\n//# sourceMappingURL=banner-ad-size.enum.js.map","// This enum should be keep in sync with their native equivalents with the same name\nexport var InterstitialAdPluginEvents;\n(function (InterstitialAdPluginEvents) {\n /**\n * Emits after trying to prepare and Interstitial, when it is loaded and ready to be show\n */\n InterstitialAdPluginEvents[\"Loaded\"] = \"interstitialAdLoaded\";\n /**\n * Emits after trying to prepare and Interstitial, when it could not be loaded\n */\n InterstitialAdPluginEvents[\"FailedToLoad\"] = \"interstitialAdFailedToLoad\";\n /**\n * Emits when the Interstitial ad is visible to the user\n */\n InterstitialAdPluginEvents[\"Showed\"] = \"interstitialAdShowed\";\n /**\n * Emits when the Interstitial ad is failed to show\n */\n InterstitialAdPluginEvents[\"FailedToShow\"] = \"interstitialAdFailedToShow\";\n /**\n * Emits when the Interstitial ad is not visible to the user anymore.\n */\n InterstitialAdPluginEvents[\"Dismissed\"] = \"interstitialAdDismissed\";\n})(InterstitialAdPluginEvents || (InterstitialAdPluginEvents = {}));\n//# sourceMappingURL=interstitial-ad-plugin-events.enum.js.map","// This enum should be keep in sync with their native equivalents with the same name\nexport var RewardAdPluginEvents;\n(function (RewardAdPluginEvents) {\n /**\n * Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show\n */\n RewardAdPluginEvents[\"Loaded\"] = \"onRewardedVideoAdLoaded\";\n /**\n * Emits after trying to prepare a RewardAd when it could not be loaded\n */\n RewardAdPluginEvents[\"FailedToLoad\"] = \"onRewardedVideoAdFailedToLoad\";\n /**\n * Emits when the AdReward video is visible to the user\n */\n RewardAdPluginEvents[\"Showed\"] = \"onRewardedVideoAdShowed\";\n /**\n * Emits when the AdReward video is failed to show\n */\n RewardAdPluginEvents[\"FailedToShow\"] = \"onRewardedVideoAdFailedToShow\";\n /**\n * Emits when the AdReward video is not visible to the user anymore.\n *\n * **Important**: This has nothing to do with the reward it self. This event\n * will emits in this two cases:\n * 1. The user starts the video ad but close it before the reward emit.\n * 2. The user start the video and see it until end, then gets the reward\n * and after that the ad is closed.\n */\n RewardAdPluginEvents[\"Dismissed\"] = \"onRewardedVideoAdDismissed\";\n /**\n * Emits when user get rewarded from AdReward\n */\n RewardAdPluginEvents[\"Rewarded\"] = \"onRewardedVideoAdReward\";\n})(RewardAdPluginEvents || (RewardAdPluginEvents = {}));\n//# sourceMappingURL=reward-ad-plugin-events.enum.js.map","/**\n * For more information:\n * https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#consentstatus\n *\n * */\nexport var AdmobConsentStatus;\n(function (AdmobConsentStatus) {\n /**\n * User consent not required.\n */\n AdmobConsentStatus[\"NOT_REQUIRED\"] = \"NOT_REQUIRED\";\n /**\n * User consent already obtained.\n */\n AdmobConsentStatus[\"OBTAINED\"] = \"OBTAINED\";\n /**\n * User consent required but not yet obtained.\n */\n AdmobConsentStatus[\"REQUIRED\"] = \"REQUIRED\";\n /**\n * Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.\n */\n AdmobConsentStatus[\"UNKNOWN\"] = \"UNKNOWN\";\n})(AdmobConsentStatus || (AdmobConsentStatus = {}));\n//# sourceMappingURL=consent-status.enum.js.map","/**\n * For more information:\n * https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#debuggeography\n *\n * */\nexport var AdmobConsentDebugGeography;\n(function (AdmobConsentDebugGeography) {\n /**\n * Debug geography disabled.\n */\n AdmobConsentDebugGeography[AdmobConsentDebugGeography[\"DISABLED\"] = 0] = \"DISABLED\";\n /**\n * Geography appears as in EEA for debug devices.\n */\n AdmobConsentDebugGeography[AdmobConsentDebugGeography[\"EEA\"] = 1] = \"EEA\";\n /**\n * Geography appears as not in EEA for debug devices.\n */\n AdmobConsentDebugGeography[AdmobConsentDebugGeography[\"NOT_EEA\"] = 2] = \"NOT_EEA\";\n})(AdmobConsentDebugGeography || (AdmobConsentDebugGeography = {}));\n//# sourceMappingURL=consent-debug-geography.enum.js.map","import { registerPlugin } from '@capacitor/core';\nconst AdMob = registerPlugin('AdMob', {\n web: () => import('./web').then(m => new m.AdMobWeb()),\n});\nexport * from './definitions';\nexport * from './banner/index';\nexport * from './interstitial/index';\nexport * from './reward/index';\nexport * from './consent/index';\nexport * from './shared/index';\nexport { AdMob };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AdmobConsentStatus } from './consent/consent-status.enum';\nexport class AdMobWeb extends WebPlugin {\n constructor() {\n super({\n name: 'AdMob',\n platforms: ['web'],\n });\n }\n async initialize() {\n console.log('initialize');\n }\n async targetSettings() {\n console.log('targetSettings');\n }\n async requestTrackingAuthorization() {\n console.log('requestTrackingAuthorization');\n }\n async trackingAuthorizationStatus() {\n return {\n status: 'authorized',\n };\n }\n async requestConsentInfo(options) {\n console.log('requestConsentInfo', options);\n return {\n status: AdmobConsentStatus.REQUIRED,\n isConsentFormAvailable: true,\n };\n }\n async showConsentForm() {\n console.log('showConsentForm');\n return {\n status: AdmobConsentStatus.REQUIRED,\n };\n }\n async resetConsentInfo() {\n console.log('resetConsentInfo');\n }\n async setApplicationMuted(options) {\n console.log('setApplicationMuted', options);\n }\n async setApplicationVolume(options) {\n console.log('setApplicationVolume', options);\n }\n async showBanner(options) {\n console.log('showBanner', options);\n }\n // Hide the banner, remove it from screen, but can show it later\n async hideBanner() {\n console.log('hideBanner');\n }\n // Resume the banner, show it after hide\n async resumeBanner() {\n console.log('resumeBanner');\n }\n // Destroy the banner, remove it from screen.\n async removeBanner() {\n console.log('removeBanner');\n }\n async prepareInterstitial(options) {\n console.log('prepareInterstitial', options);\n return {\n adUnitId: options.adId,\n };\n }\n async showInterstitial() {\n console.log('showInterstitial');\n }\n async prepareRewardVideoAd(options) {\n console.log(options);\n return {\n adUnitId: options.adId,\n };\n }\n async showRewardVideoAd() {\n return {\n type: '',\n amount: 0,\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["MaxAdContentRating","BannerAdPluginEvents","BannerAdPosition","BannerAdSize","InterstitialAdPluginEvents","RewardAdPluginEvents","AdmobConsentStatus","AdmobConsentDebugGeography","registerPlugin","WebPlugin"],"mappings":";;;AAAWA,wCAAmB;IAC9B,CAAC,UAAU,kBAAkB,EAAE;IAC/B;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC9C;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;IAChE;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACxC;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;IAC5D,CAAC,EAAEA,0BAAkB,KAAKA,0BAAkB,GAAG,EAAE,CAAC,CAAC;;IClBnD;AACWC,0CAAqB;IAChC,CAAC,UAAU,oBAAoB,EAAE;IACjC,IAAI,oBAAoB,CAAC,aAAa,CAAC,GAAG,qBAAqB,CAAC;IAChE,IAAI,oBAAoB,CAAC,QAAQ,CAAC,GAAG,g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,CAAC,OAAO,EAAE;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC3C,KAAK;IACL;IACA,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAClC,KAAK;IACL;IACA,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,KAAK;IACL;IACA,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,KAAK;IACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;IACvC,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IACpD,QAAQ,OAAO;IACf,YAAY,QAAQ,EAAE,OAAO,CAAC,IAAI;IAClC,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACxC,KAAK;IACL,IAAI,MAAM,oBAAoB,CAAC,OAAO,EAAE;IACxC,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,QAAQ,OAAO;IACf,YAAY,QAAQ,EAAE,OAAO,CAAC,IAAI;IAClC,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO;IACf,YAAY,IAAI,EAAE,EAAE;IACpB,YAAY,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC;IACV,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/banner/banner-ad-plugin-events.enum.js","esm/banner/banner-ad-position.enum.js","esm/banner/banner-ad-size.enum.js","esm/interstitial/interstitial-ad-plugin-events.enum.js","esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js","esm/reward/reward-ad-plugin-events.enum.js","esm/consent/consent-status.enum.js","esm/consent/consent-debug-geography.enum.js","esm/index.js","esm/web.js"],"sourcesContent":["export var MaxAdContentRating;\n(function (MaxAdContentRating) {\n /**\n * Content suitable for general audiences, including families.\n */\n MaxAdContentRating[\"General\"] = \"General\";\n /**\n * Content suitable for most audiences with parental guidance.\n */\n MaxAdContentRating[\"ParentalGuidance\"] = \"ParentalGuidance\";\n /**\n * Content suitable for teen and older audiences.\n */\n MaxAdContentRating[\"Teen\"] = \"Teen\";\n /**\n * Content suitable only for mature audiences.\n */\n MaxAdContentRating[\"MatureAudience\"] = \"MatureAudience\";\n})(MaxAdContentRating || (MaxAdContentRating = {}));\n//# sourceMappingURL=definitions.js.map","// This enum should be keep in sync with their native equivalents with the same name\nexport var BannerAdPluginEvents;\n(function (BannerAdPluginEvents) {\n BannerAdPluginEvents[\"SizeChanged\"] = \"bannerAdSizeChanged\";\n BannerAdPluginEvents[\"Loaded\"] = \"bannerAdLoaded\";\n BannerAdPluginEvents[\"FailedToLoad\"] = \"bannerAdFailedToLoad\";\n /**\n * Open \"Adsense\" Event after user click banner\n */\n BannerAdPluginEvents[\"Opened\"] = \"bannerAdOpened\";\n /**\n * Close \"Adsense\" Event after user click banner\n */\n BannerAdPluginEvents[\"Closed\"] = \"bannerAdClosed\";\n /**\n * Similarly, this method should be called when an impression is recorded for the ad by the mediated SDK.\n */\n BannerAdPluginEvents[\"AdImpression\"] = \"bannerAdImpression\";\n})(BannerAdPluginEvents || (BannerAdPluginEvents = {}));\n//# sourceMappingURL=banner-ad-plugin-events.enum.js.map","/**\n * @see https://developer.android.com/reference/android/widget/LinearLayout#attr_android:gravity\n */\nexport var BannerAdPosition;\n(function (BannerAdPosition) {\n /**\n * Banner position be top-center\n */\n BannerAdPosition[\"TOP_CENTER\"] = \"TOP_CENTER\";\n /**\n * Banner position be center\n */\n BannerAdPosition[\"CENTER\"] = \"CENTER\";\n /**\n * Banner position be bottom-center(default)\n */\n BannerAdPosition[\"BOTTOM_CENTER\"] = \"BOTTOM_CENTER\";\n})(BannerAdPosition || (BannerAdPosition = {}));\n//# sourceMappingURL=banner-ad-position.enum.js.map","/**\n * For more information:\n * https://developers.google.com/admob/ios/banner#banner_sizes\n * https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize\n *\n * */\nexport var BannerAdSize;\n(function (BannerAdSize) {\n /**\n * Mobile Marketing Association (MMA)\n * banner ad size (320x50 density-independent pixels).\n */\n BannerAdSize[\"BANNER\"] = \"BANNER\";\n /**\n * Interactive Advertising Bureau (IAB)\n * full banner ad size (468x60 density-independent pixels).\n */\n BannerAdSize[\"FULL_BANNER\"] = \"FULL_BANNER\";\n /**\n * Large banner ad size (320x100 density-independent pixels).\n */\n BannerAdSize[\"LARGE_BANNER\"] = \"LARGE_BANNER\";\n /**\n * Interactive Advertising Bureau (IAB)\n * medium rectangle ad size (300x250 density-independent pixels).\n */\n BannerAdSize[\"MEDIUM_RECTANGLE\"] = \"MEDIUM_RECTANGLE\";\n /**\n * Interactive Advertising Bureau (IAB)\n * leaderboard ad size (728x90 density-independent pixels).\n */\n BannerAdSize[\"LEADERBOARD\"] = \"LEADERBOARD\";\n /**\n * A dynamically sized banner that is full-width and auto-height.\n */\n BannerAdSize[\"ADAPTIVE_BANNER\"] = \"ADAPTIVE_BANNER\";\n /**\n * @deprecated\n * Will be removed in next AdMob versions use `ADAPTIVE_BANNER`\n * Screen width x 32|50|90\n */\n BannerAdSize[\"SMART_BANNER\"] = \"SMART_BANNER\";\n})(BannerAdSize || (BannerAdSize = {}));\n//# sourceMappingURL=banner-ad-size.enum.js.map","// This enum should be keep in sync with their native equivalents with the same name\nexport var InterstitialAdPluginEvents;\n(function (InterstitialAdPluginEvents) {\n /**\n * Emits after trying to prepare and Interstitial, when it is loaded and ready to be show\n */\n InterstitialAdPluginEvents[\"Loaded\"] = \"interstitialAdLoaded\";\n /**\n * Emits after trying to prepare and Interstitial, when it could not be loaded\n */\n InterstitialAdPluginEvents[\"FailedToLoad\"] = \"interstitialAdFailedToLoad\";\n /**\n * Emits when the Interstitial ad is visible to the user\n */\n InterstitialAdPluginEvents[\"Showed\"] = \"interstitialAdShowed\";\n /**\n * Emits when the Interstitial ad is failed to show\n */\n InterstitialAdPluginEvents[\"FailedToShow\"] = \"interstitialAdFailedToShow\";\n /**\n * Emits when the Interstitial ad is not visible to the user anymore.\n */\n InterstitialAdPluginEvents[\"Dismissed\"] = \"interstitialAdDismissed\";\n})(InterstitialAdPluginEvents || (InterstitialAdPluginEvents = {}));\n//# sourceMappingURL=interstitial-ad-plugin-events.enum.js.map","// This enum should be keep in sync with their native equivalents with the same name\nexport var RewardInterstitialAdPluginEvents;\n(function (RewardInterstitialAdPluginEvents) {\n /**\n * Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show\n */\n RewardInterstitialAdPluginEvents[\"Loaded\"] = \"onRewardedInterstitialAdLoaded\";\n /**\n * Emits after trying to prepare a RewardAd when it could not be loaded\n */\n RewardInterstitialAdPluginEvents[\"FailedToLoad\"] = \"onRewardedInterstitialAdFailedToLoad\";\n /**\n * Emits when the AdReward video is visible to the user\n */\n RewardInterstitialAdPluginEvents[\"Showed\"] = \"onRewardedInterstitialAdShowed\";\n /**\n * Emits when the AdReward video is failed to show\n */\n RewardInterstitialAdPluginEvents[\"FailedToShow\"] = \"onRewardedInterstitialAdFailedToShow\";\n /**\n * Emits when the AdReward video is not visible to the user anymore.\n *\n * **Important**: This has nothing to do with the reward it self. This event\n * will emits in this two cases:\n * 1. The user starts the video ad but close it before the reward emit.\n * 2. The user start the video and see it until end, then gets the reward\n * and after that the ad is closed.\n */\n RewardInterstitialAdPluginEvents[\"Dismissed\"] = \"onRewardedInterstitialAdDismissed\";\n /**\n * Emits when user get rewarded from AdReward\n */\n RewardInterstitialAdPluginEvents[\"Rewarded\"] = \"onRewardedInterstitialAdReward\";\n})(RewardInterstitialAdPluginEvents || (RewardInterstitialAdPluginEvents = {}));\n//# sourceMappingURL=reward-interstitial-ad-plugin-events.enum.js.map","// This enum should be keep in sync with their native equivalents with the same name\nexport var RewardAdPluginEvents;\n(function (RewardAdPluginEvents) {\n /**\n * Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show\n */\n RewardAdPluginEvents[\"Loaded\"] = \"onRewardedVideoAdLoaded\";\n /**\n * Emits after trying to prepare a RewardAd when it could not be loaded\n */\n RewardAdPluginEvents[\"FailedToLoad\"] = \"onRewardedVideoAdFailedToLoad\";\n /**\n * Emits when the AdReward video is visible to the user\n */\n RewardAdPluginEvents[\"Showed\"] = \"onRewardedVideoAdShowed\";\n /**\n * Emits when the AdReward video is failed to show\n */\n RewardAdPluginEvents[\"FailedToShow\"] = \"onRewardedVideoAdFailedToShow\";\n /**\n * Emits when the AdReward video is not visible to the user anymore.\n *\n * **Important**: This has nothing to do with the reward it self. This event\n * will emits in this two cases:\n * 1. The user starts the video ad but close it before the reward emit.\n * 2. The user start the video and see it until end, then gets the reward\n * and after that the ad is closed.\n */\n RewardAdPluginEvents[\"Dismissed\"] = \"onRewardedVideoAdDismissed\";\n /**\n * Emits when user get rewarded from AdReward\n */\n RewardAdPluginEvents[\"Rewarded\"] = \"onRewardedVideoAdReward\";\n})(RewardAdPluginEvents || (RewardAdPluginEvents = {}));\n//# sourceMappingURL=reward-ad-plugin-events.enum.js.map","/**\n * For more information:\n * https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#consentstatus\n *\n * */\nexport var AdmobConsentStatus;\n(function (AdmobConsentStatus) {\n /**\n * User consent not required.\n */\n AdmobConsentStatus[\"NOT_REQUIRED\"] = \"NOT_REQUIRED\";\n /**\n * User consent already obtained.\n */\n AdmobConsentStatus[\"OBTAINED\"] = \"OBTAINED\";\n /**\n * User consent required but not yet obtained.\n */\n AdmobConsentStatus[\"REQUIRED\"] = \"REQUIRED\";\n /**\n * Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.\n */\n AdmobConsentStatus[\"UNKNOWN\"] = \"UNKNOWN\";\n})(AdmobConsentStatus || (AdmobConsentStatus = {}));\n//# sourceMappingURL=consent-status.enum.js.map","/**\n * For more information:\n * https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#debuggeography\n *\n * */\nexport var AdmobConsentDebugGeography;\n(function (AdmobConsentDebugGeography) {\n /**\n * Debug geography disabled.\n */\n AdmobConsentDebugGeography[AdmobConsentDebugGeography[\"DISABLED\"] = 0] = \"DISABLED\";\n /**\n * Geography appears as in EEA for debug devices.\n */\n AdmobConsentDebugGeography[AdmobConsentDebugGeography[\"EEA\"] = 1] = \"EEA\";\n /**\n * Geography appears as not in EEA for debug devices.\n */\n AdmobConsentDebugGeography[AdmobConsentDebugGeography[\"NOT_EEA\"] = 2] = \"NOT_EEA\";\n})(AdmobConsentDebugGeography || (AdmobConsentDebugGeography = {}));\n//# sourceMappingURL=consent-debug-geography.enum.js.map","import { registerPlugin } from '@capacitor/core';\nconst AdMob = registerPlugin('AdMob', {\n web: () => import('./web').then(m => new m.AdMobWeb()),\n});\nexport * from './definitions';\nexport * from './banner/index';\nexport * from './interstitial/index';\nexport * from './reward-interstitial/index';\nexport * from './reward/index';\nexport * from './consent/index';\nexport * from './shared/index';\nexport { AdMob };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AdmobConsentStatus } from './consent/consent-status.enum';\nexport class AdMobWeb extends WebPlugin {\n async initialize() {\n console.log('initialize');\n }\n async requestTrackingAuthorization() {\n console.log('requestTrackingAuthorization');\n }\n async trackingAuthorizationStatus() {\n return {\n status: 'authorized',\n };\n }\n async requestConsentInfo(options) {\n console.log('requestConsentInfo', options);\n return {\n status: AdmobConsentStatus.REQUIRED,\n isConsentFormAvailable: true,\n };\n }\n async showConsentForm() {\n console.log('showConsentForm');\n return {\n status: AdmobConsentStatus.REQUIRED,\n };\n }\n async resetConsentInfo() {\n console.log('resetConsentInfo');\n }\n async setApplicationMuted(options) {\n console.log('setApplicationMuted', options);\n }\n async setApplicationVolume(options) {\n console.log('setApplicationVolume', options);\n }\n async showBanner(options) {\n console.log('showBanner', options);\n }\n // Hide the banner, remove it from screen, but can show it later\n async hideBanner() {\n console.log('hideBanner');\n }\n // Resume the banner, show it after hide\n async resumeBanner() {\n console.log('resumeBanner');\n }\n // Destroy the banner, remove it from screen.\n async removeBanner() {\n console.log('removeBanner');\n }\n async prepareInterstitial(options) {\n console.log('prepareInterstitial', options);\n return {\n adUnitId: options.adId,\n };\n }\n async showInterstitial() {\n console.log('showInterstitial');\n }\n async prepareRewardVideoAd(options) {\n console.log(options);\n return {\n adUnitId: options.adId,\n };\n }\n async showRewardVideoAd() {\n return {\n type: '',\n amount: 0,\n };\n }\n async prepareRewardInterstitialAd(options) {\n console.log(options);\n return {\n adUnitId: options.adId,\n };\n }\n async showRewardInterstitialAd() {\n return {\n type: '',\n amount: 0,\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["MaxAdContentRating","BannerAdPluginEvents","BannerAdPosition","BannerAdSize","InterstitialAdPluginEvents","RewardInterstitialAdPluginEvents","RewardAdPluginEvents","AdmobConsentStatus","AdmobConsentDebugGeography","registerPlugin","WebPlugin"],"mappings":";;;AAAWA,wCAAmB;IAC9B,CAAC,UAAU,kBAAkB,EAAE;IAC/B;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC9C;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;IAChE;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACxC;IACA;IACA;IACA,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;IAC5D,CAAC,EAAEA,0BAAkB,KAAKA,0BAAkB,GAAG,EAAE,CAAC,CAAC;;IClBnD;AACWC,0CAAqB;IAChC,CAAC,UAAU,oBAAoB,EAAE;IACjC,IAAI,oBAAoB,CAA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AC;IAC7B,QAAQ,OAAO;IACf,YAAY,QAAQ,EAAE,OAAO,CAAC,IAAI;IAClC,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO;IACf,YAAY,IAAI,EAAE,EAAE;IACpB,YAAY,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,2BAA2B,CAAC,OAAO,EAAE;IAC/C,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,QAAQ,OAAO;IACf,YAAY,QAAQ,EAAE,OAAO,CAAC,IAAI;IAClC,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,OAAO;IACf,YAAY,IAAI,EAAE,EAAE;IACpB,YAAY,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC;IACV,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,7 @@ import Capacitor
|
|
|
3
3
|
import GoogleMobileAds
|
|
4
4
|
|
|
5
5
|
class BannerExecutor: NSObject, GADBannerViewDelegate {
|
|
6
|
-
|
|
6
|
+
weak var plugin: AdMob?
|
|
7
7
|
var bannerView: GADBannerView!
|
|
8
8
|
|
|
9
9
|
func showBanner(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
|
|
@@ -88,15 +88,9 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
|
|
|
88
88
|
NSLog("AdMob: find subView for resumeBanner")
|
|
89
89
|
subView.isHidden = false
|
|
90
90
|
|
|
91
|
-
let width = subView.frame.width
|
|
92
|
-
var height = subView.frame.height
|
|
93
|
-
// For fixing issue 160 iOs banner overlapping content on iPhone with rounded corners
|
|
94
|
-
let safeAreaBottom = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0
|
|
95
|
-
height += safeAreaBottom
|
|
96
|
-
|
|
97
91
|
self.plugin?.notifyListeners(BannerAdPluginEvents.SizeChanged.rawValue, data: [
|
|
98
|
-
"width": width,
|
|
99
|
-
"height": height
|
|
92
|
+
"width": subView.frame.width,
|
|
93
|
+
"height": subView.frame.height
|
|
100
94
|
])
|
|
101
95
|
|
|
102
96
|
call.resolve([:])
|
|
@@ -150,25 +144,19 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
|
|
|
150
144
|
}
|
|
151
145
|
|
|
152
146
|
/// Tells the delegate an ad request loaded an ad.
|
|
153
|
-
|
|
147
|
+
func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
|
|
154
148
|
NSLog("bannerViewDidReceiveAd")
|
|
155
149
|
|
|
156
|
-
let width = bannerView.frame.width
|
|
157
|
-
var height = bannerView.frame.height
|
|
158
|
-
// For fixing issue 160 iOs banner overlapping content on iPhone with rounded corners
|
|
159
|
-
let safeAreaBottom = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0
|
|
160
|
-
height += safeAreaBottom
|
|
161
|
-
|
|
162
150
|
self.plugin?.notifyListeners(BannerAdPluginEvents.SizeChanged.rawValue, data: [
|
|
163
|
-
"width": width,
|
|
164
|
-
"height": height
|
|
151
|
+
"width": bannerView.frame.width,
|
|
152
|
+
"height": bannerView.frame.height
|
|
165
153
|
])
|
|
166
154
|
self.plugin?.notifyListeners(BannerAdPluginEvents.Loaded.rawValue, data: [:])
|
|
167
155
|
}
|
|
168
156
|
|
|
169
157
|
/// Tells the delegate an ad request failed.
|
|
170
|
-
|
|
171
|
-
|
|
158
|
+
func bannerView(_ bannerView: GADBannerView,
|
|
159
|
+
didFailToReceiveAdWithError error: Error) {
|
|
172
160
|
NSLog("bannerView:didFailToReceiveAdWithError: \(error.localizedDescription)")
|
|
173
161
|
self.removeBannerViewToView()
|
|
174
162
|
self.plugin?.notifyListeners(BannerAdPluginEvents.SizeChanged.rawValue, data: [
|
|
@@ -181,18 +169,18 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
|
|
|
181
169
|
])
|
|
182
170
|
}
|
|
183
171
|
|
|
184
|
-
|
|
172
|
+
func bannerViewDidRecordImpression(_ bannerView: GADBannerView) {
|
|
185
173
|
self.plugin?.notifyListeners(BannerAdPluginEvents.AdImpression.rawValue, data: [:])
|
|
186
174
|
}
|
|
187
175
|
|
|
188
176
|
/// Tells the delegate that a full-screen view will be presented in response
|
|
189
177
|
/// to the user clicking on an ad.
|
|
190
|
-
|
|
178
|
+
func bannerViewWillPresentScreen(_ bannerView: GADBannerView) {
|
|
191
179
|
self.plugin?.notifyListeners(BannerAdPluginEvents.Opened.rawValue, data: [:])
|
|
192
180
|
}
|
|
193
181
|
|
|
194
182
|
/// Tells the delegate that the full-screen view will be dismissed.
|
|
195
|
-
|
|
183
|
+
func bannerViewWillDismissScreen(_ bannerView: GADBannerView) {
|
|
196
184
|
self.plugin?.notifyListeners(BannerAdPluginEvents.Closed.rawValue, data: [:])
|
|
197
185
|
}
|
|
198
186
|
}
|
|
@@ -4,7 +4,7 @@ import GoogleMobileAds
|
|
|
4
4
|
import UserMessagingPlatform
|
|
5
5
|
|
|
6
6
|
class ConsentExecutor: NSObject {
|
|
7
|
-
|
|
7
|
+
weak var plugin: AdMob?
|
|
8
8
|
|
|
9
9
|
func requestConsentInfo(_ call: CAPPluginCall, _ debugGeography: Int, _ testDeviceIdentifiers: [String], _ tagForUnderAgeOfConsent: Bool) {
|
|
10
10
|
let parameters = UMPRequestParameters()
|
|
@@ -3,7 +3,7 @@ import Capacitor
|
|
|
3
3
|
import GoogleMobileAds
|
|
4
4
|
|
|
5
5
|
class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
|
|
6
|
-
|
|
6
|
+
weak var plugin: AdMob?
|
|
7
7
|
var interstitial: GADInterstitialAd!
|
|
8
8
|
|
|
9
9
|
func prepareInterstitial(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
|
|
@@ -45,7 +45,7 @@ class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
49
49
|
NSLog("InterstitialFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
50
50
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.FailedToShow.rawValue, data: [
|
|
51
51
|
"code": 0,
|
|
@@ -53,12 +53,12 @@ class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
53
53
|
])
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
57
57
|
NSLog("InterstitialFullScreenDelegate Ad did present full screen content.")
|
|
58
58
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.Showed.rawValue, data: [:])
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
62
62
|
NSLog("InterstitialFullScreenDelegate Ad did dismiss full screen content.")
|
|
63
63
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.Dismissed.rawValue, data: [:])
|
|
64
64
|
}
|
package/ios/Plugin/Plugin.m
CHANGED
|
@@ -20,4 +20,6 @@ CAP_PLUGIN(AdMob, "AdMob",
|
|
|
20
20
|
CAP_PLUGIN_METHOD(showInterstitial, CAPPluginReturnPromise);
|
|
21
21
|
CAP_PLUGIN_METHOD(prepareRewardVideoAd, CAPPluginReturnPromise);
|
|
22
22
|
CAP_PLUGIN_METHOD(showRewardVideoAd, CAPPluginReturnPromise);
|
|
23
|
+
CAP_PLUGIN_METHOD(prepareRewardInterstitialAd, CAPPluginReturnPromise);
|
|
24
|
+
CAP_PLUGIN_METHOD(showRewardInterstitialAd, CAPPluginReturnPromise);
|
|
23
25
|
)
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -13,6 +13,7 @@ public class AdMob: CAPPlugin {
|
|
|
13
13
|
private let bannerExecutor = BannerExecutor()
|
|
14
14
|
private let adInterstitialExecutor = AdInterstitialExecutor()
|
|
15
15
|
private let adRewardExecutor = AdRewardExecutor()
|
|
16
|
+
private let adRewardInterstitialExecutor = AdRewardInterstitialExecutor()
|
|
16
17
|
private let consentExecutor = ConsentExecutor()
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -23,6 +24,8 @@ public class AdMob: CAPPlugin {
|
|
|
23
24
|
self.bannerExecutor.plugin = self
|
|
24
25
|
self.adInterstitialExecutor.plugin = self
|
|
25
26
|
self.adRewardExecutor.plugin = self
|
|
27
|
+
self.adRewardInterstitialExecutor.plugin = self
|
|
28
|
+
self.adInterstitialExecutor.plugin = self
|
|
26
29
|
self.consentExecutor.plugin = self
|
|
27
30
|
self.setRequestConfiguration(call)
|
|
28
31
|
|
|
@@ -59,7 +62,7 @@ public class AdMob: CAPPlugin {
|
|
|
59
62
|
|
|
60
63
|
@objc func setApplicationVolume(_ call: CAPPluginCall) {
|
|
61
64
|
if var volume = call.getFloat("volume") {
|
|
62
|
-
//Clamp volumes.
|
|
65
|
+
// Clamp volumes.
|
|
63
66
|
if volume < 0.0 {volume = 0.0} else if volume > 1.0 {volume = 1.0}
|
|
64
67
|
|
|
65
68
|
GADMobileAds.sharedInstance().applicationVolume = volume
|
|
@@ -123,7 +126,7 @@ public class AdMob: CAPPlugin {
|
|
|
123
126
|
|
|
124
127
|
/**
|
|
125
128
|
* AdMob: Rewarded Ads
|
|
126
|
-
* https://developers.google.com/ad-manager/mobile-ads-sdk/ios/rewarded-ads
|
|
129
|
+
* https://developers.google.com/ad-manager/mobile-ads-sdk/ios/rewarded-ads
|
|
127
130
|
*/
|
|
128
131
|
@objc func prepareRewardVideoAd(_ call: CAPPluginCall) {
|
|
129
132
|
let adUnitID = getAdId(call, "ca-app-pub-3940256099942544/1712485313")
|
|
@@ -139,6 +142,25 @@ public class AdMob: CAPPlugin {
|
|
|
139
142
|
self.adRewardExecutor.showRewardVideoAd(call)
|
|
140
143
|
}
|
|
141
144
|
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* AdMob: Rewarded Interstitial Ads
|
|
148
|
+
* https://developers.google.com/ad-manager/mobile-ads-sdk/ios/rewarded-interstitial
|
|
149
|
+
*/
|
|
150
|
+
@objc func prepareRewardInterstitialAd(_ call: CAPPluginCall) {
|
|
151
|
+
let adUnitID = getAdId(call, "ca-app-pub-3940256099942544/6978759866")
|
|
152
|
+
let request = self.GADRequestWithOption(call.getBool("npa") ?? false)
|
|
153
|
+
|
|
154
|
+
DispatchQueue.main.async {
|
|
155
|
+
self.adRewardInterstitialExecutor.prepareRewardInterstitialAd(call, request, adUnitID)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@objc func showRewardInterstitialAd(_ call: CAPPluginCall) {
|
|
160
|
+
DispatchQueue.main.async {
|
|
161
|
+
self.adRewardInterstitialExecutor.showRewardInterstitialAd(call)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
142
164
|
|
|
143
165
|
@objc func trackingAuthorizationStatus(_ call: CAPPluginCall) {
|
|
144
166
|
DispatchQueue.main.async {
|
|
@@ -231,12 +253,12 @@ public class AdMob: CAPPlugin {
|
|
|
231
253
|
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = call.getArray("testingDevices", String.self) ?? []
|
|
232
254
|
}
|
|
233
255
|
|
|
234
|
-
if call.getBool("tagForChildDirectedTreatment")
|
|
235
|
-
GADMobileAds.sharedInstance().requestConfiguration.
|
|
256
|
+
if call.getBool("tagForChildDirectedTreatment") == true {
|
|
257
|
+
GADMobileAds.sharedInstance().requestConfiguration.tagForChildDirectedTreatment = true
|
|
236
258
|
}
|
|
237
259
|
|
|
238
|
-
if call.getBool("tagForUnderAgeOfConsent")
|
|
239
|
-
GADMobileAds.sharedInstance().requestConfiguration.
|
|
260
|
+
if call.getBool("tagForUnderAgeOfConsent") == true {
|
|
261
|
+
GADMobileAds.sharedInstance().requestConfiguration.tagForUnderAgeOfConsent = true
|
|
240
262
|
}
|
|
241
263
|
|
|
242
264
|
if call.getString("maxAdContentRating") != nil {
|
|
@@ -3,7 +3,7 @@ import Capacitor
|
|
|
3
3
|
import GoogleMobileAds
|
|
4
4
|
|
|
5
5
|
class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
|
|
6
|
-
|
|
6
|
+
weak var plugin: AdMob?
|
|
7
7
|
var rewardedAd: GADRewardedAd!
|
|
8
8
|
|
|
9
9
|
func prepareRewardVideoAd(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
|
|
@@ -66,7 +66,7 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
70
70
|
NSLog("RewardFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
71
71
|
self.plugin?.notifyListeners(RewardAdPluginEvents.FailedToShow.rawValue, data: [
|
|
72
72
|
"code": 0,
|
|
@@ -74,12 +74,12 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
74
74
|
])
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
78
78
|
NSLog("RewardFullScreenDelegate Ad did present full screen content.")
|
|
79
79
|
self.plugin?.notifyListeners(RewardAdPluginEvents.Showed.rawValue, data: [:])
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
83
83
|
NSLog("RewardFullScreenDelegate Ad did dismiss full screen content.")
|
|
84
84
|
self.plugin?.notifyListeners(RewardAdPluginEvents.Dismissed.rawValue, data: [:])
|
|
85
85
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
import GoogleMobileAds
|
|
4
|
+
|
|
5
|
+
class AdRewardInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
|
|
6
|
+
public weak var plugin: AdMob?
|
|
7
|
+
var rewardedInterstitialAd: GADRewardedInterstitialAd!
|
|
8
|
+
|
|
9
|
+
func prepareRewardInterstitialAd(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
|
|
10
|
+
GADRewardedInterstitialAd.load(
|
|
11
|
+
withAdUnitID: adUnitID,
|
|
12
|
+
request: request,
|
|
13
|
+
completionHandler: { (ad, error) in
|
|
14
|
+
if let error = error {
|
|
15
|
+
NSLog("Rewarded ad failed to load with error: \(error.localizedDescription)")
|
|
16
|
+
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.FailedToLoad.rawValue, data: [
|
|
17
|
+
"code": 0,
|
|
18
|
+
"message": error.localizedDescription
|
|
19
|
+
])
|
|
20
|
+
call.reject("Loading failed")
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
self.rewardedInterstitialAd = ad
|
|
25
|
+
|
|
26
|
+
if let providedOptions = call.getObject("ssv") {
|
|
27
|
+
let ssvOptions = GADServerSideVerificationOptions()
|
|
28
|
+
|
|
29
|
+
if let customData = providedOptions["customData"] as? String {
|
|
30
|
+
NSLog("Sending Custom Data: \(customData) to SSV callback")
|
|
31
|
+
ssvOptions.customRewardString = customData
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if let userId = providedOptions["userId"] as? String {
|
|
35
|
+
NSLog("Sending UserId: \(userId) to SSV callback")
|
|
36
|
+
ssvOptions.userIdentifier = userId
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
self.rewardedInterstitialAd?.serverSideVerificationOptions = ssvOptions
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
self.rewardedInterstitialAd?.fullScreenContentDelegate = self
|
|
43
|
+
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Loaded.rawValue, data: [
|
|
44
|
+
"adUnitId": adUnitID
|
|
45
|
+
])
|
|
46
|
+
call.resolve([
|
|
47
|
+
"adUnitId": adUnitID
|
|
48
|
+
])
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
func showRewardInterstitialAd(_ call: CAPPluginCall) {
|
|
54
|
+
if let rootViewController = plugin?.getRootVC() {
|
|
55
|
+
if let ad = self.rewardedInterstitialAd {
|
|
56
|
+
ad.present(fromRootViewController: rootViewController,
|
|
57
|
+
userDidEarnRewardHandler: {
|
|
58
|
+
let reward = ad.adReward
|
|
59
|
+
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Rewarded.rawValue, data: ["type": reward.type, "amount": reward.amount])
|
|
60
|
+
call.resolve(["type": reward.type, "amount": reward.amount])
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
} else {
|
|
64
|
+
call.reject("Reward Video is Not Ready Yet")
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
70
|
+
NSLog("RewardFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
71
|
+
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.FailedToShow.rawValue, data: [
|
|
72
|
+
"code": 0,
|
|
73
|
+
"message": error.localizedDescription
|
|
74
|
+
])
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
78
|
+
NSLog("RewardFullScreenDelegate Ad did present full screen content.")
|
|
79
|
+
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Showed.rawValue, data: [:])
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
83
|
+
NSLog("RewardFullScreenDelegate Ad did dismiss full screen content.")
|
|
84
|
+
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Dismissed.rawValue, data: [:])
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
public enum RewardInterstitialAdPluginEvents: String {
|
|
2
|
+
case Loaded = "onRewardedInterstitialAdLoaded"
|
|
3
|
+
case FailedToLoad = "onRewardedInterstitialAdFailedToLoad"
|
|
4
|
+
case Showed = "onRewardedInterstitialAdShowed"
|
|
5
|
+
case FailedToShow = "onRewardedInterstitialAdFailedToShow"
|
|
6
|
+
case Dismissed = "onRewardedInterstitialAdDismissed"
|
|
7
|
+
case Rewarded = "onRewardedInterstitialAdReward"
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-community/admob",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "A native plugin for AdMob",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
8
8
|
"unpkg": "dist/plugin.js",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=18.0.0"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"android/src/main/",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
32
32
|
"verify:web": "npm run build",
|
|
33
33
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
34
|
-
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint --
|
|
34
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
35
35
|
"eslint": "eslint src/. --ext ts",
|
|
36
36
|
"prettier": "prettier \"{src/*.ts,**/*.java}\"",
|
|
37
37
|
"swiftlint": "node-swiftlint",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"release": "np --no-tests"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@capacitor/android": "
|
|
47
|
-
"@capacitor/cli": "
|
|
48
|
-
"@capacitor/core": "
|
|
46
|
+
"@capacitor/android": "^6.0.0",
|
|
47
|
+
"@capacitor/cli": "^6.0.0",
|
|
48
|
+
"@capacitor/core": "^6.0.0",
|
|
49
49
|
"@capacitor/docgen": "git+https://github.com/rdlabo/capacitor-docgen.git#feat/support_extends_build",
|
|
50
|
-
"@capacitor/ios": "
|
|
50
|
+
"@capacitor/ios": "^6.0.0",
|
|
51
51
|
"@ionic/eslint-config": "^0.3.0",
|
|
52
52
|
"@ionic/prettier-config": "^1.0.1",
|
|
53
53
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"typescript": "~4.1.5"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@capacitor/core": "
|
|
67
|
+
"@capacitor/core": "^6.0.0"
|
|
68
68
|
},
|
|
69
69
|
"husky": {
|
|
70
70
|
"hooks": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"git add"
|
|
82
82
|
],
|
|
83
83
|
"*.swift": [
|
|
84
|
-
"npm run swiftlint --
|
|
84
|
+
"npm run swiftlint -- --fix --format",
|
|
85
85
|
"git add"
|
|
86
86
|
]
|
|
87
87
|
},
|