private fun syncDeviceName(newDeviceName: String): Boolean { if (newDeviceName.trim().isEmpty()) { return false } // This may fail, and we'll have a disparity in the UI until `updateDeviceName` is called. viewLifecycleOwner.lifecycleScope.launch(Main) { context?.let { accountManager.authenticatedAccount() ?.deviceConstellation() ?.setDeviceName(newDeviceName, it) } } return true }
Takes a non-empty value and sets the device name. May fail due to authentication.