feat: update app workflows and permissions
This commit is contained in:
@ -23,7 +23,6 @@ final class HomeQuickActionsView: UIView {
|
||||
addSubview(stackView)
|
||||
stackView.snp.makeConstraints { make in
|
||||
make.edges.equalToSuperview()
|
||||
make.height.equalTo(72)
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,19 +33,36 @@ final class HomeQuickActionsView: UIView {
|
||||
|
||||
func apply(isOnline: Bool) {
|
||||
stackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
|
||||
stackView.addArrangedSubview(makeActionButton(title: "立即收款", icon: "yensign.circle", action: #selector(collectPaymentTapped)))
|
||||
stackView.addArrangedSubview(makeActionButton(title: "提交任务", icon: "doc.text", action: #selector(submitTaskTapped)))
|
||||
stackView.addArrangedSubview(makeActionButton(title: "立即收款", icon: "qrcode", action: #selector(collectPaymentTapped)))
|
||||
stackView.addArrangedSubview(makeActionButton(title: "提交任务", icon: "checklist.checked", action: #selector(submitTaskTapped)))
|
||||
stackView.addArrangedSubview(makeActionButton(
|
||||
title: isOnline ? "在线" : "离线",
|
||||
icon: isOnline ? "dot.radiowaves.left.and.right" : "moon",
|
||||
action: #selector(toggleOnlineTapped)
|
||||
icon: isOnline ? "wifi" : "wifi.slash",
|
||||
action: #selector(toggleOnlineTapped),
|
||||
backgroundColor: isOnline ? AppColor.online : AppColor.cardBackground,
|
||||
iconBackgroundColor: isOnline ? UIColor.white.withAlphaComponent(0.18) : AppColor.inputBackground,
|
||||
iconColor: isOnline ? AppColor.successBackground : AppColor.textTabInactive,
|
||||
titleColor: isOnline ? AppColor.successBackground : AppColor.textTabInactive,
|
||||
showsBorder: !isOnline
|
||||
))
|
||||
}
|
||||
|
||||
private func makeActionButton(title: String, icon: String, action: Selector) -> UIView {
|
||||
private func makeActionButton(
|
||||
title: String,
|
||||
icon: String,
|
||||
action: Selector,
|
||||
backgroundColor: UIColor = AppColor.cardBackground,
|
||||
iconBackgroundColor: UIColor = AppColor.iconBackground,
|
||||
iconColor: UIColor = AppColor.primary,
|
||||
titleColor: UIColor = AppColor.textSecondary,
|
||||
showsBorder: Bool = true
|
||||
) -> UIView {
|
||||
let container = UIView()
|
||||
container.backgroundColor = AppColor.cardBackground
|
||||
container.layer.cornerRadius = AppRadius.md
|
||||
container.backgroundColor = backgroundColor
|
||||
container.layer.cornerRadius = AppRadius.lg
|
||||
container.layer.borderWidth = showsBorder ? 1 : 0
|
||||
container.layer.borderColor = AppColor.cardOutline.cgColor
|
||||
container.accessibilityLabel = title
|
||||
|
||||
let button = UIButton(type: .system)
|
||||
button.addTarget(self, action: action, for: .touchUpInside)
|
||||
@ -55,26 +71,39 @@ final class HomeQuickActionsView: UIView {
|
||||
make.edges.equalToSuperview()
|
||||
}
|
||||
|
||||
let iconContainer = UIView()
|
||||
iconContainer.backgroundColor = iconBackgroundColor
|
||||
iconContainer.layer.cornerRadius = 18
|
||||
|
||||
let imageView = UIImageView(image: UIImage(systemName: icon))
|
||||
imageView.tintColor = AppColor.primary
|
||||
imageView.accessibilityIdentifier = icon
|
||||
imageView.tintColor = iconColor
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
|
||||
let label = UILabel()
|
||||
label.text = title
|
||||
label.font = .app(.bodyMedium)
|
||||
label.textColor = AppColor.textPrimary
|
||||
label.font = .app(.body)
|
||||
label.textColor = titleColor
|
||||
label.textAlignment = .center
|
||||
label.numberOfLines = 2
|
||||
|
||||
let column = UIStackView(arrangedSubviews: [imageView, label])
|
||||
iconContainer.addSubview(imageView)
|
||||
|
||||
let column = UIStackView(arrangedSubviews: [iconContainer, label])
|
||||
column.axis = .vertical
|
||||
column.alignment = .center
|
||||
column.spacing = 6
|
||||
column.spacing = AppSpacing.xs
|
||||
column.isUserInteractionEnabled = false
|
||||
container.addSubview(column)
|
||||
column.snp.makeConstraints { make in
|
||||
make.center.equalToSuperview()
|
||||
make.leading.trailing.equalToSuperview().inset(AppSpacing.xxs)
|
||||
}
|
||||
iconContainer.snp.makeConstraints { make in
|
||||
make.width.height.equalTo(36)
|
||||
}
|
||||
imageView.snp.makeConstraints { make in
|
||||
make.center.equalToSuperview()
|
||||
make.width.height.equalTo(22)
|
||||
}
|
||||
return container
|
||||
|
||||
Reference in New Issue
Block a user