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:
parent
54c8b28f9d
commit
8cd4521e2f
|
@ -271,6 +271,7 @@ class ComposeViewModel @Inject constructor(
|
||||||
mediaFocus = mediaFocus,
|
mediaFocus = mediaFocus,
|
||||||
poll = poll.value,
|
poll = poll.value,
|
||||||
failedToSend = false,
|
failedToSend = false,
|
||||||
|
failedToSendAlert = false,
|
||||||
scheduledAt = scheduledAt.value,
|
scheduledAt = scheduledAt.value,
|
||||||
language = postLanguage,
|
language = postLanguage,
|
||||||
statusId = originalStatusId,
|
statusId = originalStatusId,
|
||||||
|
|
|
@ -63,6 +63,7 @@ class DraftHelper @Inject constructor(
|
||||||
mediaFocus: List<Attachment.Focus?>,
|
mediaFocus: List<Attachment.Focus?>,
|
||||||
poll: NewPoll?,
|
poll: NewPoll?,
|
||||||
failedToSend: Boolean,
|
failedToSend: Boolean,
|
||||||
|
failedToSendAlert: Boolean,
|
||||||
scheduledAt: String?,
|
scheduledAt: String?,
|
||||||
language: String?,
|
language: String?,
|
||||||
statusId: String?,
|
statusId: String?,
|
||||||
|
@ -123,7 +124,7 @@ class DraftHelper @Inject constructor(
|
||||||
attachments = attachments,
|
attachments = attachments,
|
||||||
poll = poll,
|
poll = poll,
|
||||||
failedToSend = failedToSend,
|
failedToSend = failedToSend,
|
||||||
failedToSendNew = failedToSend,
|
failedToSendNew = failedToSendAlert,
|
||||||
scheduledAt = scheduledAt,
|
scheduledAt = scheduledAt,
|
||||||
language = language,
|
language = language,
|
||||||
statusId = statusId,
|
statusId = statusId,
|
||||||
|
|
|
@ -265,7 +265,7 @@ class SendStatusService : Service(), Injectable {
|
||||||
|
|
||||||
mediaUploader.cancelUploadScope(*failedStatus.media.map { it.localId }.toIntArray())
|
mediaUploader.cancelUploadScope(*failedStatus.media.map { it.localId }.toIntArray())
|
||||||
|
|
||||||
saveStatusToDrafts(failedStatus)
|
saveStatusToDrafts(failedStatus, failedToSendAlert = true)
|
||||||
|
|
||||||
val notification = buildDraftNotification(
|
val notification = buildDraftNotification(
|
||||||
R.string.send_post_notification_error_title,
|
R.string.send_post_notification_error_title,
|
||||||
|
@ -288,7 +288,7 @@ class SendStatusService : Service(), Injectable {
|
||||||
val sendJob = sendJobs.remove(statusId)
|
val sendJob = sendJobs.remove(statusId)
|
||||||
sendJob?.cancel()
|
sendJob?.cancel()
|
||||||
|
|
||||||
saveStatusToDrafts(statusToCancel)
|
saveStatusToDrafts(statusToCancel, failedToSendAlert = false)
|
||||||
|
|
||||||
val notification = buildDraftNotification(
|
val notification = buildDraftNotification(
|
||||||
R.string.send_post_notification_cancel_title,
|
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(
|
draftHelper.saveDraft(
|
||||||
draftId = status.draftId,
|
draftId = status.draftId,
|
||||||
accountId = status.accountId,
|
accountId = status.accountId,
|
||||||
|
@ -319,6 +319,7 @@ class SendStatusService : Service(), Injectable {
|
||||||
mediaFocus = status.media.map { it.focus },
|
mediaFocus = status.media.map { it.focus },
|
||||||
poll = status.poll,
|
poll = status.poll,
|
||||||
failedToSend = true,
|
failedToSend = true,
|
||||||
|
failedToSendAlert = failedToSendAlert,
|
||||||
scheduledAt = status.scheduledAt,
|
scheduledAt = status.scheduledAt,
|
||||||
language = status.language,
|
language = status.language,
|
||||||
statusId = status.statusId,
|
statusId = status.statusId,
|
||||||
|
|
Loading…
Reference in New Issue