Skip to content

Commit

Permalink
Merge pull request #1527 from gmackall/v1_embeddding_reference_removal
Browse files Browse the repository at this point in the history
Remove references to v1 embedding
  • Loading branch information
navaronbracke authored Jun 10, 2024
2 parents 7b3eebf + 62cb369 commit d4138e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -325,7 +293,6 @@ public void onAttachedToActivity(final ActivityPluginBinding binding) {
this.pluginBinding.getBinaryMessenger(),
(Application) this.pluginBinding.getApplicationContext(),
this.activityBinding.getActivity(),
null,
this.activityBinding);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d4138e2

Please sign in to comment.