Skip to content

Conversation

@camsim99
Copy link
Contributor

@camsim99 camsim99 commented May 3, 2023

Updates the README of the camera_android_camerax plugin with an overview and instructions as to how to use the plugin. Also adds CONTRIBUTING.md for further information on how to contribute to the plugin.

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.

@camsim99 camsim99 marked this pull request as ready for review May 3, 2023 16:46
@camsim99 camsim99 requested a review from bparrishMines May 3, 2023 16:46
Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

In webview_flutter, we added what lines to run to generate new apis and mocks. See: https://pub.dev/packages/webview_flutter_android#contributing. These were added as a response to feedback from external contributors.

currently uses to implement `camera`. Each of these classes uses an `InstanceManager`
(implementation in `instance_manager.dart`) to manage objects that are created by
the plugin implementation that map to objects of the same type created on the native
side. This plugin uses [`pigeon`][12] to communicate with native code, so each of
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is where you could include the location of the pigeon file as well as the exact command line to run. See: https://pub.dev/packages/webview_flutter_android#contributing

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally we should actually move that to a CONTRIBUTING.md; it's not relevant to plugin clients.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, this is in the section you already suggested moving. Sorry, I wasn't looking at the full context when I replied at first.

currently uses to implement `camera`. Each of these classes uses an `InstanceManager`
(implementation in `instance_manager.dart`) to manage objects that are created by
the plugin implementation that map to objects of the same type created on the native
side. This plugin uses [`pigeon`][12] to communicate with native code, so each of
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, this is in the section you already suggested moving. Sorry, I wasn't looking at the full context when I replied at first.

Copy link
Contributor

@bparrishMines bparrishMines 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 a couple nits

@@ -0,0 +1,46 @@
# Contributing to camera\_android\_camerax

## Plugin structure
Copy link
Contributor

Choose a reason for hiding this comment

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

not a blocker but I think this should start with an overview of the architecture @bparrishMines designed. Maybe linking the design doc or if not that then a 1 paragraph summary describing the structure.

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 one!

regenerate the communication layer by running
`dart run pigeon --input pigeons/camerax_library.dart` from the plugin root.

On the native side in `android/src/main/java/io/flutter/plugins/camerax/`, you'll
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider saying java/kotlin or android. Native means enough different things to different people that we should minimize the usage when a more accurate word choice is available.

`dart run pigeon --input pigeons/camerax_library.dart` from the plugin root.

On the native side in `android/src/main/java/io/flutter/plugins/camerax/`, you'll
find the Host API and Flutter API implementations of the same classes wrapped with
Copy link
Contributor

Choose a reason for hiding this comment

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

It would probably be helpful to articulate what host api and Flutter api mean in this context of native (or java ;) code.

in the native code map to objects created on the Dart side, and thus, are also
managed by an `InstanceManager` (implementation in `InstanceManager.java`).

If you need to access any Android classes to contribute to this plugin, you should
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand what this line through 30 is saying but I think it mixes architecture and instructions in a way that muddles what the author should use. If the architecture philosophy is include above then I think this can be shortened to "If CameraX or other Android classes do not have a duplicately named implementation in lib/src then follow the for more detail on how to add them.

you need are not wrapped or you need to access any methods not wrapped in a class,
you must take the additional steps to wrap them to maintain the structure of this plugin.

For more information on the approach of wrapping native libraries for plugins, please
Copy link
Contributor

Choose a reason for hiding this comment

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

Having read though this I think a bunch of the information only makes sense after understanding the architecture. A plain english version should be at the top along with a link to the design document.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh and @bparrishMines to help people ask questions and spread this pattern or even just write about it you should come up with a unique name for the pattern.

@@ -0,0 +1,46 @@
# Contributing to camera\_android\_camerax

## Plugin structure
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 one!

described above to add them.

For more information on the approach of wrapping native libraries for plugins,
please see the [design document][2] or contact [@bparrishmines][6] on any
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bparrishMines is mentioning you like this okay with you?

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't typically include references to our github accounts in the plugin. I think having https://github.com/flutter/packages/blob/main/CODEOWNERS should suffice. It also makes it easier to maintain since I will be added to all camera plugin PRs anyways.

Alternatively you could link to the ecosystem discord channel instead. Then anyone who is able to answer a question will be notified.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like both of those suggestions. In general it is a good idea not try not to encourage contacting a person. It is not great for the person or the one reaching out. (imagine someone 12h timezone offset from @bparrishMines 3 years from now)

@camsim99 camsim99 requested a review from reidbaker May 8, 2023 17:19
@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label May 8, 2023
@camsim99 camsim99 mentioned this pull request May 9, 2023
11 tasks
@auto-submit auto-submit bot merged commit 1f91710 into flutter:main May 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 9, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 9, 2023
flutter/packages@4800d65...1f91710

2023-05-09 [email protected] [camerax] Update README with plugin overview (flutter/packages#3891)
2023-05-09 [email protected] Fix nullability in docs (flutter/packages#3876)
2023-05-08 [email protected] [tools] Check version ranges when pathifying deps (flutter/packages#3943)
2023-05-08 [email protected] [quick_actions] Update minimum iOS version to 11 (flutter/packages#3946)
2023-05-08 [email protected] [shared_preferences] Update minimum iOS version to 11 (flutter/packages#3945)
2023-05-08 [email protected] [path_provider] Update minimum iOS version to 11 (flutter/packages#3944)
2023-05-08 [email protected] Adding setup for TestInstanceManagerHostApi in zoom and exposure tests (flutter/packages#3947)
2023-05-08 [email protected] Roll Flutter from 43ac23b to 4ed1c92 (16 revisions) (flutter/packages#3942)

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 [email protected],[email protected] 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
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
Updates the README of the `camera_android_camerax` plugin with an overview and instructions as to how to use the plugin. Also adds  `CONTRIBUTING.md` for further information on how to contribute to the plugin.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants