User.kt 968 B

12345678910111213141516171819202122232425262728293031323334
  1. package eu.mjdev.desktop.data
  2. import androidx.compose.material.icons.Icons
  3. import androidx.compose.material.icons.filled.AccountCircle
  4. import androidx.compose.runtime.mutableStateOf
  5. import eu.mjdev.desktop.helpers.system.Command
  6. @Suppress("MemberVisibilityCanBePrivate")
  7. class User(
  8. name: String?,
  9. picture: Any?,
  10. config: DesktopConfig,
  11. theme: Theme
  12. ) {
  13. val nameState = mutableStateOf(name)
  14. val pictureState = mutableStateOf(picture)
  15. val configState = mutableStateOf(config)
  16. val themeState = mutableStateOf(theme)
  17. val name get() = nameState.value
  18. val picture get() = pictureState.value
  19. val config get() = configState.value
  20. val theme get() = themeState.value
  21. companion object {
  22. // todo
  23. fun load() = User(
  24. name = Command("whoami").execute(),
  25. picture = Icons.Filled.AccountCircle,
  26. config = DesktopConfig.Default,
  27. theme = Theme.Default
  28. )
  29. }
  30. }