refactor(net): 注释掉设备令牌和配置相关功能
- 注释掉 getDeviceToken 方法及其相关逻辑 - 注释掉 getDeviceConfig 方法及其相关逻辑 - 注释掉 getAccessToken 方法及其相关逻辑 - 保留了 UiState 相关的状态流定义 - 维持了其他网络请求方法的正常功能
This commit is contained in:
@@ -30,53 +30,53 @@ class NetViewModel : ViewModel() {
|
|||||||
private val _updateOverdueStateUiState = MutableStateFlow<UiState>(UiState.Initial)
|
private val _updateOverdueStateUiState = MutableStateFlow<UiState>(UiState.Initial)
|
||||||
val updateOverdueStateUiState: StateFlow<UiState> = _updateOverdueStateUiState
|
val updateOverdueStateUiState: StateFlow<UiState> = _updateOverdueStateUiState
|
||||||
|
|
||||||
fun getDeviceToken(deviceId: String) {
|
// fun getDeviceToken(deviceId: String) {
|
||||||
viewModelScope.launch {
|
// viewModelScope.launch {
|
||||||
_getDeviceTokenUiState.value = UiState.Loading
|
// _getDeviceTokenUiState.value = UiState.Loading
|
||||||
runCatching {
|
// runCatching {
|
||||||
val response = apiService.getDeviceToken(qrcodeId = deviceId)
|
// val response = apiService.getDeviceToken(qrcodeId = deviceId)
|
||||||
if (response.isSuccess()) {
|
// if (response.isSuccess()) {
|
||||||
_getDeviceTokenUiState.value = UiState.Success(response)
|
// _getDeviceTokenUiState.value = UiState.Success(response)
|
||||||
} else {
|
// } else {
|
||||||
_getDeviceTokenUiState.value = UiState.Error(response.msg ?: "请求失败")
|
// _getDeviceTokenUiState.value = UiState.Error(response.msg ?: "请求失败")
|
||||||
}
|
// }
|
||||||
}.onFailure {
|
// }.onFailure {
|
||||||
_getDeviceTokenUiState.value = UiState.Error(it.message ?: "请求异常")
|
// _getDeviceTokenUiState.value = UiState.Error(it.message ?: "请求异常")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun getDeviceConfig(deviceId: String, deviceToken: String) {
|
// fun getDeviceConfig(deviceId: String, deviceToken: String) {
|
||||||
viewModelScope.launch {
|
// viewModelScope.launch {
|
||||||
_getDeviceConfigUiState.value = UiState.Loading
|
// _getDeviceConfigUiState.value = UiState.Loading
|
||||||
runCatching {
|
// runCatching {
|
||||||
val response = apiService.getDeviceInfo(equipmentCode = deviceId)
|
// val response = apiService.getDeviceInfo(equipmentCode = deviceId)
|
||||||
if (response.isSuccess()) {
|
// if (response.isSuccess()) {
|
||||||
_getDeviceConfigUiState.value = UiState.Success(response)
|
// _getDeviceConfigUiState.value = UiState.Success(response)
|
||||||
} else {
|
// } else {
|
||||||
_getDeviceConfigUiState.value = UiState.Error(response.msg ?: "请求失败")
|
// _getDeviceConfigUiState.value = UiState.Error(response.msg ?: "请求失败")
|
||||||
}
|
// }
|
||||||
}.onFailure {
|
// }.onFailure {
|
||||||
_getDeviceConfigUiState.value = UiState.Error(it.message ?: "请求异常")
|
// _getDeviceConfigUiState.value = UiState.Error(it.message ?: "请求异常")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun getAccessToken(deviceId: String) {
|
// fun getAccessToken(deviceId: String) {
|
||||||
viewModelScope.launch {
|
// viewModelScope.launch {
|
||||||
_getAccessTokenUiState.value = UiState.Loading
|
// _getAccessTokenUiState.value = UiState.Loading
|
||||||
runCatching {
|
// runCatching {
|
||||||
val response = apiService.getAccessToken(qrcodeId = deviceId)
|
// val response = apiService.getAccessToken(qrcodeId = deviceId)
|
||||||
if (response.isSuccess()) {
|
// if (response.isSuccess()) {
|
||||||
_getAccessTokenUiState.value = UiState.Success(response)
|
// _getAccessTokenUiState.value = UiState.Success(response)
|
||||||
} else {
|
// } else {
|
||||||
_getAccessTokenUiState.value = UiState.Error(response.msg ?: "请求失败")
|
// _getAccessTokenUiState.value = UiState.Error(response.msg ?: "请求失败")
|
||||||
}
|
// }
|
||||||
}.onFailure {
|
// }.onFailure {
|
||||||
_getAccessTokenUiState.value = UiState.Error(it.message ?: "请求异常")
|
// _getAccessTokenUiState.value = UiState.Error(it.message ?: "请求异常")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun getShelfList(deviceId: String) {
|
fun getShelfList(deviceId: String) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
|||||||
Reference in New Issue
Block a user