Skip to content

Commit

Permalink
Adjustments after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-solecki committed Feb 2, 2024
1 parent 8ac53d3 commit 88686d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libs/UserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function getAvatar(avatarSource?: AvatarSource, accountID?: number): AvatarSourc
* @param avatarURL - the avatar source from user's personalDetails
* @param accountID - the accountID of the user
*/
function getAvatarUrl(avatarSource: AvatarSource, accountID: number): AvatarSource {
function getAvatarUrl(avatarSource: AvatarSource | undefined, accountID: number): AvatarSource {
return isDefaultAvatar(avatarSource) ? getDefaultAvatarURL(accountID) : avatarSource;
}

Expand Down
14 changes: 10 additions & 4 deletions src/pages/ShareCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentU
import useEnvironment from '@hooks/useEnvironment';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import Clipboard from '@libs/Clipboard';
import getPlatform from '@libs/getPlatform';
import Navigation from '@libs/Navigation/Navigation';
Expand All @@ -40,6 +41,7 @@ function ShareCodePage({report, session, currentUserPersonalDetails}: ShareCodeP
const {translate} = useLocalize();
const {environmentURL} = useEnvironment();
const qrCodeRef = useRef<QRShareWithDownloadHandle>(null);
const {isSmallScreenWidth} = useWindowDimensions();

const isReport = !!report?.reportID;

Expand Down Expand Up @@ -69,14 +71,17 @@ function ShareCodePage({report, session, currentUserPersonalDetails}: ShareCodeP
const isNative = platform === CONST.PLATFORM.IOS || platform === CONST.PLATFORM.ANDROID;

return (
<ScreenWrapper testID={ShareCodePage.displayName}>
<ScreenWrapper
testID={ShareCodePage.displayName}
shouldShowOfflineIndicatorInWideScreen={!isReport}
>
<HeaderWithBackButton
title={translate('common.shareCode')}
onBackButtonPress={() => Navigation.goBack(isReport ? ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID) : ROUTES.SETTINGS)}
shouldShowBackButton={isReport || isSmallScreenWidth}
/>

<ScrollView style={[themeStyles.flex1, themeStyles.mt3]}>
<View style={themeStyles.shareCodePage}>
<View style={[isSmallScreenWidth ? themeStyles.workspaceSectionMobile : themeStyles.workspaceSection, themeStyles.ph4]}>
<QRShareWithDownload
ref={qrCodeRef}
url={url}
Expand All @@ -96,14 +101,15 @@ function ShareCodePage({report, session, currentUserPersonalDetails}: ShareCodeP
successIcon={Expensicons.Checkmark}
successText={translate('qrCodes.copied')}
onPress={() => Clipboard.setString(url)}
shouldLimitWidth={false}
/>

{isNative && (
<MenuItem
isAnonymousAction
title={translate('common.download')}
icon={Expensicons.Download}
onPress={() => qrCodeRef.current?.download()}
onPress={qrCodeRef.current?.download}
/>
)}

Expand Down

0 comments on commit 88686d4

Please sign in to comment.