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

Hide media preprocessing #3943

Merged
merged 9 commits into from
Nov 26, 2024
Merged

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Nov 25, 2024

Content

Pre-process the media to upload during the preview so that it can be sent instantly.

2 scenarii:

  • the user presses the send buttton, but the pre-processing is not finish yet. In this case the progress dialog is still displayed
  • the user presses the sent button and the pre-processing is done, in this case no dialog is displayed.

Motivation and context

Closes #3938

Screenshots / GIFs

SendMediaNoDialog.mp4

Tests

  • Send a video or an image and wait a bit before pressing the send button
  • Press the send button
  • Observe that no dialog is displayed and the local echo with the media is displayed in the timeline.

Second test

  • Send a video and press the send button just after
  • Observe that a dialog is displayed
  • When the screen is closed the dialog is first closed (this is the second commit)

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

@bmarty bmarty added the PR-Change For updates to an existing feature label Nov 25, 2024
@bmarty bmarty requested a review from a team as a code owner November 25, 2024 16:49
@bmarty bmarty requested review from ganfra and removed request for a team November 25, 2024 16:49
@bmarty bmarty changed the title Feature/bma/ poc/media preprocessing Hide media preprocessing Nov 25, 2024
Copy link
Contributor

github-actions bot commented Nov 25, 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/tsNJg5

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 95.38462% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.98%. Comparing base (e347294) to head (75f3556).
Report is 22 commits behind head on develop.

Files with missing lines Patch % Lines
...attachments/preview/AttachmentsPreviewPresenter.kt 91.42% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3943      +/-   ##
===========================================
+ Coverage    82.96%   82.98%   +0.01%     
===========================================
  Files         1789     1789              
  Lines        45234    45279      +45     
  Branches      5341     5347       +6     
===========================================
+ Hits         37529    37573      +44     
- Misses        5830     5831       +1     
  Partials      1875     1875              

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

@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Nov 26, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Nov 26, 2024
Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

Some remarks

@@ -63,19 +77,62 @@ class AttachmentsPreviewPresenter @AssistedInject constructor(

val ongoingSendAttachmentJob = remember { mutableStateOf<Job?>(null) }

val userSentAttachment = remember {
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit weird to use StateFlows in the Presenter, we are supposed to use compose in this layer

Copy link
Member Author

@bmarty bmarty Nov 26, 2024

Choose a reason for hiding this comment

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

}

val mediaUploadInfoStateFlow = remember { MutableStateFlow<AsyncData<MediaUploadInfo>>(AsyncData.Uninitialized) }
var prePropressingJob: Job? = null
Copy link
Member

Choose a reason for hiding this comment

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

The job is not remember here?
Also, I don't think we need the job, just cancel all coroutines from the scope?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, LGTM!

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Nov 26, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Nov 26, 2024
Copy link

sonarcloud bot commented Nov 26, 2024

@bmarty bmarty merged commit b2a79d2 into develop Nov 26, 2024
27 checks passed
@bmarty bmarty deleted the feature/bma/_poc/mediaPreprocessing branch November 26, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Change For updates to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve upload media pre-processing
3 participants