feat(servicing): 增加人脸核验相关功能
- 在 GlobalData 中添加 isLoginRecognition 字段,用于记录是否完成登录后的人脸识别 - 修改 MainActivity 中的示例 URI - 更新 WaitToStartActivity 中的对话框逻辑,增加下一步操作确认对话框 - 修改 WaitToStartVm 中的错误处理方式,使用状态更新替代 Toast 提示 - 优化 ZdCameraXActivity 中的初始化流程,增加屏幕亮度设置
This commit is contained in:
@ -27,7 +27,7 @@ class MainActivity : ComponentActivity() {
|
||||
.fillMaxSize()
|
||||
.clickable {
|
||||
val uri =
|
||||
"zd.assist://app?taskCode=ZD250416100398&driverName=宋志领&driverPhone=17630035658&rescueVehicle=沪88888".toUri()
|
||||
"zd.assist://app?taskCode=ZD250417100404&driverName=宋志领&driverPhone=17630035658&rescueVehicle=沪88888".toUri()
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
@ -75,6 +75,16 @@ object GlobalData {
|
||||
mmkv.encode("lastLoginBean", value)
|
||||
}
|
||||
|
||||
//是否已经完成登录后的人脸识别
|
||||
var isLoginRecognition : Boolean? = null
|
||||
get() {
|
||||
return mmkv.decodeBool("isLoginRecognition", false)
|
||||
}
|
||||
set(value) {
|
||||
mmkv.encode("isLoginRecognition", value ?: false)
|
||||
field = value
|
||||
}
|
||||
|
||||
var currentOrder : OrderInfo? = null
|
||||
get() {
|
||||
return mmkv.decodeParcelable("currentOrder", OrderInfo::class.java)
|
||||
|
@ -104,6 +104,7 @@ class ZdCameraXActivity : AppCompatActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_zd_camera_xactivity)
|
||||
isBack = intent.getBooleanExtra("isBack", true)
|
||||
setWindowBrightness()
|
||||
initView()
|
||||
initLocation()
|
||||
startCamera()
|
||||
@ -159,6 +160,13 @@ class ZdCameraXActivity : AppCompatActivity() {
|
||||
animatorSet?.setDuration(500)
|
||||
}
|
||||
|
||||
// 在 Activity 中调整当前窗口亮度(0.0~1.0范围)
|
||||
private fun setWindowBrightness() {
|
||||
val layoutParams = window.attributes
|
||||
layoutParams.screenBrightness = 1f
|
||||
window.attributes = layoutParams
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun setOnClick() {
|
||||
takePhoto?.setOnClickListener(ClickProxy { v : View? -> takePhoto() })
|
||||
|
@ -59,7 +59,6 @@ import com.amap.api.maps.model.LatLng
|
||||
import com.amap.api.maps.model.LatLngBounds
|
||||
import com.amap.api.maps.model.MarkerOptions
|
||||
import com.amap.api.maps.model.PolylineOptions
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.za.base.BaseActivity
|
||||
import com.za.base.theme.headBgColor
|
||||
import com.za.base.view.CommonDialog
|
||||
@ -96,7 +95,7 @@ fun WaitToStartScreen(vm : WaitToStartVm = viewModel()) {
|
||||
val value = it.data?.getStringExtra("path")
|
||||
LogUtil.print("takePhoto", "path==$value")
|
||||
if (value.isNullOrBlank()) {
|
||||
ToastUtils.showLong("照片路径为空,请重新拍摄!")
|
||||
vm.updateState(uiState.value.copy(comparableFailedStr = "照片路径为空,请重新认证!"))
|
||||
return@rememberLauncherForActivityResult
|
||||
}
|
||||
vm.dispatch(WaitToStartVm.Action.CompareServicePeople(value))
|
||||
@ -134,10 +133,27 @@ fun WaitToStartScreen(vm : WaitToStartVm = viewModel()) {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(goNextPage = null)))
|
||||
}
|
||||
|
||||
if (uiState.value.isGoNextPageDialog == true) {
|
||||
CommonDialog(cancelText = "取消",
|
||||
confirmText = "前往下一步",
|
||||
title = "是否前往下一步?",
|
||||
cancelEnable = true,
|
||||
cancel = {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(isGoNextPageDialog = false)))
|
||||
},
|
||||
dismiss = {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(isGoNextPageDialog = false)))
|
||||
},
|
||||
confirm = {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(isGoNextPageDialog = false)))
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateTask)
|
||||
})
|
||||
}
|
||||
|
||||
if (uiState.value.showServicePeopleConfirmDialog == true) {
|
||||
CommonDialog(cancelText = "取消",
|
||||
confirmText = "去拍照",
|
||||
title = "服务人员确认",
|
||||
confirmText = "去核验",
|
||||
title = "服务技师信息核验",
|
||||
cancelEnable = true,
|
||||
cancel = {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(
|
||||
@ -156,6 +172,24 @@ fun WaitToStartScreen(vm : WaitToStartVm = viewModel()) {
|
||||
})
|
||||
}
|
||||
|
||||
if (! uiState.value.comparableFailedStr.isNullOrBlank()) {
|
||||
CommonDialog(title = uiState.value.comparableFailedStr,
|
||||
confirmText = "重新核验",
|
||||
confirm = {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(comparableFailedStr = null)))
|
||||
val intent = Intent(context, ZdCameraXActivity::class.java)
|
||||
intent.putExtra("isBack", false)
|
||||
getResult.launch(intent)
|
||||
},
|
||||
cancelText = "关闭",
|
||||
cancel = {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(comparableFailedStr = null)))
|
||||
},
|
||||
dismiss = {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(comparableFailedStr = null)))
|
||||
})
|
||||
}
|
||||
|
||||
BottomSheetScaffold(scaffoldState = scaffoldState,
|
||||
topBar = {
|
||||
InServicingHeadView(title = "调度成功,等待发车",
|
||||
@ -304,8 +338,13 @@ fun WaitToStartScreen(vm : WaitToStartVm = viewModel()) {
|
||||
|
||||
// 发车按钮
|
||||
Button(onClick = {
|
||||
if (GlobalData.driverInfoBean != null && GlobalData.driverInfoBean?.authStatus == 1) {
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(
|
||||
showServicePeopleConfirmDialog = true)))
|
||||
return@Button
|
||||
}
|
||||
vm.dispatch(WaitToStartVm.Action.UpdateState(uiState.value.copy(
|
||||
showServicePeopleConfirmDialog = true)))
|
||||
isGoNextPageDialog = true)))
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
@ -232,11 +232,11 @@ class WaitToStartVm : IServicingVm<WaitToStartVm.Action, WaitToStartVm.UiState>(
|
||||
updateTask()
|
||||
}, failed = {
|
||||
LoadingManager.hideLoading()
|
||||
ToastUtils.showLong(it)
|
||||
updateState(uiState.value.copy(comparableFailedStr = it))
|
||||
})
|
||||
}, failed = {
|
||||
LoadingManager.hideLoading()
|
||||
ToastUtils.showLong(it)
|
||||
updateState(uiState.value.copy(comparableFailedStr = it))
|
||||
})
|
||||
}
|
||||
|
||||
@ -288,8 +288,10 @@ class WaitToStartVm : IServicingVm<WaitToStartVm.Action, WaitToStartVm.UiState>(
|
||||
val showCallPhoneDialog : Boolean? = false,
|
||||
val markers : ArrayList<MarkerOptions>? = null,
|
||||
val goNextPage : UpdateTaskBean? = null,
|
||||
val isGoNextPageDialog : Boolean? = null,
|
||||
val routePoints : List<LatLng>? = null,
|
||||
val remainingDistance : Float = 0f,
|
||||
val showServicePeopleConfirmDialog : Boolean? = false,
|
||||
val comparableFailedStr : String? = null,
|
||||
val estimatedArrivalTime : String = "")
|
||||
}
|
Reference in New Issue
Block a user