diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm b/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm index 0e3a0283..ad7c13c8 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm @@ -85,7 +85,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & _mediaView.mediaContent = nativeAd.mediaContent; _mediaView.contentMode = _contentMode; } - + if (oldViewProps.resizeMode != newViewProps.resizeMode) { NSString *resizeMode = [[NSString alloc] initWithUTF8String:newViewProps.resizeMode.c_str()]; if ([resizeMode isEqualToString:@"cover"]) { diff --git a/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm b/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm index f8e14dcf..1dc15d85 100644 --- a/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm +++ b/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm @@ -23,7 +23,8 @@ typedef void (^RNGMANativeAdLoadCompletionHandler)(GADNativeAd *_Nullable nativeAd, NSError *_Nullable error); -@interface RNGMANativeAdHolder : NSObject +@interface RNGMANativeAdHolder + : NSObject @property GADNativeAd *nativeAd; @@ -164,11 +165,11 @@ - (instancetype)initWithNativeModule:(RNGoogleMobileAdsNativeModule *)nativeModu videoOptions.startMuted = [requestOptions[@"startVideoMuted"] boolValue]; } - _adLoader = - [[GADAdLoader alloc] initWithAdUnitID:adUnitId - rootViewController:[RNGoogleMobileAdsCommon currentViewController] - adTypes:@[ GADAdLoaderAdTypeNative ] - options:@[ imageOptions, mediaOptions, adViewOptions, videoOptions ]]; + _adLoader = [[GADAdLoader alloc] + initWithAdUnitID:adUnitId + rootViewController:[RNGoogleMobileAdsCommon currentViewController] + adTypes:@[ GADAdLoaderAdTypeNative ] + options:@[ imageOptions, mediaOptions, adViewOptions, videoOptions ]]; _adLoader.delegate = self; _adRequest = [RNGoogleMobileAdsCommon buildAdRequest:requestOptions]; } @@ -223,36 +224,29 @@ - (void)nativeAdWillLeaveApplication:(GADNativeAd *)nativeAd { // Not in use } -- (void)videoControllerDidPlayVideo: -(nonnull GADVideoController *)videoController { +- (void)videoControllerDidPlayVideo:(nonnull GADVideoController *)videoController { [self emitAdEvent:@"video_played"]; } -- (void)videoControllerDidPauseVideo: -(nonnull GADVideoController *)videoController { +- (void)videoControllerDidPauseVideo:(nonnull GADVideoController *)videoController { [self emitAdEvent:@"video_paused"]; } -- (void)videoControllerDidEndVideoPlayback: -(nonnull GADVideoController *)videoController { +- (void)videoControllerDidEndVideoPlayback:(nonnull GADVideoController *)videoController { [self emitAdEvent:@"video_ended"]; } -- (void)videoControllerDidMuteVideo: -(nonnull GADVideoController *)videoController { +- (void)videoControllerDidMuteVideo:(nonnull GADVideoController *)videoController { [self emitAdEvent:@"video_muted"]; } -- (void)videoControllerDidUnmuteVideo: -(nonnull GADVideoController *)videoController { +- (void)videoControllerDidUnmuteVideo:(nonnull GADVideoController *)videoController { [self emitAdEvent:@"video_unmuted"]; } - (void)emitAdEvent:(NSString *)type { - [_nativeModule emitOnAdEvent:@{ - @"responseId" : _nativeAd.responseInfo.responseIdentifier, - @"type" : type - }]; + [_nativeModule + emitOnAdEvent:@{@"responseId" : _nativeAd.responseInfo.responseIdentifier, @"type" : type}]; } @end