fix: destroyed activity crash on slower phones
This commit is contained in:
parent
7bce053202
commit
e7a60e07d8
2 changed files with 29 additions and 1 deletions
|
@ -6,4 +6,27 @@ object AppUpdater {
|
||||||
suspend fun check(activity: FragmentActivity, post: Boolean = false) {
|
suspend fun check(activity: FragmentActivity, post: Boolean = false) {
|
||||||
//no-op
|
//no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GithubResponse(
|
||||||
|
@SerialName("html_url")
|
||||||
|
val htmlUrl: String,
|
||||||
|
@SerialName("tag_name")
|
||||||
|
val tagName: String,
|
||||||
|
val prerelease: Boolean,
|
||||||
|
@SerialName("created_at")
|
||||||
|
val createdAt: String,
|
||||||
|
val body: String? = null,
|
||||||
|
val assets: List<Asset>? = null
|
||||||
|
) {
|
||||||
|
@Serializable
|
||||||
|
data class Asset(
|
||||||
|
@SerialName("browser_download_url")
|
||||||
|
val browserDownloadURL: String
|
||||||
|
)
|
||||||
|
|
||||||
|
fun timeStamp(): Long {
|
||||||
|
return dateFormat.parse(createdAt)!!.time
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ import ani.dantotsu.util.Logger
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.MainScope
|
import kotlinx.coroutines.MainScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.time.delay
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.JsonArray
|
import kotlinx.serialization.json.JsonArray
|
||||||
|
@ -69,7 +70,11 @@ object AppUpdater {
|
||||||
)
|
)
|
||||||
addView(
|
addView(
|
||||||
TextView(activity).apply {
|
TextView(activity).apply {
|
||||||
val markWon = buildMarkwon(activity, false)
|
val markWon = try { //slower phones can destroy the activity before this is done
|
||||||
|
buildMarkwon(activity, false)
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
return@runOnUiThread
|
||||||
|
}
|
||||||
markWon.setMarkdown(this, md)
|
markWon.setMarkdown(this, md)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue