修改识别模式
This commit is contained in:
@@ -63,7 +63,7 @@ interface ApiService {
|
||||
suspend fun getMessage(): GetCodeBean<List<MessageGroup>>
|
||||
|
||||
/**
|
||||
* 获取设备信息
|
||||
* 修改设备信息
|
||||
*/
|
||||
@PUT("/app/updateDeviceInfo")
|
||||
suspend fun updateDeviceInfo(@Body deviceBean: DeviceBean): GetCodeBean<DeviceBean>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.example.defenseapplication.utils
|
||||
|
||||
object DeviceUpdateEvent {
|
||||
private val listeners = mutableListOf<DeviceUpdateListener>()
|
||||
|
||||
interface DeviceUpdateListener {
|
||||
fun onDeviceUpdated(deviceId: String)
|
||||
}
|
||||
|
||||
fun addListener(listener: DeviceUpdateListener) {
|
||||
if (!listeners.contains(listener)) {
|
||||
listeners.add(listener)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeListener(listener: DeviceUpdateListener) {
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
||||
fun notifyDeviceUpdated(deviceId: String) {
|
||||
listeners.forEach { it.onDeviceUpdated(deviceId) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user