11import { ContainerView , CoreTypes , CSSType , Property , View } from '@nativescript/core' ;
2- import { AdEventListener , AdEventType , BannerAdSizeBase , ManagerRequestOptions } from '../common' ;
2+ import { AdEventType } from '../common' ;
3+ import { IMediaContent , INativeAd } from '.' ;
34
45@CSSType ( 'NativeAdView' )
56export abstract class NativeAdViewBase extends ContainerView {
@@ -28,22 +29,14 @@ export abstract class NativeAdViewBase extends ContainerView {
2829 abstract storeView : View ;
2930}
3031
31- export interface IMediaContent {
32- aspectRatio : number ;
33- currentTime : number ;
34- duration : number ;
35- mainImage : any ;
36- hasVideoContent : boolean ;
37- }
38-
3932export const stretchProperty = new Property < MediaViewBase , CoreTypes . ImageStretchType > ( {
4033 name : 'stretch' ,
4134 defaultValue : 'aspectFit' ,
4235 affectsLayout : global . isIOS ,
4336} ) ;
4437
4538export const mediaContentProperty = new Property < MediaViewBase , IMediaContent > ( {
46- name : 'mediaContent'
39+ name : 'mediaContent' ,
4740} ) ;
4841
4942@CSSType ( 'MediaView' )
@@ -62,22 +55,6 @@ export enum VideoStatus {
6255 Ended ,
6356}
6457
65- export interface IVideoController {
66- status : VideoStatus ;
67-
68- clickToExpandEnabled ( ) : boolean ;
69-
70- customControlsEnabled ( ) : boolean ;
71-
72- pause ( ) : void ;
73-
74- play ( ) : void ;
75-
76- mute : boolean ;
77-
78- stop ( ) : void ;
79- }
80-
8158export enum MediaAspectRatio {
8259 LANDSCAPE = 'landscape' ,
8360 PORTRAIT = 'portrait' ,
@@ -92,73 +69,8 @@ export enum AdChoicesPlacement {
9269 BOTTOM_LEFT = 'bottomLeft' ,
9370}
9471
95- export interface NativeAdOptions {
96- nativeAdOptions ?: {
97- adChoicesPlacement ?: AdChoicesPlacement ;
98- mediaAspectRatio ?: MediaAspectRatio ;
99- customMuteThisAd ?: boolean ;
100- multipleImages ?: boolean ;
101- returnUrlsForImageAssets ?: boolean ;
102- videoOptions ?: {
103- startMuted ?: boolean ;
104- clickToExpandRequested ?: boolean ;
105- customControlsRequested ?: boolean ;
106- } ;
107- } ;
108- adSizes ?: BannerAdSizeBase [ ] ;
109- adManagerAdViewOptions ?: {
110- manualImpressionsEnabled ?: boolean ;
111- shouldDelayBannerRendering ?: boolean ;
112- } ;
113- }
114-
115- export interface IResponseInfo { }
116-
117- export interface UnconfirmedClickListener {
118- unconfirmedClickReceived ?( value : string ) ;
119- unconfirmedClickCancelled ?( ) : void ;
120- }
121-
122- export interface IMuteThisAdReason {
123- description : string ;
124- }
125-
126- export class INativeAdImage {
127- image : any ;
128- url : string ;
129- scale : number ;
130- }
131-
13272export enum NativeAdEventType {
13373 LOADED = 'native_ad_loaded' ,
13474}
13575
13676export type NativeAdEventListener = ( type : AdEventType | NativeAdEventType , error ?: Error , data ?: any | INativeAd ) => void ;
137-
138- export interface INativeAdLoader {
139- isLoading ( ) : boolean ;
140- load ( maxAdCount ?: number ) : void ;
141- load ( requestOptions ?: ManagerRequestOptions ) : void ;
142- load ( ) : void ;
143- onAdEvent ( listener : NativeAdEventListener ) ;
144- }
145-
146- export interface INativeAd {
147- adUnitId : string ;
148- onAdEvent ( listener : AdEventListener ) ;
149- destroy ( ) : void ;
150- advertiser : string ;
151- body : string ;
152- callToAction : string ;
153- headline : string ;
154- price : string ;
155- isCustomClickGestureEnabled ( ) : boolean ;
156- enableCustomClickGesture ( ) : void ;
157- recordCustomClickGesture ( ) : void ;
158- setUnconfirmedClickListener ( listener ?: UnconfirmedClickListener ) : void ;
159- images : INativeAdImage [ ] ;
160- icon : INativeAdImage ;
161- store : string ;
162- starRating : number ;
163- muteThisAdReasons : IMuteThisAdReason [ ] ;
164- }
0 commit comments