Skip to content

Commit

Permalink
Progress
Browse files Browse the repository at this point in the history
  • Loading branch information
alienator88 committed Jun 12, 2024
1 parent aee0dda commit 8e12af9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
6 changes: 4 additions & 2 deletions Pearcleaner/Logic/Styles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ struct InfoButton: View {
let color: Color
let label: String
let warning: Bool
let edge: Edge

init(text: String, color: Color = Color("mode"), label: String = "", warning: Bool = false) {
init(text: String, color: Color = Color("mode"), label: String = "", warning: Bool = false, edge: Edge = .bottom) {
self.text = text
self.color = color
self.label = label
self.warning = warning
self.edge = edge

}

Expand Down Expand Up @@ -202,7 +204,7 @@ struct InfoButton: View {
NSCursor.pop()
}
}
.popover(isPresented: $isPopoverPresented, arrowEdge: .bottom) {
.popover(isPresented: $isPopoverPresented, arrowEdge: edge) {
VStack {
Spacer()
Text(text)
Expand Down
2 changes: 1 addition & 1 deletion Pearcleaner/Views/AppSearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct AppSearchView: View {
selectedSortAlpha.toggle()
}
}
.buttonStyle(SimpleButtonStyle(icon: "circle.fill", label: "App List Sorting", help: "Can also click on User/System headers to toggle this", size: 5))
.buttonStyle(SimpleButtonStyle(icon: "circle.fill", label: "Sorting: \(selectedSortAlpha ? "ABC" : "123")", help: "Can also click on User/System headers to toggle this", size: 5))

if mini && !menubarEnabled {
Button("") {
Expand Down
38 changes: 35 additions & 3 deletions Pearcleaner/Views/FilesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ struct FilesView: View {
@AppStorage("settings.menubar.enabled") private var menubarEnabled: Bool = false
@AppStorage("settings.general.selectedSort") var selectedSortAlpha: Bool = true
@AppStorage("settings.general.sizeType") var sizeType: String = "Real"
@AppStorage("settings.general.filesWarning") private var warning: Bool = false
@State private var showAlert = false
@Environment(\.colorScheme) var colorScheme
@Binding var showPopover: Bool
@Binding var search: String
Expand Down Expand Up @@ -121,9 +123,10 @@ struct FilesView: View {
Text("\(appState.appInfo.appName)").font(.title).fontWeight(.bold).lineLimit(1)
Text("").foregroundStyle(Color("AccentColor"))
Text("v\(appState.appInfo.appVersion)").font(.title3)
if appState.appInfo.appName.count < 5 {
InfoButton(text: "Pearcleaner searches for files via a combination of bundle id and app name. \(appState.appInfo.appName) has a common or short app name so there might be unrelated files found. Please check the list thoroughly before uninstalling.")
}

// if appState.appInfo.appName.count < 5 {
// InfoButton(text: "Pearcleaner searches for files via a combination of bundle id and app name. \(appState.appInfo.appName) has a common or short app name so there might be unrelated files found. Please check the list thoroughly before uninstalling.")
// }

}
Text("\(appState.appInfo.bundleIdentifier)")
Expand Down Expand Up @@ -270,6 +273,10 @@ struct FilesView: View {

Spacer()

InfoButton(text: "Always double-check the files/folders marked for removal. In some rare cases, Pearcleaner may find some unrelated files when app names are too similar.", color: Color("mode").opacity(0.5), warning: true, edge: .top)
.padding(.top)


Button("\(sizeType == "Logical" ? totalSelectedSize.logical : sizeType == "Finder" ? totalSelectedSize.finder : totalSelectedSize.real)") {
Task {

Expand Down Expand Up @@ -362,6 +369,31 @@ struct FilesView: View {
}

}
.sheet(isPresented: $showAlert, content: {
VStack(spacing: 10) {
Text("Important")
.font(.headline)
Divider()
Spacer()
Text("Always double-check the files/folders marked for removal. In some rare cases, Pearcleaner may find some unrelated files when app names are too similar.")
.font(.subheadline)
Spacer()
Button("Close") {
warning = true
showAlert = false
}
.buttonStyle(SimpleButtonStyle(icon: "x.circle.fill", label: "Close", help: "Dismiss"))
Spacer()
}
.padding(15)
.frame(width: 400, height: 200)
.background(GlassEffect(material: .hudWindow, blendingMode: .behindWindow))
})
.onAppear {
if !warning {
showAlert = true
}
}
}

}
Expand Down
5 changes: 3 additions & 2 deletions Pearcleaner/Views/ZombieView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ struct ZombieView: View {
VStack(alignment: .leading, spacing: 10){
HStack {
Text("Leftover Files").font(.title).fontWeight(.bold)
InfoButton(text: "Leftover file search is not 100% accurate as it doesn't have any uninstalled app bundles to check against for file exclusion. This does a best guess search for files/folders and excludes the ones that have overlap with your currently installed applications. Please confirm files marked for deletion really do belong to uninstalled applications.", color: .orange, warning: true)
Spacer()

}
Text("Remaining files and folders from previous applications")
.font(.callout).foregroundStyle(Color("mode").opacity(0.5))
Expand Down Expand Up @@ -221,6 +219,8 @@ struct ZombieView: View {

Spacer()

InfoButton(text: "Leftover file search is not 100% accurate as it doesn't have any uninstalled app bundles to check against for file exclusion. This does a best guess search for files/folders and excludes the ones that have overlap with your currently installed applications. Please confirm files marked for deletion really do belong to uninstalled applications.", color: .orange, warning: true, edge: .top)

Button("Rescan") {
updateOnMain {
appState.zombieFile = .empty
Expand Down Expand Up @@ -293,6 +293,7 @@ struct ZombieView: View {
VStack(spacing: 10) {
Text("Important")
.font(.headline)
Divider()
Spacer()
Text("Leftover file search is not 100% accurate as it doesn't have any uninstalled app bundles to check against for file exclusion. This does a best guess search for files/folders and excludes the ones that have overlap with your currently installed applications. Please confirm files marked for deletion really do belong to uninstalled applications.")
.font(.subheadline)
Expand Down

0 comments on commit 8e12af9

Please sign in to comment.