Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactoring] SettingTabをリファクタリング #368

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 69 additions & 79 deletions MainApp/Setting/SettingTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,101 +40,90 @@ struct SettingTabView: View {
var body: some View {
NavigationView {
Form {
Group {
Section(header: Text("キーボードの種類")) {
NavigationLink("キーボードの種類を設定する", destination: KeyboardLayoutTypeDetailsView())
}
Section("キーボードの種類") {
NavigationLink("キーボードの種類を設定する", destination: KeyboardLayoutTypeDetailsView())
}
Section(header: Text("ライブ変換")) {
Section("ライブ変換") {
BoolSettingView(.liveConversion)
NavigationLink("詳しい設定", destination: LiveConversionSettingView())
}

Group {
Section("カスタムキー") {
CustomKeysSettingView()
if !self.isCustard(appStates.japaneseLayout) || !self.isCustard(appStates.englishLayout) {
BoolSettingView(.useNextCandidateKey)
}
if self.canQwertyLayout(appStates.englishLayout) {
BoolSettingView(.useShiftKey)
}
if !SemiStaticStates.shared.needsInputModeSwitchKey, self.canFlickLayout(appStates.japaneseLayout) {
BoolSettingView(.enablePasteButton)
}
}
Section(header: Text("バー")) {
BoolSettingView(.useReflectStyleCursorBar)
BoolSettingView(.displayTabBarButton)
BoolSettingView(.enableClipboardHistoryManagerTab)
if SemiStaticStates.shared.hasFullAccess {
NavigationLink("「ペーストを許可」のダイアログについて", destination: PasteFromOtherAppsPermissionTipsView())
}
NavigationLink("タブバーを編集", destination: EditingTabBarView(manager: $appStates.custardManager))
Section("カスタムキー") {
CustomKeysSettingView()
if !self.isCustard(appStates.japaneseLayout) || !self.isCustard(appStates.englishLayout) {
BoolSettingView(.useNextCandidateKey)
}
// デバイスが触覚フィードバックをサポートしている場合のみ表示する
if SemiStaticStates.shared.hapticsAvailable {
Section(header: Text("サウンドと振動")) {
BoolSettingView(.enableKeySound)
BoolSettingView(.enableKeyHaptics)
}
} else {
Section(header: Text("サウンド")) {
BoolSettingView(.enableKeySound)
}
if self.canQwertyLayout(appStates.englishLayout) {
BoolSettingView(.useShiftKey)
}
Section(header: Text("表示")) {
KeyboardHeightSettingView(.keyboardHeightScale)
FontSizeSettingView(.keyViewFontSize, .key, availableValueRange: 15 ... 28)
FontSizeSettingView(.resultViewFontSize, .result, availableValueRange: 12...24)
}
Section(header: Text("操作性")) {
BoolSettingView(.hideResetButtonInOneHandedMode)
if self.canFlickLayout(appStates.japaneseLayout) {
FlickSensitivitySettingView(.flickSensitivity)
}
if !SemiStaticStates.shared.needsInputModeSwitchKey, self.canFlickLayout(appStates.japaneseLayout) {
BoolSettingView(.enablePasteButton)
}
}
Group {
Section(header: Text("変換")) {
BoolSettingView(.englishCandidate)
BoolSettingView(.halfKanaCandidate)
BoolSettingView(.fullRomanCandidate)
BoolSettingView(.typographyLetter)
BoolSettingView(.unicodeCandidate)
MarkedTextSettingView(.markedTextSetting)
ContactImportSettingView()
NavigationLink("絵文字と顔文字", destination: AdditionalDictManageView())
}

Section(header: Text("言語")) {
PreferredLanguageSettingView()
Section("バー") {
BoolSettingView(.useReflectStyleCursorBar)
BoolSettingView(.displayTabBarButton)
BoolSettingView(.enableClipboardHistoryManagerTab)
if SemiStaticStates.shared.hasFullAccess {
NavigationLink("「ペーストを許可」のダイアログについて", destination: PasteFromOtherAppsPermissionTipsView())
}

Section(header: Text("ユーザ辞書")) {
BoolSettingView(.useOSUserDict)
NavigationLink("azooKeyユーザ辞書", destination: AzooKeyUserDictionaryView())
NavigationLink("タブバーを編集", destination: EditingTabBarView(manager: $appStates.custardManager))
}
// デバイスが触覚フィードバックをサポートしている場合のみ表示する
if SemiStaticStates.shared.hapticsAvailable {
Section("サウンドと振動") {
BoolSettingView(.enableKeySound)
BoolSettingView(.enableKeyHaptics)
}

Section(header: Text("テンプレート")) {
NavigationLink("テンプレートの管理", destination: TemplateListView())
}

Section(header: Text("学習機能")) {
LearningTypeSettingView()
MemoryResetSettingItemView()
} else {
Section("サウンド") {
BoolSettingView(.enableKeySound)
}
}
Section("表示") {
KeyboardHeightSettingView(.keyboardHeightScale)
FontSizeSettingView(.keyViewFontSize, .key, availableValueRange: 15 ... 28)
FontSizeSettingView(.resultViewFontSize, .result, availableValueRange: 12...24)
}

Section(header: Text("カスタムタブ")) {
NavigationLink("カスタムタブの管理", destination: ManageCustardView(manager: $appStates.custardManager))
Section("操作性") {
BoolSettingView(.hideResetButtonInOneHandedMode)
if self.canFlickLayout(appStates.japaneseLayout) {
FlickSensitivitySettingView(.flickSensitivity)
}
}
Section(header: Text("オープンソースソフトウェア")) {
Section("変換") {
BoolSettingView(.englishCandidate)
BoolSettingView(.halfKanaCandidate)
BoolSettingView(.fullRomanCandidate)
BoolSettingView(.typographyLetter)
BoolSettingView(.unicodeCandidate)
MarkedTextSettingView(.markedTextSetting)
ContactImportSettingView()
NavigationLink("絵文字と顔文字", destination: AdditionalDictManageView())
}
Section("言語") {
PreferredLanguageSettingView()
}
Section("ユーザ辞書") {
BoolSettingView(.useOSUserDict)
NavigationLink("azooKeyユーザ辞書", destination: AzooKeyUserDictionaryView())
}
Section("テンプレート") {
NavigationLink("テンプレートの管理", destination: TemplateListView())
}
Section("学習機能") {
LearningTypeSettingView()
MemoryResetSettingItemView()
}
Section("カスタムタブ") {
NavigationLink("カスタムタブの管理", destination: ManageCustardView(manager: $appStates.custardManager))
}
Section("オープンソースソフトウェア") {
Text("azooKeyはオープンソースソフトウェアであり、GitHubでソースコードを公開しています。")
FallbackLink("View azooKey on GitHub", destination: URL(string: "https://github.com/ensan-hcl/azooKey")!)
NavigationLink("Acknowledgements", destination: OpenSourceSoftwaresLicenseView())
}
Section(header: Text("このアプリについて")) {
Section("このアプリについて") {
NavigationLink("お問い合わせ", destination: ContactView())
FallbackLink("プライバシーポリシー", destination: URL(string: "https://azookey.netlify.app/PrivacyPolicy")!)
.foregroundStyle(.primary)
Expand All @@ -149,11 +138,12 @@ struct SettingTabView: View {
HStack {
Text("バージョン")
Spacer()
Text(SharedStore.currentAppVersion?.description ?? "取得中です")
Text(verbatim: SharedStore.currentAppVersion?.description ?? "取得中です")
}
}
}
.navigationBarTitle(Text("設定"), displayMode: .large)
.navigationTitle("設定")
.navigationBarTitleDisplayMode(.large)
.onAppear {
if appStates.requestReviewManager.shouldTryRequestReview, appStates.requestReviewManager.shouldRequestReview() {
if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
Expand Down