Skip to content

Commit

Permalink
perf: add new advanced tab
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Jan 23, 2024
1 parent 18ae512 commit 6c837d4
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 16 deletions.
4 changes: 4 additions & 0 deletions Easydict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
037E006D2B3DC098006491C6 /* EZOpenAIService+EZPromptMessages.m in Sources */ = {isa = PBXBuildFile; fileRef = 03CF27FA2B3A787900E19B57 /* EZOpenAIService+EZPromptMessages.m */; };
038030952B4106800009230C /* CocoaLumberjack in Frameworks */ = {isa = PBXBuildFile; productRef = 038030942B4106800009230C /* CocoaLumberjack */; };
038030972B4106800009230C /* CocoaLumberjackSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 038030962B4106800009230C /* CocoaLumberjackSwift */; };
03832F542B5F6BE200D0DC64 /* AdvancedTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03832F532B5F6BE200D0DC64 /* AdvancedTab.swift */; };
0383914C292FBE120009828C /* Main.strings in Resources */ = {isa = PBXBuildFile; fileRef = 03839140292FBE120009828C /* Main.strings */; };
0383914D292FBE120009828C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 03839143292FBE120009828C /* Assets.xcassets */; };
0383914E292FBE120009828C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 03839144292FBE120009828C /* ViewController.m */; };
Expand Down Expand Up @@ -421,6 +422,7 @@
037852B529588EDE00D0E2CF /* EZCustomTableRowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZCustomTableRowView.m; sourceTree = "<group>"; };
037852B7295D49F900D0E2CF /* EZTableRowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EZTableRowView.h; sourceTree = "<group>"; };
037852B8295D49F900D0E2CF /* EZTableRowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZTableRowView.m; sourceTree = "<group>"; };
03832F532B5F6BE200D0DC64 /* AdvancedTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedTab.swift; sourceTree = "<group>"; };
03839141292FBE120009828C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
03839142292FBE120009828C /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
03839143292FBE120009828C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2099,6 +2101,7 @@
0A8685C72B552A590022534F /* DisabledAppTab.swift */,
276742042B3DC230002A2C75 /* PrivacyTab.swift */,
276742052B3DC230002A2C75 /* AboutTab.swift */,
03832F532B5F6BE200D0DC64 /* AdvancedTab.swift */,
);
path = Tabs;
sourceTree = "<group>";
Expand Down Expand Up @@ -2831,6 +2834,7 @@
DC46DF802B4417B900DEAE3E /* Configuration.swift in Sources */,
036E7D7B293F4FC8002675DF /* EZOpenLinkButton.m in Sources */,
EAED41EC2B54AA920005FE0A /* ServiceConfigurationSection.swift in Sources */,
03832F542B5F6BE200D0DC64 /* AdvancedTab.swift in Sources */,
276742092B3DC230002A2C75 /* AboutTab.swift in Sources */,
03008B2E2941956D0062B821 /* EZURLSchemeHandler.m in Sources */,
DC6D9C872B352EBC0055EFFC /* FontSizeHintView.swift in Sources */,
Expand Down
19 changes: 18 additions & 1 deletion Easydict/App/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"sourceLanguage" : "en",
"strings" : {
"" : {

"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : ""
}
}
}
},
"about" : {
"comment" : "about",
Expand Down Expand Up @@ -37,6 +44,16 @@
}
}
},
"advanced" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "高级"
}
}
}
},
"ali_translate" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
6 changes: 6 additions & 0 deletions Easydict/NewApp/View/SettingView/SettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enum SettingTab: Int {
case general
case service
case disabled
case advanced
case privacy
case about
}
Expand All @@ -34,6 +35,9 @@ struct SettingView: View {
DisabledAppTab()
.tabItem { Label("disabled_app_list", systemImage: "nosign") }
.tag(SettingTab.disabled)
AdvancedTab()
.tabItem { Label("advanced", systemImage: "wrench.and.screwdriver") }
.tag(SettingTab.advanced)

PrivacyTab()
.tabItem { Label("privacy", systemImage: "hand.raised.square") }
Expand Down Expand Up @@ -71,6 +75,8 @@ struct SettingView: View {
320
case .about:
450
default:
400
}

let newSize = CGSize(width: maxWidth, height: height)
Expand Down
42 changes: 42 additions & 0 deletions Easydict/NewApp/View/SettingView/Tabs/AdvancedTab.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// AdvancedTab.swift
// Easydict
//
// Created by tisfeng on 2024/1/23.
// Copyright © 2024 izual. All rights reserved.
//

import Defaults
import SwiftUI

@available(macOS 13, *)
struct AdvancedTab: View {
var body: some View {
Form {
Section {
Picker("setting.general.advance.default_tts_service", selection: $defaultTTSServiceType) {
ForEach(TTSServiceType.allCases, id: \.rawValue) { option in
Text(option.localizedStringResource)
.tag(option)
}
}
Toggle("setting.general.advance.enable_beta_feature", isOn: $enableBetaFeature)
Toggle(isOn: $enableBetaNewApp) {
Text("enable_beta_new_app")
}
} header: {
Text("setting.general.advance.header")
}
}
.formStyle(.grouped)
}

@Default(.defaultTTSServiceType) private var defaultTTSServiceType
@Default(.enableBetaFeature) private var enableBetaFeature
@Default(.enableBetaNewApp) private var enableBetaNewApp
}

@available(macOS 13, *)
#Preview {
AdvancedTab()
}
15 changes: 0 additions & 15 deletions Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,6 @@ struct GeneralTab: View {
} header: {
Text("other")
}

Section {
Picker("setting.general.advance.default_tts_service", selection: $defaultTTSServiceType) {
ForEach(TTSServiceType.allCases, id: \.rawValue) { option in
Text(option.localizedStringResource)
.tag(option)
}
}
Toggle("setting.general.advance.enable_beta_feature", isOn: $enableBetaFeature)
Toggle(isOn: $enableBetaNewApp) {
Text("enable_beta_new_app")
}
} header: {
Text("setting.general.advance.header")
}
}
.formStyle(.grouped)
}
Expand Down

0 comments on commit 6c837d4

Please sign in to comment.