UserDef // +kCandidateServiceMenuContents.

This commit is contained in:
ShikiSuen 2024-02-26 21:00:20 +08:00
parent 46d4e7bdb3
commit 923471c8bb
3 changed files with 30 additions and 0 deletions

View File

@ -25,6 +25,29 @@ import SwiftExtension
"com.valvesoftware.steam": true, "jp.naver.line.mac": true, "com.valvesoftware.steam": true, "jp.naver.line.mac": true,
] ]
public static let kDefaultCandidateServiceMenuItem: [String] = [
#"Unicode Metadata: %s"# + "\t" + #"@SEL:copyUnicodeMetadata:"#,
#"macOS Dict: %s"# + "\t" + #"@URL:dict://%s"#,
#"Bing: %s"# + "\t" + #"@WEB:https://www.bing.com/search?q=%s"#,
#"DuckDuckGo: %s"# + "\t" + #"@WEB:https://duckduckgo.com/?t=h_&q=%s"#,
#"Ecosia: %s"# + "\t" + #"@WEB:https://www.ecosia.org/search?method=index&q=%s"#,
#"Google: %s"# + "\t" + #"@WEB:https://www.google.com/search?q=%s"#,
#"MoeDict: %s"# + "\t" + #"@WEB:https://www.moedict.tw/%s"#,
#"Wikitonary: %s"# + "\t" + #"@WEB:https://zh.wiktionary.org/wiki/Special:Search?search=%s"#,
#"Unihan: %s"# + "\t" + #"@WEB:https://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%s"#,
#"Zi-Hi: %s"# + "\t" + #"@WEB:https://zi-hi.com/sp/uni/%s"#,
#"HTML Ruby Zhuyin: %s"# + "\t" + #"@SEL:copyRubyHTMLZhuyinTextbookStyle:"#,
#"HTML Ruby Pinyin: %s"# + "\t" + #"@SEL:copyRubyHTMLHanyuPinyinTextbookStyle:"#,
#"Zhuyin Annotation: %s"# + "\t" + #"@SEL:copyInlineZhuyinAnnotationTextbookStyle:"#,
#"Pinyin Annotation: %s"# + "\t" + #"@SEL:copyInlineHanyuPinyinAnnotationTextbookStyle:"#,
#"Braille 1947: %s"# + "\t" + #"@SEL:copyBraille1947:"#,
#"Braille 2018: %s"# + "\t" + #"@SEL:copyBraille2018:"#,
#"Baidu: %s"# + "\t" + #"@WEB:https://www.baidu.com/s?wd=%s"#,
#"BiliBili: %s"# + "\t" + #"@WEB:https://search.bilibili.com/all?keyword=%s"#,
#"Genshin BiliWiki: %s"# + "\t" + #"@WEB:https://wiki.biligame.com/ys/%s"#,
#"HSR BiliWiki: %s"# + "\t" + #"@WEB:https://wiki.biligame.com/sr/%s"#,
]
public var didAskForSyncingLMPrefs: (() -> Void)? public var didAskForSyncingLMPrefs: (() -> Void)?
public var didAskForRefreshingSpeechSputnik: (() -> Void)? public var didAskForRefreshingSpeechSputnik: (() -> Void)?
public var didAskForSyncingShiftKeyDetectorPrefs: (() -> Void)? public var didAskForSyncingShiftKeyDetectorPrefs: (() -> Void)?
@ -37,6 +60,9 @@ import SwiftExtension
@AppProperty(key: UserDef.kFailureFlagForUOMObservation.rawValue, defaultValue: false) @AppProperty(key: UserDef.kFailureFlagForUOMObservation.rawValue, defaultValue: false)
public dynamic var failureFlagForUOMObservation: Bool public dynamic var failureFlagForUOMObservation: Bool
@AppProperty(key: UserDef.kCandidateServiceMenuContents.rawValue, defaultValue: kDefaultCandidateServiceMenuItem)
public dynamic var candidateServiceMenuContents: [String]
@AppProperty(key: UserDef.kRespectClientAccentColor.rawValue, defaultValue: true) @AppProperty(key: UserDef.kRespectClientAccentColor.rawValue, defaultValue: true)
public dynamic var respectClientAccentColor: Bool public dynamic var respectClientAccentColor: Bool

View File

@ -11,6 +11,7 @@ import Foundation
public protocol PrefMgrProtocol { public protocol PrefMgrProtocol {
var isDebugModeEnabled: Bool { get set } var isDebugModeEnabled: Bool { get set }
var failureFlagForUOMObservation: Bool { get set } var failureFlagForUOMObservation: Bool { get set }
var candidateServiceMenuContents: [String] { get set }
var respectClientAccentColor: Bool { get set } var respectClientAccentColor: Bool { get set }
var securityHardenedCompositionBuffer: Bool { get set } var securityHardenedCompositionBuffer: Bool { get set }
var checkAbusersOfSecureEventInputAPI: Bool { get set } var checkAbusersOfSecureEventInputAPI: Bool { get set }

View File

@ -33,6 +33,7 @@ public enum UserDef: String, CaseIterable, Identifiable {
case kIsDebugModeEnabled = "_DebugMode" case kIsDebugModeEnabled = "_DebugMode"
case kFailureFlagForUOMObservation = "_FailureFlag_UOMObservation" case kFailureFlagForUOMObservation = "_FailureFlag_UOMObservation"
case kCandidateServiceMenuContents = "CandidateServiceMenuContents"
case kRespectClientAccentColor = "RespectClientAccentColor" case kRespectClientAccentColor = "RespectClientAccentColor"
case kSecurityHardenedCompositionBuffer = "SecurityHardenedCompositionBuffer" case kSecurityHardenedCompositionBuffer = "SecurityHardenedCompositionBuffer"
case kCheckAbusersOfSecureEventInputAPI = "CheckAbusersOfSecureEventInputAPI" case kCheckAbusersOfSecureEventInputAPI = "CheckAbusersOfSecureEventInputAPI"
@ -158,6 +159,7 @@ public extension UserDef {
switch self { switch self {
case .kIsDebugModeEnabled: return .bool case .kIsDebugModeEnabled: return .bool
case .kFailureFlagForUOMObservation: return .bool case .kFailureFlagForUOMObservation: return .bool
case .kCandidateServiceMenuContents: return .dictionary
case .kRespectClientAccentColor: return .bool case .kRespectClientAccentColor: return .bool
case .kSecurityHardenedCompositionBuffer: return .bool case .kSecurityHardenedCompositionBuffer: return .bool
case .kCheckAbusersOfSecureEventInputAPI: return .bool case .kCheckAbusersOfSecureEventInputAPI: return .bool
@ -254,6 +256,7 @@ public extension UserDef {
var metaData: MetaData? { var metaData: MetaData? {
switch self { switch self {
case .kIsDebugModeEnabled: return .init(userDef: self, shortTitle: "Debug Mode") case .kIsDebugModeEnabled: return .init(userDef: self, shortTitle: "Debug Mode")
case .kCandidateServiceMenuContents: return nil
case .kFailureFlagForUOMObservation: return nil case .kFailureFlagForUOMObservation: return nil
case .kRespectClientAccentColor: return .init( case .kRespectClientAccentColor: return .init(
userDef: self, shortTitle: "i18n:userdef.kRespectClientAccentColor.shortTitle", userDef: self, shortTitle: "i18n:userdef.kRespectClientAccentColor.shortTitle",