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

Conversation

@hellohuanlin
Copy link
Contributor

Breaking up CameraPlugin.m is part of optional cleanups discussed in the proposal. The monolithic CameraPlugin.m makes it hard to unit test other sub-tasks, so we want to do this clean up sooner.

Refactor the following types And added unit tests for them:

  • ResolutionPreset
  • VideoFormat
  • FocusMode
  • ExposureMode
  • DeviceOrientation

For some reason the left/right orientation is flipped, but this seems to be intentional for some unknown reason: https://github.com/flutter/plugins/pull/3390/files#r793213256

No version change: just moving code

Issue here: flutter/flutter#96429

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/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin 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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@hellohuanlin hellohuanlin force-pushed the camera_refactor_other_enums branch from e4b1a51 to 0d5d94f Compare January 27, 2022 02:59
XCTAssertEqual(UIDeviceOrientationLandscapeRight,
FLTGetUIDeviceOrientationForString(@"landscapeLeft"));
XCTAssertEqual(UIDeviceOrientationLandscapeLeft,
FLTGetUIDeviceOrientationForString(@"landscapeRight"));
Copy link
Contributor Author

@hellohuanlin hellohuanlin Jan 27, 2022

Choose a reason for hiding this comment

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

For some reason the left/right orientation is flipped, but this seems to be intentional for some undocumented reasons: https://github.com/flutter/plugins/pull/3390/files#r793213256

@hellohuanlin hellohuanlin marked this pull request as ready for review January 27, 2022 04:04
@hellohuanlin hellohuanlin requested review from cyanglaz, jmagman and stuartmorgan-g and removed request for bparrishMines January 27, 2022 04:05
@@ -0,0 +1,19 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

I like the idea of splitting out things from CameraPlugin but this seems excessive, each header only has like 2 functions/typedef in them, and the function implementations are super simple. There's more boilerplate than logic in some of them. Same with the tests, I don't think we need 5 new test files each containing ~10 lines of asserts.

There's no fast rules here, it's preference, but lots of little interrelated files are hard to navigate, too.

What about a CameraProperties.h/m with everything you split out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the CameraProperties.h/m approach. Will update.


#import "ExposureMode.h"

NSString *FLTGetStringForFLTExposureMode(FLTExposureMode mode) {
Copy link
Member

Choose a reason for hiding this comment

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

Missing Swift enums yet? 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, it's in the header file

@hellohuanlin hellohuanlin requested a review from jmagman January 27, 2022 19:48
@hellohuanlin hellohuanlin force-pushed the camera_refactor_other_enums branch from 5e1399e to 39d5bae Compare January 27, 2022 19:55
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

LGTM

@hellohuanlin hellohuanlin added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

p: camera platform-ios waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants