mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
remove magic numbers
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
ff23ced3ac
commit
c005d93f8c
@ -25,21 +25,28 @@ import com.nextcloud.talk.models.domain.NotificationLevel
|
|||||||
class DomainEnumNotificationLevelConverter : IntBasedTypeConverter<NotificationLevel>() {
|
class DomainEnumNotificationLevelConverter : IntBasedTypeConverter<NotificationLevel>() {
|
||||||
override fun getFromInt(i: Int): NotificationLevel {
|
override fun getFromInt(i: Int): NotificationLevel {
|
||||||
return when (i) {
|
return when (i) {
|
||||||
0 -> NotificationLevel.DEFAULT
|
DEFAULT -> NotificationLevel.DEFAULT
|
||||||
1 -> NotificationLevel.ALWAYS
|
ALWAYS -> NotificationLevel.ALWAYS
|
||||||
2 -> NotificationLevel.MENTION
|
MENTION -> NotificationLevel.MENTION
|
||||||
3 -> NotificationLevel.NEVER
|
NEVER -> NotificationLevel.NEVER
|
||||||
else -> NotificationLevel.DEFAULT
|
else -> NotificationLevel.DEFAULT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun convertToInt(`object`: NotificationLevel): Int {
|
override fun convertToInt(`object`: NotificationLevel): Int {
|
||||||
return when (`object`) {
|
return when (`object`) {
|
||||||
NotificationLevel.DEFAULT -> 0
|
NotificationLevel.DEFAULT -> DEFAULT
|
||||||
NotificationLevel.ALWAYS -> 1
|
NotificationLevel.ALWAYS -> ALWAYS
|
||||||
NotificationLevel.MENTION -> 2
|
NotificationLevel.MENTION -> MENTION
|
||||||
NotificationLevel.NEVER -> 3
|
NotificationLevel.NEVER -> NEVER
|
||||||
else -> 0
|
else -> DEFAULT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val DEFAULT: Int = 0
|
||||||
|
private const val ALWAYS: Int = 1
|
||||||
|
private const val MENTION: Int = 2
|
||||||
|
private const val NEVER: Int = 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user