|
1 | | -import {FirebaseApp} from '@nativescript/firebase-core'; |
2 | | -import {CSSType, Property, View} from '@nativescript/core'; |
| 1 | +import { FirebaseApp } from '@nativescript/firebase-core'; |
| 2 | +import { CSSType, Property, View } from '@nativescript/core'; |
3 | 3 |
|
4 | 4 | export interface IMobileAd { |
5 | | - adUnitId: string; |
6 | | - loaded: boolean; |
| 5 | + adUnitId: string; |
| 6 | + loaded: boolean; |
7 | 7 |
|
8 | | - load(): void; |
| 8 | + load(): void; |
9 | 9 |
|
10 | | - onAdEvent(listener?: AdEventListener); |
| 10 | + onAdEvent(listener?: AdEventListener); |
11 | 11 |
|
12 | | - show(showOptions?: AdShowOptions); |
| 12 | + show(showOptions?: AdShowOptions); |
13 | 13 | } |
14 | 14 |
|
15 | 15 | export interface IRewardedInterstitialAd extends IInterstitialAd { |
16 | | - setServerSideVerificationOptions(options: ServerSideVerificationOptions): void; |
| 16 | + setServerSideVerificationOptions(options: ServerSideVerificationOptions): void; |
17 | 17 | } |
18 | 18 |
|
19 | 19 | export interface ServerSideVerificationOptions { |
20 | | - userId: string; |
21 | | - customData: string; |
| 20 | + userId: string; |
| 21 | + customData: string; |
22 | 22 | } |
23 | 23 |
|
24 | | -export interface IInterstitialAd extends IMobileAd { |
25 | | -} |
| 24 | +export interface IInterstitialAd extends IMobileAd {} |
26 | 25 |
|
27 | 26 | export interface IRewardedAd extends IMobileAd { |
28 | | - setServerSideVerificationOptions(options: ServerSideVerificationOptions): void; |
| 27 | + setServerSideVerificationOptions(options: ServerSideVerificationOptions): void; |
29 | 28 | } |
30 | 29 |
|
31 | 30 | export abstract class BannerAdSizeBase { |
32 | | - static get BANNER(): BannerAdSizeBase { |
33 | | - throw new Error('unimplemented'); |
34 | | - } |
| 31 | + static get BANNER(): BannerAdSizeBase { |
| 32 | + throw new Error('unimplemented'); |
| 33 | + } |
35 | 34 |
|
36 | | - static get FULL_BANNER(): BannerAdSizeBase { |
37 | | - throw new Error('unimplemented'); |
38 | | - } |
| 35 | + static get FULL_BANNER(): BannerAdSizeBase { |
| 36 | + throw new Error('unimplemented'); |
| 37 | + } |
39 | 38 |
|
40 | | - static get LARGE_BANNER(): BannerAdSizeBase { |
41 | | - throw new Error('unimplemented'); |
42 | | - } |
| 39 | + static get LARGE_BANNER(): BannerAdSizeBase { |
| 40 | + throw new Error('unimplemented'); |
| 41 | + } |
43 | 42 |
|
44 | | - static get LEADERBOARD(): BannerAdSizeBase { |
45 | | - throw new Error('unimplemented'); |
46 | | - } |
| 43 | + static get LEADERBOARD(): BannerAdSizeBase { |
| 44 | + throw new Error('unimplemented'); |
| 45 | + } |
47 | 46 |
|
48 | | - static get MEDIUM_RECTANGLE(): BannerAdSizeBase { |
49 | | - throw new Error('unimplemented'); |
50 | | - } |
| 47 | + static get MEDIUM_RECTANGLE(): BannerAdSizeBase { |
| 48 | + throw new Error('unimplemented'); |
| 49 | + } |
51 | 50 |
|
52 | | - static get SMART_BANNER(): BannerAdSizeBase { |
53 | | - throw new Error('unimplemented'); |
54 | | - } |
| 51 | + static get SMART_BANNER(): BannerAdSizeBase { |
| 52 | + throw new Error('unimplemented'); |
| 53 | + } |
55 | 54 |
|
56 | | - static get ADAPTIVE_BANNER(): BannerAdSizeBase { |
57 | | - throw new Error('unimplemented'); |
58 | | - } |
| 55 | + static get ADAPTIVE_BANNER(): BannerAdSizeBase { |
| 56 | + throw new Error('unimplemented'); |
| 57 | + } |
59 | 58 |
|
60 | | - static get FLUID(): BannerAdSizeBase { |
61 | | - throw new Error('unimplemented'); |
62 | | - } |
| 59 | + static get FLUID(): BannerAdSizeBase { |
| 60 | + throw new Error('unimplemented'); |
| 61 | + } |
63 | 62 |
|
64 | | - static get WIDE_SKYSCRAPER(): BannerAdSizeBase { |
65 | | - throw new Error('unimplemented'); |
66 | | - } |
| 63 | + static get WIDE_SKYSCRAPER(): BannerAdSizeBase { |
| 64 | + throw new Error('unimplemented'); |
| 65 | + } |
67 | 66 |
|
68 | | - static get INVALID(): BannerAdSizeBase { |
69 | | - throw new Error('unimplemented'); |
70 | | - } |
| 67 | + static get INVALID(): BannerAdSizeBase { |
| 68 | + throw new Error('unimplemented'); |
| 69 | + } |
71 | 70 |
|
72 | | - static get SEARCH(): BannerAdSizeBase { |
73 | | - throw new Error('unimplemented'); |
74 | | - } |
| 71 | + static get SEARCH(): BannerAdSizeBase { |
| 72 | + throw new Error('unimplemented'); |
| 73 | + } |
75 | 74 | } |
76 | 75 |
|
77 | 76 | export const sizeProperty = new Property<BannerAdBase, BannerAdSizeBase>({ |
78 | | - name: 'size', |
| 77 | + name: 'size', |
79 | 78 | }); |
80 | 79 |
|
81 | 80 | export const unitIdProperty = new Property<BannerAdBase, BannerAdSizeBase>({ |
82 | | - name: 'unitId', |
| 81 | + name: 'unitId', |
83 | 82 | }); |
84 | 83 |
|
85 | 84 | @CSSType('BannerAd') |
86 | 85 | export abstract class BannerAdBase extends View { |
87 | | - static onAdClickedEvent = 'adClicked'; |
88 | | - static onAdClosedEvent = 'adClosed'; |
89 | | - static onAdFailedToLoadEvent = 'adFailedToLoad'; |
90 | | - static onAdLoadedEvent = 'adLoaded'; |
91 | | - static onAdOpenedEvent = 'adOpened'; |
92 | | - static onAdImpression = 'adImpression'; |
93 | | - static onAdFailedToShowFullScreenContent = 'adFailedToShowFullScreenContent'; |
94 | | - size: BannerAdSizeBase; |
95 | | - unitId: BannerAdSizeBase; |
| 86 | + static onAdClickedEvent = 'adClicked'; |
| 87 | + static onAdClosedEvent = 'adClosed'; |
| 88 | + static onAdFailedToLoadEvent = 'adFailedToLoad'; |
| 89 | + static onAdLoadedEvent = 'adLoaded'; |
| 90 | + static onAdOpenedEvent = 'adOpened'; |
| 91 | + static onAdImpression = 'adImpression'; |
| 92 | + static onAdFailedToShowFullScreenContent = 'adFailedToShowFullScreenContent'; |
| 93 | + size: BannerAdSizeBase; |
| 94 | + unitId: BannerAdSizeBase; |
96 | 95 |
|
97 | | - abstract load(options?: RequestOptions); |
| 96 | + abstract load(options?: RequestOptions); |
98 | 97 |
|
99 | | - abstract isLoading(): boolean; |
| 98 | + abstract isLoading(): boolean; |
100 | 99 | } |
101 | 100 |
|
102 | 101 | sizeProperty.register(BannerAdBase); |
103 | 102 | unitIdProperty.register(BannerAdBase); |
104 | 103 |
|
105 | 104 | export enum MaxAdContentRating { |
106 | | - G = 'G', |
107 | | - MA = 'MA', |
108 | | - PG = 'PG', |
109 | | - T = 'T', |
110 | | - UNSPECIFIED = 'UNSPECIFIED', |
| 105 | + G = 'G', |
| 106 | + MA = 'MA', |
| 107 | + PG = 'PG', |
| 108 | + T = 'T', |
| 109 | + UNSPECIFIED = 'UNSPECIFIED', |
111 | 110 | } |
112 | 111 |
|
113 | 112 | export enum AdEventType { |
114 | | - CLICKED = 'adClicked', |
115 | | - CLOSED = 'adClosed', |
116 | | - LOADED = 'adLoaded', |
117 | | - OPENED = 'adOpened', |
118 | | - IMPRESSION = 'adImpression', |
119 | | - FAILED_TO_SHOW_FULL_SCREEN_CONTENT = 'adFailedToShowFullScreenContent', |
120 | | - FAILED_TO_LOAD_EVENT = 'adFailedToLoad', |
| 113 | + CLICKED = 'adClicked', |
| 114 | + CLOSED = 'adClosed', |
| 115 | + LOADED = 'adLoaded', |
| 116 | + OPENED = 'adOpened', |
| 117 | + IMPRESSION = 'adImpression', |
| 118 | + FAILED_TO_SHOW_FULL_SCREEN_CONTENT = 'adFailedToShowFullScreenContent', |
| 119 | + FAILED_TO_LOAD_EVENT = 'adFailedToLoad', |
121 | 120 | } |
122 | 121 |
|
123 | 122 | export interface AdShowOptions { |
124 | | - immersiveModeEnabled: undefined | false | true; |
| 123 | + immersiveModeEnabled: undefined | false | true; |
125 | 124 | } |
126 | 125 |
|
127 | 126 | export interface RequestConfiguration { |
128 | | - maxAdContentRating?: MaxAdContentRating.G | MaxAdContentRating.PG | MaxAdContentRating.T | MaxAdContentRating.MA; |
129 | | - tagForChildDirectedTreatment?: undefined | false | true; |
130 | | - tagForUnderAgeOfConsent?: undefined | false | true; |
131 | | - testDevices?: string[]; |
| 127 | + maxAdContentRating?: MaxAdContentRating.G | MaxAdContentRating.PG | MaxAdContentRating.T | MaxAdContentRating.MA; |
| 128 | + tagForChildDirectedTreatment?: undefined | false | true; |
| 129 | + tagForUnderAgeOfConsent?: undefined | false | true; |
| 130 | + testDevices?: string[]; |
132 | 131 | } |
133 | 132 |
|
134 | 133 | export interface RequestOptions { |
135 | | - contentUrl?: undefined | string; |
136 | | - keywords?: string[]; |
137 | | - location?: [number, number]; |
138 | | - locationAccuracy?: undefined | number; |
139 | | - networkExtras?: undefined | { [key: string]: string }; |
140 | | - requestAgent?: undefined | string; |
141 | | - requestNonPersonalizedAdsOnly?: undefined | false | true; |
| 134 | + contentUrl?: undefined | string; |
| 135 | + keywords?: string[]; |
| 136 | + location?: [number, number]; |
| 137 | + locationAccuracy?: undefined | number; |
| 138 | + networkExtras?: undefined | { [key: string]: string }; |
| 139 | + requestAgent?: undefined | string; |
| 140 | + requestNonPersonalizedAdsOnly?: undefined | false | true; |
142 | 141 | } |
143 | 142 |
|
144 | 143 | export interface ManagerRequestOptions extends RequestOptions { |
145 | | - publisherProvidedId?: string; |
146 | | - customTargeting?: { [key: string]: string | string[] }; |
147 | | - categoryExclusions?: string[]; |
148 | | - adString?: string; |
| 144 | + publisherProvidedId?: string; |
| 145 | + customTargeting?: { [key: string]: string | string[] }; |
| 146 | + categoryExclusions?: string[]; |
| 147 | + adString?: string; |
149 | 148 | } |
150 | 149 |
|
151 | 150 | export enum RewardedAdEventType { |
152 | | - EARNED_REWARD = 'rewarded_earned_reward', |
153 | | - LOADED = 'rewarded_loaded', |
| 151 | + EARNED_REWARD = 'rewarded_earned_reward', |
| 152 | + LOADED = 'rewarded_loaded', |
154 | 153 | } |
155 | 154 |
|
156 | 155 | export interface IRewardedItem { |
157 | | - amount: number; |
158 | | - type: string; |
| 156 | + amount: number; |
| 157 | + type: string; |
159 | 158 | } |
160 | 159 |
|
161 | 160 | export interface TestIds { |
162 | | - BANNER: string; |
163 | | - INTERSTITIAL: string; |
164 | | - REWARDED: string; |
| 161 | + BANNER: string; |
| 162 | + INTERSTITIAL: string; |
| 163 | + REWARDED: string; |
| 164 | +} |
| 165 | + |
| 166 | +export enum AdapterStatusState { |
| 167 | + NOT_READY, |
| 168 | + READY, |
| 169 | +} |
| 170 | + |
| 171 | +export interface AdapterStatus { |
| 172 | + description: string; |
| 173 | + latency: number; |
| 174 | + initializationState: AdapterStatusState; |
165 | 175 | } |
166 | 176 |
|
167 | 177 | export type AdEventListener = (type: AdEventType | RewardedAdEventType, error?: Error, data?: any | IRewardedItem) => void; |
168 | 178 |
|
169 | 179 | export interface IAdmob { |
170 | | - app: FirebaseApp; |
| 180 | + app: FirebaseApp; |
171 | 181 |
|
172 | | - setRequestConfiguration(requestConfiguration: RequestConfiguration); |
| 182 | + setRequestConfiguration(requestConfiguration: RequestConfiguration); |
173 | 183 | } |
0 commit comments