Compare commits

..
Author SHA1 Message Date
Daniel Sogl c8edd359b2 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.
2026-07-27 22:23:54 +02:00
2 changed files with 198 additions and 80 deletions
@@ -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<boolean> {
return;
}
@Cordova()
showMediationDebugger(): Promise<any> {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
getConsentDialogState(): Promise<ConsentDialogState> {
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<any> {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
isAgeRestrictedUser(): Promise<boolean> {
return;
@@ -130,8 +173,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @param {boolean} muted Whether ads should be muted.
*/
@Cordova()
setMuted(): Promise<boolean> {
setMuted(muted: boolean): Promise<any> {
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<any> {
return;
}
@Cordova()
trackEvent(event: string, parameters?: object): Promise<any> {
return;
@@ -167,6 +226,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova()
updateBannerPosition(adUnitId: string, position: AdViewPosition): Promise<any> {
return;
}
@Cordova()
setBannerExtraParameter(adUnitId: string, key: string, value: string): Promise<any> {
return;
@@ -187,6 +251,46 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdLoadedEvent',
})
onBannerAdLoaded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdLoadFailedEvent',
})
onBannerAdLoadFailed(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdClickedEvent',
})
onBannerAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdExpandedEvent',
})
onBannerAdExpanded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdCollapsedEvent',
})
onBannerAdCollapsed(): Observable<AdInfo> {
return;
}
/** MRECS */
@Cordova()
@@ -204,6 +308,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova()
updateMRecPosition(adUnitId: string, position: AdViewPosition): Promise<any> {
return;
}
@Cordova()
setMRecExtraParameter(adUnitId: string, key: string, value: string): Promise<any> {
return;
@@ -224,6 +333,46 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdLoadedEvent',
})
onMRecAdLoaded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdLoadFailedEvent',
})
onMRecAdLoadFailed(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdClickedEvent',
})
onMRecAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdExpandedEvent',
})
onMRecAdExpanded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdCollapsedEvent',
})
onMRecAdCollapsed(): Observable<AdInfo> {
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<boolean> {
return;
}
@Cordova()
showInterstitial(adUnitId: string, placement?: string): Promise<any> {
return;
@@ -249,6 +406,14 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnInterstitialClickedEvent',
})
onInterstitialClicked(): Observable<AdInfo> {
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<boolean> {
return;
}
@Cordova()
showRewardedAd(adUnitId: string, placement?: string): Promise<any> {
return;
@@ -306,6 +479,14 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdClickedEvent',
})
onRewardedAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdLoadFailedEvent',
@@ -332,9 +513,17 @@ export class Applovin extends AwesomeCordovaNativePlugin {
@Cordova({
eventObservable: true,
event: 'OnRewardedAdAdFailedToDisplayEvent',
event: 'OnRewardedAdFailedToDisplayEvent',
})
onRewardedAdAdFailedToDisplay(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdReceivedRewardEvent',
})
onRewardedAdReceivedReward(): Observable<AdRewardInfo> {
return;
}
}
@@ -30,9 +30,9 @@ export interface CameraPreviewOptions {
/** Preview box drag across the screen, default 'false' */
previewDrag?: boolean;
/** Capture images to a file and return back the file path instead of returning base64 encoded data. Defaults to false */
storeToFile?: boolean;
/** Capture images to a file and return back the file path instead of returning base64 encoded data. */
storeToFile: boolean;
/** Preview box to the back of the webview (true => back, false => front) , default false */
toBack?: boolean;
@@ -166,19 +166,6 @@ export class CameraPreview extends AwesomeCordovaNativePlugin {
CUSTOM: 'custom',
};
WHITE_BALANCE_MODE = {
LOCK: 'lock',
AUTO: 'auto',
CONTINUOUS: 'continuous',
INCANDESCENT: 'incandescent',
CLOUDY_DAYLIGHT: 'cloudy-daylight',
DAYLIGHT: 'daylight',
FLUORESCENT: 'fluorescent',
SHADE: 'shade',
TWILIGHT: 'twilight',
WARM_FLUORESCENT: 'warm-fluorescent',
};
FLASH_MODE = {
OFF: 'off',
ON: 'on',
@@ -310,16 +297,6 @@ export class CameraPreview extends AwesomeCordovaNativePlugin {
return;
}
/**
* Get color effects supported by the camera device currently started. Android only.
*
* @returns {Promise<any>}
*/
@Cordova()
getSupportedColorEffects(): Promise<any> {
return;
}
/**
*
* Set camera color effect.
@@ -530,40 +507,6 @@ export class CameraPreview extends AwesomeCordovaNativePlugin {
return;
}
/**
* Get white balance modes supported by the camera device currently started.
*
* @returns {Promise<any>}
*/
@Cordova()
getSupportedWhiteBalanceModes(): Promise<any> {
return;
}
/**
* Get the current white balance mode of the camera device currently started.
*
* @returns {Promise<any>}
*/
@Cordova()
getWhiteBalanceMode(): Promise<any> {
return;
}
/**
* Set the white balance mode for the camera device currently started.
*
* @param {string} [whiteBalanceMode] 'lock', 'auto', 'continuous', 'incandescent', 'cloudy-daylight', 'daylight', 'fluorescent', 'shade', 'twilight' or 'warm-fluorescent'
* @returns {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2,
})
setWhiteBalanceMode(whiteBalanceMode?: string): Promise<any> {
return;
}
/**
* Set specific focus point. Note, this assumes the camera is full-screen.
*
@@ -605,18 +548,4 @@ export class CameraPreview extends AwesomeCordovaNativePlugin {
getCameraCharacteristics(): Promise<any> {
return;
}
/**
* Convert a local file (e.g. a `file://` path returned by takePicture with storeToFile) into a Blob.
*
* @param {string} path the local url to convert
* @returns {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2,
})
getBlob(path: string): Promise<any> {
return;
}
}