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] full api redesign with DataStore and cache-less interface #5210

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

tarrinneal
Copy link
Contributor

@tarrinneal tarrinneal commented Oct 24, 2023

Full rework for shared_preferences, allows user to decide whether to use cache or be fully async and pull direct from the platform.

fixes flutter/flutter#123078
fixes flutter/flutter#133098
fixes flutter/flutter#65145
fixes flutter/flutter#64739
fixes flutter/flutter#151036

@tarrinneal tarrinneal changed the title first draft [shared_preferences] full api redesign Oct 30, 2023
@tarrinneal tarrinneal changed the title [shared_preferences] full api redesign [shared_preferences] full api redesign with cache-less option Oct 30, 2023
@tarrinneal tarrinneal marked this pull request as ready for review October 30, 2023 23:57
@tmpfs

This comment was marked as off-topic.

@stuartmorgan

This comment was marked as off-topic.

@tmpfs

This comment was marked as off-topic.

@stuartmorgan

This comment was marked as off-topic.

@tarrinneal tarrinneal requested review from hellohuanlin and removed request for cyanglaz November 21, 2023 23:48
@@ -41,6 +44,15 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making the java target higher in this rewrite (11 or 17)

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the current state of flutter tool enforcement on Java versions? Does the tooling require 11 now, or could someone be using 8?

If the tooling allows 8, I think having shared_preferences require something higher would be extremely disruptive, and we'd want to raise that floor tool-first rather than critical-package-first.

Copy link
Contributor

Choose a reason for hiding this comment

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

From offline discussion: It's still 8 at the tooling level for now. Given that, we should hold off, and update to 11/17 after the tool (on stable) has done so.

@hellohuanlin
Copy link
Contributor

@tarrinneal do you have a design doc that I can take a look before reviewing it?

@tarrinneal
Copy link
Contributor Author

@tarrinneal do you have a design doc that I can take a look before reviewing it?

https://docs.google.com/document/d/1DNhUYIJaDA10g2cOqipKyPuPkgL_FYPfgkF9Coqcc6k/edit

Might have changed the design a bit since I wrote it.

@tarrinneal
Copy link
Contributor Author

We should probably start brainstorming actual names in parallel with the rest of the review. Maybe AsyncSharedPreferences and CachedSharedPreferences?

CachedSharedPreferences seems incorrect. SharedPreferencesWithCache? I'm fine with either.

@tarrinneal
Copy link
Contributor Author

@stuartmorgan last chance if you want to do another pass on this now that it's just the front end.

@tarrinneal
Copy link
Contributor Author

Looks like tests are passing (besides mac flake), going to mark as auto merge!

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
Copy link
Contributor

auto-submit bot commented Jul 30, 2024

auto label is removed for flutter/packages/5210, due to - The status or check suite Mac_arm64 ios_platform_tests_shard_1 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
@auto-submit auto-submit bot merged commit 644000b into flutter:main Jul 30, 2024
76 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 31, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 31, 2024
flutter/packages@99e8606...46a712f

2024-07-31 [email protected] [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 [email protected] [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 [email protected] [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 [email protected] [shared_preferences] Platform implementations of async api (flutter/packages#6965)

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 [email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@xVemu
Copy link

xVemu commented Aug 1, 2024

setMockInitialValues is missing for SharedPreferencesWithCache

@tarrinneal
Copy link
Contributor Author

setMockInitialValues is missing for SharedPreferencesWithCache

You can set the cache manually when instantiating SharedPreferencesWithCache so there is no need for that method.

TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
flutter/packages@99e8606...46a712f

2024-07-31 [email protected] [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 [email protected] [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 [email protected] [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 [email protected] [shared_preferences] Platform implementations of async api (flutter/packages#6965)

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 [email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
flutter/packages@99e8606...46a712f

2024-07-31 [email protected] [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 [email protected] [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 [email protected] [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 [email protected] [shared_preferences] Platform implementations of async api (flutter/packages#6965)

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 [email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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
Projects
None yet
7 participants