[admob][android] Export interstitial JS module
This commit is contained in:
parent
b1e9561633
commit
dd1262ca86
|
@ -0,0 +1,22 @@
|
|||
export default class AdRequest {
|
||||
|
||||
constructor() {
|
||||
this._props = {
|
||||
keywords: [],
|
||||
};
|
||||
}
|
||||
|
||||
build() {
|
||||
return this._props;
|
||||
}
|
||||
|
||||
addTestDevice() {
|
||||
this._props.testDevice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
addKeyword(word: string) {
|
||||
this._props.keywords.push(word);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
import { NativeModules } from 'react-native';
|
||||
|
||||
const FirebaseAdMob = NativeModules.RNFirebaseAdmob;
|
||||
|
||||
export default class Interstitial {
|
||||
|
||||
constructor(admob: Object, eventListener: Object, adunit: string) {
|
||||
this.admob = admob;
|
||||
this.adUnit = adunit;
|
||||
|
||||
eventListener.addListener('interstitial_event', this._onInterstitialEvent.bind(this));
|
||||
}
|
||||
|
||||
_onInterstitialEvent(event) {
|
||||
|
||||
}
|
||||
|
||||
loadAd(request: AdRequest) {
|
||||
return FirebaseAdMob.interstitialLoadAd(this.adUnit, request);
|
||||
}
|
||||
|
||||
isLoaded() {
|
||||
return true;
|
||||
}
|
||||
|
||||
show() {
|
||||
return FirebaseAdMob.interstitialShowAd(this.adUnit);
|
||||
}
|
||||
}
|
|
@ -1 +1,20 @@
|
|||
export const Banner = require('./Banner');
|
||||
import Interstitial from './Interstitial';
|
||||
import AdRequest from './AdRequest';
|
||||
import Banner from './Banner';
|
||||
import Base from './../base';
|
||||
|
||||
const FirebaseAdMob = NativeModules.RNFirebaseAdMob;
|
||||
const FirebaseAdMobEvt = new NativeEventEmitter(FirebaseAdMob);
|
||||
|
||||
export default class Admob extends Base {
|
||||
|
||||
interstitial(adUnit: string) {
|
||||
return new Interstitial(this, FirebaseAdMobEvt, adUnit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const statics = {
|
||||
Banner,
|
||||
AdRequest,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue