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

LHN - Long pressing chat does not show "Copy Onx Data" on all platforms #46482

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
9 changes: 1 addition & 8 deletions src/libs/Environment/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ function isDevelopment(): boolean {
return (Config?.ENVIRONMENT ?? CONST.ENVIRONMENT.DEV) === CONST.ENVIRONMENT.DEV;
}

/**
* Are we running the app in staging?
*/
function isStaging(): boolean {
return (Config?.ENVIRONMENT ?? CONST.ENVIRONMENT.DEV) === CONST.ENVIRONMENT.STAGING;
}

/**
* Are we running the app in production?
*/
Expand Down Expand Up @@ -83,4 +76,4 @@ function getSpotnanaEnvironmentTMCID(): Promise<string> {
return getEnvironment().then((environment) => SPOTNANA_ENVIRONMENT_TMC_ID[environment]);
}

export {getEnvironment, isInternalTestBuild, isDevelopment, isStaging, isProduction, getEnvironmentURL, getOldDotEnvironmentURL, getTravelDotEnvironmentURL, getSpotnanaEnvironmentTMCID};
export {getEnvironment, isInternalTestBuild, isDevelopment, isProduction, getEnvironmentURL, getOldDotEnvironmentURL, getTravelDotEnvironmentURL, getSpotnanaEnvironmentTMCID};
17 changes: 16 additions & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {Emoji} from '@assets/emojis/types';
import * as Expensicons from '@components/Icon/Expensicons';
import MiniQuickEmojiReactions from '@components/Reactions/MiniQuickEmojiReactions';
import QuickEmojiReactions from '@components/Reactions/QuickEmojiReactions';
import useEnvironment from '@hooks/useEnvironment';
import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL';
import * as Browser from '@libs/Browser';
import Clipboard from '@libs/Clipboard';
Expand Down Expand Up @@ -542,7 +543,21 @@ const ContextMenuActions: ContextMenuAction[] = [
icon: Expensicons.Copy,
successTextTranslateKey: 'reportActionContextMenu.copied',
successIcon: Expensicons.Checkmark,
shouldShow: (type) => type === CONST.CONTEXT_MENU_TYPES.REPORT && (Environment.isDevelopment() || Environment.isStaging() || Environment.isInternalTestBuild()),
shouldShow: (type) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const {environment, isProduction} = useEnvironment();
cdOut marked this conversation as resolved.
Show resolved Hide resolved

// If we are on production, don't show this option
if (isProduction) {
return false;
}

const isADHOC = environment === CONST.ENVIRONMENT.ADHOC;
const isStaging = environment === CONST.ENVIRONMENT.STAGING;
const isDevelopment = environment === CONST.ENVIRONMENT.DEV;

return type === CONST.CONTEXT_MENU_TYPES.REPORT && (isDevelopment || isStaging || isADHOC);
cdOut marked this conversation as resolved.
Show resolved Hide resolved
},
onPress: (closePopover, {reportID}) => {
const report = ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
Clipboard.setString(JSON.stringify(report, null, 4));
Expand Down
Loading