Skip to content

Commit

Permalink
Merge 2afd118 into c31dcb4
Browse files Browse the repository at this point in the history
  • Loading branch information
dylancom authored Dec 12, 2021
2 parents c31dcb4 + 2afd118 commit 2b84b07
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions ios/RNGoogleAds/RNGoogleAdsBannerViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,35 +100,31 @@ - (void)sendEvent:(NSString *)type payload:(NSDictionary *_Nullable)payload {
self.onNativeEvent(event);
}

- (void)adViewDidReceiveAd:(GADBannerView *)adView {
- (void)bannerViewDidReceiveAd:(GADBannerView *)bannerView {
[self sendEvent:@"onAdLoaded"
payload:@{
@"width" : @(adView.bounds.size.width),
@"height" : @(adView.bounds.size.height),
@"width" : @(bannerView.bounds.size.width),
@"height" : @(bannerView.bounds.size.height),
}];
}

- (void)adView:(GADBannerView *)adView didFailToReceiveAdWithError:(NSError *)error {
- (void)bannerView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(NSError *)error {
NSDictionary *errorAndMessage = [RNGoogleAdsCommon getCodeAndMessageFromAdError:error];
[self sendEvent:@"onAdFailedToLoad" payload:errorAndMessage];
}

- (void)adViewWillPresentScreen:(GADBannerView *)adView {
- (void)bannerViewWillPresentScreen:(GADBannerView *)bannerView {
[self sendEvent:@"onAdOpened" payload:nil];
}

- (void)adViewWillDismissScreen:(GADBannerView *)adView {
- (void)bannerViewWillDismissScreen:(GADBannerView *)bannerView {
// not in use
}

- (void)adViewDidDismissScreen:(GADBannerView *)adView {
- (void)bannerViewDidDismissScreen:(GADBannerView *)bannerView {
[self sendEvent:@"onAdClosed" payload:nil];
}

- (void)adViewWillLeaveApplication:(GADBannerView *)adView {
[self sendEvent:@"onAdLeftApplication" payload:nil];
}

@end

@implementation RNGoogleAdsBannerViewManager
Expand Down

0 comments on commit 2b84b07

Please sign in to comment.