添加了界面及逻辑
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.sw.platecabinet.viewmodel
|
||||
|
||||
import com.sw.inbound.utils.SPUtil
|
||||
import com.sw.platecabinet.GlobalKey
|
||||
|
||||
class UserViewModel : BaseViewModel() {
|
||||
|
||||
fun generateToken(deviceId: String = "SWSN:88:12:AC:4E:D9:CC") {
|
||||
launchWithLoading {
|
||||
val response = repository.generateToken(deviceId)
|
||||
if (parseResponse(response)) {
|
||||
// 缓存token
|
||||
SPUtil.getInstance().put(GlobalKey.KEY_TOKEN, response.data)
|
||||
// 首次运行获取人脸数据
|
||||
if (SPUtil.getInstance().get(GlobalKey.KEY_FIRST_RUN, false) != true) {
|
||||
getUserFaceCache()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getUserFaceCache() {
|
||||
launchWithLoading {
|
||||
val response = repository.getUserFaceCache()
|
||||
if (parseResponse(response)) {
|
||||
// 获取成功一次后缓存状态
|
||||
SPUtil.getInstance().put(GlobalKey.KEY_FIRST_RUN, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活 arcsoft 人脸
|
||||
*/
|
||||
fun activeEngine(
|
||||
appId: String = "Hkz1rBk6PZXbS8KwKr67K2eZtsz8bRoMHLg64bUdgCZj",
|
||||
sdkKey: String = "AabXs3sHM8UhhE7oCGf4LVMLrdkGb1nJNksbjjTdVt7k",
|
||||
activeKey: String = "085F-118G-Q391-53YL"
|
||||
) {
|
||||
// val runtimeABI: RuntimeABI? = FaceEngine.getRuntimeABI()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user