Use Set for opening hours instead of list
This commit is contained in:
@@ -26,7 +26,10 @@ data class OpeningHours(
|
||||
sealed interface OpeningSchedule {
|
||||
data object TwentyFourSeven : OpeningSchedule
|
||||
@Serializable
|
||||
data class Hours(@Serializable val openingHours: List<OpeningHours>) : OpeningSchedule
|
||||
data class Hours(@Serializable val openingHours: Set<OpeningHours>) : OpeningSchedule {
|
||||
@Deprecated("Use the constructor with Set<OpeningHours> instead.")
|
||||
constructor(openingHours: List<OpeningHours>) : this(openingHours.toSet())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ object OpeningScheduleSerializer : KSerializer<OpeningSchedule> {
|
||||
)
|
||||
} catch (e: SerializationException) {
|
||||
Log.e("MM20", "Failed to deserialize OpeningSchedule.Hours", e)
|
||||
return OpeningSchedule.Hours(openingHours = emptyList())
|
||||
return OpeningSchedule.Hours(openingHours = emptySet())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user