From d9b847b3cb6a7d400f37a3f3d7c69355b42d59a7 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Fri, 29 Apr 2016 17:17:30 -0400 Subject: [PATCH] feat(plugin): add admob pro plugin closes #146 --- src/index.ts | 3 + src/plugins/admob.ts | 177 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 src/plugins/admob.ts diff --git a/src/index.ts b/src/index.ts index 49ebfa910..059b053ab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,6 +6,7 @@ const DEVICE_READY_TIMEOUT = 2000; declare var window; import {ActionSheet} from './plugins/actionsheet'; +import {AdMob} from './plugins/admob'; import {AppAvailability} from './plugins/appavailability'; import {AppRate} from './plugins/apprate'; import {AppVersion} from './plugins/appversion'; @@ -54,6 +55,7 @@ import {WebIntent} from './plugins/webintent'; export { ActionSheet, + AdMob, AppAvailability, AppRate, AppVersion, @@ -107,6 +109,7 @@ export * from './plugins/plugin'; // Window export to use outside of a module loading system window['IonicNative'] = { ActionSheet: ActionSheet, + AdMob: AdMob, AppAvailability: AppAvailability, AppRate: AppRate, AppVersion: AppVersion, diff --git a/src/plugins/admob.ts b/src/plugins/admob.ts new file mode 100644 index 000000000..da7f28042 --- /dev/null +++ b/src/plugins/admob.ts @@ -0,0 +1,177 @@ +import {Plugin, Cordova} from './plugin'; +import {Observable} from "rxjs/Observable"; + +/** + * @name AdMob + * @description + * @usage + */ +@Plugin({ + plugin: 'cordova-plugin-admobpro', + pluginRef: 'AdMob', + repo: 'https://github.com/floatinghotspot/cordova-admob-pro' +}) +export class AdMob { + + // Static Methods + + /** + * + * @param adIdOrOptions + */ + @Cordova() + static createBanner(adIdOrOptions : any) : Promise {return} + + /** + * + */ + @Cordova({ + sync: true + }) + static removeBanner() : void {} + + /** + * + * @param position + */ + @Cordova({ + sync: true + }) + static showBanner(position : any) : void {} + + /** + * + * @param x + * @param y + */ + @Cordova({ + sync: true + }) + static showBannerAtXY(x : number, y : number) : void {} + + /** + * + */ + @Cordova({ + sync: true + }) + static hideBanner() : void {} + + /** + * + * @param adIdOrOptions + */ + @Cordova() + static prepareInterstitial(adIdOrOptions : any) : Promise {return} + + /** + * Show interstitial + */ + @Cordova({ + sync: true + }) + static showInterstitial() : void {} + + /** + * + */ + @Cordova() + static isInterstitialReady () : Promise {return} + + /** + * Prepare a reward video ad + * @param adIdOrOptions + */ + @Cordova() + static prepareRewardVideoAd(adIdOrOptions : any) : Promise {return} + + /** + * Show a reward video ad + */ + @Cordova({ + sync : true + }) + static showRewardVideoAd() : void {} + + /** + * Sets the values for configuration and targeting + * @param options Returns a promise that resolves if the options are set successfully + */ + @Cordova() + static setOptions(options:any) : Promise {return} + + /** + * Get user ad settings + * @returns {Promise} Returns a promise that resolves with the ad settings + */ + @Cordova() + static getAdSettings() : Promise {return} + + // Events + + @Cordova({ + eventObservable: true, + event: 'onBannerFailedToReceive' + }) + static onBannerFailedToReceive () : Observable {return} + + @Cordova({ + eventObservable: true, + event: 'onBannerReceive' + }) + static onBannerReceive () : Observable {return} + + @Cordova({ + eventObservable: true, + event: 'onBannerPresent' + }) + static onBannerPresent () : Observable {return} + + @Cordova({ + eventObservable: true, + event: 'onBannerLeaveApp' + }) + static onBannerLeaveApp () : Observable {return} + + @Cordova({ + eventObservable: true, + event: 'onBannerDismiss' + }) + static onBannerDismiss () : Observable {return} + + + @Cordova({ + eventObservable: true, + event: 'onInterstitialFailedToReceive' + }) + static onInterstitialFailedToReceive () : Observable {return} + + + @Cordova({ + eventObservable: true, + event: 'onInterstitialReceive' + }) + static onInterstitialReceive () : Observable {return} + + + @Cordova({ + eventObservable: true, + event: 'onInterstitialPresent' + }) + static onInterstitialPresent () : Observable {return} + + + @Cordova({ + eventObservable: true, + event: 'onInterstitialLeaveApp' + }) + static onInterstitialLeaveApp () : Observable {return} + + + @Cordova({ + eventObservable: true, + event: 'onInterstitialDismiss' + }) + static onInterstitialDismiss () : Observable {return} + +} \ No newline at end of file