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

[image_picker] Add desktop support - implementations #4172

Merged

Conversation

stuartmorgan
Copy link
Contributor

Platform implementation portion of
#3882

Updates the Windows implementation to use the new base class for camera delegation, and creates new macOS and Linux implementations that are near-duplicates.

These are separate packages, rather than a single shared package, because it's likely that they will diverge over time (e.g., the TODO for macOS to use a system image picker control on newer versions of macOS), and the amount of code that could be shared is minimal anyway.

Part of flutter/flutter#102115 Part of flutter/flutter#102320 Part of flutter/flutter#85100

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.

Platform implementation portion of
flutter#3882

Updates the Windows implementation to use the new base class for camera
delegation, and creates new macOS and Linux implementations that are
near-duplicates.

These are separate packages, rather than a single shared package,
because it's likely that they will diverge over time (e.g., the TODO for
macOS to use a system image picker control on newer versions of macOS),
and the amount of code that could be shared is minimal anyway.

Part of flutter/flutter#102115
Part of flutter/flutter#102320
Part of flutter/flutter#85100
/// Linux.
class ImagePickerLinux extends CameraDelegatingImagePickerPlatform {
/// Constructs a platform implementation.
ImagePickerLinux();
Copy link
Member

Choose a reason for hiding this comment

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

Could this be const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't generally make our platform implementation classes const. I don't think there's much benefit to it, and it would lock them into being const forever without a breaking change. Is there any real upside to it?

/// macOS.
class ImagePickerMacOS extends CameraDelegatingImagePickerPlatform {
/// Constructs a platform implementation.
ImagePickerMacOS();
Copy link
Member

Choose a reason for hiding this comment

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

Similar question here (and probably for Windows).

Copy link
Member

@cbracken cbracken 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 one (x3) minor nit.

Copy link
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

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

A few small things.

Comment on lines 30 to 33
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{image_picker_platform_interface: {path: ../../../image_picker/image_picker_platform_interface}}
Copy link
Contributor

Choose a reason for hiding this comment

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

You're probably already aware this is still here.

Copy link
Contributor

Choose a reason for hiding this comment

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

the others as well, the platform changes have landed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, apparently I screwed up my search (and didn't review the final diff). Fixed.

}

// `preferredCameraDevice` and `maxDuration` arguments are not currently
// supported. If any of these arguments is supplied, they will be silently
Copy link
Contributor

Choose a reason for hiding this comment

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

optional nit: any vs either. Technically any is fine though.

is should be are though, as these are countable, plural, options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed everywhere.

}

// `maxWidth`, `maxHeight`, and `imageQuality` arguments are not currently
// supported. If any of these arguments is supplied, they will be silently
Copy link
Contributor

Choose a reason for hiding this comment

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

same is -> are

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed everywhere.

// arguments are not supported on Windows. If any of these arguments
// is supplied, it'll be silently ignored by the Windows version of
// the plugin. `source` is not implemented for `ImageSource.camera`
// and will throw an exception.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't these deleted comments still be here in some capacity?

Copy link
Contributor

Choose a reason for hiding this comment

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

or rather, "deprecation" comments, if there is a newer method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added short comments explaining the soft-deprecation and pointing to the new methods, for all three platforms.

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 9, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 9, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 9, 2023

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

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 9, 2023
@auto-submit auto-submit bot merged commit ecf2b68 into flutter:main Jun 9, 2023
@stuartmorgan stuartmorgan deleted the image-picker-macos-linux-impls branch June 9, 2023 23:38
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 12, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 12, 2023
flutter/packages@afe2f05...c9865e8

2023-06-11 engine-flutter-autoroll@skia.org Roll Flutter from da127f1 to 3df163f (25 revisions) (flutter/packages#4183)
2023-06-10 stuartmorgan@google.com [image_picker] Add desktop support (flutter/packages#3882)
2023-06-09 tarrinneal@gmail.com [image_picker] getMedia platform changes (flutter/packages#4174)
2023-06-09 stuartmorgan@google.com [image_picker] Add desktop support - implementations (flutter/packages#4172)
2023-06-09 engine-flutter-autoroll@skia.org Roll Flutter from 6e254a3 to da127f1 (28 revisions) (flutter/packages#4170)
2023-06-09 32538273+ValentinVignal@users.noreply.github.com [go_router_builder] Include required and positional query parameters in the location (flutter/packages#4163)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants