feat: add and option to toggle stats and graphs temporaily in toolbox

This commit is contained in:
Acaki committed 2025-08-07 04:25:15 +08:00
1 parent 131d115761
commit b8ba716f34
2 files changed
+29 -2

No files matched your search

@@ -283,6 +283,29 @@
} }
} }
}, },
"[ Toggle stats overlay & graphs ]" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "[ 切换统计覆盖层和图表 ]"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "[ 切換統計覆蓋層和圖表 ]"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "[ 切換統計覆蓋層和圖表 ]"
}
}
}
},
"[ On-screen widget tool ]" : { "[ On-screen widget tool ]" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -13,6 +13,7 @@ import UIKit
@objc optional func switchWidgetProfile() @objc optional func switchWidgetProfile()
@objc optional func bringUpSoftKeyboard() @objc optional func bringUpSoftKeyboard()
@objc optional func enterPip() @objc optional func enterPip()
@objc optional func toggleStatsOverlay()
} }
@@ -28,12 +29,13 @@ import UIKit
private let viewBackgroundColor = UIColor(white: 0.2, alpha: 0.8); private let viewBackgroundColor = UIColor(white: 0.2, alpha: 0.8);
private let highlightColor = UIColor(white: 0.39, alpha: 0.8); private let highlightColor = UIColor(white: 0.39, alpha: 0.8);
private let titleLabel = UILabel() private let titleLabel = UILabel()
@objc public var specialEntries : NSMutableArray = ["widgetSwitchTool", "widgetLayoutTool", "bringUpSoftKeyboard", "enterPip"] @objc public var specialEntries : NSMutableArray = ["widgetSwitchTool", "widgetLayoutTool", "bringUpSoftKeyboard", "enterPip", "toggleStatsOverlay"]
private let specialEntryAliasDic : [String:String] = [ private let specialEntryAliasDic : [String:String] = [
"widgetSwitchTool":SwiftLocalizationHelper.localizedString(forKey: "[ Switch on-screen widget profile ]"), "widgetSwitchTool":SwiftLocalizationHelper.localizedString(forKey: "[ Switch on-screen widget profile ]"),
"widgetLayoutTool":SwiftLocalizationHelper.localizedString(forKey: "[ On-screen widget tool ]"), "widgetLayoutTool":SwiftLocalizationHelper.localizedString(forKey: "[ On-screen widget tool ]"),
"bringUpSoftKeyboard":SwiftLocalizationHelper.localizedString(forKey: "[ Bring up soft keyboard ]"), "bringUpSoftKeyboard":SwiftLocalizationHelper.localizedString(forKey: "[ Bring up soft keyboard ]"),
"enterPip":SwiftLocalizationHelper.localizedString(forKey: "[ Enter picture-in-picture mode ]") "enterPip":SwiftLocalizationHelper.localizedString(forKey: "[ Enter picture-in-picture mode ]"),
"toggleStatsOverlay":SwiftLocalizationHelper.localizedString(forKey: "[ Toggle stats overlay & graphs ]")
] ]
private var viewPinned: Bool = false private var viewPinned: Bool = false
@@ -377,6 +379,8 @@ import UIKit
specialEntryDelegate?.bringUpSoftKeyboard?() specialEntryDelegate?.bringUpSoftKeyboard?()
case "enterPip": case "enterPip":
specialEntryDelegate?.enterPip?() specialEntryDelegate?.enterPip?()
case "toggleStatsOverlay":
specialEntryDelegate?.toggleStatsOverlay?()
default: break default: break
} }
} }