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

[image_picker] Update README for image_picker's retrieveLostData() to support multiple files #4336

Merged
merged 2 commits into from
Sep 15, 2021

Conversation

reez12g
Copy link
Contributor

@reez12g reez12g commented Sep 11, 2021

issues fixed by this PR

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.

@mvanbeusekom
Copy link
Contributor

mvanbeusekom commented Sep 14, 2021

Hi @reez12g, thank you for the PR. Please make sure you update the CHANGELOG.md and pubspec.yaml files. Since the README is mostly read on pub.dev, updating the README.md is therefore considered a change that needs to be published and requires the patch number to be updated.

Also I feel the example code shown in the README is confusing and could be written in a better way (see comment).

Comment on lines 65 to 75
if (response.file != null) {
setState(() {
if (response.type == RetrieveType.video) {
_handleVideo(response.file);
} else {
_handleImage(response.file);
}
});
if (response.files.length >= 2 ) {
_imageFileList = response.files
} else {
setState(() {
if (response.type == RetrieveType.video) {
_handleVideo(response.file);
} else {
_handleImage(response.file);
}
}});
Copy link
Contributor

Choose a reason for hiding this comment

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

This example looks a bit confusing, as when dealing with multiple files it simply stores the list in the _imageFileList variable, while when dealing with a single file it is calling the _handleVideo() or _handleImage() method and updating the state (as per setState call). Seems these situations are handles very differently. Maybe you can update the code to a more simple example:

    if (response.files != null) {
      for(final XFile file in response.files) {
        _handleFile(file);  
      }
    } else {
      _handleError(response.exception);
    }

The above example simply shows how to handle lost data and leaves it to the implementing users to decide how to handle the files that are retrieved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mvanbeusekom
Thank you so much for your very thoughtful comments!
The example you wrote was very clear.
I've taken it in as a commit!

@reez12g
Copy link
Contributor Author

reez12g commented Sep 14, 2021

Hi @reez12g, thank you for the PR. Please make sure you update the CHANGELOG.md and pubspec.yaml files. Since the README is mostly read on pub.dev, updating the README.md is therefore considered a change that needs to be published and requires the patch number to be updated.

Also I feel the example code shown in the README is confusing and could be written in a better way (see comment).

Thanks for the comment! I'll check it out!

@reez12g
Copy link
Contributor Author

reez12g commented Sep 15, 2021

Hi @reez12g, thank you for the PR. Please make sure you update the CHANGELOG.md and pubspec.yaml files. Since the README is mostly read on pub.dev, updating the README.md is therefore considered a change that needs to be published and requires the patch number to be updated.
Also I feel the example code shown in the README is confusing and could be written in a better way (see comment).

Thanks for the comment! I'll check it out!

I updated the CHANGELOG.md and pubspec.yaml.

Copy link
Contributor

@mvanbeusekom mvanbeusekom left a comment

Choose a reason for hiding this comment

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

LGTM

@mvanbeusekom
Copy link
Contributor

@reez12g could you maybe rebase your PR on the master branch in an attempt to fix the failing build steps?

@reez12g
Copy link
Contributor Author

reez12g commented Sep 15, 2021

@mvanbeusekom

@reez12g could you maybe rebase your PR on the master branch in an attempt to fix the failing build steps?

It's done! Thank you very much.

However, the submit-queue is failing.
How can I solve this problem?

@reez12g
Copy link
Contributor Author

reez12g commented Sep 15, 2021

@mvanbeusekom

@reez12g could you maybe rebase your PR on the master branch in an attempt to fix the failing build steps?

It's done! Thank you very much.

However, the submit-queue is failing.
How can I solve this problem?

@mvanbeusekom
I'm sorry.
I've been waiting for a while, and the builds all succeeded...!

@mvanbeusekom
Copy link
Contributor

However, the submit-queue is failing.
How can I solve this problem?

Thank you for rebasing @reez12g, looking good now. The submit-queue step indicates if the code on the master branch currently is passing all CI tests. If it is not the submit-queue task will fail to prevent merging more code changes to an already faulty code base. In this case it looks like a flaky test is causing the problem and should pass when the build has re-run.

This is nothing related to your PR, I will add the wait for tree to go green label which will inform the Google Bot to automatically merge this PR when all is green.

@mvanbeusekom mvanbeusekom 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 Sep 15, 2021
@fluttergithubbot fluttergithubbot merged commit d217642 into flutter:master Sep 15, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 15, 2021
@reez12g
Copy link
Contributor Author

reez12g commented Sep 15, 2021

However, the submit-queue is failing.
How can I solve this problem?

Thank you for rebasing @reez12g, looking good now. The submit-queue step indicates if the code on the master branch currently is passing all CI tests. If it is not the submit-queue task will fail to prevent merging more code changes to an already faulty code base. In this case it looks like a flaky test is causing the problem and should pass when the build has re-run.

This is nothing related to your PR, I will add the wait for tree to go green label which will inform the Google Bot to automatically merge this PR when all is green.

I understand now!
Thank you so much for your kindness!

@reez12g reez12g deleted the fix/89722 branch September 15, 2021 10:15
@ditman
Copy link
Member

ditman commented Sep 15, 2021

This was merged before a fix for our CI landed, so even though the change has been correctly pushed to pub.dev, a tag for this failed to publish into the repo. This is not a big deal, but I just wanted to let you know why this is red in master.

The fix for CI has landed (right after this commit), so from now on the release action should be able to publish and tag new plugins.

Apologies for the inconvenience!

@reez12g
Copy link
Contributor Author

reez12g commented Sep 15, 2021

I understand! Thank you for taking the time to tell me!

@ditman
Copy link
Member

ditman commented Sep 15, 2021

Thanks again for the fix, keep them coming! 🙏

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 18, 2021
amantoux pushed a commit to amantoux/plugins that referenced this pull request Sep 27, 2021
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes p: image_picker 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.

4 participants