From 9a3ad8d03fda5c289166018eb8bd0d0e031aa3ad Mon Sep 17 00:00:00 2001 From: Luke Freeman Date: Sat, 8 Feb 2020 08:34:09 -0800 Subject: [PATCH] fix example and migrate to androidx --- example/android/app/build.gradle | 31 +++++++++---------- .../goposse/fluro/activities/MainActivity.kt | 15 ++++----- example/android/build.gradle | 4 +-- example/android/config.gradle | 8 ++--- example/android/gradle.properties | 3 ++ .../ios/Flutter/flutter_export_environment.sh | 10 ++++++ .../ios/Runner/GeneratedPluginRegistrant.h | 3 ++ pubspec.yaml | 2 +- 8 files changed, 44 insertions(+), 32 deletions(-) create mode 100755 example/ios/Flutter/flutter_export_environment.sh diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 9da8896..2f8d9ae 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,19 +1,18 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply from: "../config.gradle" apply from: "../flutter.gradle" android { - compileSdkVersion versions.targetSDK - buildToolsVersion "${versions.buildTools}" + compileSdkVersion 29 + buildToolsVersion "29.0.3" defaultConfig { - minSdkVersion versions.minSDK - targetSdkVersion versions.targetSDK - applicationId "$appInfo.applicationID" - versionCode appInfo.build - versionName "${appInfo.version}" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + minSdkVersion 24 + targetSdkVersion 29 + applicationId "app.yakka.fluroexample" + versionCode 1 + versionName "1.6.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { disable 'InvalidPackage' @@ -30,13 +29,13 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // kotlin - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61" // google - implementation "com.android.support:appcompat-v7:${versions.googleSupport}" - implementation "com.android.support:support-v13:${versions.googleSupport}" - implementation "com.android.support:support-v4:${versions.googleSupport}" + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.legacy:legacy-support-v13:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' // testing - androidTestImplementation "com.android.support:support-annotations:${versions.googleSupport}" - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test:rules:1.0.1' + androidTestImplementation 'androidx.annotation:annotation:1.1.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test:rules:1.2.0' } diff --git a/example/android/app/src/main/java/com/goposse/fluro/activities/MainActivity.kt b/example/android/app/src/main/java/com/goposse/fluro/activities/MainActivity.kt index e6a2cfd..29f2875 100644 --- a/example/android/app/src/main/java/com/goposse/fluro/activities/MainActivity.kt +++ b/example/android/app/src/main/java/com/goposse/fluro/activities/MainActivity.kt @@ -9,7 +9,7 @@ import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity : FlutterActivity() { - private val LOG_TAG = "A:Main" + private val logTag = "A:Main" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -17,16 +17,13 @@ class MainActivity : FlutterActivity() { checkForLinkEvent(intent) } - override fun onResume() { - super.onResume() - } - private fun checkForLinkEvent(intent: Intent) { - if (intent.action == Intent.ACTION_VIEW && intent.data != null) { - val path = intent.data.getQueryParameter("path") - val text = intent.data.getQueryParameter("message") ?: "Why you don't enter text?" + val data = intent.data + if (intent.action == Intent.ACTION_VIEW && data != null) { + val path = data.getQueryParameter("path") + val text = data.getQueryParameter("message") ?: "Why you don't enter text?" if (path != null) { - Log.d(LOG_TAG, "Setting initial route to: $path?message=$text") + Log.d(logTag, "Setting initial route to: $path?message=$text") flutterView.setInitialRoute("$path?message=$text") } } diff --git a/example/android/build.gradle b/example/android/build.gradle index 7522b13..d78e801 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.2.30' + ext.kotlin_version = '1.3.61' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.5.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/config.gradle b/example/android/config.gradle index 0056f9b..3e6eeb6 100644 --- a/example/android/config.gradle +++ b/example/android/config.gradle @@ -1,13 +1,13 @@ ext.appInfo = [ - version: '1.3.0', + version: '1.6.0', build: 1, applicationID: "com.goposse.fluro" ] ext.versions = [ minSDK: 21, - targetSDK: 27, - buildTools: '27.0.3', - kotlin: '1.2.30', + targetSDK: 29, + buildTools: '29.0.3', + kotlin: '1.3.61', googleSupport: '27.1.0' ] \ No newline at end of file diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 8bd86f6..38c8d45 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1 +1,4 @@ org.gradle.jvmargs=-Xmx1536M +android.enableR8=true +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..c197596 --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/home/luke/Development/.sdks/flutter" +export "FLUTTER_APPLICATION_PATH=/home/luke/Development/yakka/fluro/fluro-flutter/example" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "FLUTTER_FRAMEWORK_DIR=/home/luke/Development/.sdks/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" diff --git a/example/ios/Runner/GeneratedPluginRegistrant.h b/example/ios/Runner/GeneratedPluginRegistrant.h index 3b700eb..ed9a5c6 100644 --- a/example/ios/Runner/GeneratedPluginRegistrant.h +++ b/example/ios/Runner/GeneratedPluginRegistrant.h @@ -7,8 +7,11 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface GeneratedPluginRegistrant : NSObject + (void)registerWithRegistry:(NSObject*)registry; @end +NS_ASSUME_NONNULL_END #endif /* GeneratedPluginRegistrant_h */ diff --git a/pubspec.yaml b/pubspec.yaml index 9b034b5..1f2c118 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ homepage: https://github.com/theyakka/fluro environment: sdk: ">=2.1.0 <3.0.0" - flutter: ">=1.2.0" + flutter: ">=1.5.0 <1.13.0" dependencies: flutter: