Skip to content

Commit

Permalink
Add PrivacyViewController
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Oct 30, 2023
1 parent 210d1a7 commit 77784df
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 11 deletions.
18 changes: 15 additions & 3 deletions Easydict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
03F25CB329327BC200E66A12 /* EZShortcut.m in Sources */ = {isa = PBXBuildFile; fileRef = 03F25CB229327BC200E66A12 /* EZShortcut.m */; };
03F639952AA6CFBB009B9914 /* EZBingConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 03F639942AA6CFBB009B9914 /* EZBingConfig.m */; };
277091082AF0031C00E5EFB9 /* PrivacyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277091072AF0031C00E5EFB9 /* PrivacyViewController.swift */; };
2770910B2AF00B1400E5EFB9 /* DisableAutoSelectTextViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2770910A2AF00B1400E5EFB9 /* DisableAutoSelectTextViewController.swift */; };
277D850C2AED800F00A94F5A /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277D850B2AED800F00A94F5A /* AboutViewController.swift */; };
277D850E2AED80C100A94F5A /* Settings in Frameworks */ = {isa = PBXBuildFile; productRef = 277D850D2AED80C100A94F5A /* Settings */; };
277D85122AED838300A94F5A /* MenuItemManagerHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277D85112AED838300A94F5A /* MenuItemManagerHelper.swift */; };
Expand Down Expand Up @@ -630,6 +631,7 @@
03F639942AA6CFBB009B9914 /* EZBingConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZBingConfig.m; sourceTree = "<group>"; };
06E15747A7BD34D510ADC6A8 /* Pods-Easydict.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Easydict.debug.xcconfig"; path = "Target Support Files/Pods-Easydict/Pods-Easydict.debug.xcconfig"; sourceTree = "<group>"; };
277091072AF0031C00E5EFB9 /* PrivacyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyViewController.swift; sourceTree = "<group>"; };
2770910A2AF00B1400E5EFB9 /* DisableAutoSelectTextViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisableAutoSelectTextViewController.swift; sourceTree = "<group>"; };
277D850B2AED800F00A94F5A /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
277D85112AED838300A94F5A /* MenuItemManagerHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuItemManagerHelper.swift; sourceTree = "<group>"; };
27B7919C2AEC36A1006E07C6 /* Easydict.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Easydict.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1115,6 +1117,7 @@
03B0222B29231FA6001C7E63 /* Service */,
03E02A2329250CED00A10260 /* EventMonitor */,
03B0229929231FA6001C7E63 /* StatusItem */,
277091092AF00AEA00E5EFB9 /* SettingsWindow */,
03B0229C29231FA6001C7E63 /* PerferenceWindow */,
03BDA7982A26DA000079D04F /* Libraries */,
038954372A25A94E00EFFDC3 /* Utility */,
Expand Down Expand Up @@ -1367,7 +1370,6 @@
03E02A212924E77100A10260 /* EZMenuItemManager.m */,
0329CD6D29EE924500963F78 /* EZRightClickDetector.h */,
0329CD6E29EE924500963F78 /* EZRightClickDetector.m */,
277D85112AED838300A94F5A /* MenuItemManagerHelper.swift */,
);
path = StatusItem;
sourceTree = "<group>";
Expand All @@ -1386,8 +1388,6 @@
039E5020296E5D9900072344 /* EZScrollViewController.m */,
03262C1D29EF8EE500EFECA0 /* EZPrivacyViewController.h */,
03262C1E29EF8EE500EFECA0 /* EZPrivacyViewController.m */,
277091072AF0031C00E5EFB9 /* PrivacyViewController.swift */,
277D850B2AED800F00A94F5A /* AboutViewController.swift */,
);
path = PerferenceWindow;
sourceTree = "<group>";
Expand Down Expand Up @@ -1818,6 +1818,17 @@
path = Volcano;
sourceTree = "<group>";
};
277091092AF00AEA00E5EFB9 /* SettingsWindow */ = {
isa = PBXGroup;
children = (
277D85112AED838300A94F5A /* MenuItemManagerHelper.swift */,
2770910A2AF00B1400E5EFB9 /* DisableAutoSelectTextViewController.swift */,
277091072AF0031C00E5EFB9 /* PrivacyViewController.swift */,
277D850B2AED800F00A94F5A /* AboutViewController.swift */,
);
path = SettingsWindow;
sourceTree = "<group>";
};
6220AD582A8280E800BBFB52 /* Bing */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2308,6 +2319,7 @@
03542A552937B7DE00C34C33 /* EZTranslateError.m in Sources */,
03BDA7B82A26DA280079D04F /* XPMValuedArgument.m in Sources */,
036196762A000F5900806370 /* NSData+Base64.m in Sources */,
2770910B2AF00B1400E5EFB9 /* DisableAutoSelectTextViewController.swift in Sources */,
03BDA7BA2A26DA280079D04F /* XPMMutableAttributedArray.m in Sources */,
037852B629588EDE00D0E2CF /* EZCustomTableRowView.m in Sources */,
03F0DB382953428300EBF9C1 /* EZLog.m in Sources */,
Expand Down
3 changes: 0 additions & 3 deletions Easydict/App/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1070,9 +1070,6 @@
}
}
}
},
"Hello, World!" : {

},
"hide" : {
"localizations" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let AboutViewController: () -> SettingsPane = {
struct AboutPanelView: View {
var body: some View {
ScrollView {
LazyVStack(spacing: 15) {
VStack(spacing: 15) {
Image(.logo)
.resizable()
.frame(width: 110, height: 110)
Expand All @@ -44,9 +44,10 @@ struct AboutPanelView: View {
Link("Easydict", destination: URL(string: EZGithubRepoEasydictURL)!)
}
}
.padding(.horizontal, 50)
.padding(.vertical, 30)
}
.padding(.horizontal, 50)
.padding(.vertical, 30)
.frame(idealWidth: 500, idealHeight: 400)
.onAppear { // FIXME: Use task when update to macOS 12
Task.detached {
let version = await EZMenuItemManager.shared().fetchRepoLatestVersion(EZGithubRepoEasydict)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// DisableAutoSelectTextViewController.swift
// Easydict
//
// Created by Kyle on 2023/10/31.
// Copyright © 2023 izual. All rights reserved.
//

import Settings
import SwiftUI

let DisableAutoSelectTextViewController: () -> SettingsPane = {
let panelView = Settings.Pane(
identifier: .init("DisableAutoSelectText"),
title: NSLocalizedString("disabled_app_list", comment: ""),
toolbarIcon: .disableBlue
) {
DisableAutoSelectTextPanelView()
}
return Settings.PaneHostingController(pane: panelView)
}

struct DisableAutoSelectTextPanelView: View {
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 15) {
Text(verbatim: "TODO")
}
.padding(.horizontal, 50)
.padding(.vertical, 30)
}
.frame(idealWidth: 500, idealHeight: 300)
}
}

#Preview {
DisableAutoSelectTextPanelView()
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class MenuItemManagerHelper: NSObject {

private lazy var settingsWindowController = SettingsWindowController(
panes: [
DisableAutoSelectTextViewController(),
PrivacyViewController(),
AboutViewController(),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ let PrivacyViewController: () -> SettingsPane = {
struct PrivacyPanelView: View {
var body: some View {
ScrollView {
LazyVStack(spacing: 15) {
VStack(alignment: .leading, spacing: 15) {
Text("privacy_statement")
.font(.title)
.settingDescription()
Text("privacy_statement_content")
.font(.body)
.multilineTextAlignment(.leading)
.padding(.bottom)
HStack {
Text("crash_log")
Toggle("allow_collect_crash_log", isOn: $allowCollectCrashLog)
Expand All @@ -42,7 +44,10 @@ struct PrivacyPanelView: View {
Toggle("allow_collect_analytics", isOn: $allowCollectAnalytics)
}
}
.padding(.horizontal, 50)
.padding(.vertical, 30)
}
.frame(idealWidth: 500, idealHeight: 300)
}

@AppStorage("EZConfiguration_kAllowCrashLogKey")
Expand Down

0 comments on commit 77784df

Please sign in to comment.