@@ -282,103 +282,73 @@ export class RewardedItem implements IRewardedItem {
282
282
export class BannerAdSize extends BannerAdSizeBase {
283
283
#native: GADAdSize ;
284
284
285
- constructor ( width ? : number , height ? : number ) {
285
+ constructor ( width : number , height : number , native ? ) {
286
286
super ( ) ;
287
- if ( width && height ) {
287
+ if ( typeof width === 'number' && typeof height === 'number' ) {
288
288
this . #native = GADAdSizeFromCGSize ( CGSizeMake ( width , height ) ) ;
289
+ } else if ( arguments [ 2 ] instanceof GADAdSize ) {
290
+ this . #native = arguments [ 2 ] ;
291
+ } else {
292
+ this . #native = GADAdSizeInvalid ;
289
293
}
290
294
}
291
295
292
296
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 ) ;
300
298
}
301
299
302
300
static get BANNER ( ) : BannerAdSize {
303
- return BannerAdSize . fromNative ( kGADAdSizeBanner ) ;
301
+ return BannerAdSize . fromNative ( GADAdSizeBanner ) ;
304
302
}
305
303
306
304
static get FULL_BANNER ( ) : BannerAdSize {
307
- return BannerAdSize . fromNative ( kGADAdSizeFullBanner ) ;
305
+ return BannerAdSize . fromNative ( GADAdSizeFullBanner ) ;
308
306
}
309
307
310
308
static get LARGE_BANNER ( ) : BannerAdSize {
311
- return BannerAdSize . fromNative ( kGADAdSizeLargeBanner ) ;
309
+ return BannerAdSize . fromNative ( GADAdSizeLargeBanner ) ;
312
310
}
313
311
314
312
static get LEADERBOARD ( ) : BannerAdSize {
315
- return BannerAdSize . fromNative ( kGADAdSizeLeaderboard ) ;
313
+ return BannerAdSize . fromNative ( GADAdSizeLeaderboard ) ;
316
314
}
317
315
318
316
static get MEDIUM_RECTANGLE ( ) : BannerAdSize {
319
- return BannerAdSize . fromNative ( kGADAdSizeMediumRectangle ) ;
317
+ return BannerAdSize . fromNative ( GADAdSizeMediumRectangle ) ;
320
318
}
321
319
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 ;
324
322
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 ;
332
324
} 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 ;
342
326
}
343
327
344
- return BannerAdSize . fromNative ( banner ) ;
328
+ return BannerAdSize . fromNative ( TNSGA . createAnchoredAdaptiveBanner ( width , nativeOrientation ) ) ;
345
329
}
346
330
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 ;
349
333
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 ;
357
335
} 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 ;
367
337
}
368
338
369
- return BannerAdSize . fromNative ( banner ) ;
339
+ return BannerAdSize . fromNative ( TNSGA . createInlineAdaptiveBanner ( width , maxHeight , nativeOrientation ) ) ;
370
340
}
371
341
372
342
static get FLUID ( ) : BannerAdSize {
373
- return BannerAdSize . fromNative ( kGADAdSizeFluid ) ;
343
+ return BannerAdSize . fromNative ( GADAdSizeFluid ) ;
374
344
}
375
345
376
346
static get WIDE_SKYSCRAPER ( ) : BannerAdSize {
377
- return BannerAdSize . fromNative ( kGADAdSizeSkyscraper ) ;
347
+ return BannerAdSize . fromNative ( GADAdSizeSkyscraper ) ;
378
348
}
379
349
380
350
static get INVALID ( ) : BannerAdSize {
381
- return BannerAdSize . fromNative ( kGADAdSizeInvalid ) ;
351
+ return BannerAdSize . fromNative ( GADAdSizeInvalid ) ;
382
352
}
383
353
384
354
static get SEARCH ( ) : BannerAdSize {
@@ -426,12 +396,13 @@ export class BannerAd extends BannerAdBase {
426
396
427
397
load ( options : RequestOptions = { } ) {
428
398
this . #isLoading = true ;
429
- this . #native?. loadRequest ( toSerializeRequestOptions ( options ) ) ;
399
+ this . #native?. loadRequest ?. ( toSerializeRequestOptions ( options ) ) ;
430
400
}
431
401
432
402
[ 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
+ }
435
406
}
436
407
437
408
[ unitIdProperty . setNative ] ( value ) {
@@ -448,15 +419,6 @@ export class BannerAd extends BannerAdBase {
448
419
this . setMeasuredDimension ( width , height ) ;
449
420
}
450
421
}
451
-
452
- // // @ts -ignore
453
- // set unitId(id) {
454
- // this.#native.adUnitID = id;
455
- // }
456
-
457
- // get unitId() {
458
- // return this.#native.adUnitID;
459
- // }
460
422
}
461
423
462
424
declare const FIRApp ;
@@ -521,8 +483,8 @@ export class Admob implements IAdmob {
521
483
if ( Array . isArray ( requestConfiguration . testDevices ) ) {
522
484
GADMobileAds . sharedInstance ( ) . requestConfiguration . testDeviceIdentifiers = requestConfiguration . testDevices . map ( ( item ) => {
523
485
if ( item === 'EMULATOR' ) {
524
- if ( typeof kGADSimulatorID ) {
525
- return kGADSimulatorID ;
486
+ if ( typeof GADSimulatorID ) {
487
+ return GADSimulatorID ;
526
488
}
527
489
return '' ;
528
490
}
0 commit comments