Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General code health improvement for release #1070

Merged
merged 14 commits into from
May 7, 2024
2 changes: 1 addition & 1 deletion packages/google_mobile_ads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ use [github's issue tracker](https://github.com/googleads/googleads-mobile-flutt

## License

[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html)
[Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0)
40 changes: 38 additions & 2 deletions packages/google_mobile_ads/lib/src/ad_containers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ class AdRequest {
this.neighboringContentUrls,
this.nonPersonalizedAds,
this.httpTimeoutMillis,
@deprecated this.mediationExtrasIdentifier,
@Deprecated('Use mediationExtras instead.')
this.mediationExtrasIdentifier,
this.extras,
this.mediationExtras});

Expand Down Expand Up @@ -230,7 +231,7 @@ class AdRequest {
/// to the ad request. This identifier will get passed to your platform-side
/// mediation extras factory class, allowing for additional customization
/// of network extras.
@deprecated
@Deprecated('Use mediationExtras instead.')
final String? mediationExtrasIdentifier;

/// Extras to pass to the AdMob adapter.
Expand All @@ -252,6 +253,18 @@ class AdRequest {
mapEquals<String, String>(extras, other.extras) &&
mediationExtras == other.mediationExtras;
}

@override
int get hashCode => Object.hash(
keywords,
contentUrl,
nonPersonalizedAds,
neighboringContentUrls,
httpTimeoutMillis,
//ignore: deprecated_member_use_from_same_package
mediationExtrasIdentifier,
extras,
mediationExtras);
}

/// Targeting info per the Ad Manager API.
Expand Down Expand Up @@ -303,6 +316,10 @@ class AdManagerAdRequest extends AdRequest {
other.customTargetingLists.toString() &&
publisherProvidedId == other.publisherProvidedId;
}

@override
int get hashCode =>
Object.hash(customTargeting, customTargetingLists, publisherProvidedId);
}

/// An [AdSize] with the given width and a Google-optimized height to create a banner ad.
Expand Down Expand Up @@ -554,6 +571,9 @@ class AdSize {
bool operator ==(Object other) {
return other is AdSize && width == other.width && height == other.height;
}

@override
int get hashCode => Object.hash(width, height);
}

/// The base class for all ads.
Expand Down Expand Up @@ -1353,6 +1373,9 @@ class ServerSideVerificationOptions {
userId == other.userId &&
customData == other.customData;
}

@override
int get hashCode => Object.hash(userId, customData);
}

/// A full-screen app open ad for the Google Mobile Ads Plugin.
Expand Down Expand Up @@ -1505,6 +1528,15 @@ class NativeAdOptions {
shouldRequestMultipleImages == other.shouldRequestMultipleImages &&
shouldReturnUrlsForImageAssets == other.shouldReturnUrlsForImageAssets;
}

@override
int get hashCode => Object.hash(
adChoicesPlacement,
mediaAspectRatio,
videoOptions,
requestCustomMuteThisAd,
shouldRequestMultipleImages,
shouldReturnUrlsForImageAssets);
}

/// Options for controlling video playback in supported ad formats.
Expand Down Expand Up @@ -1539,4 +1571,8 @@ class VideoOptions {
customControlsRequested == other.customControlsRequested &&
startMuted == other.startMuted;
}

@override
int get hashCode =>
Object.hash(clickToExpandRequested, customControlsRequested, startMuted);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ class AdMessageCodec extends StandardMessageCodec {
writeValue(buffer, value.orientationValue);
} else if (value is AnchoredAdaptiveBannerAdSize) {
buffer.putUint8(_valueAnchoredAdaptiveBannerAdSize);
var orientationValue;
String? orientationValue;
if (value.orientation != null) {
orientationValue = (value.orientation as Orientation).name;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/google_mobile_ads/lib/src/ump/consent_form_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ class ConsentFormImpl extends ConsentForm {
bool operator ==(Object other) {
return other is ConsentFormImpl && platformHash == other.platformHash;
}

@override
int get hashCode => platformHash.hashCode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class ConsentRequestParameters {
tagForUnderAgeOfConsent == other.tagForUnderAgeOfConsent &&
consentDebugSettings == other.consentDebugSettings;
}

@override
int get hashCode =>
Object.hash(tagForUnderAgeOfConsent, consentDebugSettings);
}

/// Debug settings to hardcode in test requests.
Expand All @@ -55,6 +59,9 @@ class ConsentDebugSettings {
debugGeography == other.debugGeography &&
listEquals(testIdentifiers, other.testIdentifiers);
}

@override
int get hashCode => Object.hash(debugGeography, testIdentifiers);
}

/// Debug values for testing geography.
Expand Down
3 changes: 3 additions & 0 deletions packages/google_mobile_ads/lib/src/ump/form_error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ class FormError {
errorCode == other.errorCode &&
message == other.message;
}

@override
int get hashCode => Object.hash(errorCode, message);
}