Skip to content

Commit

Permalink
Merge pull request #46482 from software-mansion-labs/@cdOut/copy-onyx…
Browse files Browse the repository at this point in the history
…-fix

LHN - Long pressing chat does not show "Copy Onx Data" on all platforms
  • Loading branch information
bondydaa authored Jul 31, 2024
2 parents 9c4ba58 + f24cd05 commit 55be36f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
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};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {ContextMenuItemHandle} from '@components/ContextMenuItem';
import ContextMenuItem from '@components/ContextMenuItem';
import FocusTrapForModal from '@components/FocusTrap/FocusTrapForModal';
import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager';
import useEnvironment from '@hooks/useEnvironment';
import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
Expand Down Expand Up @@ -126,6 +127,7 @@ function BaseReportActionContextMenu({
const [shouldKeepOpen, setShouldKeepOpen] = useState(false);
const wrapperStyle = StyleUtils.getReportActionContextMenuStyles(isMini, shouldUseNarrowLayout);
const {isOffline} = useNetwork();
const {isProduction} = useEnvironment();
const threedotRef = useRef<View>(null);

const reportAction: OnyxEntry<ReportAction> = useMemo(() => {
Expand All @@ -145,7 +147,7 @@ function BaseReportActionContextMenu({
let filteredContextMenuActions = ContextMenuActions.filter(
(contextAction) =>
!disabledActions.includes(contextAction) &&
contextAction.shouldShow(type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID, isPinnedChat, isUnreadChat, !!isOffline, isMini),
contextAction.shouldShow(type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID, isPinnedChat, isUnreadChat, !!isOffline, isMini, isProduction),
);

if (isMini) {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type ShouldShow = (
isUnreadChat: boolean,
isOffline: boolean,
isMini: boolean,
isProduction: boolean,
) => boolean;

type ContextMenuActionPayload = {
Expand Down Expand Up @@ -546,7 +547,7 @@ 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, isProduction) => type === CONST.CONTEXT_MENU_TYPES.REPORT && !isProduction,
onPress: (closePopover, {reportID}) => {
const report = ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
Clipboard.setString(JSON.stringify(report, null, 4));
Expand Down

0 comments on commit 55be36f

Please sign in to comment.