Skip to content

Commit

Permalink
[resources] Use regular classes for resource qualifiers. (#4892)
Browse files Browse the repository at this point in the history
To avoid data classes in the public API.
  • Loading branch information
terrakok authored May 30, 2024
1 parent 2305ea7 commit bf47d0b
Showing 1 changed file with 38 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit bf47d0b

Please sign in to comment.