This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Setup detectors to be called with options #652
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mravn-google
approved these changes
Jul 10, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
case "TextDetector#close": | ||
TextDetector.instance.close(result); | ||
image = filePathToVisionImage((String) call.argument("path"), result); | ||
if (image != null) TextDetector.instance.handleDetection(image, null, result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears brittle. result
must be called exactly once, but the code here does not enforce that on its own. Relying on another method to call result
iff it returns null
makes it easy to introduce an error later on.
public void close(MethodChannel.Result result) {} | ||
public void handleDetection( | ||
FirebaseVisionImage image, | ||
@Nullable Map<String, Object> options, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending a null map instead of the empty one is somewhat of an anti-pattern.
bparrishMines
force-pushed
the
with_options
branch
from
July 10, 2018 17:53
8b8ae5a
to
b3cdada
Compare
bparrishMines
force-pushed
the
with_options
branch
from
July 10, 2018 18:07
b3cdada
to
2634f5e
Compare
bparrishMines
force-pushed
the
with_options
branch
from
July 16, 2018 18:33
de94985
to
383ca5c
Compare
kmorkos
pushed a commit
to kmorkos/plugins
that referenced
this pull request
Jul 19, 2018
julianscheel
pushed a commit
to jusst-engineering/plugins
that referenced
this pull request
Mar 11, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Also removed close method to simplify implementation of detectors for version 0.0.2. On android, the api includes the close method, but not calling it doesn't seem to affect performance. Current implementation just initializes a new detector with options each time. This is easier for now since I'm working with an other developers who have already created an mlkit plugin. #646