feat: update app workflows and permissions

This commit is contained in:
2026-07-09 17:34:00 +08:00
parent 43e6133c21
commit 8e356973bd
44 changed files with 2944 additions and 307 deletions

View File

@ -207,8 +207,8 @@ final class HomeViewController: BaseViewController {
)
}
cell.cardView.onSubmitTask = { [weak self] in
self?.navigationController?.pushViewController(TaskAddViewController(), animated: true)
}
self?.navigationController?.pushViewController(TaskAddViewController(), animated: true)
}
cell.cardView.onToggleOnline = { [weak self] in
self?.viewModel.showOnlineStatusSwitchDialog()
}
@ -301,10 +301,17 @@ final class HomeViewController: BaseViewController {
storeItem: viewModel.storeItem,
commonMenus: viewModel.commonMenus
)
dataSource.apply(snapshot, animatingDifferences: false)
dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in
self?.refreshStatusVisibleCells()
}
presentDialogsIfNeeded()
}
private func refreshStatusVisibleCells() {
refreshWorkStatusVisibleCell()
refreshQuickActionsVisibleCell()
}
private func refreshWorkStatusVisibleCell() {
guard !viewModel.isMinimalTopRole,
let sectionIndex = currentSections.firstIndex(of: .workStatus) else {
@ -321,6 +328,18 @@ final class HomeViewController: BaseViewController {
)
}
private func refreshQuickActionsVisibleCell() {
guard !viewModel.isMinimalTopRole,
let sectionIndex = currentSections.firstIndex(of: .quickActions) else {
return
}
let indexPath = IndexPath(item: 0, section: sectionIndex)
guard let cell = collectionView.cellForItem(at: indexPath) as? HomeQuickActionsCell else {
return
}
cell.apply(isOnline: viewModel.isOnline)
}
private func presentDialogsIfNeeded() {
if viewModel.showPermissionDialog {
presentDialog(.permission)