| 1 | import { MobileAd, type MobileAdOptions } from "./common"; |
| 2 | import { addPluginListener, PluginListener } from "@tauri-apps/api/core"; |
| 3 | |
| 4 | export class RewardedAd extends MobileAd<RewardedAdOptions> { |
| 5 | static cls = "RewardedAd"; |
| 6 | |
| 7 | isLoaded() { |
| 8 | return super.isLoaded(); |
| 9 | } |
| 10 | |
| 11 | async load() { |
| 12 | return super.load(); |
| 13 | } |
| 14 | |
| 15 | async show() { |
| 16 | return super.show(); |
| 17 | } |
| 18 | |
| 19 | async onRewarded( |
| 20 | handler: (payload: any) => void |
| 21 | ): Promise<PluginListener> { |
| 22 | return await addPluginListener( |
| 23 | 'admob', |
| 24 | 'rewarded_reward', |
| 25 | handler |
| 26 | ); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | export async function onRewarded( |
| 31 | handler: (payload: any) => void |
| 32 | ): Promise<PluginListener> { |
| 33 | return await addPluginListener( |
| 34 | 'admob', |
| 35 | 'rewarded/reward', |
| 36 | handler |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | export class RewardedInterstitialAd extends MobileAd<RewardedAdOptions> { |
| 41 | static cls = "RewardedInterstitialAd"; |
| 42 | |
| 43 | isLoaded() { |
| 44 | return super.isLoaded(); |
| 45 | } |
| 46 | |
| 47 | async load() { |
| 48 | return super.load(); |
| 49 | } |
| 50 | |
| 51 | async show() { |
| 52 | return super.show(); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | export interface RewardedAdOptions extends MobileAdOptions { |
| 57 | serverSideVerification?: { |
| 58 | userId?: string; |
| 59 | customData?: string; |
| 60 | }; |
| 61 | } |