refactor: unified getUser repository call for convention

This commit is contained in:
andrekir 2024-10-25 07:50:34 -03:00
parent e05c35afc2
commit 5cf9741b13
4 changed files with 16 additions and 15 deletions

View file

@ -251,12 +251,7 @@ class UIViewModel @Inject constructor(
fun updateMapCenterAndZoom(center: GeoPoint, zoom: Double) =
_mapState.update { it.copy(center = center, zoom = zoom) }
fun getUser(userId: String?) = nodeDB.getUser(userId) ?: user {
id = userId.orEmpty()
longName = app.getString(R.string.unknown_username)
shortName = app.getString(R.string.unknown_node_short_name)
hwModel = MeshProtos.HardwareModel.UNSET
}
fun getUser(userId: String?) = nodeDB.getUser(userId ?: DataPacket.ID_BROADCAST)
private val _snackbarText = MutableLiveData<Any?>(null)
val snackbarText: LiveData<Any?> get() = _snackbarText