@@ -282,103 +282,73 @@ export class RewardedItem implements IRewardedItem {
282282export class BannerAdSize extends BannerAdSizeBase {
283283 #native: GADAdSize ;
284284
285- constructor ( width ? : number , height ? : number ) {
285+ constructor ( width : number , height : number , native ? ) {
286286 super ( ) ;
287- if ( width && height ) {
287+ if ( typeof width === 'number' && typeof height === 'number' ) {
288288 this . #native = GADAdSizeFromCGSize ( CGSizeMake ( width , height ) ) ;
289+ } else if ( arguments [ 2 ] instanceof GADAdSize ) {
290+ this . #native = arguments [ 2 ] ;
291+ } else {
292+ this . #native = GADAdSizeInvalid ;
289293 }
290294 }
291295
292296 static fromNative ( size : GADAdSize ) {
293- const banner = new BannerAdSize ( ) ;
294- if ( size instanceof GADAdSize ) {
295- banner . #native = size ;
296- } else {
297- banner . #native = kGADAdSizeInvalid ;
298- }
299- return banner ;
297+ return new BannerAdSize ( null , null , size ) ;
300298 }
301299
302300 static get BANNER ( ) : BannerAdSize {
303- return BannerAdSize . fromNative ( kGADAdSizeBanner ) ;
301+ return BannerAdSize . fromNative ( GADAdSizeBanner ) ;
304302 }
305303
306304 static get FULL_BANNER ( ) : BannerAdSize {
307- return BannerAdSize . fromNative ( kGADAdSizeFullBanner ) ;
305+ return BannerAdSize . fromNative ( GADAdSizeFullBanner ) ;
308306 }
309307
310308 static get LARGE_BANNER ( ) : BannerAdSize {
311- return BannerAdSize . fromNative ( kGADAdSizeLargeBanner ) ;
309+ return BannerAdSize . fromNative ( GADAdSizeLargeBanner ) ;
312310 }
313311
314312 static get LEADERBOARD ( ) : BannerAdSize {
315- return BannerAdSize . fromNative ( kGADAdSizeLeaderboard ) ;
313+ return BannerAdSize . fromNative ( GADAdSizeLeaderboard ) ;
316314 }
317315
318316 static get MEDIUM_RECTANGLE ( ) : BannerAdSize {
319- return BannerAdSize . fromNative ( kGADAdSizeMediumRectangle ) ;
317+ return BannerAdSize . fromNative ( GADAdSizeMediumRectangle ) ;
320318 }
321319
322- static createAnchoredAdaptiveBanner ( width : number | 'fullWidth' | 'autoHeight' , orientation : 'portrait' | 'landscape' | 'device' = 'device' ) : BannerAdSize {
323- let banner ;
320+ static createAnchoredAdaptiveBanner ( width : number , orientation : 'portrait' | 'landscape' | 'device' = 'device' ) : BannerAdSize {
321+ let nativeOrientation : Orientation = Orientation . Device ;
324322 if ( orientation === 'portrait' ) {
325- if ( width === 'fullWidth' ) {
326- banner = TNSGA . createAnchoredAdaptiveBanner ( Width . FullWidth , Orientation . Portrait ) ;
327- } else if ( width === 'autoHeight' ) {
328- banner = TNSGA . createAnchoredAdaptiveBanner ( Width . AutoHeight , Orientation . Portrait ) ;
329- } else {
330- banner = TNSGA . createAnchoredAdaptiveBannerWithWidth ( width , Orientation . Device ) ;
331- }
323+ nativeOrientation = Orientation . Portrait ;
332324 } else if ( orientation === 'landscape' ) {
333- if ( width === 'fullWidth' ) {
334- banner = TNSGA . createAnchoredAdaptiveBanner ( Width . FullWidth , Orientation . Landscape ) ;
335- } else if ( width === 'autoHeight' ) {
336- banner = TNSGA . createAnchoredAdaptiveBanner ( Width . AutoHeight , Orientation . Landscape ) ;
337- } else {
338- banner = TNSGA . createAnchoredAdaptiveBannerWithWidth ( width , Orientation . Device ) ;
339- }
340- } else {
341- banner = TNSGA . createAnchoredAdaptiveBannerWithWidth ( width as any , Orientation . Device ) ;
325+ nativeOrientation = Orientation . Landscape ;
342326 }
343327
344- return BannerAdSize . fromNative ( banner ) ;
328+ return BannerAdSize . fromNative ( TNSGA . createAnchoredAdaptiveBanner ( width , nativeOrientation ) ) ;
345329 }
346330
347- static createInLineAdaptiveBanner ( width : number | 'fullWidth' | 'autoHeight' , orientation : 'portrait' | 'landscape' | 'device' = 'device' ) : BannerAdSize {
348- let banner ;
331+ static createInLineAdaptiveBanner ( width : number , maxHeight : number = 0 , orientation : 'portrait' | 'landscape' | 'device' = 'device' ) : BannerAdSize {
332+ let nativeOrientation : Orientation = Orientation . Device ;
349333 if ( orientation === 'portrait' ) {
350- if ( width === 'fullWidth' ) {
351- banner = TNSGA . createInlineAdaptiveBanner ( Width . FullWidth , Orientation . Portrait ) ;
352- } else if ( width === 'autoHeight' ) {
353- banner = TNSGA . createInlineAdaptiveBanner ( Width . AutoHeight , Orientation . Portrait ) ;
354- } else {
355- banner = TNSGA . createInlineAdaptiveBannerWithWidth ( width , Orientation . Device ) ;
356- }
334+ nativeOrientation = Orientation . Portrait ;
357335 } else if ( orientation === 'landscape' ) {
358- if ( width === 'fullWidth' ) {
359- banner = TNSGA . createInlineAdaptiveBanner ( Width . FullWidth , Orientation . Landscape ) ;
360- } else if ( width === 'autoHeight' ) {
361- banner = TNSGA . createInlineAdaptiveBanner ( Width . AutoHeight , Orientation . Landscape ) ;
362- } else {
363- banner = TNSGA . createInlineAdaptiveBannerWithWidth ( width , Orientation . Device ) ;
364- }
365- } else {
366- banner = TNSGA . createInlineAdaptiveBannerWithWidth ( width as any , Orientation . Device ) ;
336+ nativeOrientation = Orientation . Landscape ;
367337 }
368338
369- return BannerAdSize . fromNative ( banner ) ;
339+ return BannerAdSize . fromNative ( TNSGA . createInlineAdaptiveBanner ( width , maxHeight , nativeOrientation ) ) ;
370340 }
371341
372342 static get FLUID ( ) : BannerAdSize {
373- return BannerAdSize . fromNative ( kGADAdSizeFluid ) ;
343+ return BannerAdSize . fromNative ( GADAdSizeFluid ) ;
374344 }
375345
376346 static get WIDE_SKYSCRAPER ( ) : BannerAdSize {
377- return BannerAdSize . fromNative ( kGADAdSizeSkyscraper ) ;
347+ return BannerAdSize . fromNative ( GADAdSizeSkyscraper ) ;
378348 }
379349
380350 static get INVALID ( ) : BannerAdSize {
381- return BannerAdSize . fromNative ( kGADAdSizeInvalid ) ;
351+ return BannerAdSize . fromNative ( GADAdSizeInvalid ) ;
382352 }
383353
384354 static get SEARCH ( ) : BannerAdSize {
@@ -426,12 +396,13 @@ export class BannerAd extends BannerAdBase {
426396
427397 load ( options : RequestOptions = { } ) {
428398 this . #isLoading = true ;
429- this . #native?. loadRequest ( toSerializeRequestOptions ( options ) ) ;
399+ this . #native?. loadRequest ?. ( toSerializeRequestOptions ( options ) ) ;
430400 }
431401
432402 [ sizeProperty . setNative ] ( value ) {
433- console . log ( this . #native. frame . origin . x , this . #native. frame . origin . y , this . #native. frame . size . width , this . #native. frame . size . height ) ;
434- this . #native. adSize = value ?. native ;
403+ if ( this . #native) {
404+ this . #native. adSize = value ?. native ;
405+ }
435406 }
436407
437408 [ unitIdProperty . setNative ] ( value ) {
@@ -448,15 +419,6 @@ export class BannerAd extends BannerAdBase {
448419 this . setMeasuredDimension ( width , height ) ;
449420 }
450421 }
451-
452- // // @ts -ignore
453- // set unitId(id) {
454- // this.#native.adUnitID = id;
455- // }
456-
457- // get unitId() {
458- // return this.#native.adUnitID;
459- // }
460422}
461423
462424declare const FIRApp ;
@@ -521,8 +483,8 @@ export class Admob implements IAdmob {
521483 if ( Array . isArray ( requestConfiguration . testDevices ) ) {
522484 GADMobileAds . sharedInstance ( ) . requestConfiguration . testDeviceIdentifiers = requestConfiguration . testDevices . map ( ( item ) => {
523485 if ( item === 'EMULATOR' ) {
524- if ( typeof kGADSimulatorID ) {
525- return kGADSimulatorID ;
486+ if ( typeof GADSimulatorID ) {
487+ return GADSimulatorID ;
526488 }
527489 return '' ;
528490 }
0 commit comments