@@ -573,10 +573,9 @@ firebase.admob.showBanner = function (arg) {
573573 var settings = firebase . merge ( arg , firebase . admob . defaults ) ;
574574 var view = settings . view ;
575575 var bannerType = firebase . admob . _getBannerType ( settings . size ) ;
576- var adViewSize = CGSizeFromGADAdSize ( bannerType ) ;
577576
578- var originX = ( view . frame . size . width - adViewSize . width ) / 2 ;
579- var originY = settings . margins . top > - 1 ? settings . margins . top : ( settings . margins . bottom > - 1 ? view . frame . size . height - adViewSize . height - settings . margins . bottom : 0.0 ) ;
577+ var originX = ( view . frame . size . width - bannerType . size . width ) / 2 ;
578+ var originY = settings . margins . top > - 1 ? settings . margins . top : ( settings . margins . bottom > - 1 ? view . frame . size . height - bannerType . size . height - settings . margins . bottom : 0.0 ) ;
580579 var origin = CGPointMake ( originX , originY ) ;
581580 firebase . admob . adView = GADBannerView . alloc ( ) . initWithAdSizeOrigin ( bannerType , origin ) ;
582581
@@ -678,29 +677,37 @@ firebase.admob.hideBanner = function () {
678677} ;
679678
680679firebase . admob . _getBannerType = function ( size ) {
681- // Note that when the app is archived symbols like kGADAdSizeSmartBannerPortrait
682- // are normally not available in {N}.. that's why we added those to build.xcconfig.
683- // However, if that still fails this would work: GADAdSizeFromCGSize(CGSizeMake(250, 250))
684- // (but we then need to hardcode the sizes..)
680+ // see nativescript-admob's iOS sourcecode for why we're not using SDK-provided constants here
685681 if ( size == firebase . admob . AD_SIZE . BANNER ) {
686- return kGADAdSizeBanner ;
682+ // return kGADAdSizeBanner;
683+ return { "size" :{ "width" :320 , "height" :50 } , "flags" :0 } ;
687684 } else if ( size == firebase . admob . AD_SIZE . LARGE_BANNER ) {
688- return kGADAdSizeLargeBanner ;
685+ // return kGADAdSizeLargeBanner;
686+ return { "size" :{ "width" :320 , "height" :100 } , "flags" :0 } ;
689687 } else if ( size == firebase . admob . AD_SIZE . MEDIUM_RECTANGLE ) {
690- return kGADAdSizeMediumRectangle ;
688+ // return kGADAdSizeMediumRectangle;
689+ return { "size" :{ "width" :300 , "height" :250 } , "flags" :0 } ;
691690 } else if ( size == firebase . admob . AD_SIZE . FULL_BANNER ) {
692- return kGADAdSizeFullBanner ;
691+ // return kGADAdSizeFullBanner;
692+ return { "size" :{ "width" :468 , "height" :60 } , "flags" :0 } ;
693693 } else if ( size == firebase . admob . AD_SIZE . LEADERBOARD ) {
694- return kGADAdSizeLeaderboard ;
695- } else if ( size == firebase . admob . AD_SIZE . SMART_BANNER ) {
694+ // return kGADAdSizeLeaderboard;
695+ return { "size" :{ "width" :728 , "height" :90 } , "flags" :0 } ;
696+ } else if ( size == firebase . admob . AD_SIZE . SKYSCRAPER ) {
697+ // return kGADAdSizeSkyscraper;
698+ return { "size" :{ "width" :120 , "height" :600 } , "flags" :0 } ;
699+ } else if ( size == firebase . admob . AD_SIZE . SMART_BANNER || size == firebase . admob . AD_SIZE . FLUID ) {
696700 var orientation = utils . ios . getter ( UIDevice , UIDevice . currentDevice ) . orientation ;
697701 if ( orientation == UIDeviceOrientation . UIDeviceOrientationPortrait || orientation == UIDeviceOrientation . UIDeviceOrientationPortraitUpsideDown ) {
698- return kGADAdSizeSmartBannerPortrait ;
702+ // return kGADAdSizeSmartBannerPortrait;
703+ return { "size" :{ "width" :0 , "height" :0 } , "flags" :18 } ;
699704 } else {
700- return kGADAdSizeSmartBannerLandscape ;
705+ // return kGADAdSizeSmartBannerLandscape;
706+ return { "size" :{ "width" :0 , "height" :0 } , "flags" :26 } ;
701707 }
702708 } else {
703- return kGADAdSizeInvalid ;
709+ // return kGADAdSizeInvalid;
710+ return { "size" :{ "width" :- 1 , "height" :- 1 } , "flags" :0 } ;
704711 }
705712} ;
706713
0 commit comments