Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit db478ef

Browse files
theScrabiabelgardep
authored andcommitted
refactor ShareType
1 parent 29de5ab commit db478ef

File tree

1 file changed

+2
-12
lines changed
  • owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares

1 file changed

+2
-12
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/RemoteShare.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,7 @@ enum class ShareType constructor(val value: Int) {
106106
FEDERATED(6);
107107

108108
companion object {
109-
fun fromValue(value: Int): ShareType? {
110-
return when (value) {
111-
-1 -> UNKNOWN
112-
0 -> USER
113-
1 -> GROUP
114-
3 -> PUBLIC_LINK
115-
4 -> EMAIL
116-
5 -> CONTACT
117-
6 -> FEDERATED
118-
else -> null
119-
}
120-
}
109+
private val values = values();
110+
fun fromValue(value: Int) = values.firstOrNull { it.value == value }
121111
}
122112
}

0 commit comments

Comments
 (0)