packages
packages copied to clipboard
[Camera] Add lens type information (iOS)
This PR adds lens type information. The goal is to identify whether the lens type is wide, ultra-wide, telephoto, etc., as discussed in https://github.com/flutter/flutter/issues/119908. The iOS implementation is complete, so lens data will now be populated on iOS.
- Introduces a new CameraLensType enum to provide lens type information about the camera (e.g.: ultra-wide, telephoto, ...)
- Adds lensType in the PlatformCameraDescription and CameraDescription classes
- Implements utility functions to convert between PlatformCameraLensType and CameraLensType.
- Updates auto-generated code (using Pigeon) to reflect these changes.
Current CameraDescription for iPhone 11
[
CameraDescription(
com.apple.avfoundation.avcapturedevice.built-in_video:0,
CameraLensDirection.back,
90
),
CameraDescription(
com.apple.avfoundation.avcapturedevice.built-in_video:1,
CameraLensDirection.front,
90
),
CameraDescription(
com.apple.avfoundation.avcapturedevice.built-in_video:5,
CameraLensDirection.back,
90
)
]
New CameraDescription for iPhone 11
[
CameraDescription(
com.apple.avfoundation.avcapturedevice.built-in_video:0,
CameraLensDirection.back,
90,
CameraLensType.wide
),
CameraDescription(
com.apple.avfoundation.avcapturedevice.built-in_video:1,
CameraLensDirection.front,
90,
CameraLensType.wide
),
CameraDescription(
com.apple.avfoundation.avcapturedevice.built-in_video:5,
CameraLensDirection.back,
90,
CameraLensType.ultraWide
)
]
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene page, which explains my responsibilities.
- [x] 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.) - [x] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I linked to at least one issue that this PR fixes in the description above.
- [x] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [x] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes. - [x] I updated/added relevant documentation (doc comments with
///). - [x] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
Please see https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins for information on how to make this PR pass CI checks, which is important for review.
Please see https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins for information on how to make this PR pass CI checks, which is important for review.
I made changes as specified by the docs, please let me if there's anything else I need to do
- [x] All existing and new tests are passing.
This PR is currently failing a substantial number of our CI checks, so this checkbox state is not accurate. If you click through the details of each CI task failure you can see the specific issues that will need to be fixed before this would be ready for review.
Hi @stuartmorgan, I fixed tests and most CI errors.
One of the remaining errors is related to versions and the changelog not being updated. But I think that some packages don't require version bumps since there are no changes. Could you confirm if this assumption is correct?
- camera_avfoundation, camera_platform_interface: Version already bumped and
CHANGELOG.mdupdated. - camera, camera_android, camera_android_camerax, camera_web, camera_windows: No changes, no version bump needed.
The other issue is with formatting. I ran the format command using Flutter Plugin Tools, but there's still an error in camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h. Should I manually update the formatting for this file?
But I think that some packages don't require version bumps since there are no changes. Could you confirm if this assumption is correct?
Yes; for packages that don't require any changes at all, you can just revert the dependency_override changes in those packages, at which point the CI will stop flagging them as issue.
The other issue is with formatting. I ran the format command using Flutter Plugin Tools, but there's still an error in
camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h. Should I manually update the formatting for this file?
This is probably due to a clang-format difference between your local tools and the CI; the CI is the authoritative version, so you'll need to match it by hand in this case, yes.
From triage: @lenzpaul Are you still planning on the discussion related to the enum values?
Note that there seems to be an error in the CI related to Package.resolved. I'm not sure how to resolve this. Could this maybe be related to the XCode version on the build machine? XCode 16.2 was just released...
Hi @stuartmorgan, this is now approved by @hellohuanlin. What are the next steps to merge it? And when would this be available for us to use? Thanks!
What are the next steps to merge it?
The cross-platform aspects (especially this discussion) still need to be reviewed by @bparrishMines
And when would this be available for us to use?
I'm not sure what you are asking exactly; when it lands depends on the review process, so I can't provide a date.
I'm unsubscribing from this, since as @lenzpaul mentioned in his compatibility table, this is not supported at all on the web platform. The web changes are only "pathified" dependencies so this PR can run tests.
@stuartmorgan I noticed is that camera_platform_interface 2.9.0 was released so I think I should bump my change to 2.10.0?
Is there anything I'd need to do to make this pass?
@lenzpaul The analyze error should have been fixed by https://github.com/flutter/packages/pull/8344/files. You should be able to merge in main to fix it.
@stuartmorgan @bparrishMines @ditman FYI I created https://github.com/flutter/packages/pull/8723
Status update from triage: The platform interface PR landed, so this is waiting for the implementation package PR to be extracted.
From triage: based on Discord discussion, updating this for the camera Swift conversion is in progress
From triage: the camera Swift conversion churn should be nearly complete; we will revisit this after that.
Greetings from stale PR triage! 👋 Is this still waiting on Swift conversion churn?
The relevant code has been converted to Swift, so this just needs to be reconciled against the current source and then can be landed.
I reconciled this with the changes that have landed in the meantime, most notably the native code file that was changed to Swift and the introduction of the protocols around the SDK types. @hellohuanlin Could you review my conversion of the CameraPlugin changes to Swift?
Thanks again @lenzpaul ! Sorry that the timing of this PR and the Swift migration ended up causing this to take a lot of extra time to land.
Great to see this merged! Thanks for your help with this