完善素材管理 UI 交互并修复列表解析与时间选择。

MaterialItem 兼容 Android 缺失字段默认值,优化素材详情/列表/标签布局与上下架开关交互,修复个人空间时间选择器初始值。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 13:34:45 +08:00
parent 7deeedec68
commit cbf2db649e
6 changed files with 122 additions and 29 deletions

View File

@ -607,14 +607,13 @@ final class ProfileSpaceSettingsViewController: BaseViewController {
private func showTimePicker(initialTime: String?, onConfirm: @escaping (String) -> Void) {
let dialog = ProfileTimePickerDialogViewController(
initialDate: date(fromTime: "00:00"),
initialDate: date(fromTime: initialTime ?? "00:00"),
onConfirm: { [weak self] date in
guard let self else { return }
onConfirm(timeString(from: date))
}
)
present(dialog, animated: false)
_ = initialTime
}
private func date(fromTime value: String) -> Date {
@ -976,7 +975,7 @@ final class ProfileAddScheduleViewController: BaseViewController {
}
private func showTimePicker(initialTime: String?, onConfirm: @escaping (String) -> Void) {
let date = Self.date(from: "00:00")
let date = Self.date(from: initialTime)
let dialog = ProfileTimePickerDialogViewController(initialDate: date) { selectedDate in
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en_US_POSIX")
@ -984,7 +983,6 @@ final class ProfileAddScheduleViewController: BaseViewController {
onConfirm(formatter.string(from: selectedDate))
}
present(dialog, animated: false)
_ = initialTime
}
@objc private func startTapped() {
@ -1063,7 +1061,9 @@ final class ProfileAddScheduleViewController: BaseViewController {
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en_US_POSIX")
formatter.dateFormat = "HH:mm"
return formatter.date(from: time ?? "00:00") ?? Date()
return formatter.date(from: time ?? "")
?? formatter.date(from: "00:00")
?? Date(timeIntervalSince1970: 0)
}
}
@ -1265,6 +1265,9 @@ private final class ProfileTagWrapView: UIView {
case .device:
button.backgroundColor = AppColor.inputBackground
button.setTitleColor(UIColor(hex: 0x4B5563), for: .normal)
button.snp.makeConstraints { make in
make.height.equalTo(28)
}
}
if removable {
button.addAction(UIAction { [weak self] _ in