diff --git a/gradle/core.versions.toml b/gradle/core.versions.toml index 4b995b98..cad70323 100644 --- a/gradle/core.versions.toml +++ b/gradle/core.versions.toml @@ -1,5 +1,5 @@ [versions] -androidxCore = "1.15.0" +androidxCore = "1.13.1" # Doesn't build when bumped to 1.15.0 (Waiting SDK 35) composeBom = "2024.12.01" integrity = "1.4.0" junit = "4.13.2" diff --git a/src/main/kotlin/com/infomaniak/core/EnumUtils.kt b/src/main/kotlin/com/infomaniak/core/EnumUtils.kt index 01b80c41..3bbc96c8 100644 --- a/src/main/kotlin/com/infomaniak/core/EnumUtils.kt +++ b/src/main/kotlin/com/infomaniak/core/EnumUtils.kt @@ -20,3 +20,11 @@ package com.infomaniak.core inline fun > enumValueOfOrNull(value: String?): T? { return value?.let { runCatching { enumValueOf(it) }.getOrNull() } } + +inline fun apiEnumValueOfOrNull(value: String?): T? where T : Enum, T : ApiEnum { + return value?.let { runCatching { enumValues().firstOrNull { it.apiValue == value } }.getOrNull() } +} + +interface ApiEnum { + val apiValue: String +}