Skip to content
Open
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
29 changes: 20 additions & 9 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,47 @@ 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"
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

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
consumerProguardFiles 'consumer-rules.pro'
minSdkVersion 21
}
lintOptions {
disable 'InvalidPackage'
Expand All @@ -42,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'
}
7 changes: 7 additions & 0 deletions android/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -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.**
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rootProject.name = 'sms_user_consent'
include ':sms_user_consent'
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ class SmsUserConsentPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
"requestSms" -> {
SmsRetriever.getClient(mActivity.applicationContext).startSmsUserConsent(call.argument<String>("senderPhoneNumber"))

mActivity.registerReceiver(smsVerificationReceiver, IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION))
mActivity.registerReceiver(
smsVerificationReceiver,
IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION),
Context.RECEIVER_EXPORTED
)
result.success(null)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down