fix: 去掉撤销打卡确认弹窗,直接执行+Toast提示
撤销是低频操作,二次确认多余。点击直接调API, 成功后Toast"撤销成功",失败Toast错误信息。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,6 @@ import com.xiaoqu.watch.ui.common.BaseFragment
|
||||
import com.xiaoqu.watch.ui.punch.PunchPanelView
|
||||
import com.xiaoqu.watch.ui.punch.PunchResult
|
||||
import com.xiaoqu.watch.ui.punch.PunchViewModel
|
||||
import com.xiaoqu.watch.ui.widget.QuConfirmDialog
|
||||
import com.xiaoqu.watch.ui.widget.StatusBarView
|
||||
import com.xiaoqu.watch.util.DateUtil
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
@@ -57,7 +56,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
||||
|
||||
// ===== 打卡面板 =====
|
||||
private lateinit var punchPanel: PunchPanelView
|
||||
private var confirmDialog: QuConfirmDialog? = null
|
||||
|
||||
// ===== 主页 View 引用 =====
|
||||
private lateinit var tvClock: TextView
|
||||
@@ -133,7 +131,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
||||
/** 初始化打卡面板 */
|
||||
private fun initPunchPanel() {
|
||||
punchPanel = binding.punchPanel
|
||||
confirmDialog = QuConfirmDialog(binding.dialogContainer)
|
||||
|
||||
// 上班打卡
|
||||
punchPanel.onPunchInClick = {
|
||||
@@ -145,10 +142,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
||||
punchViewModel.startPunch(1)
|
||||
}
|
||||
|
||||
// 撤销打卡
|
||||
// 撤销打卡(直接执行,成功后 Toast 提示)
|
||||
punchPanel.onRevokeClick = {
|
||||
// 弹出确认弹窗
|
||||
showRevokeConfirm()
|
||||
punchViewModel.revokePunch()
|
||||
}
|
||||
|
||||
// 面板关闭时恢复 ViewPager2 滑动
|
||||
@@ -157,16 +153,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示撤销打卡确认弹窗 */
|
||||
private fun showRevokeConfirm() {
|
||||
confirmDialog?.showText(
|
||||
text = "确定撤销打卡?",
|
||||
onConfirm = {
|
||||
punchViewModel.revokePunch()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/** 监听打卡状态变化 */
|
||||
private fun observePunchState() {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
|
||||
Reference in New Issue
Block a user