Merge Tusky PR 4292 to fix sending posts on API 34.
This commit is contained in:
parent
992160717b
commit
5456297612
2 changed files with 13 additions and 4 deletions
|
|
@ -197,6 +197,7 @@
|
|||
</service>
|
||||
|
||||
<service android:name=".service.SendStatusService"
|
||||
android:foregroundServiceType="shortService"
|
||||
android:exported="false" />
|
||||
|
||||
<provider
|
||||
|
|
|
|||
|
|
@ -115,15 +115,23 @@ class SendStatusService : Service(), Injectable {
|
|||
|
||||
statusesToSend[sendingNotificationId] = statusToSend
|
||||
sendStatus(sendingNotificationId--)
|
||||
} else {
|
||||
if (intent.hasExtra(KEY_CANCEL)) {
|
||||
cancelSending(intent.getIntExtra(KEY_CANCEL, 0))
|
||||
}
|
||||
} else if (intent.hasExtra(KEY_CANCEL)) {
|
||||
cancelSending(intent.getIntExtra(KEY_CANCEL, 0))
|
||||
}
|
||||
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
override fun onTimeout(startId: Int) {
|
||||
// https://developer.android.com/about/versions/14/changes/fgs-types-required#short-service
|
||||
// max time for short service reached on Android 14+, stop sending
|
||||
statusesToSend.forEach { (statusId, _) ->
|
||||
serviceScope.launch {
|
||||
failSending(statusId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendStatus(statusId: Int) {
|
||||
// when statusToSend == null, sending has been canceled
|
||||
val statusToSend = statusesToSend[statusId] ?: return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue