mirror of
https://github.com/exituser/Pearcleaner.git
synced 2026-09-17 07:19:04 +00:00
updates
This commit is contained in:
@@ -28,7 +28,6 @@ struct GeneralSettingsTab: View {
|
||||
@State private var diskStatus: Bool = false
|
||||
@State private var accessStatus: Bool = false
|
||||
@State private var autoStatus: Bool = false
|
||||
@State private var remStatus: Bool = false
|
||||
@Binding var showPopover: Bool
|
||||
@Binding var search: String
|
||||
@State var selectedIndex: Int?
|
||||
@@ -182,6 +181,8 @@ struct GeneralSettingsTab: View {
|
||||
|
||||
InfoButtonPerms()
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("Refresh") {
|
||||
checkAllPermissions(appState: appState) { results in
|
||||
updateOnMain {
|
||||
@@ -190,7 +191,6 @@ struct GeneralSettingsTab: View {
|
||||
diskStatus = results.fullDiskAccess
|
||||
accessStatus = results.accessibility
|
||||
autoStatus = results.automation
|
||||
remStatus = results.reminders
|
||||
if results.allPermissionsGranted {
|
||||
updateOnMain {
|
||||
appState.permissionsOkay = true
|
||||
@@ -199,142 +199,91 @@ struct GeneralSettingsTab: View {
|
||||
}
|
||||
}
|
||||
.buttonStyle(SimpleButtonStyle(icon: "arrow.triangle.2.circlepath", help: "Refresh permissions"))
|
||||
.padding(.trailing, 5)
|
||||
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
|
||||
|
||||
HStack {
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: "externaldrive")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing)
|
||||
.foregroundStyle(diskStatus ? .green : .red)
|
||||
.saturation(displayMode.colorScheme == .dark ? 0.5 : 1)
|
||||
Text("Full Disk")
|
||||
.font(.callout)
|
||||
.foregroundStyle(Color("mode").opacity(0.5))
|
||||
.frame(width: 100)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("") {
|
||||
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
}
|
||||
.buttonStyle(SimpleButtonStyle(icon: "arrow.right.circle.fill", help: "View disk permissions pane", size: 14))
|
||||
|
||||
Spacer()
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.leading)
|
||||
.frame(width: 200)
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: "externaldrive")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing)
|
||||
.foregroundStyle(diskStatus ? .green : .red)
|
||||
.saturation(displayMode.colorScheme == .dark ? 0.5 : 1)
|
||||
Text(diskStatus ? "Full Disk permission granted" : "Full Disk permission not granted")
|
||||
.font(.callout)
|
||||
.foregroundStyle(Color("mode").opacity(0.5))
|
||||
|
||||
Spacer()
|
||||
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: "accessibility")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing)
|
||||
.foregroundStyle(accessStatus ? .green : .red)
|
||||
.saturation(displayMode.colorScheme == .dark ? 0.5 : 1)
|
||||
Text("Accessibility")
|
||||
.font(.callout)
|
||||
.foregroundStyle(Color("mode").opacity(0.5))
|
||||
.frame(width: 100)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("") {
|
||||
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
Button("") {
|
||||
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
.buttonStyle(SimpleButtonStyle(icon: "arrow.right.circle.fill", help: "View accessibility permissions pane", size: 14))
|
||||
|
||||
Spacer()
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.leading)
|
||||
.frame(width: 200)
|
||||
.buttonStyle(SimpleButtonStyle(icon: "folder", help: "View disk permissions pane"))
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.leading)
|
||||
|
||||
Spacer()
|
||||
|
||||
|
||||
HStack {
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: "gearshape.2")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing)
|
||||
.foregroundStyle(autoStatus ? .green : .red)
|
||||
.saturation(displayMode.colorScheme == .dark ? 0.5 : 1)
|
||||
Text("Automation")
|
||||
.font(.callout)
|
||||
.foregroundStyle(Color("mode").opacity(0.5))
|
||||
.frame(width: 100)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("") {
|
||||
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Automation") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
}
|
||||
.buttonStyle(SimpleButtonStyle(icon: "arrow.right.circle.fill", help: "View automation permissions pane", size: 14))
|
||||
|
||||
Spacer()
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.leading)
|
||||
.frame(width: 200)
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: "accessibility")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing)
|
||||
.foregroundStyle(accessStatus ? .green : .red)
|
||||
.saturation(displayMode.colorScheme == .dark ? 0.5 : 1)
|
||||
Text(accessStatus ? "Accessibility permission granted" : "Accessibility permission not granted")
|
||||
.font(.callout)
|
||||
.foregroundStyle(Color("mode").opacity(0.5))
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: "calendar")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing)
|
||||
.foregroundStyle(remStatus ? .green : .red)
|
||||
.saturation(displayMode.colorScheme == .dark ? 0.5 : 1)
|
||||
Text("Reminders")
|
||||
.font(.callout)
|
||||
.foregroundStyle(Color("mode").opacity(0.5))
|
||||
.frame(width: 100)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("") {
|
||||
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Reminders") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
Button("") {
|
||||
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
.buttonStyle(SimpleButtonStyle(icon: "arrow.right.circle.fill", help: "View reminders permissions pane", size: 14))
|
||||
|
||||
Spacer()
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.leading)
|
||||
.frame(width: 200)
|
||||
.buttonStyle(SimpleButtonStyle(icon: "folder", help: "View accessibility permissions pane"))
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.leading)
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: "gearshape.2")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing)
|
||||
.foregroundStyle(autoStatus ? .green : .red)
|
||||
.saturation(displayMode.colorScheme == .dark ? 0.5 : 1)
|
||||
Text(autoStatus ? "Automation permission granted" : "Automation permission not granted")
|
||||
.font(.callout)
|
||||
.foregroundStyle(Color("mode").opacity(0.5))
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("") {
|
||||
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Automation") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
}
|
||||
.buttonStyle(SimpleButtonStyle(icon: "folder", help: "View automation permissions pane"))
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.leading)
|
||||
|
||||
|
||||
|
||||
@@ -445,7 +394,6 @@ struct GeneralSettingsTab: View {
|
||||
diskStatus = results.fullDiskAccess
|
||||
accessStatus = results.accessibility
|
||||
autoStatus = results.automation
|
||||
remStatus = results.reminders
|
||||
if results.allPermissionsGranted {
|
||||
updateOnMain {
|
||||
appState.permissionsOkay = true
|
||||
@@ -457,23 +405,17 @@ struct GeneralSettingsTab: View {
|
||||
|
||||
}
|
||||
.padding(20)
|
||||
.frame(width: 500, height: 650)
|
||||
.frame(width: 500, height: 670)
|
||||
|
||||
}
|
||||
|
||||
private var keysToIgnore: Set<String> {
|
||||
["windowWidthKey", "windowHeightKey", "windowWidthKeyMini", "windowHeightKeyMini", "windowXKey", "windowYKey"]
|
||||
}
|
||||
|
||||
private func resetUserDefaults() {
|
||||
isResetting = true
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let defaults = UserDefaults.standard
|
||||
let dictionary = defaults.dictionaryRepresentation()
|
||||
dictionary.keys.forEach { key in
|
||||
if !keysToIgnore.contains(key) {
|
||||
defaults.removeObject(forKey: key)
|
||||
}
|
||||
defaults.removeObject(forKey: key)
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
isResetting = false
|
||||
|
||||
Reference in New Issue
Block a user