-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Magic code blur #28711
Magic code blur #28711
Conversation
@Santhosh-Sellavel 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] |
@wojtus7 What's the new fix for the two blockers, can you explain for me please? |
Issue #28494: So the problem here is that the code you get from SMS is not pasted but very rapidly inputed on the keyboard. In this implementation of magic input I get the value and clear the input after user type anything. If user paste anything I get 6 digits and use it and then clear input. The way iOS rapidly input new digits from SMS is breaking because it inputs the values so fast that react doesn't have time to clear the input because useState is async and takes a little time. So for code: 123456 the input in magic code was: 112123 because every change of the input was 1 -> 12 -> 123 -> 1234 and every state of the input was interpreted as pasted code. The answer was to create new ref At the same time we can't just not clear the input because the Answer for #28590 was just add |
@wojtus7 Sorry for the delay, please resolve conflicts! |
bump @wojtus7 |
hi, just letting y'all know I'm back from OOO and happy to review this whenever! |
@wojtus7 I'd love to get this merged this week - do you have time to resolve conflicts and get this ready to review again? Thank you! |
Hi @dangrous Today I'm first day back after being OOO for 2 weeks. I started to work on it right away and have all conflicts resolved but my GPG stopped working after not using Mac for some reason and trying to figure it out. Working on it right now, will push the changes whenever it's resolved and will do my best to make this PR merge this week! |
ef8dea3
to
d50aae2
Compare
@Santhosh-Sellavel all conflicts resolved! |
Thank you @wojtus7 ! @Santhosh-Sellavel let us knwo if you have time to review today or tomorrow - thank you! |
TestFails on Android. The keyboard disappears immediately when magic code input is presented Screen.Recording.2023-10-26.at.12.08.38.AM.mov |
This #28590 is not resolved Screen.Recording.2023-10-26.at.12.24.52.AM.mov |
@wojtus7 Screen_Recording_20231026_004910_New.Expensify.Dev.mp4🔴 🔴 While testing found even a weirder case was able to enter more than 6 numbers but it changed only the last digit and the code was not submitted at all.Screen_Recording_20231026_005218_New.Expensify.Dev.mp4cc: @dangrous |
Hmm. I guess some things break after the main merge or I am going crazy 😞 @Santhosh-Sellavel about: I think this is caused by and the auto submit feature being turn off after one time: |
I think this is more complex than that. I tested it a lot and it happen in a lot of places and not only in the way you described but also can happen when go back a screen then the email input fails, and sometimes the error doesn't happen at all. Nagranie.z.ekranu.2023-10-27.o.19.59.15.mov |
Mostly looks good. While testing today I ran into this issue while testing on Android Alone. Tested this issue #28590. Focus is set correctly but the keyboard is not shown on the Android Screen.Recording.2023-11-15.at.11.23.43.PM.movThis is NAB as it is specific to a platform and can be handled as a follow-up. Basic cases pass for me, so I'm good with approving this. But I couldn't test this issue on iOS Simulator can you test this please @dangrous iPhone, thanks! |
Oh hm I'm not sure I can test that even with a physical iPhone since I need it to text me and I don't think it will... Let me investigate. |
In the meantime, if we CAN find a fix for the keyboard thing you mentioned that would be ideal, but yeah I don't think it's a blocker |
I've fixed this issue here, pulled main & resolved conflicts. Video: fix-android.movI've tested the magic code, but I couldn't test the OTP auto-fill functionality (I can't send text messages to the testing devices that I have). cc @Santhosh-Sellavel for another review |
Okay I managed to set up getting texts on my physical iOS device. BUT - both on staging, main, and this branch - the phone does not try to autofill from a text anymore - I don't get the prompt. Can one of you possibly try on staging and see if it's my phone or something else? It does look like the messaging changed since that bug was filed, so that could be it. If you can't, I can ask around internally, too. Thanks! |
@dangrous I can't test this case alone, please ask internally. |
Okay, I figured it out! Seems to work well. |
Hey, when can I expect another round of review? @Santhosh-Sellavel @dangrous |
@Santhosh-Sellavel are you able to test/review again? The iOS issue seems to be solved with this PR. |
AFK today, will do tomorrow. |
On it now again! |
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, tests 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.
Two minor clarifications, otherwise this is looking good!
src/components/MagicCodeInput.js
Outdated
setInput(TEXT_INPUT_EMPTY_STATE); | ||
setFocusedIndex(newFocusedIndex); | ||
setEditIndex(newFocusedIndex); |
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.
We use these three lines in a number of places - might it be good to separate them out into a helper function?
src/components/MagicCodeInput.js
Outdated
@@ -181,9 +233,12 @@ function MagicCodeInput(props) { | |||
return; | |||
} | |||
|
|||
const addedValue = |
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.
Can you add a comment to explain this? It's very confusing to look at, haha. Also some parentheses around the boolean section might help.
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.
love it!
Okay, going to merge, let's be sure to watch this for bugs but I think we're going to be good this time. |
@@ -264,6 +264,11 @@ class ContactMethodDetailsPage extends Component { | |||
title={this.props.translate('contacts.removeContactMethod')} | |||
onConfirm={this.confirmDeleteAndHideModal} | |||
onCancel={() => this.toggleDeleteModal(false)} | |||
onModalHide={() => { | |||
InteractionManager.runAfterInteractions(() => { | |||
this.validateCodeFormRef.current.focusLastSelected(); |
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.
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.
I can handle the fix if need be but if you're around @wojtus7 that would be great!
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.
Hey, @wojtus7 is not here. I can help with this one in an hour or two.
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.
I can help too )
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.
Working on the 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.
Thank you for jumping in @kosmydel! We'll be ready to review whenever
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.
I'm recording videos, however, I have a rate limit for adding new contact methods.
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.
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.5-7 🚀
|
})); | ||
|
||
useFocusEffect( | ||
useCallback(() => { | ||
if (!inputValidateCodeRef.current) { | ||
return; | ||
} | ||
if (focusTimeoutRef.current) { | ||
clearTimeout(focusTimeoutRef.current); | ||
} | ||
focusTimeoutRef.current = setTimeout(inputValidateCodeRef.current.focus, CONST.ANIMATED_TRANSITION); |
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.
focusLastSelected
should have been used also here, like this:
focusTimeoutRef.current = setTimeout(inputValidateCodeRef.current.focusLastSelected, CONST.ANIMATED_TRANSITION);
This caused issue - #33170
Details
This PR is a direct continuation of the PR that got reverted here.
It should his two release blockers:
#28494
#28590
Additionally resolve issue:
#26090
Description:
In order to make blur possible I needed to refactor the magic component. Instead of 6 separate text inputs there is only one wrapped inside TapGestureHandler that determine which number should be inputed. This resulted is some code that is simpler, taps are handled by gesture handler and right-click/context menu/context is handled by native text input. but at the same time created small issue that paste button shows only on the beginning of the input.
Fixed Issues
$ #18244
PROPOSAL: #18244 (comment)
Tests
Offline tests
QA Steps
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)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
bez.nazwy.mov
Mobile Web - Chrome
Screenrecorder-2023-08-01-17-22-47-275.mp4
Mobile Web - Safari
Nagranie.z.ekranu.2023-08-1.o.14.42.25.mov
Desktop
bez.nazwy.mov
iOS
Nagranie.z.ekranu.2023-08-1.o.14.44.35.mov
Android
Nagranie.z.ekranu.2023-08-1.o.14.41.23.mov