-
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: Android - Distance - Waypoint does not change position correctly by dragging. #41378
Conversation
… by dragging. Signed-off-by: Krishna Gupta <[email protected]>
@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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeRecord_2024-05-23-02-50-45.mp4Record_2024-05-23-02-50-45.mp4Android: mWeb ChromeRecord_2024-05-23-02-54-44.mp4iOS: NativeScreen.Recording.2024-05-23.at.3.17.06.AM-1-1.moviOS: mWeb SafariScreen.Recording.2024-05-23.at.3.02.30.AM.movMacOS: Chrome / SafariScreen.Recording.2024-05-23.at.2.22.08.AM-1.movMacOS: DesktopScreen.Recording.2024-05-23.at.3.20.01.AM.mov |
@@ -426,7 +426,7 @@ function IOURequestStepDistance({ | |||
<View style={styles.flex1}> | |||
<DraggableList | |||
data={waypointsList} | |||
keyExtractor={(item) => item} | |||
keyExtractor={(item) => (waypoints[item]?.address ?? '') + item || item} |
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.
what about the case when the address is same for 2 location?
VIDEO-2024-05-03-17-48-20.mp4
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.
sorry for delay, will look at this today.
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.
@ishpaul777, I added keyForList for each waypoint when they are added and it works perfectly, should we do 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.
can you please push change so i can evaluate ?
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.
gentle bump @Krishna2323
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.
will push changes in few hours, sorry for delay again, I missed you previous comment.
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.
@ishpaul777, you can retest the changes now.
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'll test this within few hours
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.
@ishpaul777, friendly bump.
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.
Reviewing now 👀
Signed-off-by: Krishna Gupta <[email protected]>
@@ -119,6 +119,7 @@ function IOURequestStepWaypoint({ | |||
name: values.name ?? '', | |||
lat: values.lat ?? 0, | |||
lng: values.lng ?? 0, | |||
keyForList: `${new Date().getTime()}_${Math.random().toString(36).substring(2, 15)}`, |
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.
Why only when offline 🤔 if (isOffline && waypointValue) {
??
Also can we do something like keyForList: "waypoint-{Date.now()}"
is there a reason to do such intensive string processing
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 can use waypoint-${Date.now()}
here, but not when dragging. If there are three waypoints and we assign waypoint-${Date.now()}
to keyForList, it will be the same for all three.
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.
Ignore my previous comment, I thought the backend won't save the keyForList
and we will have to add again but that's not the case. The keyForList is saved and returned from the backend.
Why only when offline 🤔 if (isOffline && waypointValue) { ??
I forgot to add to selectWaypoint
function, now added.
src/types/onyx/RecentWaypoint.ts
Outdated
@@ -10,6 +10,9 @@ type RecentWaypoint = { | |||
|
|||
/** The longitude of the waypoint */ | |||
lng?: number; | |||
|
|||
/** The longitude of the waypoint */ |
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.
wrong comment
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.
updated.
src/types/onyx/Transaction.ts
Outdated
@@ -38,6 +38,9 @@ type Waypoint = { | |||
|
|||
/** Address street line 2 */ | |||
street2?: string; | |||
|
|||
/** The longitude of the waypoint */ |
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.
wrong comment
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.
updated.
newWaypoints[`waypoint${index}`] = waypoints[waypoint] ?? {}; | ||
const newWaypointObj = waypoints[waypoint].keyForList | ||
? waypoints[waypoint] | ||
: {...waypoints[waypoint], keyForList: `${new Date().getTime()}_${Math.random().toString(36).substring(2, 15)}`}; |
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.
shouldn't the keyForList be there always if added in waypoint page, why this check ?
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 thought the backend won't save the keyForList
property but thats not the case. This part is not updated.
Signed-off-by: Krishna Gupta <[email protected]>
Signed-off-by: Krishna Gupta <[email protected]>
@ishpaul777, friendly bump. |
sorry i have been sick so on/off lately.. will review again today |
const newWaypointObj = waypoints[waypoint]; | ||
newWaypoints[`waypoint${index}`] = newWaypointObj ?? {}; |
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.
This change seems unnecessary
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.
reverted.
Please merge main when you got the chance : ) |
Friendly bump @Krishna2323 |
Signed-off-by: Krishna Gupta <[email protected]>
@@ -119,6 +119,7 @@ function IOURequestStepWaypoint({ | |||
name: values.name ?? '', | |||
lat: values.lat ?? 0, | |||
lng: values.lng ?? 0, | |||
keyForList: `${waypointValue as string}_${Date.now()}`, |
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.
keyForList: `${waypointValue as string}_${Date.now()}`, | |
keyForList: `${waypointValue ?? 'waypoint'}_${Date.now()}`, |
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.
updated.
@ishpaul777, merged main. |
Signed-off-by: Krishna Gupta <[email protected]>
@@ -139,6 +140,7 @@ function IOURequestStepWaypoint({ | |||
lng: values.lng ?? 0, | |||
address: values.address ?? '', | |||
name: values.name ?? '', | |||
keyForList: `${values.name ?? 'waypoint'}_${Date.now()}`, |
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.
sorry i just notice this inconsistency, can you help me understand why here we use name and above it we use waypointValue (which is address) ??
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.
different by mistake, updated now to values.name
.
Signed-off-by: Krishna Gupta <[email protected]>
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
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.
It is working great!
Just some minor comments.
Signed-off-by: Krishna Gupta <[email protected]>
@Krishna2323 thanks, just one type check now. |
✋ 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/rlinoz in version: 1.4.77-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀
|
Details
Fixed Issues
$ #40105
PROPOSAL: #40105 (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 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_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4