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

Capacitor community master #2

Merged
merged 15 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on: [push, pull_request]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 18
- run: npm install
- run: npm run lint

Expand All @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 18
- run: npm install
- run: npm run lint

Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 18
- run: npm install
- run: npm run verify:web

Expand All @@ -48,16 +48,16 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 18
- run: npm install
# - run: npm run verify:android

verify-ios:
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 18
- run: npm install
- run: npm run verify:ios
2 changes: 1 addition & 1 deletion QuquplayAdmob.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ Pod::Spec.new do |s|
s.swift_version = '5.1'
s.static_framework = true
s.dependency 'Capacitor'
s.dependency 'Google-Mobile-Ads-SDK', '10.12.0'
s.dependency 'Google-Mobile-Ads-SDK', '11.3.0'
end
72 changes: 36 additions & 36 deletions README.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ ext {
androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.2.0'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '22.4.0'
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.10.0'
playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '23.0.0'
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.13.0'
}

buildscript {
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -25,10 +25,10 @@ apply plugin: 'kotlin-android'

android {
namespace "com.getcapacitor.community.admob.admob"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -133,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down Expand Up @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

import androidx.core.util.Supplier;
import com.getcapacitor.JSArray;
import com.getcapacitor.JSObject;
Expand All @@ -19,7 +18,6 @@
import com.google.android.ump.ConsentRequestParameters;
import com.google.android.ump.FormError;
import com.google.android.ump.UserMessagingPlatform;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -36,13 +34,13 @@ public AdConsentExecutor(
super(contextSupplier, activitySupplier, notifyListenersFunction, pluginLogTag, "AdConsentExecutor");
}

public boolean canShowPersonalizedAds(){
public boolean canShowPersonalizedAds() {
Context context = contextSupplier.get();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
String purposeConsent = prefs.getString("IABTCF_PurposeConsents", "");
String vendorConsent = prefs.getString("IABTCF_VendorConsents","");
String vendorLI = prefs.getString("IABTCF_VendorLegitimateInterests","");
String purposeLI = prefs.getString("IABTCF_PurposeLegitimateInterests","");
String vendorConsent = prefs.getString("IABTCF_VendorConsents", "");
String vendorLI = prefs.getString("IABTCF_VendorLegitimateInterests", "");
String purposeLI = prefs.getString("IABTCF_PurposeLegitimateInterests", "");

int googleId = 755;
boolean hasGoogleVendorConsent = hasAttribute(vendorConsent, googleId);
Expand All @@ -59,17 +57,19 @@ public boolean canShowPersonalizedAds(){
indexesLI.add(9);
indexesLI.add(10);

return hasConsentFor(indexes, purposeConsent, hasGoogleVendorConsent)
&& hasConsentOrLegitimateInterestFor(indexesLI, purposeConsent, purposeLI, hasGoogleVendorConsent, hasGoogleVendorLI);

return (
hasConsentFor(indexes, purposeConsent, hasGoogleVendorConsent) &&
hasConsentOrLegitimateInterestFor(indexesLI, purposeConsent, purposeLI, hasGoogleVendorConsent, hasGoogleVendorLI)
);
}
public boolean canShowAds(){

public boolean canShowAds() {
Context context = contextSupplier.get();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
String purposeConsent = prefs.getString("IABTCF_PurposeConsents", "");
String vendorConsent = prefs.getString("IABTCF_VendorConsents","");
String vendorLI = prefs.getString("IABTCF_VendorLegitimateInterests","");
String purposeLI = prefs.getString("IABTCF_PurposeLegitimateInterests","");
String vendorConsent = prefs.getString("IABTCF_VendorConsents", "");
String vendorLI = prefs.getString("IABTCF_VendorLegitimateInterests", "");
String purposeLI = prefs.getString("IABTCF_PurposeLegitimateInterests", "");

int googleId = 755;
boolean hasGoogleVendorConsent = hasAttribute(vendorConsent, googleId);
Expand All @@ -84,9 +84,10 @@ public boolean canShowAds(){
indexesLI.add(9);
indexesLI.add(10);

return hasConsentFor(indexes, purposeConsent, hasGoogleVendorConsent)
&& hasConsentOrLegitimateInterestFor(indexesLI, purposeConsent, purposeLI, hasGoogleVendorConsent, hasGoogleVendorLI);

return (
hasConsentFor(indexes, purposeConsent, hasGoogleVendorConsent) &&
hasConsentOrLegitimateInterestFor(indexesLI, purposeConsent, purposeLI, hasGoogleVendorConsent, hasGoogleVendorLI)
);
}

@PluginMethod
Expand Down Expand Up @@ -206,24 +207,30 @@ private void ensureConsentInfo() {

private boolean hasAttribute(String input, int index) {
if (input == null) return false;
return input.length() >= index && input.charAt(index-1) == '1';
return input.length() >= index && input.charAt(index - 1) == '1';
}

private boolean hasConsentFor(List<Integer> indexes, String purposeConsent, boolean hasVendorConsent) {
for (Integer p: indexes) {
for (Integer p : indexes) {
if (!hasAttribute(purposeConsent, p)) {
return false;
}
}
return hasVendorConsent;
}

private boolean hasConsentOrLegitimateInterestFor(List<Integer> indexes, String purposeConsent, String purposeLI, boolean hasVendorConsent, boolean hasVendorLI){
for (Integer p: indexes) {
private boolean hasConsentOrLegitimateInterestFor(
List<Integer> indexes,
String purposeConsent,
String purposeLI,
boolean hasVendorConsent,
boolean hasVendorLI
) {
for (Integer p : indexes) {
boolean purposeAndVendorLI = hasAttribute(purposeLI, p) && hasVendorLI;
boolean purposeConsentAndVendorConsent = hasAttribute(purposeConsent, p) && hasVendorConsent;
boolean isOk = purposeAndVendorLI || purposeConsentAndVendorConsent;
if (!isOk){
if (!isOk) {
return false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion demo/angular/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ npm-debug.log*
/platforms
/plugins
/www
/.angular
/.angular
/.nx
2 changes: 1 addition & 1 deletion demo/angular/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
namespace "io.ionic.starter"
compileSdkVersion rootProject.ext.compileSdkVersion
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "io.ionic.starter"
minSdkVersion rootProject.ext.minSdkVersion
Expand Down
4 changes: 2 additions & 2 deletions demo/angular/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.android.tools.build:gradle:8.2.1'
classpath 'com.google.gms:google-services:4.4.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Binary file modified demo/angular/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading