-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: hide troubleshoot on prod, Implement auto-off timeout for troub… #76649
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f159541
feat: hide troubleshoot on prod, Implement auto-off timeout for troub…
pasyukevich 1ebafae
fix: lint
pasyukevich 20bc848
fix: prettier
pasyukevich 8dacaf6
feat: add troubleshoot recording start time and refactor recording ma…
pasyukevich 75b6559
refactor: centralize profiling data handling and cleanup in Troublesh…
pasyukevich ab05b01
Merge branch 'main' into fix/troubleshoot
pasyukevich dfda881
Merge branch 'main' into fix/troubleshoot
pasyukevich 0d77061
fix comments
pasyukevich 751337e
Refactor handleStopRecording functions to use async/await for improve…
pasyukevich 473031c
fix lint
pasyukevich 10ed019
fix issue with troubleshoot on/off failure
pasyukevich 27e633c
Merge branch 'main' into fix/troubleshoot
pasyukevich eb35e7b
Merge branch 'main' into fix/troubleshoot
pasyukevich c06db73
fix comments
pasyukevich 371ff8b
fix prettier and compiler
pasyukevich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/components/RecordTroubleshootDataToolMenu/finalizeStopRecording.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import type StopRecordingParams from './handleStopRecording.types'; | ||
|
|
||
| type FinalizeStopRecordingParams = Pick<StopRecordingParams, 'infoFileName' | 'appInfo' | 'logsWithParsedMessages' | 'onDisableLogging' | 'cleanupAfterDisable' | 'zipRef' | 'onDownloadZip'>; | ||
|
|
||
| export default async function finalizeStopRecording({ | ||
| infoFileName, | ||
| appInfo, | ||
| logsWithParsedMessages, | ||
| onDisableLogging, | ||
| cleanupAfterDisable, | ||
| zipRef, | ||
| onDownloadZip, | ||
| }: FinalizeStopRecordingParams): Promise<void> { | ||
| zipRef.current?.file(infoFileName, appInfo); | ||
|
|
||
| await onDisableLogging(logsWithParsedMessages); | ||
| cleanupAfterDisable(); | ||
| onDownloadZip?.(); | ||
| } |
37 changes: 37 additions & 0 deletions
37
src/components/RecordTroubleshootDataToolMenu/handleStopRecording.android.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import RNFetchBlob from 'react-native-blob-util'; | ||
| import finalizeStopRecording from './finalizeStopRecording'; | ||
| import type StopRecordingParams from './handleStopRecording.types'; | ||
|
|
||
| export default async function handleStopRecording({ | ||
| profilingData, | ||
| infoFileName, | ||
| appInfo, | ||
| logsWithParsedMessages, | ||
| onDisableLogging, | ||
| cleanupAfterDisable, | ||
| zipRef, | ||
| onDownloadZip, | ||
| setProfileTracePath, | ||
| }: StopRecordingParams): Promise<void> { | ||
| const {profilePath} = profilingData; | ||
|
|
||
| if (profilePath) { | ||
| try { | ||
| // Check if it is an internal path of `DownloadManager` then append content://media to create a valid url | ||
| const {path} = await RNFetchBlob.fs.stat(!profilePath.startsWith('content://media/') && profilePath.match(/\/downloads\/\d+$/) ? `content://media/${profilePath}` : profilePath); | ||
| setProfileTracePath?.(path); | ||
| } catch { | ||
| setProfileTracePath?.(profilePath); | ||
| } | ||
| } | ||
|
|
||
| await finalizeStopRecording({ | ||
| infoFileName, | ||
| appInfo, | ||
| logsWithParsedMessages, | ||
| onDisableLogging, | ||
| cleanupAfterDisable, | ||
| zipRef, | ||
| onDownloadZip, | ||
| }); | ||
| } |
57 changes: 57 additions & 0 deletions
57
src/components/RecordTroubleshootDataToolMenu/handleStopRecording.ios.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import RNFS from 'react-native-fs'; | ||
| import Log from '@libs/Log'; | ||
| import finalizeStopRecording from './finalizeStopRecording'; | ||
| import type StopRecordingParams from './handleStopRecording.types'; | ||
|
|
||
| export default async function handleStopRecording({ | ||
| profilingData, | ||
| infoFileName, | ||
| profileFileName, | ||
| appInfo, | ||
| logsWithParsedMessages, | ||
| onDisableLogging, | ||
| cleanupAfterDisable, | ||
| zipRef, | ||
| pathToBeUsed, | ||
| onDownloadZip, | ||
| setProfileTracePath, | ||
| }: StopRecordingParams): Promise<void> { | ||
| const {profilePath} = profilingData; | ||
|
|
||
| if (!profilePath) { | ||
| cleanupAfterDisable(); | ||
| return; | ||
| } | ||
|
|
||
| const newFilePath = `${pathToBeUsed}/${profileFileName}`; | ||
|
|
||
| try { | ||
| const fileExists = await RNFS.exists(newFilePath); | ||
| if (fileExists) { | ||
| await RNFS.unlink(newFilePath); | ||
| Log.hmmm('[ProfilingToolMenu] existing file deleted successfully'); | ||
| } | ||
| } catch (error) { | ||
| const message = error instanceof Error ? error.message : String(error); | ||
| Log.hmmm('[ProfilingToolMenu] error checking/deleting existing file: ', message); | ||
| } | ||
|
|
||
| try { | ||
| await RNFS.copyFile(profilePath, newFilePath); | ||
| await finalizeStopRecording({ | ||
| infoFileName, | ||
| appInfo, | ||
| logsWithParsedMessages, | ||
| onDisableLogging, | ||
| cleanupAfterDisable, | ||
| zipRef, | ||
| onDownloadZip, | ||
| }); | ||
|
|
||
| setProfileTracePath?.(newFilePath); | ||
| Log.hmmm('[ProfilingToolMenu] file copied successfully'); | ||
| } catch (error) { | ||
| const message = error instanceof Error ? error.message : String(error); | ||
| Log.hmmm('[ProfilingToolMenu] error copying file: ', message); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.