From 7ca070f00552f211b8978d701bc292da7217c2ff Mon Sep 17 00:00:00 2001 From: Tanay Neotia <50850142+tneotia@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:18:05 -0400 Subject: [PATCH 1/2] Indicate plugin will compile on JDK 17 --- android/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/android/build.gradle b/android/build.gradle index c25e978..4ed40b4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,6 +22,13 @@ android { minSdkVersion 16 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = '17' + } lintOptions { disable 'InvalidPackage' } From 624e9e74077dc3a9a42feca14f772dbc28f2f9f3 Mon Sep 17 00:00:00 2001 From: Zach Berger Date: Sun, 16 Feb 2025 17:22:27 +0530 Subject: [PATCH 2/2] Remove registerWith which has been long deprecated. This was removed from Flutter 3.29 so this method causes the plugin to no longer build. --- .../SecureApplicationPlugin.kt | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/android/src/main/kotlin/org/jezequel/secure_application/SecureApplicationPlugin.kt b/android/src/main/kotlin/org/jezequel/secure_application/SecureApplicationPlugin.kt index 4f0b3ac..a77098b 100644 --- a/android/src/main/kotlin/org/jezequel/secure_application/SecureApplicationPlugin.kt +++ b/android/src/main/kotlin/org/jezequel/secure_application/SecureApplicationPlugin.kt @@ -8,7 +8,6 @@ import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel.MethodCallHandler import io.flutter.plugin.common.MethodChannel.Result -import io.flutter.plugin.common.PluginRegistry.Registrar import android.view.WindowManager.LayoutParams; import androidx.lifecycle.Lifecycle import io.flutter.embedding.engine.plugins.activity.ActivityAware @@ -61,23 +60,6 @@ public class SecureApplicationPlugin: FlutterPlugin, MethodCallHandler, Activity // not used for now but might be used to add some features in the future } - // This static function is optional and equivalent to onAttachedToEngine. It supports the old - // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting - // plugin registration via this function while apps migrate to use the new Android APIs - // post-flutter-1.12 via https://flutter.dev/go/android-project-migration. - // - // It is encouraged to share logic between onAttachedToEngine and registerWith to keep - // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called - // depending on the user's project. onAttachedToEngine or registerWith must both be defined - // in the same class. - companion object { - @JvmStatic - fun registerWith(registrar: Registrar) { - val channel = MethodChannel(registrar.messenger(), "secure_application") - channel.setMethodCallHandler(SecureApplicationPlugin()) - } - } - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { if (call.method == "secure") { activity?.window?.addFlags(LayoutParams.FLAG_SECURE)