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

View Folders and logs #2283

Merged
merged 8 commits into from
Jan 25, 2024
Merged

View Folders and logs #2283

merged 8 commits into from
Jan 25, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jan 24, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Introduce a viewfolder module, able to navigate to a folder hierarchy and to display the content of any file (ofc it works better with TXT files).
When viewing file, it possible to copy a line to the clipboard, or download or share the file.
Line numbers are displayed, as well as a basic syntactic coloration, using logcat colors.

Add a entry to the problem report screen so that user can inspect the logs that will be sent when reporting a problem.

viewfolder may be used later in the developer screen to be able to navigate to the files or cache directories.

Motivation and context

Closes #2276

Screenshots / GIFs

see recorded screenshot.

Tests

  • Go to the "Report a problem" screen
  • Click on "View logs" to open the new screen. The folder does not contain subfolder, so the navigation functionnality cannot be fully tested with the app right now. It's possible to change the rootPath to do so, but the app has to be built again.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

Copy link
Contributor

github-actions bot commented Jan 24, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/MjaLZz

@bmarty bmarty force-pushed the feature/bma/logViewer branch 2 times, most recently from ab92e67 to 3ba6698 Compare January 24, 2024 17:36
Add test

Add test
@bmarty bmarty marked this pull request as ready for review January 24, 2024 22:19
@bmarty bmarty requested a review from a team as a code owner January 24, 2024 22:19
@bmarty bmarty requested review from jmartinesp and removed request for a team January 24, 2024 22:19
@bmarty bmarty changed the title View Folders - WIP View Folders and logs Jan 24, 2024
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I have tested using a Monospace font, but the result is less nice to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the fact that we have line numbers, thanks!

Should we add a bit more padding to the left? Otherwise, I think we'll run into this quite often:

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have seen that too, but user has to scroll a lot to see it, so instead I preferred to add "Save" and "Share" actions to be able to read the file in better conditions (i.e. on a computer).
I will iterate to adapt the size depending on the total number of lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, actually, I think this is an acceptable issue to have, since the offset will appear only on a few cases:

image image

I prefer to keep more width for the file content.

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jan 24, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jan 24, 2024

data class ViewFileState(
val name: String,
val lines: ImmutableList<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be an AsyncData and the UI should have a loader? For large files, the viewer will display an 'empty file' text for 1-2s before actually displaying the file contents.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, I've been a bit lazy here :). 4601e2a

* Ex: `01-23 13:14:50.740 25818 25818 D org.matrix.rust.sdk: elementx: SyncIndicator = Hide | RustRoomListService.kt:81`
*/
@Composable
private fun String.toColor(): Color {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few minor nits I've already mentioned. Also, the tests need to be fixed.

Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: 144 lines in your changes are missing coverage. Please review.

Comparison is base (15e3ecc) 70.15% compared to head (4eb10a2) 70.03%.
Report is 5 commits behind head on develop.

Files Patch % Lines
.../android/features/viewfolder/impl/file/FileSave.kt 0.00% 34 Missing ⚠️
...roid/features/viewfolder/impl/file/ViewFileView.kt 69.14% 14 Missing and 15 partials ⚠️
...android/features/viewfolder/impl/file/FileShare.kt 0.00% 22 Missing ⚠️
.../features/viewfolder/impl/folder/FolderExplorer.kt 0.00% 20 Missing ⚠️
.../features/viewfolder/impl/folder/ViewFolderView.kt 68.85% 7 Missing and 12 partials ⚠️
...res/viewfolder/impl/DefaultViewFolderEntryPoint.kt 0.00% 8 Missing ⚠️
...features/viewfolder/impl/file/FileContentReader.kt 0.00% 5 Missing ⚠️
...features/viewfolder/impl/file/ViewFilePresenter.kt 85.71% 1 Missing and 2 partials ⚠️
...id/features/viewfolder/api/ViewFolderEntryPoint.kt 0.00% 2 Missing ⚠️
...ures/viewfolder/impl/folder/ViewFolderPresenter.kt 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2283      +/-   ##
===========================================
- Coverage    70.15%   70.03%   -0.13%     
===========================================
  Files         1335     1351      +16     
  Lines        32802    33137     +335     
  Branches      6809     6866      +57     
===========================================
+ Hits         23012    23207     +195     
- Misses        6511     6623     +112     
- Partials      3279     3307      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Jan 25, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@bmarty bmarty merged commit 203262a into develop Jan 25, 2024
13 of 15 checks passed
@bmarty bmarty deleted the feature/bma/logViewer branch January 25, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In app logs viewer
2 participants