From 46a6c3e52188ce55edad92a107ecbe4b930f825d Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Sun, 21 Apr 2024 18:07:24 +0530 Subject: [PATCH 01/15] Show console debug logs via test tools menu --- ios/Podfile | 17 ++ src/CONST.ts | 3 +- src/ROUTES.ts | 2 +- .../BaseClientSideLoggingToolMenu.tsx | 21 +- .../ConsoleComponents.tsx | 191 ++++++++++++++++++ .../ConsoleModal.tsx | 64 ++++++ .../index.android.tsx | 4 +- .../ClientSideLoggingToolMenu/index.ios.tsx | 4 +- .../ClientSideLoggingToolMenu/index.tsx | 4 +- src/components/Modal/index.tsx | 2 +- src/components/TestToolsModal.tsx | 2 +- src/libs/Navigation/types.ts | 1 + src/pages/settings/AboutPage/ConsolePage.tsx | 158 +-------------- .../ShareLogList/BaseShareLogList.tsx | 10 +- .../AboutPage/ShareLogList/index.native.tsx | 4 +- .../settings/AboutPage/ShareLogList/index.tsx | 4 +- src/pages/settings/AboutPage/ShareLogPage.tsx | 2 +- .../utils/generators/ModalStyleUtils.ts | 23 +++ 18 files changed, 345 insertions(+), 171 deletions(-) create mode 100644 src/components/ClientSideLoggingToolMenu/ConsoleComponents.tsx create mode 100644 src/components/ClientSideLoggingToolMenu/ConsoleModal.tsx diff --git a/ios/Podfile b/ios/Podfile index 4f00eb2adfdd..0c524878e5f7 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,3 +1,5 @@ +use_frameworks! :linkage => :static + require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") # Set the type of Mapbox SDK to use # This value is used by $RNMapboxMaps @@ -111,6 +113,21 @@ target 'NewExpensify' do end end end + + deployment_target = '13.4' + + installer.generated_projects.each do |project| + project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target + end + end + project.build_configurations.each do |config| + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target + end + end + + `sed -i -e $'s/__IPHONE_10_0/__IPHONE_15_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h` end end diff --git a/src/CONST.ts b/src/CONST.ts index 2cd614b74816..4ded9e282d3e 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -860,6 +860,7 @@ const CONST = { POPOVER: 'popover', RIGHT_DOCKED: 'right_docked', ONBOARDING: 'onboarding', + CENTERED_SMALL_AND_UNSWIPEABLE: 'centered_small_and_unswipeable' }, ANCHOR_ORIGIN_VERTICAL: { TOP: 'top', @@ -3100,7 +3101,7 @@ const CONST = { // Test tool menu parameters TEST_TOOL: { // Number of concurrent taps to open then the Test modal menu - NUMBER_OF_TAPS: 4, + NUMBER_OF_TAPS: 2, }, MENU_HELP_URLS: { diff --git a/src/ROUTES.ts b/src/ROUTES.ts index ceb4c217cb6e..71e673aea994 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -175,7 +175,7 @@ const ROUTES = { SETTINGS_CONSOLE: 'settings/troubleshoot/console', SETTINGS_SHARE_LOG: { route: 'settings/troubleshoot/console/share-log', - getRoute: (source: string) => `settings/troubleshoot/console/share-log?source=${encodeURI(source)}` as const, + getRoute: (source: string, isViaTestToolsModal = false) => `settings/troubleshoot/console/share-log?source=${encodeURI(source)}&isViaTestToolsModal=${isViaTestToolsModal}` as const, }, SETTINGS_EXIT_SURVEY_REASON: 'settings/exit-survey/reason', diff --git a/src/components/ClientSideLoggingToolMenu/BaseClientSideLoggingToolMenu.tsx b/src/components/ClientSideLoggingToolMenu/BaseClientSideLoggingToolMenu.tsx index fcad770908a6..a6bb085c949a 100644 --- a/src/components/ClientSideLoggingToolMenu/BaseClientSideLoggingToolMenu.tsx +++ b/src/components/ClientSideLoggingToolMenu/BaseClientSideLoggingToolMenu.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useState} from 'react'; import {Alert} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -12,6 +12,7 @@ import * as Console from '@libs/actions/Console'; import {parseStringifiedMessages} from '@libs/Console'; import ONYXKEYS from '@src/ONYXKEYS'; import type {CapturedLogs, Log} from '@src/types/onyx'; +import ConsoleModal from "@components/ClientSideLoggingToolMenu/ConsoleModal"; type BaseClientSideLoggingToolMenuOnyxProps = { /** Logs captured on the current device */ @@ -30,9 +31,11 @@ type BaseClientSideLoggingToolProps = { onDisableLogging: (logs: Log[]) => void; /** Action to run when enabling logging */ onEnableLogging?: () => void; + /** Boolean to know if this was opened via test tools modal */ + isViaTestToolsModal: boolean } & BaseClientSideLoggingToolMenuOnyxProps; -function BaseClientSideLoggingToolMenu({shouldStoreLogs, capturedLogs, file, onShareLogs, onDisableLogging, onEnableLogging}: BaseClientSideLoggingToolProps) { +function BaseClientSideLoggingToolMenu({shouldStoreLogs, capturedLogs, file, onShareLogs, onDisableLogging, onEnableLogging, isViaTestToolsModal, closeTestToolsModal}: BaseClientSideLoggingToolProps) { const {translate} = useLocalize(); const onToggle = () => { @@ -59,6 +62,8 @@ function BaseClientSideLoggingToolMenu({shouldStoreLogs, capturedLogs, file, onS Console.disableLoggingAndFlushLogs(); }; const styles = useThemeStyles(); + const [isConsoleModalVisible, setIsConsoleModalVisible] = useState(false); + return ( <> @@ -68,6 +73,15 @@ function BaseClientSideLoggingToolMenu({shouldStoreLogs, capturedLogs, file, onS onToggle={onToggle} /> + {!!shouldStoreLogs && isViaTestToolsModal && + +