Issue/36520 android scan second tap on capture button causes error to show up#37182
Conversation
Prevent calling the function while navigation is going on
…-Scan---Second-tap-on-capture-button-causes-error-to-show-up
|
@hoangzinh 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] |
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Thanks @agent3bood I will review the PR today |
| const {shortcutKey, descriptionKey, modifiers} = keyboardShortcut; | ||
| return KeyboardShortcut.subscribe(shortcutKey, onPressHandler, descriptionKey, modifiers, true, false, 0, false); | ||
| }, [keyboardShortcut, onPressHandler]); | ||
| return KeyboardShortcut.subscribe(shortcutKey, singleExecution(onKeyboardShortcutPressHandler), descriptionKey, modifiers, true, false, 0, false); |
There was a problem hiding this comment.
Instead of workaround by introducing a new callback here, we can update the type there, what do you think
App/src/libs/KeyboardShortcut/index.ts
Line 134 in 174a032
callback: (event?: KeyboardEvent) => void | Promise<void>There was a problem hiding this comment.
If I update the signature then it would mean the KeyboardShortcut.subscribe is able to handle the promise, but actually is is not handling futures.
There was a problem hiding this comment.
it makes sense. Then why do we need wrapped by singleExecution here? In the previous logic we don't have.
There was a problem hiding this comment.
Removed singleExecution, it is not required here.
| const [cameraPermissionStatus, setCameraPermissionStatus] = useState(undefined); | ||
| const askedForPermission = useRef(false); | ||
|
|
||
| const [didCapturePhoto, setDidCapturePhoto] = useState(false); |
There was a problem hiding this comment.
without this check, it still works fine on my simulator with double tap/triple tap. Is there any case that we need those checks?
Screen.Recording.2024-02-27.at.22.44.45.mov
There was a problem hiding this comment.
Without this part it will work for second/third tap, but if you keep tapping until the page transition then it will show the same error message as before.
As I explained in the issue, after the photo is taken navigation will kick off, using this code will block taking new photo while navigation is in progress.
There was a problem hiding this comment.
Because if we use this technique, it appears that the hook useSingleExecution is not useful anymore. If we haven't had a global fix in useSingleExecution yet, I think we can scope the fix in second/third tap. About keep tapping until the page transition, it's a very edge case, I don't think normal users would do that.
There was a problem hiding this comment.
Reverted, tested with second/third tap and it works fine.
Could be a feature request: show animation once photo is taken, something like circular progress while the navigates to next step.
There was a problem hiding this comment.
it's a good idea. But let's focus on fixing bug first. Thanks for updating, I will try to complete review checklist today
|
@agent3bood could you add the order number to your test steps? |
This reverts commit aa0a8af.
|
@agent3bood it looks like you override the checkbox requirement. Usually, it's
|
Done. |
|
Perfect, last but not least, could you confirm this checkbox with your change in this PR?
|
Done. |
src/components/Pressable/GenericPressable/BaseGenericPressable.tsx
Outdated
Show resolved
Hide resolved
|
@agent3bood I found a bug when do testing in Android Chrome, when I did double tap on the capture button, it took to next step without error but the selection list is loading forever Screen.Recording.2024-02-28.at.17.45.27.mov |
I was able to reproduce this on Android emulator for both my branch and production as well. Recording if from production site. Screen.Recording.2024-02-28.at.14.43.54.mov |
|
Thanks @agent3bood after deep dive into the root cause, I found that:
=> It shows the skeleton view. Given it also happens in the main branch and it's not straightforward to fix. It's fine for me to leave it as it is. As least we confirmed it's only happen on simulators |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-02-28.at.17.53.04.android.movAndroid: mWeb ChromeScreen.Recording.2024-02-28.at.22.25.15.andoird.chrome.moviOS: NativeI don't have a real IOS device, and in the IOS simulator, we can not turn on camera https://stackoverflow.com/a/50523741 Screen.Recording.2024-02-28.at.17.59.40.ios.moviOS: mWeb SafariScreen.Recording.2024-02-28.at.17.49.48.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2024-02-28.at.17.29.32.web.movMacOS: DesktopScreen.Recording.2024-02-28.at.17.31.03.desktop.mov |
|
@agent3bood Linter seems to be complaining, can you please check it and fix. Thanks. |
…-Scan---Second-tap-on-capture-button-causes-error-to-show-up # Conflicts: # src/pages/iou/request/step/IOURequestStepParticipants.js
|
✋ 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 staging by https://github.com/techievivek in version: 1.4.46-0 🚀
|
|
Issue #36520 is still reproducible in android and iOS when tapping |
|
@kavimuru I am aware of this behavior and did had a solution for it, but after a discussion with @hoangzinh we decided to remove it. |
|
would like to here your thought here #37182 (comment) @techievivek |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.4.46-2 🚀
|


Details
Fix bug where a second tap on the camera button on native will show an error message.
There were three things fixed in this PR
capturePhototo return aPromiseso it works properly with the native implementation ofuseSingleExecution.didCapturePhototo prevent another call tocapturePhotowhile navigation is triggered and the user is still on the camera screen.focuslistener to reset thedidCapturePhotowhen the user navigate back to the scan screen.Fixed Issues
$ #36520
PROPOSAL: #36520 (comment)
Tests
Offline tests
same as tests
QA Steps
same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen_Recording_20240225-103944_New.Expensify.Dev.mp4
Android: mWeb Chrome
Screen_Recording_20240225-180953_Chrome.mp4
iOS: Native
RPReplay_Final1708876872.MP4
iOS: mWeb Safari
RPReplay_Final1708874323.MP4
MacOS: Chrome / Safari
Screen.Recording.2024-02-25.at.10.52.00.mov
MacOS: Desktop
Screen.Recording.2024-02-25.at.18.22.21.mov