-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for paid events callback * Invoke all android method calls on ui thread. Co-authored-by: Benjamin Koch <[email protected]>
- Loading branch information
Showing
33 changed files
with
771 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...e_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterAdValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package io.flutter.plugins.googlemobileads; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
/** A wrapper for {@link com.google.android.gms.ads.AdValue}. */ | ||
public class FlutterAdValue { | ||
final int precisionType; | ||
@NonNull final String currencyCode; | ||
final long valueMicros; | ||
|
||
public FlutterAdValue(int precisionType, @NonNull String currencyCode, long valueMicros) { | ||
this.precisionType = precisionType; | ||
this.currencyCode = currencyCode; | ||
this.valueMicros = valueMicros; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ds/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterPaidEventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package io.flutter.plugins.googlemobileads; | ||
|
||
import androidx.annotation.NonNull; | ||
import com.google.android.gms.ads.AdValue; | ||
import com.google.android.gms.ads.OnPaidEventListener; | ||
|
||
/** Implementation of {@link OnPaidEventListener} that sends events to {@link AdInstanceManager}. */ | ||
public class FlutterPaidEventListener implements OnPaidEventListener { | ||
@NonNull private final AdInstanceManager manager; | ||
@NonNull private final FlutterAd ad; | ||
|
||
FlutterPaidEventListener(@NonNull AdInstanceManager manager, @NonNull FlutterAd ad) { | ||
this.manager = manager; | ||
this.ad = ad; | ||
} | ||
|
||
@Override | ||
public void onPaidEvent(AdValue adValue) { | ||
FlutterAdValue value = | ||
new FlutterAdValue( | ||
adValue.getPrecisionType(), adValue.getCurrencyCode(), adValue.getValueMicros()); | ||
manager.onPaidEvent(ad, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.