continue uploading media after sending post (#4662)
regression from https://github.com/tuskyapp/Tusky/pull/4599 https://pug.ninja/@motoridersd/113102603349423738 The problem is, `MediaUploader` is no longer a singleton, so the state is not correctly shared between `ComposeActivity` and `SendStatusService.` But it can't be a singleton, since `MediaUploadApi` (injected into `MediaUploader`) needs to be recreated on account change. Let's share the state in the companion object instead.
This commit is contained in:
parent
e515784729
commit
a9d6b60291
|
@ -97,9 +97,11 @@ class MediaUploader @Inject constructor(
|
|||
private val mediaUploadApi: MediaUploadApi
|
||||
) {
|
||||
|
||||
private val uploads = mutableMapOf<Int, UploadData>()
|
||||
|
||||
private var mostRecentId: Int = 0
|
||||
private companion object {
|
||||
private const val TAG = "MediaUploader"
|
||||
private val uploads = mutableMapOf<Int, UploadData>()
|
||||
private var mostRecentId: Int = 0
|
||||
}
|
||||
|
||||
fun getNewLocalMediaId(): Int {
|
||||
return mostRecentId++
|
||||
|
@ -326,8 +328,4 @@ class MediaUploader @Inject constructor(
|
|||
return media.type == QueuedMedia.Type.IMAGE &&
|
||||
(media.mediaSize > instanceInfo.imageSizeLimit || getImageSquarePixels(context.contentResolver, media.uri) > instanceInfo.imageMatrixLimit)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val TAG = "MediaUploader"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue