mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Split up preferences, add Updates pane
This commit is contained in:
parent
b3dbb1af45
commit
f3a3961e0e
7 changed files with 243 additions and 38 deletions
|
|
@ -70,7 +70,6 @@
|
|||
CABFA9EE2592F0CC00380FEE /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = CABFA9ED2592F0CC00380FEE /* SwiftSoup */; };
|
||||
CABFA9F82592F0F900380FEE /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = CABFA9F72592F0F900380FEE /* KeychainAccess */; };
|
||||
CABFA9FD2592F13300380FEE /* LegibleError in Frameworks */ = {isa = PBXBuildFile; productRef = CABFA9FC2592F13300380FEE /* LegibleError */; };
|
||||
CABFAA2C2592FBFC00380FEE /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABFAA2A2592FBFC00380FEE /* SettingsView.swift */; };
|
||||
CABFAA2D2592FBFC00380FEE /* Configure.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABFAA2B2592FBFC00380FEE /* Configure.swift */; };
|
||||
CABFAA432593104F00380FEE /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABFAA422593104F00380FEE /* AboutView.swift */; };
|
||||
CABFAA492593162500380FEE /* Bundle+InfoPlistValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABFAA482593162500380FEE /* Bundle+InfoPlistValues.swift */; };
|
||||
|
|
@ -94,6 +93,10 @@
|
|||
CAFBDC68259A308B003DCC5A /* InfoPane.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFBDC67259A308B003DCC5A /* InfoPane.swift */; };
|
||||
CAFBDC6C259A3098003DCC5A /* View+Conditional.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFBDC6B259A3098003DCC5A /* View+Conditional.swift */; };
|
||||
CAFE4A9A25B7C7A30064FE51 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = CAFE4A9925B7C7A30064FE51 /* Sparkle */; };
|
||||
CAFE4AA325B7CF960064FE51 /* Preferences in Frameworks */ = {isa = PBXBuildFile; productRef = CAFE4AA225B7CF960064FE51 /* Preferences */; };
|
||||
CAFE4AAC25B7D2C70064FE51 /* GeneralPreferencePane.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFE4AAB25B7D2C70064FE51 /* GeneralPreferencePane.swift */; };
|
||||
CAFE4AB425B7D3AF0064FE51 /* AdvancedPreferencePane.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFE4AB325B7D3AF0064FE51 /* AdvancedPreferencePane.swift */; };
|
||||
CAFE4ABC25B7D54B0064FE51 /* UpdatesPreferencePane.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFE4ABB25B7D54B0064FE51 /* UpdatesPreferencePane.swift */; };
|
||||
CAFFFED8259CDA5000903F81 /* XcodeListViewRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFFFED7259CDA5000903F81 /* XcodeListViewRow.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
|
|
@ -219,7 +222,6 @@
|
|||
CABFA9B92592EEEA00380FEE /* Downloads.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Downloads.swift; sourceTree = "<group>"; };
|
||||
CABFA9BA2592EEEA00380FEE /* DateFormatter+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+.swift"; sourceTree = "<group>"; };
|
||||
CABFA9D42592EF6300380FEE /* DECISIONS.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = DECISIONS.md; sourceTree = "<group>"; };
|
||||
CABFAA2A2592FBFC00380FEE /* SettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingsView.swift; path = Xcodes/SettingsView.swift; sourceTree = SOURCE_ROOT; };
|
||||
CABFAA2B2592FBFC00380FEE /* Configure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Configure.swift; path = Xcodes/Backend/Configure.swift; sourceTree = SOURCE_ROOT; };
|
||||
CABFAA422593104F00380FEE /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
|
||||
CABFAA482593162500380FEE /* Bundle+InfoPlistValues.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+InfoPlistValues.swift"; sourceTree = "<group>"; };
|
||||
|
|
@ -250,6 +252,9 @@
|
|||
CAFBDC4D2599B33D003DCC5A /* MainToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainToolbar.swift; sourceTree = "<group>"; };
|
||||
CAFBDC67259A308B003DCC5A /* InfoPane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoPane.swift; sourceTree = "<group>"; };
|
||||
CAFBDC6B259A3098003DCC5A /* View+Conditional.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Conditional.swift"; sourceTree = "<group>"; };
|
||||
CAFE4AAB25B7D2C70064FE51 /* GeneralPreferencePane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPreferencePane.swift; sourceTree = "<group>"; };
|
||||
CAFE4AB325B7D3AF0064FE51 /* AdvancedPreferencePane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedPreferencePane.swift; sourceTree = "<group>"; };
|
||||
CAFE4ABB25B7D54B0064FE51 /* UpdatesPreferencePane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdatesPreferencePane.swift; sourceTree = "<group>"; };
|
||||
CAFFFED7259CDA5000903F81 /* XcodeListViewRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XcodeListViewRow.swift; sourceTree = "<group>"; };
|
||||
CAFFFEEE259CEAC400903F81 /* RingProgressViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RingProgressViewStyle.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
|
@ -267,6 +272,7 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CAFE4A9A25B7C7A30064FE51 /* Sparkle in Frameworks */,
|
||||
CAFE4AA325B7CF960064FE51 /* Preferences in Frameworks */,
|
||||
CABFA9E42592F08E00380FEE /* Version in Frameworks */,
|
||||
CABFA9FD2592F13300380FEE /* LegibleError in Frameworks */,
|
||||
CA9FF86D25951C6E00E47BAF /* XCModel in Frameworks */,
|
||||
|
|
@ -436,10 +442,10 @@
|
|||
children = (
|
||||
63EAA4E9259944340046AB8F /* Common */,
|
||||
CA9FF8552595082000E47BAF /* About */,
|
||||
CAFE4AAA25B7D29B0064FE51 /* Preferences */,
|
||||
CAA1CB50255A5D16003FD669 /* SignIn */,
|
||||
CABFAA142592F73000380FEE /* XcodeList */,
|
||||
CAE4247E259A666100B8B246 /* MainWindow.swift */,
|
||||
CABFAA2A2592FBFC00380FEE /* SettingsView.swift */,
|
||||
CAFBDC6B259A3098003DCC5A /* View+Conditional.swift */,
|
||||
CA9FF8652595130600E47BAF /* View+IsHidden.swift */,
|
||||
);
|
||||
|
|
@ -526,6 +532,16 @@
|
|||
path = XcodesTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CAFE4AAA25B7D29B0064FE51 /* Preferences */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CAFE4AB325B7D3AF0064FE51 /* AdvancedPreferencePane.swift */,
|
||||
CAFE4AAB25B7D2C70064FE51 /* GeneralPreferencePane.swift */,
|
||||
CAFE4ABB25B7D54B0064FE51 /* UpdatesPreferencePane.swift */,
|
||||
);
|
||||
path = Preferences;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
|
@ -573,6 +589,7 @@
|
|||
CA9FF86C25951C6E00E47BAF /* XCModel */,
|
||||
CAA858CC25A3D8BC00ACF8C0 /* ErrorHandling */,
|
||||
CAFE4A9925B7C7A30064FE51 /* Sparkle */,
|
||||
CAFE4AA225B7CF960064FE51 /* Preferences */,
|
||||
);
|
||||
productName = XcodesMac;
|
||||
productReference = CAD2E79E2449574E00113D76 /* Xcodes.app */;
|
||||
|
|
@ -640,6 +657,7 @@
|
|||
CAA858CB25A3D8BC00ACF8C0 /* XCRemoteSwiftPackageReference "ErrorHandling" */,
|
||||
CAC28186259EE27200B8AB0B /* XCRemoteSwiftPackageReference "CombineExpectations" */,
|
||||
CAFE4A9825B7C7A30064FE51 /* XCRemoteSwiftPackageReference "Sparkle" */,
|
||||
CAFE4AA125B7CF960064FE51 /* XCRemoteSwiftPackageReference "Preferences" */,
|
||||
);
|
||||
productRefGroup = CAD2E79F2449574E00113D76 /* Products */;
|
||||
projectDirPath = "";
|
||||
|
|
@ -730,7 +748,9 @@
|
|||
CABFA9CA2592EEEA00380FEE /* AppState+Update.swift in Sources */,
|
||||
CA44901F2463AD34003D8213 /* Tag.swift in Sources */,
|
||||
CABFA9BF2592EEEA00380FEE /* URLSession+DownloadTaskPublisher.swift in Sources */,
|
||||
CAFE4AAC25B7D2C70064FE51 /* GeneralPreferencePane.swift in Sources */,
|
||||
CABFA9BB2592EEEA00380FEE /* DateFormatter+.swift in Sources */,
|
||||
CAFE4ABC25B7D54B0064FE51 /* UpdatesPreferencePane.swift in Sources */,
|
||||
CABFA9BD2592EEEA00380FEE /* Environment.swift in Sources */,
|
||||
CABFA9C32592EEEA00380FEE /* Downloads.swift in Sources */,
|
||||
CAC281DA259F985100B8AB0B /* InstallationStep.swift in Sources */,
|
||||
|
|
@ -744,6 +764,7 @@
|
|||
CA61A6E0259835580008926E /* Xcode.swift in Sources */,
|
||||
CAE4247F259A666100B8B246 /* MainWindow.swift in Sources */,
|
||||
CA452BB0259FD9770072DFA4 /* ProgressIndicator.swift in Sources */,
|
||||
CAFE4AB425B7D3AF0064FE51 /* AdvancedPreferencePane.swift in Sources */,
|
||||
CAC281C8259F97E100B8AB0B /* InstallationStepView.swift in Sources */,
|
||||
CA9FF84E2595079F00E47BAF /* ScrollingTextView.swift in Sources */,
|
||||
CABFA9C12592EEEA00380FEE /* Version+.swift in Sources */,
|
||||
|
|
@ -767,7 +788,6 @@
|
|||
CABFA9C72592EEEA00380FEE /* Entry+.swift in Sources */,
|
||||
CAE424B4259A764700B8B246 /* AppState+Install.swift in Sources */,
|
||||
CAE42487259A68A300B8B246 /* XcodeListCategory.swift in Sources */,
|
||||
CABFAA2C2592FBFC00380FEE /* SettingsView.swift in Sources */,
|
||||
CAA858C425A2BE4E00ACF8C0 /* Downloader.swift in Sources */,
|
||||
CA9FF87B2595293E00E47BAF /* DataSource.swift in Sources */,
|
||||
CABFA9C92592EEEA00380FEE /* URLRequest+Apple.swift in Sources */,
|
||||
|
|
@ -1305,6 +1325,14 @@
|
|||
version = "1.24.0-spm";
|
||||
};
|
||||
};
|
||||
CAFE4AA125B7CF960064FE51 /* XCRemoteSwiftPackageReference "Preferences" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/sindresorhus/Preferences";
|
||||
requirement = {
|
||||
kind = upToNextMinorVersion;
|
||||
minimumVersion = 2.2.0;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
|
|
@ -1357,6 +1385,11 @@
|
|||
package = CAFE4A9825B7C7A30064FE51 /* XCRemoteSwiftPackageReference "Sparkle" */;
|
||||
productName = Sparkle;
|
||||
};
|
||||
CAFE4AA225B7CF960064FE51 /* Preferences */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = CAFE4AA125B7CF960064FE51 /* XCRemoteSwiftPackageReference "Preferences" */;
|
||||
productName = Preferences;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = CAD2E7962449574E00113D76 /* Project object */;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,15 @@
|
|||
"version": "0.16.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Preferences",
|
||||
"repositoryURL": "https://github.com/sindresorhus/Preferences",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "4802a493acef50c814e4eb63e9a44e0941ec8883",
|
||||
"version": "2.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Sparkle",
|
||||
"repositoryURL": "https://github.com/sparkle-project/Sparkle/",
|
||||
|
|
|
|||
|
|
@ -1,30 +1,19 @@
|
|||
import AppleAPI
|
||||
import Preferences
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
extension Preferences.PaneIdentifier {
|
||||
static let advanced = Self("advanced")
|
||||
}
|
||||
|
||||
struct AdvancedPreferencePane: View {
|
||||
@EnvironmentObject var appState: AppState
|
||||
@AppStorage("dataSource") var dataSource: DataSource = .xcodeReleases
|
||||
@AppStorage("downloader") var downloader: Downloader = .aria2
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
GroupBox(label: Text("Apple ID")) {
|
||||
VStack(alignment: .leading) {
|
||||
if appState.authenticationState == .authenticated {
|
||||
Text(Current.defaults.string(forKey: "username") ?? "-")
|
||||
Button("Sign Out", action: appState.signOut)
|
||||
} else {
|
||||
Button("Sign In", action: { self.appState.presentingSignInAlert = true })
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.sheet(isPresented: $appState.presentingSignInAlert) {
|
||||
SignInCredentialsView(isPresented: $appState.presentingSignInAlert)
|
||||
.environmentObject(appState)
|
||||
}
|
||||
}
|
||||
|
||||
GroupBox(label: Text("Data Source")) {
|
||||
Preferences.Container(contentWidth: 400.0) {
|
||||
Preferences.Section(title: "Data Source") {
|
||||
VStack(alignment: .leading) {
|
||||
Picker("Data Source", selection: $dataSource) {
|
||||
ForEach(DataSource.allCases) { dataSource in
|
||||
|
|
@ -39,7 +28,7 @@ struct SettingsView: View {
|
|||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
GroupBox(label: Text("Downloader")) {
|
||||
Preferences.Section(title: "Downloader") {
|
||||
VStack(alignment: .leading) {
|
||||
Picker("Downloader", selection: $downloader) {
|
||||
ForEach(Downloader.allCases) { downloader in
|
||||
|
|
@ -54,7 +43,7 @@ struct SettingsView: View {
|
|||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
GroupBox(label: Text("Privileged Helper")) {
|
||||
Preferences.Section(title: "Privileged Helper") {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
switch appState.helperInstallState {
|
||||
case .unknown:
|
||||
|
|
@ -73,14 +62,12 @@ struct SettingsView: View {
|
|||
|
||||
Text("Xcodes uses a separate privileged helper to perform tasks as root. These are things that would require sudo on the command line, including post-install steps and switching Xcode versions with xcode-select.")
|
||||
.font(.footnote)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("Settings")
|
||||
.frame(width: 400)
|
||||
.frame(minHeight: 500)
|
||||
}
|
||||
|
||||
private var dataSourceFootnote: NSAttributedString {
|
||||
|
|
@ -118,10 +105,10 @@ struct SettingsView: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct SettingsView_Previews: PreviewProvider {
|
||||
struct AdvancedPreferencePane_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
SettingsView()
|
||||
AdvancedPreferencePane()
|
||||
.environmentObject(AppState())
|
||||
}
|
||||
}
|
||||
42
Xcodes/Frontend/Preferences/GeneralPreferencePane.swift
Normal file
42
Xcodes/Frontend/Preferences/GeneralPreferencePane.swift
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import AppleAPI
|
||||
import Preferences
|
||||
import SwiftUI
|
||||
|
||||
extension Preferences.PaneIdentifier {
|
||||
static let general = Self("general")
|
||||
}
|
||||
|
||||
struct GeneralPreferencePane: View {
|
||||
@EnvironmentObject var appState: AppState
|
||||
|
||||
var body: some View {
|
||||
Preferences.Container(contentWidth: 400.0) {
|
||||
Preferences.Section(title: "Apple ID") {
|
||||
VStack(alignment: .leading) {
|
||||
if appState.authenticationState == .authenticated {
|
||||
Text(Current.defaults.string(forKey: "username") ?? "-")
|
||||
Button("Sign Out", action: appState.signOut)
|
||||
} else {
|
||||
Button("Sign In", action: { self.appState.presentingSignInAlert = true })
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.sheet(isPresented: $appState.presentingSignInAlert) {
|
||||
SignInCredentialsView(isPresented: $appState.presentingSignInAlert)
|
||||
.environmentObject(appState)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct GeneralPreferencePane_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
GeneralPreferencePane()
|
||||
.environmentObject(AppState())
|
||||
}
|
||||
}
|
||||
}
|
||||
85
Xcodes/Frontend/Preferences/UpdatesPreferencePane.swift
Normal file
85
Xcodes/Frontend/Preferences/UpdatesPreferencePane.swift
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
import AppleAPI
|
||||
import Preferences
|
||||
import Sparkle
|
||||
import SwiftUI
|
||||
|
||||
extension Preferences.PaneIdentifier {
|
||||
static let updates = Self("updates")
|
||||
}
|
||||
|
||||
struct UpdatesPreferencePane: View {
|
||||
@StateObject var updater = ObservableUpdater()
|
||||
|
||||
var body: some View {
|
||||
Preferences.Container(contentWidth: 400.0) {
|
||||
Preferences.Section(title: "Updates") {
|
||||
VStack(alignment: .leading) {
|
||||
Toggle(
|
||||
"Automatically check for updates",
|
||||
isOn: $updater.automaticallyChecksForUpdates
|
||||
)
|
||||
|
||||
Button("Check Now") {
|
||||
SUUpdater.shared()?.checkForUpdates(nil)
|
||||
}
|
||||
|
||||
Text("Last checked: \(lastUpdatedString)")
|
||||
.font(.footnote)
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var lastUpdatedString: String {
|
||||
if let lastUpdatedDate = updater.lastUpdateCheckDate {
|
||||
return Self.formatter.string(from: lastUpdatedDate)
|
||||
} else {
|
||||
return "Never"
|
||||
}
|
||||
}
|
||||
|
||||
private static let formatter = configure(DateFormatter()) {
|
||||
$0.dateStyle = .medium
|
||||
$0.timeStyle = .medium
|
||||
}
|
||||
}
|
||||
|
||||
class ObservableUpdater: ObservableObject {
|
||||
@Published var automaticallyChecksForUpdates = false {
|
||||
didSet {
|
||||
SUUpdater.shared()?.automaticallyChecksForUpdates = automaticallyChecksForUpdates
|
||||
}
|
||||
}
|
||||
private var automaticallyChecksForUpdatesObservation: NSKeyValueObservation?
|
||||
@Published var lastUpdateCheckDate: Date?
|
||||
private var lastUpdateCheckDateObservation: NSKeyValueObservation?
|
||||
|
||||
|
||||
init() {
|
||||
automaticallyChecksForUpdatesObservation = SUUpdater.shared()?.observe(
|
||||
\.automaticallyChecksForUpdates,
|
||||
options: [.initial, .new, .old],
|
||||
changeHandler: { [unowned self] updater, change in
|
||||
guard change.newValue != change.oldValue else { return }
|
||||
self.automaticallyChecksForUpdates = updater.automaticallyChecksForUpdates
|
||||
}
|
||||
)
|
||||
lastUpdateCheckDateObservation = SUUpdater.shared()?.observe(
|
||||
\.lastUpdateCheckDate,
|
||||
options: [.initial, .new, .old],
|
||||
changeHandler: { [unowned self] updater, change in
|
||||
self.lastUpdateCheckDate = updater.lastUpdateCheckDate
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct UpdatesPreferencePane_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
UpdatesPreferencePane()
|
||||
.environmentObject(AppState())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,22 @@
|
|||
{\*\expandedcolortbl;;}
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
|
||||
|
||||
\f0\fs34 \cf0 SwiftSoup\
|
||||
\f0\fs34 \cf0 Preferences\
|
||||
\
|
||||
|
||||
\fs26 MIT License\
|
||||
\
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)\
|
||||
\
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\
|
||||
\
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\
|
||||
\
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\
|
||||
\
|
||||
\
|
||||
|
||||
\fs34 SwiftSoup\
|
||||
\
|
||||
|
||||
\fs26 MIT License\
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import AppKit
|
||||
import Preferences
|
||||
import Sparkle
|
||||
import SwiftUI
|
||||
|
||||
|
|
@ -34,6 +35,13 @@ struct XcodesApp: App {
|
|||
appDelegate.checkForUpdates()
|
||||
}
|
||||
}
|
||||
CommandGroup(replacing: .appSettings) {
|
||||
Button("Preferences...") {
|
||||
showPreferencesWindow()
|
||||
}
|
||||
.keyboardShortcut(KeyEquivalent(","), modifiers: .command)
|
||||
}
|
||||
|
||||
CommandGroup(after: CommandGroupPlacement.newItem) {
|
||||
Button("Refresh") {
|
||||
appState.update()
|
||||
|
|
@ -44,11 +52,37 @@ struct XcodesApp: App {
|
|||
|
||||
XcodeCommands(appState: appState)
|
||||
}
|
||||
|
||||
Settings {
|
||||
SettingsView()
|
||||
.environmentObject(appState)
|
||||
}
|
||||
}
|
||||
|
||||
private func showPreferencesWindow() {
|
||||
PreferencesWindowController(
|
||||
panes: [
|
||||
Preferences.Pane(
|
||||
identifier: .general,
|
||||
title: "General",
|
||||
toolbarIcon: NSImage(systemSymbolName: "gearshape", accessibilityDescription: "General")!
|
||||
) {
|
||||
GeneralPreferencePane()
|
||||
.environmentObject(appState)
|
||||
},
|
||||
Preferences.Pane(
|
||||
identifier: .updates,
|
||||
title: "Updates",
|
||||
toolbarIcon: NSImage(systemSymbolName: "arrow.triangle.2.circlepath.circle", accessibilityDescription: "Updates")!
|
||||
) {
|
||||
UpdatesPreferencePane()
|
||||
},
|
||||
Preferences.Pane(
|
||||
identifier: .advanced,
|
||||
title: "Advanced",
|
||||
toolbarIcon: NSImage(systemSymbolName: "gearshape.2", accessibilityDescription: "Advanced")!
|
||||
) {
|
||||
AdvancedPreferencePane()
|
||||
.environmentObject(appState)
|
||||
},
|
||||
]
|
||||
)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue