Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shared_preferences] Ports SharedPreferencesAndroid to Pigeon #3321

Merged
merged 22 commits into from
Apr 13, 2023

Conversation

AmanNegi
Copy link
Contributor

@AmanNegi AmanNegi commented Feb 28, 2023

This PR ports the SharedPreferences-Android to Pigeon. It was earlier created in flutter/plugins however it was ported to flutter/packages.

fixes flutter/flutter#95013
fixes flutter/flutter#117914

Previous PR: flutter/plugins#7015

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. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • [✅] I signed the CLA.
  • [✅] The title of the PR starts with the name of the package 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, or this PR is exempt from version changes.
  • [✅] I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • [✅] I updated/added relevant documentation (doc comments with ///).
  • [✅] I added new tests to check the change I am making, or this 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.

@tarrinneal
Copy link
Contributor

Have all of the requested changes from the closed pr been made?

@AmanNegi
Copy link
Contributor Author

AmanNegi commented Mar 1, 2023

Hey there @tarrinneal, I was requested by @stuartmorgan for a few changes however they were lost in the transition of moving from /plugins to /packages. I am working on those and will update you asap.

@stuartmorgan
Copy link
Contributor

  • [✅] The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]

Please don't check boxes without having done the checklist item; it defeats the point of the checklist.

@AmanNegi AmanNegi changed the title feat(Package): Ports SharedPreferencesAndroid to Pigeon [shared_preferences] Ports SharedPreferencesAndroid to Pigeon Mar 1, 2023
@AmanNegi
Copy link
Contributor Author

AmanNegi commented Mar 1, 2023

  • [✅] The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]

Please don't check boxes without having done the checklist item; it defeats the point of the checklist.

Sorry for that got carried in the switching transition, fixed it now. I did not receive any response regarding this. Let me know if it seems alright?

@stuartmorgan
Copy link
Contributor

I did not receive any response regarding this. Let me know if it seems alright?

You have not addressed my original comment, so no, this still has the same problem. This PR needs actual tests.

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

(Updating review status based on the above.)

@stuartmorgan
Copy link
Contributor

@AmanNegi Are you still planning on updating this PR with tests?

@AmanNegi
Copy link
Contributor Author

AmanNegi commented Mar 22, 2023

Yeah, but I'm unable to think as to how to test theSharedPreferences object and its functionalities. Only way is to mock all the functions.

  • I will provide you the updated tests, let me know if they are fine

@stuartmorgan
Copy link
Contributor

I'm unable to think as to how to test theSharedPreferences object

As explained previously, the goal is not to test SharedPreferences, it is to test the plugin's code, which is SharedPreferencesPlugin and MethodCallHandlerImpl.

@tarrinneal
Copy link
Contributor

adding @bparrishMines as a reviewer, since I can't review my own code in this pr

@tarrinneal tarrinneal removed their request for review April 12, 2023 01:05
private void setUp(@NonNull BinaryMessenger messenger, @NonNull Context context) {
preferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
try {
SharedPreferencesApi.setup(messenger, this);
Copy link
Contributor

Choose a reason for hiding this comment

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

When detaching from the engine this should be replaced with null to remove the handler.

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM with some final nits for things I missed. Thanks for getting this over the finish line!

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 13, 2023
@stuartmorgan
Copy link
Contributor

Tree status is stale here; overriding.

@stuartmorgan stuartmorgan added the warning: land on red to fix tree breakage Override tree-status signal (land even with closed tree), combine with the autosubmit label. label Apr 13, 2023
@auto-submit auto-submit bot merged commit 9852b41 into flutter:main Apr 13, 2023
@AmanNegi
Copy link
Contributor Author

Thanks a lot @tarrinneal for helping with this. Also special thanks for @stuartmorgan for maintaining the project and guiding us.

@tarrinneal
Copy link
Contributor

tarrinneal commented Apr 13, 2023

Thanks a lot @tarrinneal for helping with this. Also special thanks for @stuartmorgan for maintaining the project and guiding us.

Thank you for getting this going!

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 14, 2023
flutter/packages@d01f4ea...e4ec155

2023-04-14 stuartmorgan@google.com [shared_preferences] Remove Android lint baseline (flutter/packages#3707)
2023-04-13 37607224+AmanNegi@users.noreply.github.com [shared_preferences] Ports SharedPreferencesAndroid to Pigeon (flutter/packages#3321)
2023-04-13 10687576+bparrishMines@users.noreply.github.com [webview_flutter_android] Fix Android lint warnings (flutter/packages#3675)
2023-04-13 gautier.bayzelon@gmail.com [go_router_builder] Use only one .where() (flutter/packages#3698)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter from 3b4b149 to be45eb2 (21 revisions) (flutter/packages#3701)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
exaby73 pushed a commit to exaby73/flutter_nevercode that referenced this pull request Apr 17, 2023
flutter/packages@d01f4ea...e4ec155

2023-04-14 stuartmorgan@google.com [shared_preferences] Remove Android lint baseline (flutter/packages#3707)
2023-04-13 37607224+AmanNegi@users.noreply.github.com [shared_preferences] Ports SharedPreferencesAndroid to Pigeon (flutter/packages#3321)
2023-04-13 10687576+bparrishMines@users.noreply.github.com [webview_flutter_android] Fix Android lint warnings (flutter/packages#3675)
2023-04-13 gautier.bayzelon@gmail.com [go_router_builder] Use only one .where() (flutter/packages#3698)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter from 3b4b149 to be45eb2 (21 revisions) (flutter/packages#3701)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
…r#3321)

[shared_preferences] Ports SharedPreferencesAndroid to Pigeon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: shared_preferences platform-android warning: land on red to fix tree breakage Override tree-status signal (land even with closed tree), combine with the autosubmit label.
Projects
None yet
4 participants