From 553a37858a3dea5e7239d5a67dae128164210278 Mon Sep 17 00:00:00 2001 From: Niklas Baudy Date: Sun, 10 Dec 2023 12:04:48 -0300 Subject: [PATCH] Breaking change: Emoji is no longer Parcelable. (#1043) --- .../vanniktech/emoji/facebook/FacebookEmoji.kt | 9 +++------ .../emoji/googlecompat/GoogleCompatEmoji.kt | 9 +++------ .../com/vanniktech/emoji/google/GoogleEmoji.kt | 9 +++------ .../kotlin/com/vanniktech/emoji/ios/IosEmoji.kt | 9 +++------ .../com/vanniktech/emoji/twitter/TwitterEmoji.kt | 9 +++------ emoji/api/current.txt | 2 +- .../kotlin/com/vanniktech/emoji/EmojiTheming.kt | 2 ++ .../emoji/commonParcelableAndroidApi.kt | 5 ----- .../kotlin/com/vanniktech/emoji/Emoji.kt | 2 +- .../com/vanniktech/emoji/commonParcelableApi.kt | 15 --------------- .../kotlin/com/vanniktech/emoji/TestEmoji.kt | 6 +++--- .../vanniktech/emoji/commonParcelableJvmApi.kt | 6 ------ generator/template/Emoji.kt | 9 +++------ generator/template/EmojiCompat.kt | 9 +++------ 14 files changed, 28 insertions(+), 73 deletions(-) delete mode 100644 emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonParcelableAndroidApi.kt delete mode 100644 emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonParcelableApi.kt delete mode 100644 emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt diff --git a/emoji-facebook/src/commonMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmoji.kt b/emoji-facebook/src/commonMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmoji.kt index dcd93afea4..276bb86594 100644 --- a/emoji-facebook/src/commonMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmoji.kt +++ b/emoji-facebook/src/commonMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmoji.kt @@ -17,11 +17,8 @@ package com.vanniktech.emoji.facebook import com.vanniktech.emoji.Emoji -import com.vanniktech.emoji.IgnoredOnParcel -import com.vanniktech.emoji.Parcelable -import com.vanniktech.emoji.Parcelize -@Parcelize internal class FacebookEmoji internal constructor( +internal class FacebookEmoji internal constructor( override val unicode: String, override val shortcodes: List, internal val x: Int, @@ -29,8 +26,8 @@ import com.vanniktech.emoji.Parcelize override val isDuplicate: Boolean, override val variants: List = emptyList(), private var parent: FacebookEmoji? = null, -) : Emoji, Parcelable { - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { +) : Emoji { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!! diff --git a/emoji-google-compat/src/commonMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmoji.kt b/emoji-google-compat/src/commonMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmoji.kt index 780e6308f6..4b097d6e04 100644 --- a/emoji-google-compat/src/commonMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmoji.kt +++ b/emoji-google-compat/src/commonMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmoji.kt @@ -17,18 +17,15 @@ package com.vanniktech.emoji.googlecompat import com.vanniktech.emoji.Emoji -import com.vanniktech.emoji.IgnoredOnParcel -import com.vanniktech.emoji.Parcelable -import com.vanniktech.emoji.Parcelize -@Parcelize internal class GoogleCompatEmoji internal constructor( +internal class GoogleCompatEmoji internal constructor( override val unicode: String, override val shortcodes: List, override val isDuplicate: Boolean, override val variants: List = emptyList(), private var parent: GoogleCompatEmoji? = null, -) : Emoji, Parcelable { - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { +) : Emoji { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!! diff --git a/emoji-google/src/commonMain/kotlin/com/vanniktech/emoji/google/GoogleEmoji.kt b/emoji-google/src/commonMain/kotlin/com/vanniktech/emoji/google/GoogleEmoji.kt index b9e8161432..2b8b4c9b1e 100644 --- a/emoji-google/src/commonMain/kotlin/com/vanniktech/emoji/google/GoogleEmoji.kt +++ b/emoji-google/src/commonMain/kotlin/com/vanniktech/emoji/google/GoogleEmoji.kt @@ -17,11 +17,8 @@ package com.vanniktech.emoji.google import com.vanniktech.emoji.Emoji -import com.vanniktech.emoji.IgnoredOnParcel -import com.vanniktech.emoji.Parcelable -import com.vanniktech.emoji.Parcelize -@Parcelize internal class GoogleEmoji internal constructor( +internal class GoogleEmoji internal constructor( override val unicode: String, override val shortcodes: List, internal val x: Int, @@ -29,8 +26,8 @@ import com.vanniktech.emoji.Parcelize override val isDuplicate: Boolean, override val variants: List = emptyList(), private var parent: GoogleEmoji? = null, -) : Emoji, Parcelable { - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { +) : Emoji { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!! diff --git a/emoji-ios/src/commonMain/kotlin/com/vanniktech/emoji/ios/IosEmoji.kt b/emoji-ios/src/commonMain/kotlin/com/vanniktech/emoji/ios/IosEmoji.kt index f1b5faa4fc..80b4f056c8 100644 --- a/emoji-ios/src/commonMain/kotlin/com/vanniktech/emoji/ios/IosEmoji.kt +++ b/emoji-ios/src/commonMain/kotlin/com/vanniktech/emoji/ios/IosEmoji.kt @@ -17,11 +17,8 @@ package com.vanniktech.emoji.ios import com.vanniktech.emoji.Emoji -import com.vanniktech.emoji.IgnoredOnParcel -import com.vanniktech.emoji.Parcelable -import com.vanniktech.emoji.Parcelize -@Parcelize internal class IosEmoji internal constructor( +internal class IosEmoji internal constructor( override val unicode: String, override val shortcodes: List, internal val x: Int, @@ -29,8 +26,8 @@ import com.vanniktech.emoji.Parcelize override val isDuplicate: Boolean, override val variants: List = emptyList(), private var parent: IosEmoji? = null, -) : Emoji, Parcelable { - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { +) : Emoji { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!! diff --git a/emoji-twitter/src/commonMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmoji.kt b/emoji-twitter/src/commonMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmoji.kt index 8fe71bb592..018f1e8d7c 100644 --- a/emoji-twitter/src/commonMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmoji.kt +++ b/emoji-twitter/src/commonMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmoji.kt @@ -17,11 +17,8 @@ package com.vanniktech.emoji.twitter import com.vanniktech.emoji.Emoji -import com.vanniktech.emoji.IgnoredOnParcel -import com.vanniktech.emoji.Parcelable -import com.vanniktech.emoji.Parcelize -@Parcelize internal class TwitterEmoji internal constructor( +internal class TwitterEmoji internal constructor( override val unicode: String, override val shortcodes: List, internal val x: Int, @@ -29,8 +26,8 @@ import com.vanniktech.emoji.Parcelize override val isDuplicate: Boolean, override val variants: List = emptyList(), private var parent: TwitterEmoji? = null, -) : Emoji, Parcelable { - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { +) : Emoji { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!! diff --git a/emoji/api/current.txt b/emoji/api/current.txt index 8bead224d6..97132fe87c 100644 --- a/emoji/api/current.txt +++ b/emoji/api/current.txt @@ -1,7 +1,7 @@ // Signature format: 4.0 package com.vanniktech.emoji { - public interface Emoji extends android.os.Parcelable { + public interface Emoji { method public com.vanniktech.emoji.Emoji getBase(); method public java.util.List getShortcodes(); method public String getUnicode(); diff --git a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiTheming.kt b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiTheming.kt index 59eb707b57..3e18f4bff0 100644 --- a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiTheming.kt +++ b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/EmojiTheming.kt @@ -19,8 +19,10 @@ package com.vanniktech.emoji import android.content.Context +import android.os.Parcelable import androidx.annotation.ColorInt import com.vanniktech.emoji.internal.Utils +import kotlinx.parcelize.Parcelize /** Control the colors of all Emoji UI components. */ @Parcelize data class EmojiTheming( diff --git a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonParcelableAndroidApi.kt b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonParcelableAndroidApi.kt deleted file mode 100644 index 697b4c1e5f..0000000000 --- a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonParcelableAndroidApi.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.vanniktech.emoji - -actual typealias Parcelable = android.os.Parcelable -actual typealias Parcelize = kotlinx.parcelize.Parcelize -actual typealias IgnoredOnParcel = kotlinx.parcelize.IgnoredOnParcel diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/Emoji.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/Emoji.kt index 8299e8102c..9633e2cd74 100644 --- a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/Emoji.kt +++ b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/Emoji.kt @@ -16,7 +16,7 @@ package com.vanniktech.emoji -interface Emoji : Parcelable { +interface Emoji { val base: Emoji val unicode: String val shortcodes: List diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonParcelableApi.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonParcelableApi.kt deleted file mode 100644 index c455a5a675..0000000000 --- a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonParcelableApi.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.vanniktech.emoji - -expect interface Parcelable - -@OptIn(ExperimentalMultiplatform::class) -@OptionalExpectation -@Target(AnnotationTarget.CLASS) -@Retention(AnnotationRetention.BINARY) -expect annotation class Parcelize() - -@OptIn(ExperimentalMultiplatform::class) -@OptionalExpectation -@Target(AnnotationTarget.PROPERTY) -@Retention(AnnotationRetention.SOURCE) -expect annotation class IgnoredOnParcel() diff --git a/emoji/src/commonTest/kotlin/com/vanniktech/emoji/TestEmoji.kt b/emoji/src/commonTest/kotlin/com/vanniktech/emoji/TestEmoji.kt index 82ffd17126..f546e58468 100644 --- a/emoji/src/commonTest/kotlin/com/vanniktech/emoji/TestEmoji.kt +++ b/emoji/src/commonTest/kotlin/com/vanniktech/emoji/TestEmoji.kt @@ -1,12 +1,12 @@ package com.vanniktech.emoji -@Parcelize data class TestEmoji( +data class TestEmoji( override val unicode: String, override val shortcodes: List, override val isDuplicate: Boolean, override val variants: List = emptyList(), private var parent: TestEmoji? = null, -) : Emoji, Parcelable { +) : Emoji { constructor( codePoints: IntArray, shortcodes: List, @@ -14,7 +14,7 @@ package com.vanniktech.emoji variants: List = emptyList(), ) : this(String(codePoints, 0, codePoints.size), shortcodes, isDuplicate, variants) - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!! diff --git a/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt b/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt deleted file mode 100644 index 1a06cde4de..0000000000 --- a/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt +++ /dev/null @@ -1,6 +0,0 @@ - -@file:Suppress("ktlint:standard:filename") - -package com.vanniktech.emoji - -actual interface Parcelable diff --git a/generator/template/Emoji.kt b/generator/template/Emoji.kt index a833455fe5..6556762c2f 100644 --- a/generator/template/Emoji.kt +++ b/generator/template/Emoji.kt @@ -17,11 +17,8 @@ package com.vanniktech.emoji.<%= package %> import com.vanniktech.emoji.Emoji -import com.vanniktech.emoji.IgnoredOnParcel -import com.vanniktech.emoji.Parcelable -import com.vanniktech.emoji.Parcelize -@Parcelize internal class <%= name %> internal constructor( +internal class <%= name %> internal constructor( override val unicode: String, override val shortcodes: List, internal val x: Int, @@ -29,8 +26,8 @@ import com.vanniktech.emoji.Parcelize override val isDuplicate: Boolean, override val variants: List<<%= name %>> = emptyList(), private var parent: <%= name %>? = null, -) : Emoji, Parcelable { - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { +) : Emoji { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!! diff --git a/generator/template/EmojiCompat.kt b/generator/template/EmojiCompat.kt index e2293f056e..fc4b5750f5 100644 --- a/generator/template/EmojiCompat.kt +++ b/generator/template/EmojiCompat.kt @@ -17,18 +17,15 @@ package com.vanniktech.emoji.<%= package %> import com.vanniktech.emoji.Emoji -import com.vanniktech.emoji.IgnoredOnParcel -import com.vanniktech.emoji.Parcelable -import com.vanniktech.emoji.Parcelize -@Parcelize internal class <%= name %> internal constructor( +internal class <%= name %> internal constructor( override val unicode: String, override val shortcodes: List, override val isDuplicate: Boolean, override val variants: List<<%= name %>> = emptyList(), private var parent: <%= name %>? = null, -) : Emoji, Parcelable { - @IgnoredOnParcel override val base by lazy(LazyThreadSafetyMode.NONE) { +) : Emoji { + override val base by lazy(LazyThreadSafetyMode.NONE) { var result = this while (result.parent != null) { result = result.parent!!