From 42a9eb628f1ac5a246b80f45d3c099dec5d7287d Mon Sep 17 00:00:00 2001 From: Syer10 Date: Thu, 7 Apr 2022 19:40:27 -0400 Subject: [PATCH] Fix sources menu crash when put in background --- .../kotlin/ca/gosyer/jui/core/io/Serializable.kt | 9 +++++++++ .../kotlin/ca/gosyer/jui/core/io/JvmSerializable.kt | 9 +++++++++ .../kotlin/ca/gosyer/jui/data/models/Source.kt | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 core/src/commonMain/kotlin/ca/gosyer/jui/core/io/Serializable.kt create mode 100644 core/src/jvmMain/kotlin/ca/gosyer/jui/core/io/JvmSerializable.kt diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/io/Serializable.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/io/Serializable.kt new file mode 100644 index 00000000..9211d8e4 --- /dev/null +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/io/Serializable.kt @@ -0,0 +1,9 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.core.io + +expect interface Serializable \ No newline at end of file diff --git a/core/src/jvmMain/kotlin/ca/gosyer/jui/core/io/JvmSerializable.kt b/core/src/jvmMain/kotlin/ca/gosyer/jui/core/io/JvmSerializable.kt new file mode 100644 index 00000000..930300b4 --- /dev/null +++ b/core/src/jvmMain/kotlin/ca/gosyer/jui/core/io/JvmSerializable.kt @@ -0,0 +1,9 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package ca.gosyer.jui.core.io + +actual typealias Serializable = java.io.Serializable \ No newline at end of file diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Source.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Source.kt index 396a55f7..e2c8a9d0 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Source.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/models/Source.kt @@ -7,6 +7,7 @@ package ca.gosyer.jui.data.models import kotlinx.serialization.Serializable +import ca.gosyer.jui.core.io.Serializable as JvmSerializable @Serializable data class Source( @@ -18,7 +19,7 @@ data class Source( val isConfigurable: Boolean, val isNsfw: Boolean, val displayName: String -) { +): JvmSerializable { val displayLang: String get() = if (id == LOCAL_SOURCE_ID) { "other"