From c8edd359b23d8966b462efd3f849ce3b0bd5412f Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Mon, 27 Jul 2026 22:23:54 +0200 Subject: [PATCH] feat(applovin): sync wrapper with cordova-plugin-applovin-max@2.1.0 Add segment targeting, ad-ready checks, banner/mrec position updates, and the full set of banner/mrec/interstitial/rewarded ad lifecycle events introduced upstream. Deprecate APIs removed in 2.0.0 and fix setMuted's missing parameter plus a broken rewarded-ad event name. --- .../plugins/applovin/index.ts | 201 +++++++++++++++++- 1 file changed, 195 insertions(+), 6 deletions(-) diff --git a/src/@awesome-cordova-plugins/plugins/applovin/index.ts b/src/@awesome-cordova-plugins/plugins/applovin/index.ts index b3d6e9564..1688e846b 100644 --- a/src/@awesome-cordova-plugins/plugins/applovin/index.ts +++ b/src/@awesome-cordova-plugins/plugins/applovin/index.ts @@ -3,10 +3,27 @@ import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-pl import { Observable } from 'rxjs'; export interface InitializeConfig { - hasUserConsentValue: boolean; - isAgeRestrictedUserValue: boolean; - isDoNotSellValue: boolean; - isTabletValue: boolean; + /** + * @deprecated Never populated by the native SDKs. Use `hasUserConsent` instead. + */ + hasUserConsentValue?: boolean; + /** + * @deprecated Never populated by the native SDKs, and the underlying `isAgeRestrictedUser` + * field was removed upstream in cordova-plugin-applovin-max@2.0.0. + */ + isAgeRestrictedUserValue?: boolean; + /** + * @deprecated Never populated by the native SDKs. Use `isDoNotSell` instead. + */ + isDoNotSellValue?: boolean; + /** + * @deprecated Never populated by the native SDKs. Use `isTablet` instead. + */ + isTabletValue?: boolean; + hasUserConsent: boolean; + isDoNotSell: boolean; + isTablet: boolean; + countryCode: string; } export interface AdInfo { @@ -17,6 +34,11 @@ export interface AdInfo { revenue: number; } +export interface AdRewardInfo extends AdInfo { + rewardLabel: string; + rewardAmount: number; +} + export enum AdViewPosition { TOP_CENTER = 'top_center', TOP_RIGHT = 'top_right', @@ -28,6 +50,10 @@ export enum AdViewPosition { BOTTOM_RIGHT = 'bottom_right', } +/** + * @deprecated Only produced by the now-removed `getConsentDialogState` method + * (removed upstream in cordova-plugin-applovin-max@2.0.0). + */ export enum ConsentDialogState { UNKNOWN = 0, APPLIES = 1, @@ -80,11 +106,22 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + /** + * Check whether the SDK has been initialized. + */ + @Cordova() + isInitialized(): Promise { + return; + } + @Cordova() showMediationDebugger(): Promise { return; } + /** + * @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0. + */ @Cordova() getConsentDialogState(): Promise { return; @@ -100,11 +137,17 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + /** + * @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0. + */ @Cordova() setIsAgeRestrictedUser(isAgeRestrictedUser: boolean): Promise { return; } + /** + * @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0. + */ @Cordova() isAgeRestrictedUser(): Promise { return; @@ -130,8 +173,11 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + /** + * @param {boolean} muted Whether ads should be muted. + */ @Cordova() - setMuted(): Promise { + setMuted(muted: boolean): Promise { return; } @@ -145,6 +191,19 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + /** SEGMENT TARGETING */ + + /** + * Add a segment for segment targeting. Must be called before `initialize()`. + * + * @param {number} key The segment key. + * @param {number[]} values The segment values. + */ + @Cordova() + addSegment(key: number, values: number[]): Promise { + return; + } + @Cordova() trackEvent(event: string, parameters?: object): Promise { return; @@ -167,6 +226,11 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + @Cordova() + updateBannerPosition(adUnitId: string, position: AdViewPosition): Promise { + return; + } + @Cordova() setBannerExtraParameter(adUnitId: string, key: string, value: string): Promise { return; @@ -187,6 +251,46 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + @Cordova({ + eventObservable: true, + event: 'OnBannerAdLoadedEvent', + }) + onBannerAdLoaded(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnBannerAdLoadFailedEvent', + }) + onBannerAdLoadFailed(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnBannerAdClickedEvent', + }) + onBannerAdClicked(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnBannerAdExpandedEvent', + }) + onBannerAdExpanded(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnBannerAdCollapsedEvent', + }) + onBannerAdCollapsed(): Observable { + return; + } + /** MRECS */ @Cordova() @@ -204,6 +308,11 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + @Cordova() + updateMRecPosition(adUnitId: string, position: AdViewPosition): Promise { + return; + } + @Cordova() setMRecExtraParameter(adUnitId: string, key: string, value: string): Promise { return; @@ -224,6 +333,46 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + @Cordova({ + eventObservable: true, + event: 'OnMRecAdLoadedEvent', + }) + onMRecAdLoaded(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnMRecAdLoadFailedEvent', + }) + onMRecAdLoadFailed(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnMRecAdClickedEvent', + }) + onMRecAdClicked(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnMRecAdExpandedEvent', + }) + onMRecAdExpanded(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnMRecAdCollapsedEvent', + }) + onMRecAdCollapsed(): Observable { + return; + } + /** INTERSTITIALS */ @Cordova() @@ -231,6 +380,14 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + /** + * @param {string} adUnitId The ad unit id to check. + */ + @Cordova() + isInterstitialReady(adUnitId: string): Promise { + return; + } + @Cordova() showInterstitial(adUnitId: string, placement?: string): Promise { return; @@ -249,6 +406,14 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + @Cordova({ + eventObservable: true, + event: 'OnInterstitialClickedEvent', + }) + onInterstitialClicked(): Observable { + return; + } + @Cordova({ eventObservable: true, event: 'OnInterstitialLoadFailedEvent', @@ -288,6 +453,14 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + /** + * @param {string} adUnitId The ad unit id to check. + */ + @Cordova() + isRewardedAdReady(adUnitId: string): Promise { + return; + } + @Cordova() showRewardedAd(adUnitId: string, placement?: string): Promise { return; @@ -306,6 +479,14 @@ export class Applovin extends AwesomeCordovaNativePlugin { return; } + @Cordova({ + eventObservable: true, + event: 'OnRewardedAdClickedEvent', + }) + onRewardedAdClicked(): Observable { + return; + } + @Cordova({ eventObservable: true, event: 'OnRewardedAdLoadFailedEvent', @@ -332,9 +513,17 @@ export class Applovin extends AwesomeCordovaNativePlugin { @Cordova({ eventObservable: true, - event: 'OnRewardedAdAdFailedToDisplayEvent', + event: 'OnRewardedAdFailedToDisplayEvent', }) onRewardedAdAdFailedToDisplay(): Observable { return; } + + @Cordova({ + eventObservable: true, + event: 'OnRewardedAdReceivedRewardEvent', + }) + onRewardedAdReceivedReward(): Observable { + return; + } }