don't show sending failed dialog when sending was cancelled (#3226)

* don't show sending failed dialog when sending was cancelled

* still mark cancelled statuses as failed but don't show alert
This commit is contained in:
Konrad Pozniak 2023-01-28 12:40:36 +01:00 committed by GitHub
parent 54c8b28f9d
commit 8cd4521e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -271,6 +271,7 @@ class ComposeViewModel @Inject constructor(
mediaFocus = mediaFocus,
poll = poll.value,
failedToSend = false,
failedToSendAlert = false,
scheduledAt = scheduledAt.value,
language = postLanguage,
statusId = originalStatusId,

View File

@ -63,6 +63,7 @@ class DraftHelper @Inject constructor(
mediaFocus: List<Attachment.Focus?>,
poll: NewPoll?,
failedToSend: Boolean,
failedToSendAlert: Boolean,
scheduledAt: String?,
language: String?,
statusId: String?,
@ -123,7 +124,7 @@ class DraftHelper @Inject constructor(
attachments = attachments,
poll = poll,
failedToSend = failedToSend,
failedToSendNew = failedToSend,
failedToSendNew = failedToSendAlert,
scheduledAt = scheduledAt,
language = language,
statusId = statusId,

View File

@ -265,7 +265,7 @@ class SendStatusService : Service(), Injectable {
mediaUploader.cancelUploadScope(*failedStatus.media.map { it.localId }.toIntArray())
saveStatusToDrafts(failedStatus)
saveStatusToDrafts(failedStatus, failedToSendAlert = true)
val notification = buildDraftNotification(
R.string.send_post_notification_error_title,
@ -288,7 +288,7 @@ class SendStatusService : Service(), Injectable {
val sendJob = sendJobs.remove(statusId)
sendJob?.cancel()
saveStatusToDrafts(statusToCancel)
saveStatusToDrafts(statusToCancel, failedToSendAlert = false)
val notification = buildDraftNotification(
R.string.send_post_notification_cancel_title,
@ -305,7 +305,7 @@ class SendStatusService : Service(), Injectable {
}
}
private suspend fun saveStatusToDrafts(status: StatusToSend) {
private suspend fun saveStatusToDrafts(status: StatusToSend, failedToSendAlert: Boolean) {
draftHelper.saveDraft(
draftId = status.draftId,
accountId = status.accountId,
@ -319,6 +319,7 @@ class SendStatusService : Service(), Injectable {
mediaFocus = status.media.map { it.focus },
poll = status.poll,
failedToSend = true,
failedToSendAlert = failedToSendAlert,
scheduledAt = status.scheduledAt,
language = status.language,
statusId = status.statusId,