Skip to content

Commit

Permalink
Update for Godot 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Schwenke committed May 10, 2021
1 parent 811a505 commit da3eba6
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
.cxx
gradle/wrapper/gradle-wrapper.jar
godot-lib.3.2.3.stable.release/build/
godot-lib.3.3.stable.release/build/.transforms/2555c0ee443cae35f015c1a437e694d1.bin
godot-lib.3.3.stable.release/build/.transforms/9bae84e9ca6c5cffd8450d011651e8e1.bin
godot-lib.3.3.stable.release/build/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Support my work:
**Follow me on [Twitter](https://twitter.com/pascalschwenke) and add me on [LinkedIn](https://www.linkedin.com/in/pascal-schwenke-537a8a169/)!**


# Consent plugin for Godot 3.2.3
# Consent plugin for Godot 3.3

This plugin implements the [Google Consent SDK](https://developers.google.com/admob/android/eu-consent/) for [Godot 3.2.3](https://godotengine.org/). The [GDPR](https://gdpr.eu/) requires Google App developers to obtain user consent before displaying any ads served by AdMob or its ad technology providers.
This plugin implements the [Google Consent SDK](https://developers.google.com/admob/android/eu-consent/) for [Godot 3.3](https://godotengine.org/). The [GDPR](https://gdpr.eu/) requires Google App developers to obtain user consent before displaying any ads served by AdMob or its ad technology providers.

The main features of the plugin are:
* Verifying that consent for personalized or non-personalized ads has been obtained
Expand All @@ -16,7 +16,7 @@ The main features of the plugin are:
See the plugin in action:\
[![Demo video](https://github.com/pschw/GodotConsentPlugin/blob/main/thumbnail_mini.jpg?raw=true)](https://youtu.be/PJ2H8ZK8O_w "Demo video")

## Adding the plugin to Godot 3.2.3
## Adding the plugin to Godot 3.3
1. Follow the [official documentation](https://docs.godotengine.org/en/latest/getting_started/workflow/export/android_custom_build.html) to configure, install and enable an Android Custom Build.
2. Download the consent plugin from the release tab.
3. Extract the contents of ConsentPlugin.7z to `res://android/plugins`
Expand Down
2 changes: 1 addition & 1 deletion consentGdpr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
compileOnly project(":godot-lib.3.2.3.stable.release")
compileOnly project(":godot-lib.3.3.stable.release")
implementation 'com.google.android.ads.consent:consent-library:1.0.8'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
import org.godotengine.godot.Godot;
import org.godotengine.godot.plugin.GodotPlugin;
import org.godotengine.godot.plugin.SignalInfo;
import org.godotengine.godot.plugin.UsedByGodot;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

import androidx.annotation.NonNull;
Expand All @@ -35,7 +34,7 @@ public class ConsentPlugin extends GodotPlugin {
*/
public ConsentPlugin(Godot godot) {
super(godot);
activity = godot;
activity = godot.getActivity();
TestDevice testDevice = new TestDevice(activity);
testDevice.setupTestDeviceIfDebugEnabled();
}
Expand All @@ -45,6 +44,7 @@ public ConsentPlugin(Godot godot) {
*
* @param publisherIds At least one publisher id from an admob account that has been verified.
*/
@UsedByGodot
public void requestConsentInformation(String[] publisherIds) {
Log.d(PLUGIN_NAME, "requestConsentInfo called");
consentInformation = ConsentInformation.getInstance(activity);
Expand Down Expand Up @@ -75,6 +75,7 @@ public void onFailedToUpdateConsentInfo(String errorDescription) {
* @param withNonPersonalizedAdsOption Display option to use only non personalized ads?
* @param withAdFreeOption Display form option to use the paid/ad free version of the app?
*/
@UsedByGodot
public void buildConsentForm(String privacyUrl, final boolean withPersonalizedAdsOption, final boolean withNonPersonalizedAdsOption, final boolean withAdFreeOption) {
Log.d(PLUGIN_NAME, "buildConsentForm called");
try {
Expand Down Expand Up @@ -141,6 +142,7 @@ public void onConsentFormError(String errorDescription) {
/**
* Use this method to load the consent form after it has been build.
*/
@UsedByGodot
public void loadConsentForm() {
Log.d(PLUGIN_NAME, "LoadConsentForm called");
activity.runOnUiThread(new Runnable() {
Expand All @@ -154,6 +156,7 @@ public void run() {
/**
* Show the consent form after it has been loaded.
*/
@UsedByGodot
public void showConsentForm() {
Log.d(PLUGIN_NAME, "showConsentForm called");
activity.runOnUiThread(new Runnable() {
Expand Down Expand Up @@ -187,21 +190,6 @@ public String getPluginName() {
return PLUGIN_NAME;
}

/**
* Return all the method names as list that can be called from godot side.
*
* @return
*/
@NonNull
@Override
public List<String> getPluginMethods() {
return Arrays.asList(
"requestConsentInformation",
"buildConsentForm",
"loadConsentForm",
"showConsentForm");
}

/**
* A set of all signals the plugin can emit.
*
Expand Down
2 changes: 0 additions & 2 deletions godot-lib.3.2.3.stable.release/build.gradle

This file was deleted.

2 changes: 2 additions & 0 deletions godot-lib.3.3.stable.release/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('godot-lib.3.3.stable.release.aar'))
Binary file not shown.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include ':godot-lib.3.2.3.stable.release'
include ':godot-lib.3.3.stable.release'
include ':consentGdpr'
rootProject.name = "consent"

0 comments on commit da3eba6

Please sign in to comment.