diff --git a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/AdMessageCodec.java b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/AdMessageCodec.java index 3918e39af..9ebd90420 100644 --- a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/AdMessageCodec.java +++ b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/AdMessageCodec.java @@ -36,7 +36,6 @@ import java.nio.ByteBuffer; import java.util.List; import java.util.Map; -import java.util.Objects; /** * Encodes and decodes values by reading from a ByteBuffer and writing to a ByteArrayOutputStream. @@ -70,14 +69,10 @@ class AdMessageCodec extends StandardMessageCodec { private static final byte VALUE_COLOR = (byte) 153; private static final byte VALUE_MEDIATION_EXTRAS = (byte) 154; - @NonNull - Context context; - @NonNull - final FlutterAdSize.AdSizeFactory adSizeFactory; - @Nullable - private MediationNetworkExtrasProvider mediationNetworkExtrasProvider; - @NonNull - private final FlutterRequestAgentProvider requestAgentProvider; + @NonNull Context context; + @NonNull final FlutterAdSize.AdSizeFactory adSizeFactory; + @Nullable private MediationNetworkExtrasProvider mediationNetworkExtrasProvider; + @NonNull private final FlutterRequestAgentProvider requestAgentProvider; AdMessageCodec( @NonNull Context context, @NonNull FlutterRequestAgentProvider requestAgentProvider) { @@ -259,13 +254,14 @@ protected void writeValue(ByteArrayOutputStream stream, Object value) { @Override protected Object readValueOfType(byte type, ByteBuffer buffer) { switch (type) { - case VALUE_INLINE_ADAPTIVE_BANNER_AD_SIZE: { - final Integer width = (Integer) readValueOfType(buffer.get(), buffer); - final Integer height = (Integer) readValueOfType(buffer.get(), buffer); - final Integer orientation = (Integer) readValueOfType(buffer.get(), buffer); - return new FlutterAdSize.InlineAdaptiveBannerAdSize( - adSizeFactory, context, width, orientation, height); - } + case VALUE_INLINE_ADAPTIVE_BANNER_AD_SIZE: + { + final Integer width = (Integer) readValueOfType(buffer.get(), buffer); + final Integer height = (Integer) readValueOfType(buffer.get(), buffer); + final Integer orientation = (Integer) readValueOfType(buffer.get(), buffer); + return new FlutterAdSize.InlineAdaptiveBannerAdSize( + adSizeFactory, context, width, orientation, height); + } case VALUE_ANCHORED_ADAPTIVE_BANNER_AD_SIZE: final String orientation = (String) readValueOfType(buffer.get(), buffer); final Integer width = (Integer) readValueOfType(buffer.get(), buffer); @@ -290,8 +286,9 @@ protected Object readValueOfType(byte type, ByteBuffer buffer) { .setMediationNetworkExtrasProvider(mediationNetworkExtrasProvider) .setAdMobExtras((Map) readValueOfType(buffer.get(), buffer)) .setRequestAgent(requestAgentProvider.getRequestAgent()) - .setMediationExtras((List) readValueOfType(buffer.get(), buffer)) - .build(); + .setMediationExtras( + (List) readValueOfType(buffer.get(), buffer)) + .build(); case VALUE_MEDIATION_EXTRAS: String className = (String) readValueOfType(buffer.get(), buffer); Map extras = (Map) readValueOfType(buffer.get(), buffer); @@ -357,7 +354,8 @@ protected Object readValueOfType(byte type, ByteBuffer buffer) { builder.setMediationNetworkExtrasProvider(mediationNetworkExtrasProvider); builder.setAdMobExtras((Map) readValueOfType(buffer.get(), buffer)); builder.setRequestAgent(requestAgentProvider.getRequestAgent()); - builder.setMediationExtras((List) readValueOfType(buffer.get(), buffer)); + builder.setMediationExtras( + (List) readValueOfType(buffer.get(), buffer)); return builder.build(); case VALUE_INITIALIZATION_STATE: final String state = (String) readValueOfType(buffer.get(), buffer); diff --git a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterAdRequest.java b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterAdRequest.java index bd34b4337..e6ae123ad 100644 --- a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterAdRequest.java +++ b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterAdRequest.java @@ -208,7 +208,8 @@ private void addNetworkExtras(AdRequest.Builder builder, String adUnitId) { Map, Bundle> networkExtras = new HashMap<>(); if (mediationExtras != null) { for (FlutterMediationExtras flutterExtras : mediationExtras) { - Pair, Bundle> pair = flutterExtras.getMediationExtras(); + Pair, Bundle> pair = + flutterExtras.getMediationExtras(); networkExtras.put(pair.first, pair.second); } } else if (mediationNetworkExtrasProvider != null) { diff --git a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMediationExtras.java b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMediationExtras.java index d95f3bcf4..5e44115c3 100644 --- a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMediationExtras.java +++ b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMediationExtras.java @@ -25,4 +25,4 @@ public interface FlutterMediationExtras { void setMediationExtras(Map extras); -} \ No newline at end of file +} diff --git a/packages/google_mobile_ads/example/ios/Runner.xcodeproj/project.pbxproj b/packages/google_mobile_ads/example/ios/Runner.xcodeproj/project.pbxproj index 87f331859..4c0a8be68 100644 --- a/packages/google_mobile_ads/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/google_mobile_ads/example/ios/Runner.xcodeproj/project.pbxproj @@ -10,7 +10,7 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3D7E269FA8038A55BBCBF250 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2AB4EE7241D0927BB957D65 /* Pods_Runner.framework */; }; - 588A95C9AF0A9F291BFBAA5B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86606948223BE74D544C6A9E /* Pods_RunnerTests.framework */; }; + 588A95C9AF0A9F291BFBAA5B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86606948223BE74D544C6A9E /* Pods_RunnerTests.framework */; }; 8FC897F52411A9F100415930 /* NativeAdView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8FC897F42411A9F100415930 /* NativeAdView.xib */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; diff --git a/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.h b/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.h index ad1c0583c..3691554a2 100644 --- a/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.h +++ b/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.h @@ -87,9 +87,11 @@ @property NSString *_Nullable contentURL; @property BOOL nonPersonalizedAds; @property NSArray *_Nullable neighboringContentURLs; -@property NSString *_Nullable mediationExtrasIdentifier DEPRECATED_MSG_ATTRIBUTE("Use mediationExtras instead."); +@property NSString *_Nullable mediationExtrasIdentifier + DEPRECATED_MSG_ATTRIBUTE("Use mediationExtras instead."); @property id< - FLTMediationNetworkExtrasProvider> _Nullable mediationNetworkExtrasProvider DEPRECATED_MSG_ATTRIBUTE("Use mediationExtras instead."); + FLTMediationNetworkExtrasProvider> _Nullable mediationNetworkExtrasProvider + DEPRECATED_MSG_ATTRIBUTE("Use mediationExtras instead."); @property NSDictionary *_Nullable adMobExtras; @property NSString *_Nonnull requestAgent; @property NSArray *_Nullable mediationExtras; diff --git a/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.m b/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.m index a752e6c34..647d5080c 100644 --- a/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.m +++ b/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.m @@ -174,15 +174,16 @@ - (void)addNetworkExtrasToGADRequest:(GADRequest *)request NSArray> *extras; if (_mediationExtras != NULL) { - NSMutableArray> *flutterExtras = [NSMutableArray array]; - for(id extra in _mediationExtras) { + NSMutableArray> *flutterExtras = + [NSMutableArray array]; + for (id extra in _mediationExtras) { [flutterExtras addObject:[extra getMediationExtras]]; } extras = [NSArray arrayWithArray:flutterExtras]; } else { extras = [_mediationNetworkExtrasProvider - getMediationExtras:adUnitId - mediationExtrasIdentifier:_mediationExtrasIdentifier]; + getMediationExtras:adUnitId + mediationExtrasIdentifier:_mediationExtrasIdentifier]; } BOOL addedNpaToGADExtras = false; diff --git a/packages/google_mobile_ads/ios/Classes/FLTGoogleMobileAdsReaderWriter_Internal.m b/packages/google_mobile_ads/ios/Classes/FLTGoogleMobileAdsReaderWriter_Internal.m index 292c10bea..58481db7a 100644 --- a/packages/google_mobile_ads/ios/Classes/FLTGoogleMobileAdsReaderWriter_Internal.m +++ b/packages/google_mobile_ads/ios/Classes/FLTGoogleMobileAdsReaderWriter_Internal.m @@ -122,7 +122,9 @@ - (id _Nullable)readValueOfType:(UInt8)type { return request; } case FLTAdmobFieldMediationExtras: { - id flutterMediationExtras = [[NSClassFromString([self readValueOfType:[self readByte]]) alloc] init]; + id flutterMediationExtras = + [[NSClassFromString([self readValueOfType:[self readByte]]) alloc] + init]; NSMutableDictionary *flutterExtras = [self readValueOfType:[self readByte]]; flutterMediationExtras.extras = flutterExtras; return flutterMediationExtras; diff --git a/packages/google_mobile_ads/ios/Classes/FLTMediationExtras.h b/packages/google_mobile_ads/ios/Classes/FLTMediationExtras.h index 2c2ae97ad..a6534055c 100644 --- a/packages/google_mobile_ads/ios/Classes/FLTMediationExtras.h +++ b/packages/google_mobile_ads/ios/Classes/FLTMediationExtras.h @@ -17,8 +17,8 @@ @protocol FlutterMediationExtras -@property NSMutableDictionary * _Nullable extras; +@property NSMutableDictionary *_Nullable extras; -- (id _Nonnull) getMediationExtras; +- (id _Nonnull)getMediationExtras; @end diff --git a/packages/google_mobile_ads/lib/src/ad_instance_manager.dart b/packages/google_mobile_ads/lib/src/ad_instance_manager.dart index 17ddd37df..82c1f57ac 100644 --- a/packages/google_mobile_ads/lib/src/ad_instance_manager.dart +++ b/packages/google_mobile_ads/lib/src/ad_instance_manager.dart @@ -900,7 +900,7 @@ class AdMessageCodec extends StandardMessageCodec { writeValue(buffer, value.getIOSClassName()); } writeValue(buffer, value.getExtras()); - } else if (value is RewardItem) { + } else if (value is RewardItem) { buffer.putUint8(_valueRewardItem); writeValue(buffer, value.amount); writeValue(buffer, value.type); diff --git a/packages/google_mobile_ads/lib/src/mediation_extras.dart b/packages/google_mobile_ads/lib/src/mediation_extras.dart index 8cafce4c0..dec85f572 100644 --- a/packages/google_mobile_ads/lib/src/mediation_extras.dart +++ b/packages/google_mobile_ads/lib/src/mediation_extras.dart @@ -16,7 +16,6 @@ import 'package:google_mobile_ads/src/ad_containers.dart'; /// Contains information for a particular ad network set by developer. abstract class MediationExtras { - /// Fully-qualified name of an Android FlutterMediationExtras class. /// /// The name of the class must implement the FlutterMediationExtras interface.