feat: 网络
This commit is contained in:
@@ -25,6 +25,7 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import timber.log.Timber
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.resumeWithException
|
||||
|
||||
|
||||
class DeviceServiceManager(val context: Application) {
|
||||
@@ -157,7 +158,12 @@ class DeviceServiceManager(val context: Application) {
|
||||
}
|
||||
|
||||
suspend fun getSn() = suspendCancellableCoroutine { continuation ->
|
||||
systemFuncServiceTodo { service ->
|
||||
ServiceManager.getSystemFuncService(context) { service ->
|
||||
if (service == null) {
|
||||
continuation.resumeWithException(Throwable("没有拿到SN 要重启APP"))
|
||||
return@getSystemFuncService
|
||||
}
|
||||
systemFuncService = service
|
||||
sn = service.sn
|
||||
continuation.resume(sn)
|
||||
}
|
||||
@@ -187,7 +193,6 @@ class DeviceServiceManager(val context: Application) {
|
||||
}
|
||||
systemFuncService = service
|
||||
todo.invoke(service)
|
||||
Timber.d(" ${service.sn}")
|
||||
}
|
||||
} else {
|
||||
todo.invoke(systemFuncService!!)
|
||||
|
||||
Reference in New Issue
Block a user