Skip to content

feat: Navigate between folders (WPB-17392)#4018

Merged
ohassine merged 24 commits intodevelopfrom
cells-create-folder
May 20, 2025
Merged

feat: Navigate between folders (WPB-17392)#4018
ohassine merged 24 commits intodevelopfrom
cells-create-folder

Conversation

@ohassine
Copy link
Member

@ohassine ohassine commented May 12, 2025

TaskWPB-17392 [Android] Show folders in files screen


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Follow up PR of #4007

It aims to allow user to navigate between folders and sub folders

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

ohassine added 20 commits April 23, 2025 13:30
…-attachement-type

# Conflicts:
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellFilesScreen.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/ConversationFilesScreen.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/createfolder/CreateFolderScreen.kt
# Conflicts:
#	app/src/main/kotlin/com/wire/android/di/accountScoped/CellsModule.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/AllFilesScreen.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellFilesScreen.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellListItem.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellScreenContent.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellViewModel.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/ConversationFilesScreen.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/download/DownloadFileBottomSheet.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/model/CellFileUi.kt
#	features/cells/src/main/res/values/strings.xml
#	kalium
@pull-request-size
Copy link

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

@ohassine ohassine marked this pull request as ready for review May 12, 2025 13:45
@ohassine ohassine requested review from Garzas and sbakhtiarov May 12, 2025 13:45
Copy link
Contributor

@Garzas Garzas left a comment

Choose a reason for hiding this comment

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

Nice 🥇

actionsFlow = viewModel.actions,
pagingListItems = pagingListItems,
sendIntent = { viewModel.sendIntent(it) },
onFolderClick = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to use existing API for communication between View and ViewModel. You can define another CellViewIntent type OnFolderClick and use existing sendIntent method to send it to ViewModel.
Or change existing intent OnFileClick to OnNodeClick and choose the handler in the ViewModel depending on the clicked node type (file / folder).

Copy link
Member Author

Choose a reason for hiding this comment

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

We will not need the viewModel here as we will navigate to a different screen

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe right now we do not have any extra logic, but we could have some checks in future (e.g. permissions) which would be better to do in the view model.
I guess the only real reason to handle it via the view model is to make this flow testable via view model unit tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's keep it simple for now—no need to over-engineer prematurely. If we need to add permission checks or more complex logic later, we can refactor and move that into the ViewModel when it makes sense.

downloadFileState = downloadFileSheet,
menuState = menu,
isAllFiles = false,
onFolderClick = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to use the intent - action API and send this to a ViewModel via sendIntent, prepare the right destination and send new OpenFolder action back to the view for navigation.
This way we will have same approach for all user actions handling, move a small piece of logic (building the destination name) to the ViewModel and can add test case for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's more extra work to do, pass intent from view to viewModel back to view again.
And ViewModels should be UI-agnostic, they should not know about navigation, screens..

Copy link
Contributor

Choose a reason for hiding this comment

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

By passing it via viewmodel

  • we will make this action testable
  • user action handling logic will be in the viewmodel, not in the view

ViewModel must not know about navigation implementation details, but it should define the logic for handling user actions, like:
user clicked item -> check if it is a folder -> send command to open folder

@ohassine ohassine requested a review from sbakhtiarov May 13, 2025 14:19
# Conflicts:
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellListItem.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellScreenContent.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/CellViewModel.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/ConversationFilesScreen.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/createfolder/CreateFolderScreenNavArgs.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/dialog/FileActionsBottomSheet.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/dialog/FolderActionsBottomSheet.kt
#	features/cells/src/main/java/com/wire/android/feature/cells/ui/model/CellNodeUi.kt
#	kalium
@pull-request-size pull-request-size bot added size/M and removed size/L labels May 19, 2025
@sonarqubecloud
Copy link

@ohassine ohassine added this pull request to the merge queue May 20, 2025
Merged via the queue into develop with commit 9d857ac May 20, 2025
13 of 14 checks passed
@ohassine ohassine deleted the cells-create-folder branch May 20, 2025 11:41
@github-actions
Copy link
Contributor

Built wire-android-staging-compat-pr-4018.apk is available for download

@github-actions
Copy link
Contributor

Built wire-android-dev-debug-pr-4018.apk is available for download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants