Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ internal data class ProfileCardJson(
val occupation: String,
val link: String,
val image: String,
@Deprecated("Use cardType instead", replaceWith = ReplaceWith("cardType"))
@Deprecated(
"Let's use cardType, but keep it for compatibility.",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this. This deprecation message will be shown when developers use this field, so personally the phrase 'keep it' might be a little difficult for developers to understand what they need to do. I recommend adding a separate comment to clarify.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, let me update.

replaceWith = ReplaceWith("cardType")
)
val theme: String? = null,
@SerialName("card_type")
val cardType: String? = null,
Expand All @@ -22,7 +25,7 @@ internal fun ProfileCardJson.toModel() = ProfileCard.Exists(
occupation = occupation,
link = link,
image = image,
cardType = checkNotNull(cardType ?: theme).toProfileCardType(),
cardType = checkNotNull(cardType ?: cardType).toProfileCardType(),
)

internal fun String.toProfileCardType() = ProfileCardType.valueOf(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProfileCardJsonTest {
assertEquals("test occupation", profileCardJson.occupation)
assertEquals("https://github.com/DroidKaigi/conference-app-2024", profileCardJson.link)
assertEquals("BASE64_ENCODED_SAMPLE_IMAGE_STRING", profileCardJson.image)
assertEquals("Iguana", profileCardJson.theme)
assertEquals("Iguana", profileCardJson.cardType)
assertNull(profileCardJson.cardType)
}

Expand All @@ -44,7 +44,7 @@ class ProfileCardJsonTest {
assertEquals("test occupation", profileCardJson.occupation)
assertEquals("https://github.com/DroidKaigi/conference-app-2024", profileCardJson.link)
assertEquals("BASE64_ENCODED_SAMPLE_IMAGE_STRING", profileCardJson.image)
assertNull(profileCardJson.theme)
assertNull(profileCardJson.cardType)
assertEquals("Iguana", profileCardJson.cardType)
}

Expand Down