-
Notifications
You must be signed in to change notification settings - Fork 155
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
Do not delete the original file if it's not a temporary file when sending it to a room. #3819
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
import io.element.android.tests.testutils.lambda.lambdaError | ||
|
||
class FakeTemporaryUriDeleter( | ||
val deleteCallback: (uri: Uri?) -> Unit = { lambdaError() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name it deleteLambda
like we do elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -57,6 +60,20 @@ class AttachmentsPreviewPresenter @AssistedInject constructor( | |||
|
|||
val ongoingSendAttachmentJob = remember { mutableStateOf<Job?>(null) } | |||
|
|||
DisposableEffect(Unit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it's disposed for some reason (new screen on the backstack, config changes not handled)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point, so I guess I have to handle the cancellation with an event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ganfra thanks for the review, I have taken your remarks in to account. Let me know if it's fine for you! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3819 +/- ##
===========================================
+ Coverage 82.97% 82.98% +0.01%
===========================================
Files 1782 1783 +1
Lines 44911 44961 +50
Branches 5287 5288 +1
===========================================
+ Hits 37265 37311 +46
- Misses 5799 5805 +6
+ Partials 1847 1845 -2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just realised this might be be incompatible with the new async media upload?
LaunchedEffect(state.sendActionState) { | ||
latestOnDismiss() | ||
} | ||
BackHandler(enabled = state.sendActionState !is SendActionState.Sending) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cancellation during the sending state is emitting a ClearSendState
event, so I did not want to change this behavior.
Lets rebase on develop with the latest changes and see how it reacts? |
I can confirm that the issue is fixed on my physical device with the debug build posted earlier. I'll give it another try with the rebased build when one is available. Thanks for the quick turnaround on this! |
…. No functional change here.
b13605d
to
8dfe530
Compare
Quality Gate passedIssues Measures |
It seems to work as expected 🎉 |
Content
When sending file using Element X the original file may be deleted by the application. This is an error of course and this PR fixes it.
This PR also ensure that temporary files that are created when taking a photo or a video are correctly deleted if the process is cancelled. Else such file were living in the application
cache
folder until this one get deleted.Motivation and context
Fixes #3800
Screenshots / GIFs
Tests
Tested devices
Checklist