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

[camera_avfoundation] 🐛 Fix inverted orientation strings #5261

Merged
merged 4 commits into from
Oct 31, 2023

Conversation

AlexV525
Copy link
Member

@AlexV525 AlexV525 commented Oct 30, 2023

Tests are also updated correspondingly.

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.

@AlexV525 AlexV525 marked this pull request as ready for review October 30, 2023 04:58
@@ -104,9 +104,9 @@ UIDeviceOrientation FLTGetUIDeviceOrientationForString(NSString *orientation) {
switch (orientation) {
case UIDeviceOrientationPortraitUpsideDown:
return @"portraitDown";
case UIDeviceOrientationLandscapeRight:
return @"landscapeLeft";
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you dig into the history and see why we had this flipped before? was it just a mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. This should be a mistake when learning the relation between AVCaptureVideoOrientation, UIInterfaceOrientation, and UIDeviceOrientation.

AVCaptureVideoOrientation should be flipped with the corresponding UIDeviceOrientation by applying the affine transform, which typically means:

  • AVCaptureVideoOrientationLandscapeLeft <=> UIDeviceOrientationLandscapeRight
  • AVCaptureVideoOrientationLandscapeRight <=> UIDeviceOrientationLandscapeLeft

But the previous PR over-handled the implementation by replacing those string results too, which makes it a mistake. The value corresponding to orientation strings should always be as-is.

See also: https://stackoverflow.com/questions/7845520/why-does-avcapturevideoorientation-landscape-modes-result-in-upside-down-still-i

@AlexV525 AlexV525 added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 31, 2023
@auto-submit auto-submit bot merged commit 7dff4f1 into flutter:main Oct 31, 2023
79 checks passed
@AlexV525 AlexV525 deleted the fix/orientation branch October 31, 2023 23:17
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 1, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 1, 2023
flutter/packages@c9fec61...6ad40b9

2023-11-01 engine-flutter-autoroll@skia.org Roll Flutter from e12d1a7 to 29b2516 (34 revisions) (flutter/packages#5290)
2023-11-01 stuartmorgan@google.com [file_selector] Updates iOS to Pigeon 13 (flutter/packages#5268)
2023-10-31 github@alexv525.com [camera_avfoundation] � Fix inverted orientation strings (flutter/packages#5261)
2023-10-31 43054281+camsim99@users.noreply.github.com [tool] Add option for Android compile SDK version to update-dependencies command (flutter/packages#5010)
2023-10-31 stuartmorgan@google.com [video_player] Update iOS/macOS to Pigeon 13 (flutter/packages#5270)
2023-10-31 tessertaha@gmail.com [video_player] Update example app to replace `ButtonBar` with `OverflowBar` (flutter/packages#5274)
2023-10-31 stuartmorgan@google.com [image_picker] Update iOS to Pigeon 13 (flutter/packages#5266)

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://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
HugoOlthof pushed a commit to moneybird/packages that referenced this pull request Dec 13, 2023
@reidbaker reidbaker mentioned this pull request Jan 12, 2024
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: camera platform-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[camera][ios] Landscape orientation seems to be inverted on iOS The camera customization UI is upside down
2 participants