From c11c37c8add85869e493080d3c2bf767157e2253 Mon Sep 17 00:00:00 2001 From: Marcel Schnelle Date: Thu, 15 Aug 2024 17:47:23 +0900 Subject: [PATCH] Make EventResponse#message field nullable The UI layer already handles this message being null, and we can provide a `null` value from the API now as well --- .../confsched/data/eventmap/EventMapApiClient.kt | 2 +- .../data/eventmap/response/EventResponse.kt | 2 +- .../droidkaigi/confsched/model/EventMapEvent.kt | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/EventMapApiClient.kt b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/EventMapApiClient.kt index 9a8455cbf..5fe61d849 100644 --- a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/EventMapApiClient.kt +++ b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/EventMapApiClient.kt @@ -56,7 +56,7 @@ public fun EventMapResponse.toEventMapList(): PersistentList { enTitle = event.i18nDesc.en, ), moreDetailsUrl = event.moreDetailsUrl, - message = event.message.toMultiLangText(), + message = event.message?.toMultiLangText(), ) } } diff --git a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/response/EventResponse.kt b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/response/EventResponse.kt index 357f31fbb..6edb3b2c0 100644 --- a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/response/EventResponse.kt +++ b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/eventmap/response/EventResponse.kt @@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable public data class EventResponse( val i18nDesc: I18nDescResponse, val id: String, - val message: MessageResponse, + val message: MessageResponse?, val moreDetailsUrl: String?, val noShow: Boolean, val roomId: Int, diff --git a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/EventMapEvent.kt b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/EventMapEvent.kt index 478b3e34a..9936868ad 100644 --- a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/EventMapEvent.kt +++ b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/EventMapEvent.kt @@ -34,10 +34,14 @@ public fun EventMapEvent.Companion.fakes(): PersistentList = Room } else { null }, - message = MultiLangText( - "※こちらのイベントは時間が変更されました。", - "※This event has been rescheduled.", - ), + message = if (it.ordinal % 3 == 0) { + MultiLangText( + "※こちらのイベントは時間が変更されました。", + "※This event has been rescheduled.", + ) + } else { + null + }, ) }.toPersistentList()