From 7c5ff40ed3dab46678017395b9d03d3ae88912dc Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Fri, 7 Jun 2024 10:58:01 -0700 Subject: [PATCH 1/2] remove references to v1 embedding --- .../plugin/filepicker/FilePickerPlugin.java | 43 +++---------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java index d03a5d76..614901fc 100644 --- a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java +++ b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java @@ -23,7 +23,6 @@ import io.flutter.plugin.common.EventChannel; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.common.PluginRegistry; /** * FilePickerPlugin @@ -116,29 +115,6 @@ public void onActivityStopped(final Activity activity) { private static boolean withData = false; private static int compressionQuality; - /** - * Plugin registration. - */ - public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) { - - if (registrar.activity() == null) { - // If a background flutter view tries to register the plugin, there will be no activity from the registrar, - // we stop the registering process immediately because the ImagePicker requires an activity. - return; - } - - final Activity activity = registrar.activity(); - Application application = null; - if (registrar.context() != null) { - application = (Application) (registrar.context().getApplicationContext()); - } - - final FilePickerPlugin plugin = new FilePickerPlugin(); - plugin.setup(registrar.messenger(), application, activity, registrar, null); - - } - - @SuppressWarnings("unchecked") @Override public void onMethodCall(final MethodCall call, final MethodChannel.Result rawResult) { @@ -258,7 +234,6 @@ private void setup( final BinaryMessenger messenger, final Application application, final Activity activity, - final PluginRegistry.Registrar registrar, final ActivityPluginBinding activityBinding) { this.activity = activity; @@ -278,18 +253,11 @@ public void onCancel(final Object arguments) { } }); this.observer = new LifeCycleObserver(activity); - if (registrar != null) { - // V1 embedding setup for activity listeners. - application.registerActivityLifecycleCallbacks(this.observer); - registrar.addActivityResultListener(this.delegate); - registrar.addRequestPermissionsResultListener(this.delegate); - } else { - // V2 embedding setup for activity listeners. - activityBinding.addActivityResultListener(this.delegate); - activityBinding.addRequestPermissionsResultListener(this.delegate); - this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding); - this.lifecycle.addObserver(this.observer); - } + // V2 embedding setup for activity listeners. + activityBinding.addActivityResultListener(this.delegate); + activityBinding.addRequestPermissionsResultListener(this.delegate); + this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding); + this.lifecycle.addObserver(this.observer); } private void tearDown() { @@ -325,7 +293,6 @@ public void onAttachedToActivity(final ActivityPluginBinding binding) { this.pluginBinding.getBinaryMessenger(), (Application) this.pluginBinding.getApplicationContext(), this.activityBinding.getActivity(), - null, this.activityBinding); } From 62cb36962beeb16f50628fd01fbc0a6e8c5de167 Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Fri, 7 Jun 2024 12:51:00 -0700 Subject: [PATCH 2/2] pubspec+changelog --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce1feee..bccfaeea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 8.0.4 +### Android +Removes references to Flutter v1 android embedding classes. + ## 8.0.3 ### Web Fixes a TypeError with `pickFiles()` when using the HTML renderer. diff --git a/pubspec.yaml b/pubspec.yaml index 8f2c8b16..42771cb2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker repository: https://github.com/miguelpruivo/flutter_file_picker issue_tracker: https://github.com/miguelpruivo/flutter_file_picker/issues -version: 8.0.3 +version: 8.0.4 dependencies: flutter: