From 4c5b5acfcde86598e0db62aa5c200d3dba8522ec Mon Sep 17 00:00:00 2001 From: Alysson Date: Wed, 11 Jun 2025 19:50:34 -0300 Subject: [PATCH 1/4] feat:fixed consent for newer android versions --- android/build.gradle | 24 +++++++++++++------ .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../sms_user_consent/SmsUserConsentPlugin.kt | 6 ++++- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 8f97c2e..c4eeb73 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ group 'dev.pharsh.sms_user_consent' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.8.21' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -17,7 +17,7 @@ buildscript { rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() } } @@ -25,13 +25,23 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 30 + namespace "dev.pharsh.sms_user_consent" + compileSdkVersion 33 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = "1.8" + } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { - minSdkVersion 16 + minSdkVersion 21 } lintOptions { disable 'InvalidPackage' @@ -44,4 +54,4 @@ dependencies { // for sms user consent implementation 'com.google.android.gms:play-services-auth:18.1.0' implementation 'com.google.android.gms:play-services-auth-api-phone:17.4.0' -} +} \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 01a286e..dcf0f19 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip diff --git a/android/src/main/kotlin/dev/pharsh/sms_user_consent/SmsUserConsentPlugin.kt b/android/src/main/kotlin/dev/pharsh/sms_user_consent/SmsUserConsentPlugin.kt index b4de8fb..10be7f5 100644 --- a/android/src/main/kotlin/dev/pharsh/sms_user_consent/SmsUserConsentPlugin.kt +++ b/android/src/main/kotlin/dev/pharsh/sms_user_consent/SmsUserConsentPlugin.kt @@ -42,7 +42,11 @@ class SmsUserConsentPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { "requestSms" -> { SmsRetriever.getClient(mActivity.applicationContext).startSmsUserConsent(call.argument("senderPhoneNumber")) - mActivity.registerReceiver(smsVerificationReceiver, IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION)) + mActivity.registerReceiver( + smsVerificationReceiver, + IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION), + Context.RECEIVER_EXPORTED + ) result.success(null) } } From 791d13c701734107fdd89ed66515378291c0a58d Mon Sep 17 00:00:00 2001 From: Alysson Date: Wed, 11 Jun 2025 20:06:10 -0300 Subject: [PATCH 2/4] fix:include in settings --- android/settings.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/android/settings.gradle b/android/settings.gradle index 0c5507c..1d07629 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1 +1,2 @@ rootProject.name = 'sms_user_consent' +include ':sms_user_consent' \ No newline at end of file From b12a8bef16a02f42024e423de0f7ee4dc7c9f724 Mon Sep 17 00:00:00 2001 From: Alysson Date: Wed, 11 Jun 2025 20:12:47 -0300 Subject: [PATCH 3/4] fix:canged repo in pubspec --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 60769bc..b456fd7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: sms_user_consent description: Request user's phone number (supports dual sim) and/or consent to read SMS without adding any permissions version: 0.1.0 -repository: https://github.com/pharshdev/sms_user_consent +repository: https://github.com/tonsoo/sms_user_consent.git environment: sdk: '>=2.12.0 <3.0.0' From 645c95c3f4368ef5488ebe1ed747dd68968a8086 Mon Sep 17 00:00:00 2001 From: ghsgabriel Date: Tue, 17 Jun 2025 20:56:23 -0300 Subject: [PATCH 4/4] Add ProGuard consumer rules to fix R8 minification issues (#1) * Add ProGuard consumer rules to fix R8 minification issues * Update dependencies * fix consumerProguardFiles --- android/build.gradle | 5 +++-- android/consumer-rules.pro | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 android/consumer-rules.pro diff --git a/android/build.gradle b/android/build.gradle index c4eeb73..7c2c653 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -41,6 +41,7 @@ android { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { + consumerProguardFiles 'consumer-rules.pro' minSdkVersion 21 } lintOptions { @@ -52,6 +53,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // for sms user consent - implementation 'com.google.android.gms:play-services-auth:18.1.0' - implementation 'com.google.android.gms:play-services-auth-api-phone:17.4.0' + implementation 'com.google.android.gms:play-services-auth:20.7.0' + implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1' } \ No newline at end of file diff --git a/android/consumer-rules.pro b/android/consumer-rules.pro new file mode 100644 index 0000000..5df0439 --- /dev/null +++ b/android/consumer-rules.pro @@ -0,0 +1,7 @@ +# Keep Google Play Services Auth API classes +-keep class com.google.android.gms.auth.api.credentials.** { *; } +-dontwarn com.google.android.gms.auth.api.credentials.** + +# Keep SMS User Consent Plugin classes +-keep class dev.pharsh.sms_user_consent.** { *; } +-dontwarn dev.pharsh.sms_user_consent.**