diff --git a/Shared/ContentView.swift b/Shared/ContentView.swift index 53777a41..8f03255c 100644 --- a/Shared/ContentView.swift +++ b/Shared/ContentView.swift @@ -153,12 +153,17 @@ struct ContentView: View { Button("Error") { viewModel.process(url: URLComponents(string: "example.com")!) } - Button("Nothing Found") { + Button("Nothing Found" as String) { viewModel.process(url: URLComponents(string: "https://www.baidu.com/")!) } Button("Toggle Onboarding") { withAnimation(OnboardingView.transitionAnimation) { isOnboarding.toggle() } } + if ProcessInfo.processInfo.isiOSAppOnMac { + Button("Open Rules Folder" as String) { + openURL(Core.ruleDirectoryURL.components!) + } + } } label: { Image(systemName: "hammer.fill") } diff --git a/Shared/SettingsView.swift b/Shared/SettingsView.swift index b069df9a..176f41bd 100644 --- a/Shared/SettingsView.swift +++ b/Shared/SettingsView.swift @@ -357,6 +357,7 @@ extension Core.RuleManagerView { @State private var ruleFilesInfo: [RuleFileInfo] = RuleManager.shared.ruleFilesInfo @AppStorage("isAdvancedRuleConfigurationEnabled", store: RSSBud.userDefaults) var isAdvancedRuleConfigurationEnabled: Bool = false @AppStorage("lastRSSHubRadarRemoteRulesFetchDate", store: RSSBud.userDefaults) private var _lastRemoteRulesFetchDate: Double? + @Environment(\.customOpenURLAction) private var openURL private var lastRemoteRulesFetchDate: Date? { get { _lastRemoteRulesFetchDate.map(Date.init(timeIntervalSinceReferenceDate:)) } @@ -376,6 +377,12 @@ extension Core.RuleManagerView { } } + if ProcessInfo.processInfo.isiOSAppOnMac { + Button("Open Rules Folder", systemImage: "arrow.up.forward.app.fill") { + openURL(Core.ruleDirectoryURL.components!) + } + } + HStack { Button( ruleManager.isFetchingRemoteRules ? "Updating Rules..." : "Save and update", diff --git a/Shared/en.lproj/Localizable.strings b/Shared/en.lproj/Localizable.strings index 0d10c1dc..e3d8a34b 100644 --- a/Shared/en.lproj/Localizable.strings +++ b/Shared/en.lproj/Localizable.strings @@ -67,6 +67,7 @@ "Remote URL" = "Remote URL"; "Leave Empty For Local Files" = "Leave empty for local files"; "Add new rule file" = "Add Rule File"; +"Open Rules Folder" = "Open Rules Folder"; "Nothing Found" = "Nothing Found"; "Error Occurred" = "Oops..."; diff --git a/Shared/zh-Hans.lproj/Localizable.strings b/Shared/zh-Hans.lproj/Localizable.strings index 71759233..f44c9c3b 100644 --- a/Shared/zh-Hans.lproj/Localizable.strings +++ b/Shared/zh-Hans.lproj/Localizable.strings @@ -67,6 +67,7 @@ "Remote URL" = "远程 URL"; "Leave Empty For Local Files" = "留空则为本地文件"; "Add new rule file" = "添加规则文件"; +"Open Rules Folder" = "打开规则文件夹"; "Nothing Found" = "真的一滴也没有了 (/TДT)/"; "Error Occurred" = "出错了...";