修复收集箱有内容时无法进入

This commit is contained in:
2026-07-15 22:43:45 +08:00
parent 10ba84e349
commit 545e023ffc
+15 -13
View File
@@ -15,15 +15,16 @@ class ViewController: UIViewController {
let icon: String
let iconColor: UIColor
let title: String
let identifier: String
}
private var menuItems: [[MenuItem]] = [
[
MenuItem(icon: "tray.full", iconColor: .systemIndigo, title: "收集箱"),
MenuItem(icon: "note.text", iconColor: .systemYellow, title: "打开备忘录"),
MenuItem(icon: "doc.text", iconColor: .systemBlue, title: "格式化日志"),
MenuItem(icon: "text.alignleft", iconColor: .systemGreen, title: "格式化笔记"),
MenuItem(icon: "folder", iconColor: .systemOrange, title: "打开文件")
MenuItem(icon: "tray.full", iconColor: .systemIndigo, title: "收集箱", identifier: "inbox"),
MenuItem(icon: "note.text", iconColor: .systemYellow, title: "打开备忘录", identifier: "notes"),
MenuItem(icon: "doc.text", iconColor: .systemBlue, title: "格式化日志", identifier: "formatLog"),
MenuItem(icon: "text.alignleft", iconColor: .systemGreen, title: "格式化笔记", identifier: "formatNote"),
MenuItem(icon: "folder", iconColor: .systemOrange, title: "打开文件", identifier: "files")
]
]
@@ -92,19 +93,19 @@ extension ViewController: UITableViewDelegate {
tableView.deselectRow(at: indexPath, animated: true)
let item = menuItems[indexPath.section][indexPath.row]
switch item.title {
case "收集箱":
switch item.identifier {
case "inbox":
let viewController = ClipInboxViewController()
navigationController?.pushViewController(viewController, animated: true)
case "打开备忘录":
case "notes":
openSystemNotesApp()
case "格式化日志":
case "formatLog":
let viewController = FormatLogViewController()
navigationController?.pushViewController(viewController, animated: true)
case "格式化笔记":
case "formatNote":
let viewController = FormatNoteViewController()
navigationController?.pushViewController(viewController, animated: true)
case "打开文件":
case "files":
openFilesApp()
default:
break
@@ -128,11 +129,12 @@ extension ViewController: UITableViewDelegate {
private func updateInboxTitle(_ title: String) {
for (sectionIndex, section) in menuItems.enumerated() {
for (rowIndex, item) in section.enumerated() {
if item.title.hasPrefix("收集箱") {
if item.identifier == "inbox" {
menuItems[sectionIndex][rowIndex] = MenuItem(
icon: item.icon,
iconColor: item.iconColor,
title: title
title: title,
identifier: item.identifier
)
let indexPath = IndexPath(row: rowIndex, section: sectionIndex)
tableView.reloadRows(at: [indexPath], with: .none)