From bf47d0b9e815dedea5dda366f2a89e132ee248fe Mon Sep 17 00:00:00 2001 From: Konstantin Date: Thu, 30 May 2024 15:22:18 +0200 Subject: [PATCH] [resources] Use regular classes for resource qualifiers. (#4892) To avoid data classes in the public API. --- .../jetbrains/compose/resources/Qualifier.kt | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Qualifier.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Qualifier.kt index 150f144bc3a..a3c314b8c90 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Qualifier.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Qualifier.kt @@ -3,14 +3,48 @@ package org.jetbrains.compose.resources interface Qualifier @InternalResourceApi -data class LanguageQualifier( +class LanguageQualifier( val language: String -) : Qualifier +) : Qualifier { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as LanguageQualifier + + return language == other.language + } + + override fun hashCode(): Int { + return language.hashCode() + } + + override fun toString(): String { + return "LanguageQualifier(language='$language')" + } +} @InternalResourceApi -data class RegionQualifier( +class RegionQualifier( val region: String -) : Qualifier +) : Qualifier { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as RegionQualifier + + return region == other.region + } + + override fun hashCode(): Int { + return region.hashCode() + } + + override fun toString(): String { + return "RegionQualifier(region='$region')" + } +} @InternalResourceApi enum class ThemeQualifier : Qualifier {