mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Improve handling of errors when saving media attachments.
Improves the error handling in `SaveAttachmentUtil.saveAttachments()` to continue processing all requested attachment saves even after individual save operations fail.
This commit is contained in:
committed by
Greyson Parrelli
parent
9b6f355802
commit
f2950e279b
@@ -89,6 +89,7 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.rx3.rxSingle
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -2443,12 +2444,12 @@ class ConversationFragment :
|
||||
resources.getQuantityString(R.plurals.ConversationFragment_saving_n_attachments_to_sd_card, attachments.size, attachments.size)
|
||||
).build().toBundle()
|
||||
|
||||
SaveAttachmentUtil.saveAttachments(attachments)
|
||||
rxSingle { SaveAttachmentUtil.saveAttachments(attachments) }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnSubscribe { progressDialog.show(parentFragmentManager, null) }
|
||||
.doOnTerminate { progressDialog.dismissAllowingStateLoss() }
|
||||
.subscribeBy { it.toast(requireContext()) }
|
||||
.subscribeBy { result -> Toast.makeText(context, result.getMessage(requireContext()), Toast.LENGTH_LONG).show() }
|
||||
.addTo(disposables)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user