feat(app): 重构应用为发盘机app,界面布局优化、移除无用代码

- 将应用名称从 SmartPlateCabinet 更改为 SmartTakePlate
- 更新初始化页面背景图片为 bg_collect_page3
- 替换 View 组件为 Space 组件以优化布局权重分配
- 调整取盘按钮尺寸和文字大小提升用户体验
- 简化人脸识别登录页面布局结构
- 更新应用图标资源为 logo_launcher
- 移除未使用的权限声明和活动注册
- 优化人脸识别相关 API 接口调用
- 调整时间显示逻辑仅保留时间部分
- 移除扫描枪事件监听相关功能代码
- 重构人脸识别数据更新逻辑
- 移除余额不足对话框相关代码
This commit is contained in:
2026-03-27 15:48:04 +08:00
parent 86c3c07e42
commit 7d2bf08023
51 changed files with 1413 additions and 3255 deletions
@@ -11,13 +11,13 @@ import com.sw.plate.utils.arcface.facedb.entity.FaceEntity
import com.sw.platecabinet.GlobalData
import com.sw.platecabinet.GlobalKey
import com.sw.platecabinet.model.DeviceConfig
import com.sw.platecabinet.model.request.LoginParam
import com.sw.platecabinet.model.response.UserFaceModel
import com.sw.platecabinet.utils.SpTool
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import timber.log.Timber
import java.io.File
/**
* 用户viewmodel
@@ -28,38 +28,18 @@ class UserViewModel : BaseViewModel() {
const val PAGE_SIZE = 100
}
// 通过人脸获取到的用户信息
// private val _currentUserInfo = MutableStateFlow<EquipmentUserInfo?>(null)
// val currentUserInfo: StateFlow<EquipmentUserInfo?> = _currentUserInfo
private val faceApi: FaceApi = FaceApi()
/**
* 获取token
*/
// 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 getUserFace(
pageNo: Int,
pageSize: Int,
callback: (List<UserFaceModel>) -> Unit
) {
launchWithLoading{
launchWithLoading {
val response = repository.getUserFaceCache(pageNum = pageNo, pageSize = pageSize)
val status = parseResponse(response)
if (status) callback(response.data?:emptyList())
if (status) callback(response.data ?: emptyList())
else emptyList<UserFaceModel>()
}
}
@@ -159,40 +139,6 @@ class UserViewModel : BaseViewModel() {
})
}
/**
* 校验码登录
*/
fun loginWithPwd(loginParam: LoginParam) {
// launchWithLoading {
// val response = repository.equipmentBoxLogin(loginParam)
// if (parseResponse(response)) {
// _currentUserInfo.value = response.data
// }
// }
}
/**
* 通过用户id获取用户信息
*/
// fun getUserInfoById(memberId: String?, action: (EquipmentUserInfo?) -> Unit = {}) {
// _currentUserInfo.value = null
// launchWithLoading {
// val loginParam = LoginParam(faceId = memberId)
// val response = repository.equipmentBoxLogin(loginParam)
// if (parseResponse(response)) {
// _currentUserInfo.value = response.data
// action(response.data)
// }
// }
// }
/**
* 重置用户信息
*/
fun resetUserInfo() {
Timber.d("resetUserInfo")
// _currentUserInfo.value = null
}
fun getDeviceConfig(block: (DeviceConfig?) -> Unit) {
// Timber.tag(TAG).d("getDeviceConfig")
@@ -206,4 +152,50 @@ class UserViewModel : BaseViewModel() {
}
}
/**
* 获取人脸数据
*/
fun getFaceIncrementList(
pageNo: Int = 1,
pageSize: Int = PAGE_SIZE,
timestamp: Long,
block: (List<UserFaceModel>) -> Unit
) {
launch {
val response = repository.getFaceIncrementList(
pageNum = pageNo.toLong(),
pageSize = pageSize.toLong(),
timestamp = timestamp
)
if (parseResponse(response)) {
withContext(Dispatchers.Default) {
val list: List<UserFaceModel> = response.data ?: emptyList()
block(list)
}
}
}
}
/**
* 添加人脸数据
*/
fun addUserFace(faceData: String, imageFile: File, block: (Boolean, UserFaceModel?) -> Unit) {
launch {
val imageResp = repository.uploadImage(imageFile)
val imageUrl = imageResp.data ?: ""
if (imageUrl.isBlank()) {
block(false, null)
return@launch
}
val faceResp = repository.addUserFace(faceData, imageUrl)
val status = parseResponse(faceResp)
if (status.not()) {
block(false, null)
return@launch
}
block(true, faceResp.data)
}
}
}