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

Conversation

@franciscojma86
Copy link
Contributor

@franciscojma86 franciscojma86 commented Dec 9, 2019

Description

Adds the macos implementation of the shared_preferences plugin.
Tested by adding a example app that runs the e2e tests.

Related Issues

Fixes flutter/flutter#41718

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • 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 signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

Copy link
Contributor

@collinjackson collinjackson 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 minor nits; I made some changes to your CHANGELOGs to describe what actually changed.

@@ -1,3 +1,7 @@
## 0.1.0+1

* Adds `package:shared_preferences_macos`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Adds `package:shared_preferences_macos`.
* Increase minimum Flutter SDK to 1.12.8.

Would it make sense to do this change in a separate PR?

@@ -1,3 +1,7 @@
## 1.0.1

* Adds `package:shared_preferences_macos`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Adds `package:shared_preferences_macos`.
* Increase minimum Flutter SDK to 1.12.8.

Would it make sense to do this change in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was required by the CI tests. Failing if the version wasn't increased.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, another PR was landed before this one, changing the version and changelog covering your suggestion. I still had to bump the version and the only change was adding the macos package.

import 'package:e2e/e2e.dart';

void main() {
E2EWidgetsFlutterBinding.ensureInitialized();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that e2e tests should live in the app-facing plugin, not the platform implementation. Otherwise they'll be duplicated for every platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But these are the only test we have for the package. IIUC, If somebody edits the package and breaks it, the app-facing plugin wouldn't detect it, is that right?

If we don't need them here, then we don't need the example app at all since that was it's only purpose.

Copy link
Contributor

@collinjackson collinjackson Dec 10, 2019

Choose a reason for hiding this comment

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

I think it makes sense to have the app-facing plugin's example app include every endorsed platform implementation, not just iOS and Android.

For plugins that have lightweight e2e integration tests like this one, we can teach our CI to run tests using the app-facing plugin's example app for every endorsed platform implementation, using a path dependency. That doesn't need to happen to land this PR, but I think we should file an issue and start heading in that direction.

We can also have heavyweight integration tests involving a native UI / lifecycle interaction, and in fact I'm planning to land an Espresso test of shared_preferences as soon as #2369 lands. I think these tests should still live in the app-facing plugin though, so that they can share the Dart code of the example app.

@amirh may have opinions about this as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this pr adds macos testing on the app-facing plugin. #2386 This example app was suggested by @amirh to be able to test the macos package and be "self contained". I'm wondering if we need them since once that pr is landed, any changes to the macos plugin will trigger the app-facing tests which will run the macos implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine for now but let's figure out how to share example app code in the future. It seems like we may be able to do it with dependency overrides.

Filed flutter/flutter#46716 (maybe we can reference that in a TODO?)

runApp(MyApp());
}

class MyApp extends StatelessWidget {
Copy link
Contributor

@collinjackson collinjackson Dec 10, 2019

Choose a reason for hiding this comment

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

Do we need to have this app? It seems like it would be preferable to re-use the app-facing plugin's example app.

@franciscojma86 franciscojma86 merged commit 7c01e67 into flutter:master Dec 10, 2019
eugenejeonme added a commit to COMANDKEYINC/flutter_plugins that referenced this pull request Dec 11, 2019
…tter#2385)"

This reverts commit 7c01e67.

# Conflicts:
#	packages/shared_preferences/shared_preferences_platform_interface/CHANGELOG.md
#	packages/shared_preferences/shared_preferences_platform_interface/pubspec.yaml
sungmin-park pushed a commit to sungmin-park/flutter-plugins that referenced this pull request Dec 17, 2019
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[shared_preferences] Add macOS support

4 participants