Add unified HomeCommonMenu/HomeAllFunctions diagnostics, rebuild all-functions from top-level menuList permissions, and document Home and AllFunctions module logic. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
1.1 KiB
Swift
34 lines
1.1 KiB
Swift
//
|
||
// HomeCommonMenuDiagnostics.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/6/30.
|
||
//
|
||
|
||
import Foundation
|
||
import os
|
||
|
||
/// 首页常用应用诊断日志,输出与 Android `HomeCommonMenu` tag 对齐的字段。
|
||
enum HomeCommonMenuDiagnostics {
|
||
private static let logger = Logger(subsystem: "com.yuanzhixiang.suixinkan", category: "HomeCommonMenu")
|
||
|
||
/// 记录常用应用流水线中的单步诊断信息。
|
||
static func log(step: String, fields: [String: String]) {
|
||
#if DEBUG
|
||
let payload = fields.map { "\($0.key)=\($0.value)" }.joined(separator: " ")
|
||
logger.debug("step=\(step, privacy: .public) \(payload, privacy: .public)")
|
||
#endif
|
||
}
|
||
|
||
/// 将 URI 列表格式化为日志可读字符串。
|
||
static func formatURIList(_ uris: [String]) -> String {
|
||
"[\(uris.joined(separator: ","))]"
|
||
}
|
||
|
||
/// 将展示项格式化为 title|uri 列表。
|
||
static func formatDisplayItems(_ items: [(title: String, uri: String)]) -> String {
|
||
let labels = items.map { "\($0.title)|\($0.uri)" }
|
||
return "[\(labels.joined(separator: ","))]"
|
||
}
|
||
}
|