-
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
Add support for viewing full screen Group Chat custom avatars #41586
Conversation
src/pages/ReportAvatar.tsx
Outdated
defaultOpen | ||
source={UserUtils.getFullSizeAvatar(avatarURL, 0)} | ||
onModalClose={() => { | ||
Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report?.reportID ?? '')); | ||
}} | ||
isWorkspaceAvatar | ||
maybeIcon | ||
originalFileName={policy?.originalFileName ?? policyName} | ||
originalFileName={policy?.originalFileName ?? title} |
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.
NAB. Can you move this to a separate variable like the rest
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.
Done. Please check
Also complete the checklist |
@s77rt Need to confirm one thing, do we need to add "View Photo" functionality for starting a new group chat modal? |
Yes, let's add support for that one too |
@nexarvo Any update on this? Let me know if there is something blocking this |
sorry for the delay. I will update and push the code for this by today EOD. |
src/pages/ReportAvatar.tsx
Outdated
if(!avatarURL && groupChatDraft?.avatarUri) { | ||
avatarURL = `${groupChatDraft.avatarUri}.jpg`; | ||
} |
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 is a hacky solution. What we can do instead is get the file name and pass it as prop originalFileName
. This will pass the condition your referenced in AttachmentView
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.
Added originalFileName in this commit.
src/pages/ReportAvatar.tsx
Outdated
let avatarURL = policy ? ReportUtils.getWorkspaceAvatar(report) : report?.avatarUrl; | ||
let fileName = policy?.originalFileName ?? title; | ||
|
||
if (!avatarURL && groupChatDraft?.avatarUri && groupChatDraft?.originalFileName) { |
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 fallback logic will not work correctly in cases where we'd expect to see a not found page i.e. we will always fallback to the draft avatar. Can you instead add a query params that determines if we want to use the group chat draft?
src/pages/ReportAvatar.tsx
Outdated
groupChatDraft: { | ||
key: ONYXKEYS.NEW_GROUP_CHAT_DRAFT, | ||
}, |
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.
Let's make this use the useOnyx
hook instead. It should help avoid loading the data from onyx if we are not going to use it. Related to the point above ^
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.
- Fix the conflicts please
src/pages/ReportAvatar.tsx
Outdated
if(shouldUseGroupChatDraft) { | ||
[groupChatDraft] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT); | ||
avatarURL = groupChatDraft?.avatarUri ?? undefined; | ||
fileName = groupChatDraft?.originalFileName ?? undefined; | ||
} |
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.
Hooks cannot be conditioned.
src/pages/ReportAvatar.tsx
Outdated
originalFileName={policy?.originalFileName ?? policyName} | ||
shouldShowNotFoundPage={!report?.reportID && !isLoadingApp} | ||
originalFileName={fileName} | ||
shouldShowNotFoundPage={!report?.reportID && !groupChatDraft && !isLoadingApp} |
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.
Related to the above ^. Since groupChatDraft will pretty much always be set we will not see the not found page in any case. Please update the logic accordingly
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.
If we remove ! groupChatDraft
from above condition then for groupChatDraft it always return not found page.
src/ROUTES.ts
Outdated
@@ -213,7 +213,7 @@ const ROUTES = { | |||
}, | |||
REPORT_AVATAR: { | |||
route: 'r/:reportID/avatar', | |||
getRoute: (reportID: string) => `r/${reportID}/avatar` as const, | |||
getRoute: (reportID: string, newGroupChat: boolean) => `r/${reportID}/avatar?newGroupChat=${newGroupChat}` as const, |
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.
Let's not pass the query param if the newGroupChat
param is not true
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.
NAB. Change the param name to isNewGroupChat
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. Added conditional to return route based on isNewGroupChat here.
src/libs/Navigation/types.ts
Outdated
@@ -884,6 +884,7 @@ type AuthScreensParamList = SharedScreensParamList & { | |||
}; | |||
[SCREENS.REPORT_AVATAR]: { | |||
reportID: string; | |||
newGroupChat: string |
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 should be boolean. Then in src/libs/Navigation/linkingConfig/config.ts
add
parse: {
newGroupChat: (newGroupChat: string) => newGroupChat === "true",
},
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 is done.
@s77rt sorry this is done. Can you please take a look |
@nexarvo This is still not working offline. Please double check Screen.Recording.2024-07-04.at.12.13.01.PM.mov |
Reviewer Checklist
Screenshots/Videos |
@@ -4637,6 +4638,7 @@ function buildOptimisticChatReport( | |||
parentReportID = '', | |||
description = '', | |||
avatarUrl = '', | |||
avatarFileName = '', |
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.
After adding this new param we need to check all calls to buildOptimisticChatReport
the 15th param should be avatarFileName
. This is not the case in buildOptimisticWorkspaceChats
. (Plaese double check all calls)
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.
@s77rt just checked this. This is fine at all the places
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.
Also conflicts are also resolved
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 is not fixed yet
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 is not fixed? I have verified in all places wherebuildOptimisticChatReport
is used.
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.
In buildOptimisticWorkspaceChats
we call buildOptimisticWorkspaceChats
and the 15th param is expenseReportId
but that param is for avatarFileName
and expenseReportId
should be the 16th
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.
@s77rt Sorry, for the miss, please have a look.
@nexarvo Any updates here? Also we have conflicts |
@@ -4637,6 +4638,7 @@ function buildOptimisticChatReport( | |||
parentReportID = '', | |||
description = '', | |||
avatarUrl = '', | |||
avatarFileName = '', |
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 is not fixed yet
src/libs/actions/Report.ts
Outdated
avatarFileName: ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.avatarFileName ?? null, | ||
avatarUrl: ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.avatarUrl ?? null, |
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.
Let's not call getAllReports
twice and instead define a report
const once
Looks good, thanks for the changes! |
✋ 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/marcaaron in version: 9.0.10-2 🚀
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.0.10-3 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.10-7 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.11-5 🚀
|
Details
Fixed Issues
$ #39850
#39760
PROPOSAL: #39850 (comment)
Tests
Group Chat Case:
Creating new Group Chat Case:
Group Chat Thread Case:
Offline tests
Group Chat Case:
Creating new Group Chat Case:
Group Chat Thread Case:
QA Steps
Group Chat Case:
Creating new Group Chat Case:
Group Chat Thread Case:
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
Screen.Recording.2024-05-25.at.12.09.09.AM.mov
Screen.20Recording.202024-05-25.20at.2012-5.mp4
Screen.20Recording.202024-05-25.20at.2012-6.mp4
Android: mWeb Chrome
Screen.20Recording.202024-05-25.20at.2012-4.mp4
Screen.Recording.2024-05-25.at.12.33.42.AM.mov
Screen.Recording.2024-05-25.at.12.35.51.AM.mov
iOS: Native
Getting build errors.
iOS: mWeb Safari
RPReplay_Final1716579777.MP4
RPReplay_Final1716579821.MP4
RPReplay_Final1716579969.mp4
MacOS: Chrome / Safari
Screen.Recording.2024-05-03.at.8.23.14.PM.mov
Screen.20Recording.202024-05-24.20at.2011-2.mp4
Screen.20Recording.202024-05-24.20at.2011.mp4
MacOS: Desktop
Screen.20Recording.202024-05-25.20at.2012-2.mp4
Screen.20Recording.202024-05-25.20at.2012-3.mp4
Screen.20Recording.202024-05-25.20at.2012.mp4