Skip to content

Commit

Permalink
Better documentation for classes
Browse files Browse the repository at this point in the history
  • Loading branch information
LTPhantom committed Feb 15, 2024
1 parent f3ef993 commit 27798e9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,30 @@
import com.google.android.gms.ads.mediation.MediationExtrasReceiver;
import java.util.Map;

/**
* Mediation Adapters that require extra parameters provide implementations of this interface to
* further be sent to the {@link com.google.android.gms.ads.AdRequest}
*
* Implementation will receive the Map of Extras via the
* {@link FlutterMediationExtras#setMediationExtras} which the implementation must store and later
* parse to the proper pair of Class and Bundle values returned by
* {@link FlutterMediationExtras#getMediationExtras()}
*/
public interface FlutterMediationExtras {

/**
* Called when the {@link FlutterAdRequest} is parsed into an
* {@link com.google.android.gms.ads.AdRequest}.
*
* @return The parsed values to be sent to the
* {@link com.google.android.gms.ads.AdRequest.Builder#addNetworkExtrasBundle}
*/
Pair<Class<? extends MediationExtrasReceiver>, Bundle> getMediationExtras();

/**
* Pair of key-values to be stored and later be parsed into a {@link Bundle}.
*
* @param extras Received from the dart layer through the MediationExtras class.
*/
void setMediationExtras(Map<String, Object> extras);
}
11 changes: 11 additions & 0 deletions packages/google_mobile_ads/ios/Classes/FLTMediationExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@
#import <Foundation/Foundation.h>
#import <GoogleMobileAds/GADAdNetworkExtras.h>

/**
* Mediation adapters will provide a class that conforms to this protocol to be
* added to the `FLTAdRequest`.
*/
@protocol FlutterMediationExtras

// Pair of key-values to be stored received from the dart layer.
@property NSMutableDictionary *_Nullable extras;

/**
* Parses the values in @c extras to the required protocol to append Mediation
* extras to the `FLTAdRequest`.
*
* @return the parsed extra values to an object that conforms to protocol.
*/
- (id<GADAdNetworkExtras> _Nonnull)getMediationExtras;

@end
6 changes: 3 additions & 3 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,7 @@ class AdRequest {
this.neighboringContentUrls,
this.nonPersonalizedAds,
this.httpTimeoutMillis,
this.mediationExtrasIdentifier,
@deprecated this.mediationExtrasIdentifier,
this.extras,
this.mediationExtras});

Expand Down Expand Up @@ -235,8 +235,7 @@ class AdRequest {
/// Extras to pass to the AdMob adapter.
final Map<String, String>? extras;

/// Extras to pass to the Mediations Adapter linked to the instance of the
/// [MediationExtras].
/// Extra parameters to pass to specific ad adapters.
final List<MediationExtras>? mediationExtras;

@override
Expand Down Expand Up @@ -274,6 +273,7 @@ class AdManagerAdRequest extends AdRequest {
neighboringContentUrls: neighboringContentUrls,
nonPersonalizedAds: nonPersonalizedAds,
httpTimeoutMillis: httpTimeoutMillis,
//ignore: deprecated_member_use_from_same_package
mediationExtrasIdentifier: mediationExtrasIdentifier,
extras: extras,
mediationExtras: mediationExtras,
Expand Down
2 changes: 1 addition & 1 deletion packages/google_mobile_ads/lib/src/mediation_extras.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Google LLC
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 27798e9

Please sign in to comment.