This commit is contained in:
Alin
2023-11-14 13:41:21 -07:00
parent 46125d8cbc
commit e3fe9ad281
21 changed files with 673 additions and 195 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ struct AboutSettingsTab: View {
.buttonStyle(SimpleButtonStyle(icon: "cloud", help: "Update application", color: Color("AccentColor")))
Button("") {
NSWorkspace.shared.open(URL(string: "https://github.com/ghosted-labs/Pearcleaner")!)
NSWorkspace.shared.open(URL(string: "https://github.com/alienator88/Pearcleaner")!)
}
.buttonStyle(SimpleButtonStyle(icon: "paperplane", help: "View repository", color: Color("AccentColor")))
}
+46 -20
View File
@@ -11,8 +11,10 @@ import SwiftUI
struct GeneralSettingsTab: View {
@EnvironmentObject var appState: AppState
@AppStorage("settings.general.glass") private var glass: Bool = true
// @AppStorage("settings.general.ants") private var ants: Bool = false
@AppStorage("settings.general.mini") private var mini: Bool = false
@AppStorage("settings.general.dark") var isDark: Bool = true
@AppStorage("displayMode") var displayMode: DisplayMode = .dark
var body: some View {
Form {
VStack {
@@ -34,30 +36,54 @@ struct GeneralSettingsTab: View {
.fill(Color("mode").opacity(0.05))
)
// HStack {
// VStack(alignment: .leading, spacing: 5) {
// Text("Animation").font(.title2)
// Text("Toggles the marching ants animation on the drop zone")
// .font(.footnote)
// .foregroundStyle(.gray)
// }
// Spacer()
// Toggle(isOn: $ants, label: {
// })
// .toggleStyle(.switch)
// }
// .padding()
// .background(
// RoundedRectangle(cornerRadius: 8)
// .fill(Color("mode").opacity(0.05))
// )
HStack {
VStack(alignment: .leading, spacing: 5) {
Text("Dark Mode").font(.title2)
Text("Toggles between dark and light mode")
.font(.footnote)
.foregroundStyle(.gray)
}
Spacer()
Toggle(isOn: $isDark, label: {
})
.toggleStyle(.switch)
.onChange(of: isDark) { newValue in
displayMode.colorScheme = newValue ? .dark : .light
}
}
.padding()
.background(
RoundedRectangle(cornerRadius: 8)
.fill(Color("mode").opacity(0.05))
)
HStack {
VStack(alignment: .leading, spacing: 5) {
Text("Mini").font(.title2)
Text("Toggles a smaller, unified view with hidden app list")
.font(.footnote)
.foregroundStyle(.gray)
}
Spacer()
Toggle(isOn: $mini, label: {
})
.toggleStyle(.switch)
.onChange(of: mini) { newVal in
resizeWindow()
}
}
.padding()
.background(
RoundedRectangle(cornerRadius: 8)
.fill(Color("mode").opacity(0.05))
)
Spacer()
}
}
.padding(20)
.frame(width: 400, height: 100)
.frame(width: 400, height: 250)
}
+6 -1
View File
@@ -124,6 +124,11 @@ func checkForUpdate(appState: AppState, manual: Bool = false) {
}
}
func launchUpdate() {
NSWorkspace.shared.open(URL(string: "https://github.com/alienator88/Pearcleaner/releases")!)
}
func downloadUpdate(appState: AppState) {
guard let latestRelease = appState.releases.first else { return }
guard let asset = latestRelease.assets.first else { return }
@@ -140,7 +145,7 @@ func downloadUpdate(appState: AppState) {
do {
if fileManager.fileExists(atPath: destinationURL.path) {
try fileManager.removeItem(at: destinationURL)
try? fileManager.removeItem(at: destinationURL)
}
try fileManager.moveItem(at: localURL, to: destinationURL)