-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add tap to focus and fix orientation #35014
Conversation
@ishpaul777 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@janicduplessis Can you please guide me through the steps to build the ios app of physical device. I couldn't figure it out on my own |
Hey @ishpaul777! Not sure if there is an easier way, but what I did is use my own developer account to sign the app and run it on device. You can do it with the following changes:
Then it should build, you might need to authorize your dev account on your phone, it should tell you how to when you run the app the first time. |
Thanks for detailed steps @janicduplessis, I am able to build the app successfully 🎉 |
A kind request, Can you please add steps for local and QA testing |
I added the steps in the PR description, lmk if it is clear. |
@ishpaul777 added test steps for the orientation fix |
Thanks for adding steps @mountiny @janicduplessis! Focus seems to be working as expected, and App ui does not rotate. But the camera still rotates and picture is not taken in portrait.
RPReplay_Final1706525483.MP4 |
@ishpaul777 this is the issue in main currently: RPReplay_Final1706528549.mp4The problem seems to be not really a landscape/ portrait but if the phone is laying flat or standing, then the angle changes 🤔 Honestly in your video it seems fine, can you also test laying the phone flat and then straighten it up? |
Even the picture was taken correctly I think |
Sorry, maybe i misunderstood the problem, i'll test again 👍 |
The problem was with auto-rotation turned off in settings, so i never faced the issue on main. Now it seems to work well when auto rotation is on the issue on main Is fixed 🎉 The behaviour in video #35014 (comment) seems correct now i fully understand the issue 👍 Sorry for misunderstanding |
Yeah sorry it's hard to explain so I included the video :D |
Thanks! Sounds like we can do the checklist now, thanks for a quick turn around |
Reviewer Checklist
Screenshots/VideosAndroid: NativeRecord_2024-02-01-18-38-03.mp4iOS: Native1ca1c6a0-eeb9-47eb-ae01-01db417daadf.mp4 |
@mountiny I completely forgot about the orientation fix, thanks! |
I will look into the warning |
Any updates on the warning? |
I checked with Marc, the author of vision camera and seems to also think the warning is harmless and can just be ignored. I will verify that later today and add code to just ignore it. |
I added code to ignore the warning, it happens when focusing very quickly and doesn't cause any issues. |
@ishpaul777 can you please finish the review now? The reassure tests are known, unrelated |
On it! |
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.
Looks good
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.
Really nice, thank you!!!
@mountiny looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
Knwown reassure failure that is resolved on main |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/marcaaron in version: 1.4.36-5 🚀
|
@janicduplessis this seems not to be working for me on iOS, should be in prod already, can you test? RPReplay_Final1707235727.mp4 |
It is kind of hard to test, I think if you angle it with something close and far you should be able to see the focus change. I think the issue you might experience is that we currently only use one camera (I think ultrawide). New iphones usually have one that is better at very close pictures so maybe we could allow it to be used. |
Interesting. We need to do something about this for sure as its been couple of people who tried and did not find it working. How can we achieve it to behave "same" as the built-in camera focus? |
I believe we could use the |
This is not part of VisionCamera V3 or V2 yet. @janicduplessis wanna just try adding that to the Effectively under the hood this should only switch to the ultra-wide-angle-camera when something is too close to focus on, while still staying at the same zoom factor. Without this API, we can only zoom out to switch to the ultra-wide, technically not achieving the same behaviour |
I heard about this in this Apple Developer Forums post, and I think the way the iOS stock Camera achieves it is by
I am not sure how that'll work on the implementation though as we need to await until the Camera switches over to the ultra-wide before we lock the switching behaviour. As an alternative, we can just always use the ultra-wide angle which has a closer |
My initial thought was to use |
@mrousavy The api you are suggesting would make it so it only changes to ultra-wide if the thing is too close to focus, instead of switching automatically like when using |
Yea kinda, I think this is how the "Macro Mode" in the stock iOS camera works (the little flower icon at the bottom left if you are close to a subject). If we use the |
When I tested last time using tap to focus or getting really close would cause it to change automatically from what I remember. |
I think this might be a good solution for now, and we can look at more complex solutions if we still have issues. |
Interesting, I would say we need to optimize for receipt scanning in this case so that is usually taking picture from close distance so if its hard to make the focus work for all proximities of the object from camera, we should ideally do the macro case first |
I can try allowing both extra-wide and wide cameras and we can test if that works well. If we are not satisfied we can explore more advanced apis @mrousavy mentionned. |
I opened a PR with the change to use dual wide camera if you want to try it. #35926 I will test it more in the next few days. |
Oh well then that's even better! AVFoundation positively surprising, as always |
hey @mountiny, sorry for delayed response i was afk, i was able to reproduce the issue only when we the camera is closer to the subject but i didn't raised it as it was the same behaviour for the native camera on normal mode so assumed it to be expected. lmk, if i should start testing the other PR |
Details
This adds tap to focus on iOS and Android for the scan receipt camera. It also adds a focus indicator to have some feedback of the focus, I made it similar to the IG camera.
Note that this only affects native iOS and Android. As far as I know browser apis have no way to control camera focus.
Fixed Issues
$ #34898
PROPOSAL: N/A
Tests
Offline tests
QA Steps
Orientation fix:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen_Recording_20240127_150658_New.Expensify.Dev.2.mp4
Android: mWeb Chrome
N/A
iOS: Native
RPReplay_Final1706051928.mov
iOS: mWeb Safari
N/A
MacOS: Chrome / Safari
N/A
MacOS: Desktop
N/A