diff --git a/.github/workflows/pre-merge-checks.yml b/.github/workflows/pre-merge-checks.yml index 8df74ce..7f8d93e 100644 --- a/.github/workflows/pre-merge-checks.yml +++ b/.github/workflows/pre-merge-checks.yml @@ -17,7 +17,7 @@ jobs: steps: # Checkout repository - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -25,12 +25,12 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.29.0' # Specify exact version instead of just 'stable' + flutter-version: '3.38.5' # Specify exact version instead of just 'stable' channel: 'stable' # Cache Flutter dependencies to speed up workflow - name: Cache Flutter dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.pub-cache key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }} diff --git a/.github/workflows/publish-to-pubdev.yml b/.github/workflows/publish-to-pubdev.yml index 55f11b3..addaf66 100644 --- a/.github/workflows/publish-to-pubdev.yml +++ b/.github/workflows/publish-to-pubdev.yml @@ -17,7 +17,7 @@ jobs: - name: Install Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.29.2' + flutter-version: '3.38.5' channel: 'stable' - name: Install dependencies 📦 run: flutter pub get diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c7cd64..8f501e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0 +* Support of latest Android and iOS +* Improvements on example app + ## 0.2.3 * Minor changes diff --git a/analysis_options.yaml b/analysis_options.yaml index f17506e..55e5184 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -5,4 +5,8 @@ formatter: linter: rules: - lines_longer_than_80_chars: false \ No newline at end of file + lines_longer_than_80_chars: false + prefer_const_constructors: true + prefer_const_declarations: true + prefer_const_literals_to_create_immutables: true + avoid_catches_without_on_clauses: false diff --git a/android/.gitignore b/android/.gitignore index c6cbe56..880270b 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -6,3 +6,4 @@ .DS_Store /build /captures +/.cxx/* diff --git a/android/build.gradle.kts b/android/build.gradle.kts index de7e157..6b002da 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -1,8 +1,8 @@ -val kotlinVersion: String by project +import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { id("com.android.library") - id("org.jetbrains.kotlin.android") + id("kotlin-android") } allprojects { @@ -17,23 +17,18 @@ group = "com.victorblaess.native_flutter_proxy" android { namespace = "com.victorblaess.native_flutter_proxy" - ndkVersion = "26.3.11579264" - compileSdk = 35 + ndkVersion = "27.3.13750724" + compileSdk = 36 compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - sourceSets["main"].java.srcDirs("src/main/kotlin") defaultConfig { - minSdk = 16 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + minSdk = 23 } lint { @@ -41,7 +36,8 @@ android { } } -dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") - implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } } diff --git a/android/gradle.properties b/android/gradle.properties index 2fc4dad..94adc3a 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,3 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -agpVersion=8.7.0 -kotlinVersion=1.8.22 \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 3718116..a807037 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ #Thu Mar 27 10:21:41 CET 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts index c601fd0..b059a33 100644 --- a/android/settings.gradle.kts +++ b/android/settings.gradle.kts @@ -1,16 +1,26 @@ pluginManagement { - val agpVersion: String by settings - val kotlinVersion: String by settings + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { - gradlePluginPortal() google() mavenCentral() + gradlePluginPortal() } - plugins { - id("com.android.library") version agpVersion - id("org.jetbrains.kotlin.android") version kotlinVersion - } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.library") version "8.13.2" apply false + id("org.jetbrains.kotlin.android") version "2.3.0" apply false } rootProject.name = "native_flutter_proxy" diff --git a/example/.gitignore b/example/.gitignore index 0fa6b67..3820a95 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -5,9 +5,12 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ +migrate_working_dir/ # IntelliJ related *.iml @@ -24,15 +27,11 @@ **/doc/api/ **/ios/Flutter/.last_build_id .dart_tool/ -.flutter-plugins .flutter-plugins-dependencies -.packages .pub-cache/ .pub/ /build/ - -# Web related -lib/generated_plugin_registrant.dart +/coverage/ # Symbolication related app.*.symbols diff --git a/example/.metadata b/example/.metadata index 56bfc2c..a046c41 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,30 @@ # This file should be version controlled and should not be manually edited. version: - revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 - channel: stable + revision: "f6ff1529fd6d8af5f706051d9251ac9231c83407" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: android + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: ios + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/README.md b/example/README.md index a135626..154449a 100644 --- a/example/README.md +++ b/example/README.md @@ -1,6 +1,6 @@ # example -A new Flutter project. +native proxy example ## Getting Started @@ -8,9 +8,9 @@ This project is a starting point for a Flutter application. A few resources to get you started if this is your first Flutter project: -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, samples, guidance on mobile development, and a full API reference. diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 0caccc8..f46ca3b 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -1 +1,8 @@ -include: ../analysis_options.yaml \ No newline at end of file +include: package:flutter_lints/flutter.yaml + +linter: + rules: + lines_longer_than_80_chars: false + prefer_const_constructors: true + prefer_const_declarations: true + prefer_const_literals_to_create_immutables: true diff --git a/example/android/.gitignore b/example/android/.gitignore index 0a741cb..be3943c 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -5,7 +5,10 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java +.cxx/ # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties +**/*.keystore +**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle deleted file mode 100644 index 69135ec..0000000 --- a/example/android/app/build.gradle +++ /dev/null @@ -1,66 +0,0 @@ -plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -} - -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' -} - -android { - compileSdkVersion 34 - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.veebee.proxy.example.example" - minSdkVersion flutter.minSdkVersion - targetSdkVersion 30 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KotlinVersion" -} \ No newline at end of file diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts new file mode 100644 index 0000000..ce91094 --- /dev/null +++ b/example/android/app/build.gradle.kts @@ -0,0 +1,43 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +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") +} + +android { + namespace = "com.example.example" + compileSdk = 36 + ndkVersion = "27.3.13750724" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + applicationId = "com.example.example" + minSdk = flutter.minSdkVersion + targetSdk = 36 + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } +} + +flutter { + source = "../.." +} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index 207e1b6..399f698 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 7d207fc..74a78b9 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,11 +1,13 @@ - - + - - @@ -38,4 +31,15 @@ android:name="flutterEmbedding" android:value="2" /> + + + + + + + diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 0000000..ac81bae --- /dev/null +++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/example/android/app/src/main/kotlin/com/veebee/proxy/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/veebee/proxy/example/example/MainActivity.kt deleted file mode 100644 index 61b2141..0000000 --- a/example/android/app/src/main/kotlin/com/veebee/proxy/example/example/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.veebee.proxy.example.example - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml index 449a9f9..06952be 100644 --- a/example/android/app/src/main/res/values-night/styles.xml +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -3,14 +3,14 @@