Fix crash when putting app in background (#3523)
This commit is contained in:
@@ -19,6 +19,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||
### Fixed
|
||||
- Fix Shikimori tracking not working ([@MajorTanya](https://github.com/MajorTanya)) ([#3497](https://github.com/mihonapp/mihon/pull/3497))
|
||||
- Fix crash trying to select text in notes screen ([@AntsyLich](https://github.com/AntsyLich)) ([#3516](https://github.com/mihonapp/mihon/pull/3516))
|
||||
- Fix crash when putting app in background ([@AntsyLich](https://github.com/AntsyLich)) ([#3523](https://github.com/mihonapp/mihon/pull/3523))
|
||||
|
||||
## [v0.20.0] - 2026-06-27
|
||||
### Added
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package tachiyomi.domain.manga.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.compose.runtime.Immutable
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import mihon.core.common.extensions.EMPTY
|
||||
import tachiyomi.core.common.preference.TriState
|
||||
import java.io.Serializable
|
||||
import java.io.ObjectStreamException
|
||||
import java.time.Instant
|
||||
import java.io.Serializable as JavaSerializable
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
@Serializable
|
||||
@Immutable
|
||||
data class Manga(
|
||||
val id: Long,
|
||||
@@ -36,7 +42,7 @@ data class Manga(
|
||||
val version: Long,
|
||||
val notes: String,
|
||||
val memo: JsonObject,
|
||||
) : Serializable {
|
||||
) : JavaSerializable {
|
||||
|
||||
val expectedNextUpdate: Instant?
|
||||
get() = nextUpdate
|
||||
@@ -134,4 +140,17 @@ data class Manga(
|
||||
memo = JsonObject.EMPTY,
|
||||
)
|
||||
}
|
||||
|
||||
@Throws(ObjectStreamException::class)
|
||||
private fun writeReplace(): Any {
|
||||
return JavaToKotlinXSerializable(Json.encodeToString<Manga>(this))
|
||||
}
|
||||
|
||||
class JavaToKotlinXSerializable(private val data: String) : JavaSerializable {
|
||||
|
||||
@Throws(ObjectStreamException::class)
|
||||
private fun readResolve(): Any {
|
||||
return Json.decodeFromString<Manga>(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user