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

[macOS] Provide support for image_picker #85100

Closed
uc-dve opened this issue Jun 23, 2021 · 4 comments · Fixed by flutter/packages#3882
Closed

[macOS] Provide support for image_picker #85100

uc-dve opened this issue Jun 23, 2021 · 4 comments · Fixed by flutter/packages#3882
Assignees
Labels
a: desktop Running on desktop p: image_picker The Image Picker plugin. P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. platform-mac Building on or for macOS specifically

Comments

@uc-dve
Copy link

uc-dve commented Jun 23, 2021

First of all this plugin is awesome.
There is a request, if you could also provide macos support.

@TahaTesser TahaTesser added the in triage Presently being triaged by the triage team label Jun 25, 2021
@TahaTesser
Copy link
Member

Hi @uc-dve
For desktop, you need to use file_picker
Closing. If you disagree, please write in the comments and I will reopen it.
Thank you

@TahaTesser TahaTesser added r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team labels Jun 25, 2021
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
@stuartmorgan
Copy link
Contributor

Re-opening; this isn't invalid. We provide an implementation on Windows that serves as an adapter for file_selector, and there's no reason we shouldn't do the same on macOS.

@stuartmorgan stuartmorgan reopened this Jun 9, 2022
@stuartmorgan stuartmorgan added plugin platform-mac Building on or for macOS specifically a: desktop Running on desktop P3 Issues that are less important to the Flutter project p: file_selector The file_selector plugin and removed r: invalid Issue is closed as not valid labels Jun 9, 2022
@TahaTesser TahaTesser changed the title Macos support in image_picker [macOS] Provide support for image_picker Jun 9, 2022
@stuartmorgan stuartmorgan added p: image_picker The Image Picker plugin. and removed p: file_selector The file_selector plugin labels Aug 31, 2022
@stuartmorgan
Copy link
Contributor

In addition to the file_selector wrapper option, we can use PHPickerViewController on macOS 13+.

@stuartmorgan stuartmorgan self-assigned this May 1, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this issue Jun 10, 2023
(This is the combination PR for overall review.)

This adds initial desktop support across all three desktop platforms:
- Adds the concept of a camera delegation as discussed in flutter/flutter#102115, and adds a helper base class at the platform interface level for implementations that want to use that approach. (Sharing it simplifies both the platform implementations and the client usage.)
- Adds a new app-facing and platform-interface API to check at runtime for support for a given source, to make writing code using `image_picker` in a world of dynamic camera support viable. (In particular this is critical for published packages that use `image_picker`, as they won't know in advance if a client app will have a delegate set up).
- Updates the Windows implementation to:
  - use the new delegation base class
  - implement the newer `getImageFromSource` API as an opportunistic fix while changing the code (if not implemented, it would fall back to `getImage`)
  - use new APIs in its example.
- Made macOS and Linux implementations that are clones of the Windows approach. They are both slightly simpler however, as MIME type (for Linux) and UTI (for macOS) allow creating generic "image" and "video" filters instead of having to hard-code a file extension list.

Since in my opinion this level of support is sufficient to allow basic real-world use of the desktop implementations, due to having a structure in place for handling camera support, this includes endorsing the desktop implementations. It is still the case that desktop does not support image resizing, which isn't ideal, but I don't think we should block on that. It is clearly documented in the README.

The desktop implementations are separate packages even though they are mostly the same right now because:
- the amount of (non-example) code being duplicated is small, and
- it makes it much easier for us to change platform implementations over time; e.g., recent versions of macOS support `PHPicker`, meaning we can later add native code for that to the macOS implementation, with just a fallback to the current `file_selector` wrapper. It's plausible that better native options for Windows and/or Linux may become available in the future as well.

Fixes flutter/flutter#102115
Fixes flutter/flutter#102320
Fixes flutter/flutter#85100
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
nksteven pushed a commit to nksteven/ez_image_picker that referenced this issue Aug 29, 2023
(This is the combination PR for overall review.)

This adds initial desktop support across all three desktop platforms:
- Adds the concept of a camera delegation as discussed in flutter/flutter#102115, and adds a helper base class at the platform interface level for implementations that want to use that approach. (Sharing it simplifies both the platform implementations and the client usage.)
- Adds a new app-facing and platform-interface API to check at runtime for support for a given source, to make writing code using `image_picker` in a world of dynamic camera support viable. (In particular this is critical for published packages that use `image_picker`, as they won't know in advance if a client app will have a delegate set up).
- Updates the Windows implementation to:
  - use the new delegation base class
  - implement the newer `getImageFromSource` API as an opportunistic fix while changing the code (if not implemented, it would fall back to `getImage`)
  - use new APIs in its example.
- Made macOS and Linux implementations that are clones of the Windows approach. They are both slightly simpler however, as MIME type (for Linux) and UTI (for macOS) allow creating generic "image" and "video" filters instead of having to hard-code a file extension list.

Since in my opinion this level of support is sufficient to allow basic real-world use of the desktop implementations, due to having a structure in place for handling camera support, this includes endorsing the desktop implementations. It is still the case that desktop does not support image resizing, which isn't ideal, but I don't think we should block on that. It is clearly documented in the README.

The desktop implementations are separate packages even though they are mostly the same right now because:
- the amount of (non-example) code being duplicated is small, and
- it makes it much easier for us to change platform implementations over time; e.g., recent versions of macOS support `PHPicker`, meaning we can later add native code for that to the macOS implementation, with just a fallback to the current `file_selector` wrapper. It's plausible that better native options for Windows and/or Linux may become available in the future as well.

Fixes flutter/flutter#102115
Fixes flutter/flutter#102320
Fixes flutter/flutter#85100
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop p: image_picker The Image Picker plugin. P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. platform-mac Building on or for macOS specifically
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants