Skip to content

Commit

Permalink
Breaking change: Emoji is no longer Parcelable. (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech authored Dec 10, 2023
1 parent 7ec8f83 commit 553a378
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@
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<String>,
internal val x: Int,
internal val y: Int,
override val isDuplicate: Boolean,
override val variants: List<FacebookEmoji> = 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!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
override val isDuplicate: Boolean,
override val variants: List<GoogleCompatEmoji> = 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!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@
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<String>,
internal val x: Int,
internal val y: Int,
override val isDuplicate: Boolean,
override val variants: List<GoogleEmoji> = 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!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@
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<String>,
internal val x: Int,
internal val y: Int,
override val isDuplicate: Boolean,
override val variants: List<IosEmoji> = 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!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@
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<String>,
internal val x: Int,
internal val y: Int,
override val isDuplicate: Boolean,
override val variants: List<TwitterEmoji> = 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!!
Expand Down
2 changes: 1 addition & 1 deletion emoji/api/current.txt
Original file line number Diff line number Diff line change
@@ -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<java.lang.String> getShortcodes();
method public String getUnicode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion emoji/src/commonMain/kotlin/com/vanniktech/emoji/Emoji.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.vanniktech.emoji

interface Emoji : Parcelable {
interface Emoji {
val base: Emoji
val unicode: String
val shortcodes: List<String>
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions emoji/src/commonTest/kotlin/com/vanniktech/emoji/TestEmoji.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.vanniktech.emoji

@Parcelize data class TestEmoji(
data class TestEmoji(
override val unicode: String,
override val shortcodes: List<String>,
override val isDuplicate: Boolean,
override val variants: List<TestEmoji> = emptyList(),
private var parent: TestEmoji? = null,
) : Emoji, Parcelable {
) : Emoji {
constructor(
codePoints: IntArray,
shortcodes: List<String>,
isDuplicate: Boolean,
variants: List<TestEmoji> = 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!!
Expand Down

This file was deleted.

9 changes: 3 additions & 6 deletions generator/template/Emoji.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@
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<String>,
internal val x: Int,
internal val y: Int,
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!!
Expand Down
9 changes: 3 additions & 6 deletions generator/template/EmojiCompat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
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!!
Expand Down

0 comments on commit 553a378

Please sign in to comment.