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

feat: media gallery [WPB-4989] #2490

Merged
merged 16 commits into from Dec 4, 2023
Merged

feat: media gallery [WPB-4989] #2490

merged 16 commits into from Dec 4, 2023

Conversation

Garzas
Copy link
Contributor

@Garzas Garzas commented Dec 1, 2023

StoryWPB-4989 [Android] Gallery for media files in a conversation


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?

  • implemented ConversationMediaGallery with image assets
  • added month/year labels to group asset images

Loading image assets functionality is slightly different then loading conversation messages, reasons:

  • paging-compose is not allowing to control when load more images, using it will cause out of memory error, because messages loading loads images asynchronously, we can't allow to load 20 images at once on screen, especially when they can have big size
  • moved control of loading next batches to ConversationAssetMessagesViewModel which checks if user scrolls LazyColumn to bottom by
val shouldContinue by remember {
        derivedStateOf {
            !scrollState.canScrollForward
        }
    }
  • waits for GetAssetMessagesForConversationUseCase to load asset's sequentially, currently BATCH_SIZE equals 5
  • added new type of MediaAssetImage : AsyncImageMessage which avoids using asynchronous image load from network to load only image from storage, because images are saved already in view model

Video with loading images when they are already downloaded
https://github.com/wireapp/wire-android/assets/13151239/ba087453-4134-4141-852a-d4ce1598ba65

Wideo With images which are not yet downloaded (for example when we restored backup)
https://github.com/wireapp/wire-android/assets/13151239/2b1209d7-fbc8-4e58-b5fa-4e37934f1292

Screen with failed image
error_image

Needs releases with:

wireapp/kalium#2260

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.

Copy link
Contributor

github-actions bot commented Dec 1, 2023

Test Results

714 tests  ±0   714 ✔️ ±0   9m 56s ⏱️ +47s
  99 suites ±0       0 💤 ±0 
  99 files   ±0       0 ±0 

Results for commit b042df0. ± Comparison against base commit 7e67653.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Merging #2490 (b042df0) into develop (f3108ca) will decrease coverage by 0.27%.
Report is 1 commits behind head on develop.
The diff coverage is 1.19%.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2490      +/-   ##
=============================================
- Coverage      41.45%   41.19%   -0.27%     
  Complexity      1105     1105              
=============================================
  Files            348      353       +5     
  Lines          12767    12848      +81     
  Branches        1668     1676       +8     
=============================================
  Hits            5293     5293              
- Misses          6976     7057      +81     
  Partials         498      498              
Files Coverage Δ
.../kotlin/com/wire/android/GlobalObserversManager.kt 80.00% <100.00%> (ø)
...ome/conversationslist/ConversationListViewModel.kt 59.68% <ø> (ø)
...wire/android/mapper/RegularMessageContentMapper.kt 23.94% <0.00%> (ø)
...tlin/com/wire/android/migration/MigrationMapper.kt 0.00% <0.00%> (ø)
...me/conversations/media/ConversationMediaNavArgs.kt 0.00% <0.00%> (ø)
...ations/media/ConversationAssetMessagesViewState.kt 0.00% <0.00%> (ø)
...sations/model/messagetypes/asset/UIAssetMessage.kt 0.00% <0.00%> (ø)
...in/kotlin/com/wire/android/mapper/UIAssetMapper.kt 0.00% <0.00%> (ø)
...ations/media/ConversationAssetMessagesViewModel.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 7e67653...b042df0. Read the comment docs.

Copy link
Contributor

github-actions bot commented Dec 1, 2023

APKs built during tests are available here. Scroll down to Artifacts!

Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

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

Looking great 👌🏻

Just have 2 small comments to use dimensions

.background(color = colorsScheme().backgroundVariant),
topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
elevation = 0.dp,
elevation = dimensions().spacing0x,

color = MaterialTheme.wireColorScheme.onPrimary, shape = RoundedCornerShape(dimensions().messageAssetBorderRadius)
)
.border(
width = 1.dp,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
width = 1.dp,
width = dimensions().spacing1x,

@AndroidBob
Copy link
Collaborator

Build 2099 succeeded.

The build produced the following APK's:

@AndroidBob
Copy link
Collaborator

Build 2115 failed.

Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

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

👌🏻

Copy link
Contributor

github-actions bot commented Dec 4, 2023

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 2120 succeeded.

The build produced the following APK's:

Copy link
Contributor

github-actions bot commented Dec 4, 2023

APKs built during tests are available here. Scroll down to Artifacts!

@Garzas Garzas enabled auto-merge December 4, 2023 11:17
@Garzas Garzas added this pull request to the merge queue Dec 4, 2023
Copy link
Contributor

github-actions bot commented Dec 4, 2023

APKs built during tests are available here. Scroll down to Artifacts!

Merged via the queue into develop with commit fc6e59e Dec 4, 2023
14 of 15 checks passed
@Garzas Garzas deleted the feat/media-gallery branch December 4, 2023 11:49
@AndroidBob
Copy link
Collaborator

Build 2129 succeeded.

The build produced the following APK's:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants