diff --git a/CHANGELOG.md b/CHANGELOG.md index a06d171..88d131f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 8.3.2 +### ⚠️ BREAKING CHANGE +* Minimum required Dart SDK version 3.3.0 (Flutter 3.19.0 - 15/02/2024) + +### 🐛 Bug Fixes +* Fix issue #410: "reply already sent and a possible ANR". Tks @Junglee-Faisal + +### 🎉 Features +* Migrated Gradle to declarative plugins block + ## 8.3.1 ### ⚠️ BREAKING CHANGE * Minimum required Dart SDK version 3.3.0 (Flutter 3.19.0 - 15/02/2024) diff --git a/android/build.gradle b/android/build.gradle index f3575a8..0244235 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ -group 'br.com.rsmarques.flutter_branch_sdk' -version '1.0' +group = 'br.com.rsmarques.flutter_branch_sdk' +version = '1.0' def getPackageVersion() { def props = new Properties() @@ -15,7 +15,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.1.4' + classpath("com.android.tools.build:gradle:8.2.2") } } @@ -34,27 +34,27 @@ android { namespace 'br.com.rsmarques.flutter_branch_sdk' } + compileSdk 35 + + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + buildFeatures { buildConfig = true } - - compileSdk 35 - defaultConfig { minSdkVersion 21 buildConfigField("String", "FBRANCH_VERSION", "\"${getPackageVersion()}\"") } - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + dependencies { + implementation 'io.branch.sdk.android:library:5.15.+' + implementation 'com.google.android.gms:play-services-ads-identifier:18.2.0' + implementation 'androidx.lifecycle:lifecycle-runtime:2.8.7' + implementation 'androidx.browser:browser:1.8.0' + implementation "store.galaxy.samsung.installreferrer:samsung_galaxystore_install_referrer:4.0.0" } } -dependencies { - implementation 'io.branch.sdk.android:library:5.15.+' - implementation 'com.google.android.gms:play-services-ads-identifier:18.2.0' - implementation 'androidx.lifecycle:lifecycle-runtime:2.8.7' - implementation 'androidx.browser:browser:1.8.0' - implementation "store.galaxy.samsung.installreferrer:samsung_galaxystore_install_referrer:4.0.0" -} \ No newline at end of file diff --git a/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/MethodResultWrapper.java b/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/MethodResultWrapper.java index 3bc513c..30f3a97 100644 --- a/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/MethodResultWrapper.java +++ b/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/MethodResultWrapper.java @@ -9,14 +9,26 @@ public class MethodResultWrapper implements MethodChannel.Result { private final MethodChannel.Result methodResult; private final Handler handler; + private boolean called; MethodResultWrapper(MethodChannel.Result result) { methodResult = result; handler = new Handler(Looper.getMainLooper()); } + private synchronized boolean checkNotCalled() { + if (called) { + return false; + } + called = true; + return true; + } + @Override public void success(final Object result) { + if (!checkNotCalled()) { + return; + } handler.post( new Runnable() { @Override @@ -33,6 +45,9 @@ public void run() { @Override public void error( final String errorCode, final String errorMessage, final Object errorDetails) { + if (!checkNotCalled()) { + return; + } handler.post( new Runnable() { @Override @@ -48,6 +63,9 @@ public void run() { @Override public void notImplemented() { + if (!checkNotCalled()) { + return; + } handler.post( new Runnable() { @Override diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 278cd09..191d3c5 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,51 +1,33 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { namespace 'br.com.rsmarques.flutter_branch_sdk_example' - defaultConfig { - compileSdk flutter.compileSdkVersion - } - ndkVersion flutter.ndkVersion + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } - + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11 + } + defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "br.com.rsmarques.flutter_branch_sdk_example" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. - minSdkVersion 21 - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName multiDexEnabled true } diff --git a/example/android/build.gradle b/example/android/build.gradle index 94a816d..bc157bd 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.2.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 7723ef5..28a1153 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true android.defaults.buildfeatures.buildconfig=true diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 33f0745..da6d3f2 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.2.2" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false +} + +include ":app" diff --git a/example/pubspec.lock b/example/pubspec.lock index 8827b94..902119b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -84,7 +84,7 @@ packages: path: ".." relative: true source: path - version: "8.3.1" + version: "8.3.2" flutter_lints: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 19f9437..3f679c2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_branch_sdk description: "Flutter Plugin for create deep link using Brach SDK (https://branch.io). This plugin provides a cross-platform (iOS, Android, Web)." -version: 8.3.1 +version: 8.3.2 repository: https://github.com/RodrigoSMarques/flutter_branch_sdk environment: @@ -43,4 +43,11 @@ flutter: pluginClass: FlutterBranchSdkPlugin web: pluginClass: FlutterBranchSdkWeb - fileName: src/flutter_branch_sdk_web.dart \ No newline at end of file + fileName: src/flutter_branch_sdk_web.dart + +topics: + - deeplink + - app-links + - universal-links + - custom-url-schemes + - web-to-app \ No newline at end of file