Skip to content
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

[CP Staging] Comment the QR code download button until it can be fixed #40109

Merged
merged 6 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/pages/ShareCodePage.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, {useMemo, useRef} from 'react';
import {View} from 'react-native';
import type {ImageSourcePropType} from 'react-native';

Check failure on line 3 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'ImageSourcePropType' is defined but never used
import type {OnyxEntry} from 'react-native-onyx';
import expensifyLogo from '@assets/images/expensify-logo-round-transparent.png';

Check failure on line 5 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'expensifyLogo' is defined but never used
import ContextMenuItem from '@components/ContextMenuItem';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItem from '@components/MenuItem';
import QRShareWithDownload from '@components/QRShare/QRShareWithDownload';

Check failure on line 10 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'QRShareWithDownload' is defined but never used
import type QRShareWithDownloadHandle from '@components/QRShare/QRShareWithDownload/types';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
Expand All @@ -20,7 +20,7 @@
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import * as Url from '@libs/Url';
import * as UserUtils from '@libs/UserUtils';

Check failure on line 23 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'UserUtils' is defined but never used
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type {Report} from '@src/types/onyx';
Expand All @@ -36,12 +36,12 @@
const themeStyles = useThemeStyles();
const {translate} = useLocalize();
const {environmentURL} = useEnvironment();
const qrCodeRef = useRef<QRShareWithDownloadHandle>(null);

Check failure on line 39 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'qrCodeRef' is assigned a value but never used
const currentUserPersonalDetails = useCurrentUserPersonalDetails();

const isReport = !!report?.reportID;

const subtitle = useMemo(() => {

Check failure on line 44 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'subtitle' is assigned a value but never used
if (isReport) {
if (ReportUtils.isExpenseReport(report)) {
return ReportUtils.getPolicyName(report);
Expand All @@ -59,13 +59,13 @@
return currentUserPersonalDetails.login;
}, [report, currentUserPersonalDetails, isReport]);

const title = isReport ? ReportUtils.getReportName(report) : currentUserPersonalDetails.displayName ?? '';

Check failure on line 62 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'title' is assigned a value but never used
const urlWithTrailingSlash = Url.addTrailingForwardSlash(environmentURL);
const url = isReport
? `${urlWithTrailingSlash}${ROUTES.REPORT_WITH_ID.getRoute(report.reportID)}`
: `${urlWithTrailingSlash}${ROUTES.PROFILE.getRoute(currentUserPersonalDetails.accountID ?? '')}`;
const platform = getPlatform();
const isNative = platform === CONST.PLATFORM.IOS || platform === CONST.PLATFORM.ANDROID;

Check failure on line 68 in src/pages/ShareCodePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'isNative' is assigned a value but never used

return (
<ScreenWrapper testID={ShareCodePage.displayName}>
Expand All @@ -76,6 +76,10 @@
/>
<ScrollView style={[themeStyles.flex1, themeStyles.pt3]}>
<View style={[themeStyles.workspaceSectionMobile, themeStyles.ph5]}>
{/*
This is a temporary measure because right now it's broken because of the Fabric update.
We need to wait for react-native v0.74 to be released so react-native-view-shot gets fixed.

<QRShareWithDownload
ref={qrCodeRef}
url={url}
Expand All @@ -84,7 +88,7 @@
logo={isReport ? expensifyLogo : (UserUtils.getAvatarUrl(currentUserPersonalDetails?.avatar, currentUserPersonalDetails?.accountID) as ImageSourcePropType)}
logoRatio={isReport ? CONST.QR.EXPENSIFY_LOGO_SIZE_RATIO : CONST.QR.DEFAULT_LOGO_SIZE_RATIO}
logoMarginRatio={isReport ? CONST.QR.EXPENSIFY_LOGO_MARGIN_RATIO : CONST.QR.DEFAULT_LOGO_MARGIN_RATIO}
/>
/> */}
</View>

<View style={themeStyles.mt9}>
Expand All @@ -98,15 +102,15 @@
shouldLimitWidth={false}
/>

{isNative && (
{/* {isNative && (
<MenuItem
isAnonymousAction
title={translate('common.download')}
icon={Expensicons.Download}
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onPress={() => qrCodeRef.current?.download?.()}
/>
)}
)} */}

<MenuItem
title={translate(`referralProgram.${CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE}.buttonText1`)}
Expand Down
12 changes: 8 additions & 4 deletions src/pages/workspace/WorkspaceProfileSharePage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useRef} from 'react';
import {View} from 'react-native';
import type {ImageSourcePropType} from 'react-native';

Check failure on line 3 in src/pages/workspace/WorkspaceProfileSharePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'ImageSourcePropType' is defined but never used
import expensifyLogo from '@assets/images/expensify-logo-round-transparent.png';

Check failure on line 4 in src/pages/workspace/WorkspaceProfileSharePage.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'expensifyLogo' is defined but never used
import ContextMenuItem from '@components/ContextMenuItem';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
Expand Down Expand Up @@ -51,14 +51,18 @@
<ScrollView style={[themeStyles.flex1, themeStyles.pt2]}>
<View style={[themeStyles.flex1, isSmallScreenWidth ? themeStyles.workspaceSectionMobile : themeStyles.workspaceSection]}>
<View style={[themeStyles.workspaceSectionMobile, themeStyles.ph9]}>
<QRShareWithDownload
{/*
This is a temporary measure because right now it's broken because of the Fabric update.
We need to wait for react-native v0.74 to be released so react-native-view-shot gets fixed.

<QRShareWithDownload
ref={qrCodeRef}
url={url}
title={policyName}
logo={(policy?.avatar ? policy.avatar : expensifyLogo) as ImageSourcePropType}
logoRatio={CONST.QR.DEFAULT_LOGO_SIZE_RATIO}
logoMarginRatio={CONST.QR.DEFAULT_LOGO_MARGIN_RATIO}
/>
/> */}
</View>

<View style={[themeStyles.mt3, themeStyles.ph4]}>
Expand All @@ -72,15 +76,15 @@
shouldLimitWidth={false}
wrapperStyle={themeStyles.sectionMenuItemTopDescription}
/>
{shouldAllowDownloadQRCode && (
{/* {shouldAllowDownloadQRCode && (
<MenuItem
isAnonymousAction
title={translate('common.download')}
icon={Expensicons.Download}
onPress={() => qrCodeRef.current?.download?.()}
wrapperStyle={themeStyles.sectionMenuItemTopDescription}
/>
)}
)} */}
</View>
</View>
</ScrollView>
Expand Down
Loading