Remove extra variables.

This commit is contained in:
Hyperling 2024-12-29 08:16:25 -07:00
parent 8447122c89
commit bcf0e0333e

View File

@ -26,14 +26,15 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
fun getEnumStringResource(enumName: String): Int { fun getEnumStringResourceID(enumName: String): Int {
val resourceID: Int = when (enumName) { return (
SortType.FIRST_NAME.toString() -> R.string.FIRST_NAME when (enumName) {
SortType.LAST_NAME.toString() -> R.string.LAST_NAME SortType.FIRST_NAME.toString() -> R.string.FIRST_NAME
SortType.PHONE_NUMBER.toString() -> R.string.PHONE_NUMBER SortType.LAST_NAME.toString() -> R.string.LAST_NAME
else -> 0 SortType.PHONE_NUMBER.toString() -> R.string.PHONE_NUMBER
} else -> 0
return resourceID }
)
} }
@Composable @Composable
@ -83,8 +84,7 @@ fun ContactScreen(
onEvent(ContactEvent.SortContacts(sortType)) onEvent(ContactEvent.SortContacts(sortType))
} }
) )
val sortTypeString: String = stringResource(getEnumStringResource(sortType.name)) Text(text = stringResource(getEnumStringResourceID(sortType.name)))
Text(text = sortTypeString)
} }
} }
} }