Use AttachmentSaver to save image editor files to device storage.

This commit is contained in:
Jeffrey Starke
2025-03-24 10:13:39 -04:00
committed by Cody Henthorne
parent b1ff5dc5ef
commit f0bb74a187
2 changed files with 35 additions and 35 deletions

View File

@@ -11,6 +11,8 @@ import android.widget.CheckBox
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import io.reactivex.rxjava3.core.Completable
import kotlinx.coroutines.rx3.rxCompletable
import kotlinx.coroutines.withContext
import org.signal.core.ui.view.AlertDialogResult
import org.signal.core.ui.view.awaitResult
@@ -52,6 +54,8 @@ class AttachmentSaver(private val host: Host) {
saveAttachments(attachments)
}
fun saveAttachmentsRx(attachments: Set<SaveAttachment>): Completable = rxCompletable { saveAttachments(attachments) }
suspend fun saveAttachments(attachments: Set<SaveAttachment>) {
if (checkIsSaveWarningAccepted(attachmentCount = attachments.size) == SaveToStorageWarningResult.ACCEPTED) {
if (checkCanWriteToMediaStore() == RequestPermissionResult.GRANTED) {