1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

refactor ShareType

This commit is contained in:
Christian Schabesberger 2020-10-14 13:04:03 +02:00 committed by Abel García de Prada
parent 29de5aba34
commit db478efedc

View File

@ -106,17 +106,7 @@ enum class ShareType constructor(val value: Int) {
FEDERATED(6);
companion object {
fun fromValue(value: Int): ShareType? {
return when (value) {
-1 -> UNKNOWN
0 -> USER
1 -> GROUP
3 -> PUBLIC_LINK
4 -> EMAIL
5 -> CONTACT
6 -> FEDERATED
else -> null
}
}
private val values = values();
fun fromValue(value: Int) = values.firstOrNull { it.value == value }
}
}