还原顶栏、浮动卡片、时间侧栏与底部交互;照片路径改为 CameraDownloads 相对路径并兼容旧数据;格式 Chip 固定 JPG 且不可点击。 Co-authored-by: Cursor <cursoragent@cursor.com>
98 lines
3.4 KiB
Swift
98 lines
3.4 KiB
Swift
//
|
||
// SpecifyUploadBottomSheet.swift
|
||
// suixinkan
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
/// 指定上传 Bottom Sheet,对齐 Android SpecifyUploadBottomSheet。
|
||
struct SpecifyUploadBottomSheet: View {
|
||
@Binding var isPresented: Bool
|
||
let onConfirm: (String) -> Void
|
||
|
||
@State private var selectedOption = WiredCameraTransferViewModel.specifyUploadAllPending
|
||
|
||
private let options = [
|
||
WiredCameraTransferViewModel.specifyUploadAllPending,
|
||
WiredCameraTransferViewModel.specifyUploadTodayCaptured
|
||
]
|
||
|
||
var body: some View {
|
||
VStack(spacing: 0) {
|
||
ZStack {
|
||
Button("取消") { isPresented = false }
|
||
.font(.system(size: 16))
|
||
.foregroundStyle(AppDesign.primary)
|
||
.frame(maxWidth: .infinity, alignment: .leading)
|
||
Text("指定上传")
|
||
.font(.system(size: 17, weight: .semibold))
|
||
.foregroundStyle(WiredTransferDesign.text333)
|
||
}
|
||
.padding(.horizontal, 16)
|
||
.frame(height: 52)
|
||
|
||
VStack(spacing: 12) {
|
||
ForEach(options, id: \.self) { option in
|
||
optionRow(option)
|
||
}
|
||
}
|
||
.padding(.horizontal, 16)
|
||
|
||
Spacer(minLength: 20)
|
||
|
||
HStack(spacing: 12) {
|
||
Button("取消") { isPresented = false }
|
||
.font(.system(size: 16, weight: .medium))
|
||
.foregroundStyle(AppDesign.primary)
|
||
.frame(maxWidth: .infinity)
|
||
.frame(height: 48)
|
||
.background(Color.white)
|
||
.overlay {
|
||
RoundedRectangle(cornerRadius: 10)
|
||
.stroke(AppDesign.primary, lineWidth: 1)
|
||
}
|
||
|
||
Button("确认上传") {
|
||
onConfirm(selectedOption)
|
||
}
|
||
.font(.system(size: 16, weight: .medium))
|
||
.foregroundStyle(.white)
|
||
.frame(maxWidth: .infinity)
|
||
.frame(height: 48)
|
||
.background(AppDesign.primary)
|
||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||
}
|
||
.padding(.horizontal, 16)
|
||
.padding(.vertical, 12)
|
||
}
|
||
.background(WiredTransferDesign.pageBackground)
|
||
.onAppear {
|
||
selectedOption = options.first ?? WiredCameraTransferViewModel.specifyUploadAllPending
|
||
}
|
||
}
|
||
|
||
private func optionRow(_ option: String) -> some View {
|
||
Button {
|
||
selectedOption = option
|
||
} label: {
|
||
HStack {
|
||
Text(option)
|
||
.font(.system(size: 15))
|
||
.foregroundStyle(WiredTransferDesign.text333)
|
||
.frame(maxWidth: .infinity, alignment: .leading)
|
||
Image(systemName: selectedOption == option ? "largecircle.fill.circle" : "circle")
|
||
.foregroundStyle(selectedOption == option ? WiredTransferDesign.text333 : WiredTransferDesign.borderLight)
|
||
}
|
||
.padding(.horizontal, 14)
|
||
.padding(.vertical, 8)
|
||
.background(Color.white)
|
||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||
.overlay {
|
||
RoundedRectangle(cornerRadius: 10)
|
||
.stroke(WiredTransferDesign.borderLight, lineWidth: 1)
|
||
}
|
||
}
|
||
.buttonStyle(.plain)
|
||
}
|
||
}
|