关联用户列表优化

This commit is contained in:
2026-05-25 17:08:45 +08:00
parent 95e2d9a3bf
commit fa3ac69752

View File

@@ -181,7 +181,9 @@ class LinkedUserActivity : AppCompatActivity() {
binding.swipeRefresh.isRefreshing = true binding.swipeRefresh.isRefreshing = true
lifecycleScope.launch { lifecycleScope.launch {
try { try {
val deviceId = DeviceIdEvent.getDeviceId() var deviceId: String? = null
if (mode == MODE_SETTINGS) {
deviceId = DeviceIdEvent.getDeviceId()
if (deviceId.isNullOrEmpty()) { if (deviceId.isNullOrEmpty()) {
Toast.makeText(this@LinkedUserActivity, "设备 ID 为空", Toast.LENGTH_SHORT).show() Toast.makeText(this@LinkedUserActivity, "设备 ID 为空", Toast.LENGTH_SHORT).show()
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
@@ -189,8 +191,9 @@ class LinkedUserActivity : AppCompatActivity() {
} }
return@launch return@launch
} }
}
val response = if (mode == MODE_SETTINGS) { val response = if (mode == MODE_SETTINGS) {
RetrofitNetwork.getNetworkService().getDeviceUserList(deviceId) RetrofitNetwork.getNetworkService().getDeviceUserList(deviceId!!)
} else { } else {
RetrofitNetwork.getNetworkService().getFamilyMembers() RetrofitNetwork.getNetworkService().getFamilyMembers()
} }