diff --git a/docs/plugins/applovin/README.md b/docs/plugins/applovin/README.md new file mode 100644 index 0000000000..1625d299b2 --- /dev/null +++ b/docs/plugins/applovin/README.md @@ -0,0 +1,20 @@ +# Applovin + +``` +$ ionic cordova plugin add cordova-plugin-applovin-max +$ npm install @awesome-cordova-plugins/applovin +``` + +## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/applovin/) + +Plugin Repo: [https://github.com/AppLovin/AppLovin-MAX-Cordova](https://github.com/AppLovin/AppLovin-MAX-Cordova) + +This plugin allows you to easily configure, integrate and interact with Applovin ads. + +## Supported platforms + +- Android + - iOS + + + diff --git a/src/@awesome-cordova-plugins/plugins/applovin/index.ts b/src/@awesome-cordova-plugins/plugins/applovin/index.ts new file mode 100644 index 0000000000..b3d6e95645 --- /dev/null +++ b/src/@awesome-cordova-plugins/plugins/applovin/index.ts @@ -0,0 +1,340 @@ +import { Injectable } from '@angular/core'; +import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-plugins/core'; +import { Observable } from 'rxjs'; + +export interface InitializeConfig { + hasUserConsentValue: boolean; + isAgeRestrictedUserValue: boolean; + isDoNotSellValue: boolean; + isTabletValue: boolean; +} + +export interface AdInfo { + adUnitId: string; + creativeId: string; + networkName: string; + placement: string; + revenue: number; +} + +export enum AdViewPosition { + TOP_CENTER = 'top_center', + TOP_RIGHT = 'top_right', + CENTERED = 'centered', + CENTER_LEFT = 'center_left', + CENTER_RIGHT = 'center_right', + BOTTOM_LEFT = 'bottom_left', + BOTTOM_CENTER = 'bottom_center', + BOTTOM_RIGHT = 'bottom_right', +} + +export enum ConsentDialogState { + UNKNOWN = 0, + APPLIES = 1, + DOES_NOT_APPLY = 2, +} + +/** + * @name Applovin + * @description + * This plugin allows you to easily configure, integrate and interact with Applovin ads. + * @usage + * ```typescript + * import { Applovin } from '@awesome-cordova-plugins/applovin'; + * + * + * constructor(private applovin: Applovin) { } + * + * + * this.applovin.initialize(sdkKey) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * + * this.applovin.loadInterstitial(adUnitId) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * + * this.applovin.showInterstitial(adUnitId, placement) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * ``` + */ +@Plugin({ + pluginName: 'Applovin', + plugin: 'cordova-plugin-applovin-max', + pluginRef: 'applovin', + repo: 'https://github.com/AppLovin/AppLovin-MAX-Cordova', + platforms: ['Android', 'iOS'], +}) +@Injectable() +export class Applovin extends AwesomeCordovaNativePlugin { + /** + * Initialize the AppLovin SDK. + * + * @param {string} sdkKey The SDK key generated for your AppLovin account. + */ + @Cordova() + initialize(sdkKey: string): Promise { + return; + } + + @Cordova() + showMediationDebugger(): Promise { + return; + } + + @Cordova() + getConsentDialogState(): Promise { + return; + } + + @Cordova() + setHasUserConsent(hasUserConsent: boolean): Promise { + return; + } + + @Cordova() + hasUserConsent(): Promise { + return; + } + + @Cordova() + setIsAgeRestrictedUser(isAgeRestrictedUser: boolean): Promise { + return; + } + + @Cordova() + isAgeRestrictedUser(): Promise { + return; + } + + @Cordova() + setDoNotSell(isDoNotSell: boolean): Promise { + return; + } + + @Cordova() + isDoNotSell(): Promise { + return; + } + + @Cordova() + isTablet(): Promise { + return; + } + + @Cordova() + setUserId(userId: string): Promise { + return; + } + + @Cordova() + setMuted(): Promise { + return; + } + + @Cordova() + setVerboseLogging(verboseLoggingEnabled: boolean): Promise { + return; + } + + @Cordova() + setTestDeviceAdvertisingIds(advertisingIds: string[]): Promise { + return; + } + + @Cordova() + trackEvent(event: string, parameters?: object): Promise { + return; + } + + /** BANNERS */ + + @Cordova() + createBanner(adUnitId: string, position: AdViewPosition): Promise { + return; + } + + @Cordova() + setBannerBackgroundColor(adUnitId: string, hexColorCode: string): Promise { + return; + } + + @Cordova() + setBannerPlacement(adUnitId: string, placement: string): Promise { + return; + } + + @Cordova() + setBannerExtraParameter(adUnitId: string, key: string, value: string): Promise { + return; + } + + @Cordova() + showBanner(adUnitId: string): Promise { + return; + } + + @Cordova() + hideBanner(adUnitId: string): Promise { + return; + } + + @Cordova() + destroyBanner(adUnitId: string): Promise { + return; + } + + /** MRECS */ + + @Cordova() + createMRec(adUnitId: string, position: AdViewPosition): Promise { + return; + } + + @Cordova() + setMRecBackgroundColor(adUnitId: string, hexColorCode: string): Promise { + return; + } + + @Cordova() + setMRecPlacement(adUnitId: string, placement: string): Promise { + return; + } + + @Cordova() + setMRecExtraParameter(adUnitId: string, key: string, value: string): Promise { + return; + } + + @Cordova() + showMRec(adUnitId: string): Promise { + return; + } + + @Cordova() + hideMRec(adUnitId: string): Promise { + return; + } + + @Cordova() + destroyMRec(adUnitId: string): Promise { + return; + } + + /** INTERSTITIALS */ + + @Cordova() + loadInterstitial(adUnitId: string): Promise { + return; + } + + @Cordova() + showInterstitial(adUnitId: string, placement?: string): Promise { + return; + } + + @Cordova() + setInterstitialExtraParameter(adUnitId: string, key: string, value: string): Promise { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnInterstitialLoadedEvent', + }) + onInterstitialLoaded(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnInterstitialLoadFailedEvent', + }) + onInterstitialLoadFailed(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnInterstitialDisplayedEvent', + }) + onInterstitialDisplayed(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnInterstitialHiddenEvent', + }) + onInterstitialHidden(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnInterstitialAdFailedToDisplayEvent', + }) + onInterstitialAdFailedToDisplay(): Observable { + return; + } + + /** REWARDED ADS */ + + @Cordova() + loadRewardedAd(adUnitId: string): Promise { + return; + } + + @Cordova() + showRewardedAd(adUnitId: string, placement?: string): Promise { + return; + } + + @Cordova() + setRewardedAdExtraParameter(adUnitId: string, key: string, value: string): Promise { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnRewardedAdLoadedEvent', + }) + onRewardedAdLoaded(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnRewardedAdLoadFailedEvent', + }) + onRewardedAdLoadFailed(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnRewardedAdDisplayedEvent', + }) + onRewardedAdDisplayed(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnRewardedAdHiddenEvent', + }) + onRewardedAdHidden(): Observable { + return; + } + + @Cordova({ + eventObservable: true, + event: 'OnRewardedAdAdFailedToDisplayEvent', + }) + onRewardedAdAdFailedToDisplay(): Observable { + return; + } +}