Skip to content

Commit

Permalink
feat(ionic): add RewardedInterstitialAd class
Browse files Browse the repository at this point in the history
  • Loading branch information
ratson committed Mar 14, 2021
1 parent a604cc6 commit bd90774
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion packages/ionic/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
NativeActions,
RewardedAd as IRewardedAd,
RewardedAdOptions,
TrackingAuthorizationStatus,
RewardedInterstitialAd as IRewardedInterstitialAd,
RewardedInterstitialAdOptions,
TrackingAuthorizationStatus
} from 'admob-plus-cordova'
import { fromEvent, Observable } from 'rxjs'

Expand Down Expand Up @@ -119,6 +121,42 @@ export class RewardedAd
}
}

export class RewardedInterstitialAd
extends IonicNativePlugin
implements Omit<IRewardedInterstitialAd, 'opts'> {
public static plugin = plugin
public static pluginName = pluginName
public static pluginRef = 'admob.RewardedInterstitialAd'

private _objectInstance: IRewardedInterstitialAd

constructor(opts: RewardedInterstitialAdOptions) {
super()

this._objectInstance = new (RewardedInterstitialAd.getPlugin())(opts)
}

get adUnitId() {
return this._objectInstance.adUnitId
}

get id() {
return this._objectInstance.id
}

public isLoaded() {
return this._objectInstance.isLoaded()
}

public load() {
return this._objectInstance.load()
}

public show() {
return this._objectInstance.show()
}
}

@Injectable()
export class AdMob
extends IonicNativePlugin
Expand All @@ -141,6 +179,7 @@ export class AdMob
public readonly BannerAd = BannerAd
public readonly InterstitialAd = InterstitialAd
public readonly RewardedAd = RewardedAd
public readonly RewardedInterstitialAd = RewardedInterstitialAd

get admob(): IAdMob {
return AdMob.getPlugin()
Expand Down

0 comments on commit bd90774

Please sign in to comment.