Conversation
|
|
||
| @objc func setFocusPoint(_ call: CAPPluginCall) { | ||
| guard let x = call.getFloat("x"), let y = call.getFloat("y") else { | ||
| call.reject("x and y coordinates must be provided.") |
There was a problem hiding this comment.
Define the error at the top of the file as property.
| } | ||
|
|
||
| guard device.isFocusPointOfInterestSupported else { | ||
| throw RuntimeError("Focus point not supported") |
There was a problem hiding this comment.
Define this error message in the BarcodeScannerPlugin.swift file as property.
| Float y = call.getFloat("y"); | ||
|
|
||
| if (x == null || y == null) { | ||
| call.reject("x and y coordinates must be provided."); |
Co-authored-by: Robin Genz <mail@robingenz.dev>
Remove spurious catch block
|
real painful thing here is that I actually need continuous focus mode for my case - ios supports it cleanly with a 'continuousFocusMode' mode, but for Android, it seems we'd have to setup and manage a looper, which blows out the complexity of the change a bit (since we have to manage the lifecycle of that as well). I had actually built out this and added an option in the focusmodeoptions so that you can choose, but then decided to revert and ask what your preference would be for this? Are you ok with a slightly larger native implementation for focus mode (on the android side, in particular), or would you prefer to keep the implementation tighter and have the client code manage a loop instead (not as ideal for the ios side)? |
|
@CmdrDats I guess this would strongly increase the maintenance effort for a feature that has only been requested once so far and is rather special. For this reason, I am not currently planning to integrate such an implementation on Android. |
|
ok, cool - glad I held off on that part then, thanks. I can definitely work around it with this version of the implementation. |
|
Tested successfully again after changes on both Android and iOS with a client side continuous autofocus loop (3s interval timeout). |
| * | ||
| * Only available on Android and iOS. | ||
| * | ||
| * @since 8.0.0 |
There was a problem hiding this comment.
| * @since 8.0.0 | |
| * @since 7.3.0 |
Please run npm run docgen again.
| /** | ||
| * X coordinate (0.0 = left, 1.0 = right) | ||
| * | ||
| * @since 8.0.0 |
| /** | ||
| * Y coordinate (0.0 = top, 1.0 = bottom) | ||
| * | ||
| * @since 8.0.0 |
| * | ||
| * @since 8.0.0 | ||
| */ | ||
| x: number; |
There was a problem hiding this comment.
Let's make this property optional and the default value should be 0.5. What do you think? Then we can remove a few checks and exceptions in the native layer.
| * | ||
| * @since 8.0.0 | ||
| */ | ||
| y: number; |
There was a problem hiding this comment.
Let's make this property optional and the default value should be 0.5. What do you think? Then we can remove a few checks and exceptions in the native layer.
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run changeset).