wire-android icon indicating copy to clipboard operation
wire-android copied to clipboard

refactor: unify modal bottom sheets [WPB-10610]

Open saleniuk opened this issue 1 year ago • 7 comments

TaskWPB-10610 [Android] Refactor and unify modal bottom sheets


PR Submission Checklist for internal contributors

  • The PR Title

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

    • [x] 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

Currently we have 3 different modal bottom sheets, each of them with each own logic.

Solutions

Create single unified modal bottom sheet that contains advantages of all three previous ones so that modal bottom sheet is always created the same way, showing and hiding is encapsulated inside sheet state so there is no need to create any LaunchedEffects to handle it, and it provides a parameter when expanded to generate content according to it. Now, show and hide functions can be called outside of coroutines, hide will execute animation and then call onComplete action if needed so no need to wrap any click lambdas with a function to hide a sheet first and it should always look good from UI perspective. Also: split bottom sheet into two dedicated for self deleting options and message options on ConversationScreen, moved some menu options composables to dedicated files, cleaned up MediaGalleryScreen and added preview, simplified hide/show calls, removed sheet state from some view states and moved it up when it's not required to pass it that deep, cleaned up and unified message and asset options depending on the message type.

Testing

How to Test

Use one of bottom sheets.

PR Post Submission Checklist for internal contributors (Optional)

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

PR Post Merge Checklist for internal contributors

  • [x] 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.

saleniuk avatar Aug 14 '24 12:08 saleniuk

Ups 🫰🟨

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

pull-request-size[bot] avatar Aug 14 '24 12:08 pull-request-size[bot]

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Project coverage is 44.67%. Comparing base (8d14713) to head (e978a28).

Files Patch % Lines
...d/ui/home/conversations/ConversationScreenState.kt 0.00% 5 Missing :warning:
...d/ui/userprofile/avatarpicker/AvatarPickerState.kt 0.00% 4 Missing :warning:
...android/ui/home/gallery/MediaGalleryScreenState.kt 0.00% 1 Missing :warning:
.../wire/android/ui/sharing/ImportMediaScreenState.kt 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3327      +/-   ##
===========================================
+ Coverage    44.62%   44.67%   +0.05%     
===========================================
  Files          456      456              
  Lines        15382    15358      -24     
  Branches      2564     2564              
===========================================
- Hits          6864     6861       -3     
+ Misses        7798     7777      -21     
  Partials       720      720              
Files Coverage Δ
...id/ui/home/conversationslist/ConversationRouter.kt 0.00% <ø> (ø)
...me/messagecomposer/location/LocationPickerState.kt 100.00% <ø> (ø)
...essagecomposer/state/MessageComposerStateHolder.kt 58.33% <ø> (-1.67%) :arrow_down:
...gs/devices/e2ei/E2eiCertificateDetailsViewModel.kt 0.00% <ø> (ø)
...ndroid/ui/userprofile/avatarpicker/AvatarPicker.kt 0.00% <ø> (ø)
...m/wire/android/feature/sketch/DrawingToolPicker.kt 0.00% <ø> (ø)
...android/ui/home/gallery/MediaGalleryScreenState.kt 0.00% <0.00%> (ø)
.../wire/android/ui/sharing/ImportMediaScreenState.kt 0.00% <0.00%> (ø)
...d/ui/userprofile/avatarpicker/AvatarPickerState.kt 0.00% <0.00%> (ø)
...d/ui/home/conversations/ConversationScreenState.kt 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8d14713...e978a28. Read the comment docs.

codecov-commenter avatar Aug 14 '24 13:08 codecov-commenter

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

github-actions[bot] avatar Aug 14 '24 14:08 github-actions[bot]

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

github-actions[bot] avatar Aug 14 '24 14:08 github-actions[bot]

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

github-actions[bot] avatar Aug 14 '24 15:08 github-actions[bot]

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

github-actions[bot] avatar Aug 14 '24 15:08 github-actions[bot]