Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[path_provider] started supporting background platform channels #4443

Merged
merged 2 commits into from
Oct 28, 2021

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Oct 21, 2021

Made path_provider execute on background platform channels when it is available instead of managing its own thread.

b/203709390
issue: flutter/flutter#91635

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@google-cla google-cla bot added the cla: yes label Oct 21, 2021
@gaaclarke gaaclarke force-pushed the path_provider_background branch 4 times, most recently from bd74fd4 to 8cc0451 Compare October 22, 2021 00:13
@gaaclarke gaaclarke requested a review from blasten October 22, 2021 00:16
@gaaclarke
Copy link
Member Author

@blasten This works with local testing. Let me know what else you think we need to do. Ideally this would have automated tests.

@@ -2,7 +2,7 @@ name: path_provider
description: Flutter plugin for getting commonly used locations on host platform file systems, such as the temp and app data directories.
repository: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
version: 2.0.5
version: 2.0.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a higher version constraint on Flutter SDK. I'm not sure if that means it also needs a minor or major version bump.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I see, you're using reflection for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should really have been a minor version update anyway, since this is a change to "add functionality in a backwards compatible manner" (the semver spec description for when to make a minor change), rather than a bug fix.

@dnfield
Copy link
Contributor

dnfield commented Oct 22, 2021

It'd be great if you could test this out in Google's internal repo. Change LGTM though, but would defer to @blasten

channel =
constructor.newInstance(messenger, channelName, StandardMethodCodec.INSTANCE, taskQueue);
impl = new PathProviderBackgroundThread();
Log.d(TAG, "use taskqueues");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to leave this in, make it a full sentence

@gaaclarke gaaclarke force-pushed the path_provider_background branch from 8cc0451 to fbf02ac Compare October 25, 2021 16:45
@gaaclarke
Copy link
Member Author

If we run integration tests against master channel and stable channel the existing tests should be sufficient since the master channel will hit the TaskQueues and the stable will run the old code. I verified locally on the master channel that it is using TaskQueues.

.build());
private PathProviderImpl impl;

private interface PathProviderImpl {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: *Impl is usually used for the implementation of an interface.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added docstring to clarify its purpose.

void getApplicationSupportDirectory(@NonNull Result result);
}

private class PathProviderPlatformThread implements PathProviderImpl {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the shim, could it have a name that is easier to map to the reason why this class exists?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added docstring to clarify its purpose. I couldn't pack all that information into a name. This is something that exists temporarily so between the documentation and the good enough name, hopefully that's satisfactory.

@gaaclarke gaaclarke force-pushed the path_provider_background branch from fbf02ac to 9705580 Compare October 27, 2021 22:10
@gaaclarke gaaclarke marked this pull request as ready for review October 27, 2021 23:13
@gaaclarke gaaclarke added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Oct 27, 2021
@gaaclarke gaaclarke merged commit 93f0483 into flutter:master Oct 28, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 28, 2021

public PathProviderPlugin() {}

private void setup(BinaryMessenger messenger, Context context) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remember when naming methods that "setup" is a noun, and "set up" is a verb, so a method (which should be named with a verb) should be called "setUp". I'm aware that Pigeon has this issue, but we shouldn't spread it beyond there.

NickalasB added a commit to NickalasB/plugins that referenced this pull request Nov 4, 2021
* master:
  [webview_flutter] Deprecate evaluateJavascript in favour of runJavaScript and runJavaScriptForResult. (flutter#4403)
  [webview_flutter] Add interface methods to load local files and HTML strings. (flutter#4446)
  [ci] add pedantic dep to new in_app_purchase pkgs (flutter#4471)
  [ci] Remove unused dep from file_selector. (flutter#4468)
  [ci] update build_runner dep in android_intent and file_selector example (flutter#4467)
  [webview_flutter] Add platform interface method `loadRequest`. (flutter#4450)
  Remove -Werror from deprecated plugin Android builds (flutter#4466)
  [webview_flutter] Update webview packages for Android and iOS to implement `runJavascript` and `runJavascriptReturningResult`. (flutter#4402)
  [camera] Fix CamcorderProfile Usages (flutter#4423)
  [google_sign_in] Use a transparent image as a placeholder for the `GoogleUserCircleAvatar` (flutter#4391)
  [in_app_purchase]IAP/platform interface add cancel status (flutter#4093)
  [image_picker] doc:readme image picker misprints (flutter#4421)
  Support Hybrid Composition through the GoogleMaps Widget (flutter#4082)
  [path_provider] started supporting background platform channels (flutter#4443)
  [device_info] started using Background Platform Channels (flutter#4456)

# Conflicts:
#	packages/webview_flutter/webview_flutter/CHANGELOG.md
#	packages/webview_flutter/webview_flutter/pubspec.yaml
amantoux pushed a commit to amantoux/plugins that referenced this pull request Dec 11, 2021
…ter#4443)

* [path_provider] started supporting background platform channels

* added docstrings
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
…ter#4443)

* [path_provider] started supporting background platform channels

* added docstrings
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes p: path_provider platform-android waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants