update ktlint plugin to 11.3.1, format code (#3442)
This commit is contained in:
parent
774d79d666
commit
d839f18267
141 changed files with 589 additions and 428 deletions
|
|
@ -53,12 +53,16 @@ class SendStatusService : Service(), Injectable {
|
|||
|
||||
@Inject
|
||||
lateinit var mastodonApi: MastodonApi
|
||||
|
||||
@Inject
|
||||
lateinit var accountManager: AccountManager
|
||||
|
||||
@Inject
|
||||
lateinit var eventHub: EventHub
|
||||
|
||||
@Inject
|
||||
lateinit var draftHelper: DraftHelper
|
||||
|
||||
@Inject
|
||||
lateinit var mediaUploader: MediaUploader
|
||||
|
||||
|
|
@ -111,7 +115,6 @@ class SendStatusService : Service(), Injectable {
|
|||
statusesToSend[sendingNotificationId] = statusToSend
|
||||
sendStatus(sendingNotificationId--)
|
||||
} else {
|
||||
|
||||
if (intent.hasExtra(KEY_CANCEL)) {
|
||||
cancelSending(intent.getIntExtra(KEY_CANCEL, 0))
|
||||
}
|
||||
|
|
@ -121,7 +124,6 @@ class SendStatusService : Service(), Injectable {
|
|||
}
|
||||
|
||||
private fun sendStatus(statusId: Int) {
|
||||
|
||||
// when statusToSend == null, sending has been canceled
|
||||
val statusToSend = statusesToSend[statusId] ?: return
|
||||
|
||||
|
|
@ -138,7 +140,6 @@ class SendStatusService : Service(), Injectable {
|
|||
statusToSend.retries++
|
||||
|
||||
sendJobs[statusId] = serviceScope.launch {
|
||||
|
||||
// first, wait for media uploads to finish
|
||||
val media = statusToSend.media.map { mediaItem ->
|
||||
if (mediaItem.id == null) {
|
||||
|
|
@ -174,7 +175,7 @@ class SendStatusService : Service(), Injectable {
|
|||
}
|
||||
}
|
||||
}
|
||||
mediaCheckRetries ++
|
||||
mediaCheckRetries++
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "failed getting media status", e)
|
||||
|
|
@ -198,9 +199,9 @@ class SendStatusService : Service(), Injectable {
|
|||
id = media.id!!,
|
||||
description = media.description,
|
||||
focus = media.focus?.toMastodonApiString(),
|
||||
thumbnail = null,
|
||||
thumbnail = null
|
||||
)
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
val editing = (statusToSend.statusId != null)
|
||||
|
|
@ -266,7 +267,6 @@ class SendStatusService : Service(), Injectable {
|
|||
}
|
||||
|
||||
private fun stopSelfWhenDone() {
|
||||
|
||||
if (statusesToSend.isEmpty()) {
|
||||
ServiceCompat.stopForeground(this@SendStatusService, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
||||
stopSelf()
|
||||
|
|
@ -276,7 +276,6 @@ class SendStatusService : Service(), Injectable {
|
|||
private suspend fun failSending(statusId: Int) {
|
||||
val failedStatus = statusesToSend.remove(statusId)
|
||||
if (failedStatus != null) {
|
||||
|
||||
mediaUploader.cancelUploadScope(*failedStatus.media.map { it.localId }.toIntArray())
|
||||
|
||||
saveStatusToDrafts(failedStatus, failedToSendAlert = true)
|
||||
|
|
@ -296,7 +295,6 @@ class SendStatusService : Service(), Injectable {
|
|||
private fun cancelSending(statusId: Int) = serviceScope.launch {
|
||||
val statusToCancel = statusesToSend.remove(statusId)
|
||||
if (statusToCancel != null) {
|
||||
|
||||
mediaUploader.cancelUploadScope(*statusToCancel.media.map { it.localId }.toIntArray())
|
||||
|
||||
val sendJob = sendJobs.remove(statusId)
|
||||
|
|
@ -336,7 +334,7 @@ class SendStatusService : Service(), Injectable {
|
|||
failedToSendAlert = failedToSendAlert,
|
||||
scheduledAt = status.scheduledAt,
|
||||
language = status.language,
|
||||
statusId = status.statusId,
|
||||
statusId = status.statusId
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -357,7 +355,6 @@ class SendStatusService : Service(), Injectable {
|
|||
accountId: Long,
|
||||
statusId: Int
|
||||
): Notification {
|
||||
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
intent.putExtra(NotificationHelper.ACCOUNT_ID, accountId)
|
||||
intent.putExtra(MainActivity.OPEN_DRAFTS, true)
|
||||
|
|
@ -442,7 +439,7 @@ data class StatusToSend(
|
|||
val idempotencyKey: String,
|
||||
var retries: Int,
|
||||
val language: String?,
|
||||
val statusId: String?,
|
||||
val statusId: String?
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue