-
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
fix: auto insert OTP not working #54253
fix: auto insert OTP not working #54253
Conversation
44b3ace
to
7397487
Compare
Ue refs instead of state
7397487
to
eedaac8
Compare
@alitoshmatov 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] |
@alitoshmatov are you able to test this feature? If not we might want to switch for a c+ who can test this in app |
🚧 @mountiny has triggered a test build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
@mountiny iOS failed to build 🥶 |
🚧 @mountiny has triggered a test build. You can view the workflow run here. |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-20.at.4.57.36.AM.movAndroid: mWeb ChromeScreen.Recording.2024-12-20.at.4.56.25.AM.moviOS: NativeScreenRecording_12-20-2024.04-31-19_1.MP4ScreenRecording_12-20-2024.04-32-44_1.MP4ScreenRecording_12-26-2024.01-53-48_1.MP4screenrecording-12-26-2024-01-48-04-1_SwQUHLrt.mp4iOS: mWeb SafariScreen.Recording.2024-12-20.at.4.53.02.AM.movMacOS: Chrome / SafariScreen.Recording.2024-12-20.at.4.45.30.AM.movscreen-recording-2024-12-26-at-12111-am_jpdpdu0c.mp4Screen.Recording.2024-12-26.at.1.30.09.AM.movScreen.Recording.2024-12-26.at.1.31.04.AM.movMacOS: DesktopScreen.Recording.2024-12-20.at.4.50.38.AM.mov |
@mountiny Not sure if this is a bug, but the magic code shows up in the suggestion only when I touch the input. ScreenRecording_12-20-2024.04-34-34_1.MP4 |
@allroundexperts yeah I observed the same (its also that way before the changes of this PR) |
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!
We should probably create a follow up to fix that. |
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 to me, but as noted in Slack. This component is used in bunch of flows. can you please test this works in them as well. Setting Copilot, Creating Expensify cards, Adding secondary login. Making login a primary login
@mountiny I'll post the screen recordings of these flows today. |
Tested all the flows on iOS native and desktop web. Added screen recordings as well. |
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.
Thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Reported the issue in expensify bug channel: |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.80-1 🚀
|
Explanation of Change
Fixes an issue where the automatically inserting the email OTP code wouldn't work on iOS.
The main problem is that when we insert the OTP code react-native's
TextInput
'sonChangeText
method will be called in quick succession with the OTP code, see here:This is breaking the assumption of the
onChangeText
function inMagicCodeInput.tsx
. When we have an OTP the text input's value is always""
so when the user enters new text theonChangeText
will only ever be called with one new digit string.I assume the breaking change might have been introduced in this PR:
At first I thought to adding a special condition that checks if the method was called with all required numbers, but then I've seen that the
MagicCodeInput
component is used in many different contexts where that assumption might be problematic.So it's a better idea to make the
onChangeText
behave correctly in any case. The solution for this is to not depend on any state. TheonChangeText
will be called very rapidly when inserting the OTP. Before it was relying on state to be updated, however by the time it was called the next time the state update hasn't been triggered yet.So its the safest to just use a ref here.
Fixed Issues
$ #48424
PROPOSAL:
Tests
Offline tests
n/a
QA Steps
Same as testing steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.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 and/or tagged@Expensify/design
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
Android: mWeb Chrome
iOS: Native
Uploading ScreenRecording_12-17-2024 16-51-08_1.MP4…
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop