Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alienator88 committed Dec 23, 2024
1 parent 1156358 commit a4b3d6d
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"location" : "https://github.com/alienator88/AlinFoundation",
"state" : {
"branch" : "main",
"revision" : "1ed36ea2b5cba7f458aeb87ac807e3f058f17aec"
"revision" : "88cfee24449408c793c1d1aa6b79ef0114f7073d"
}
},
{
Expand Down
51 changes: 24 additions & 27 deletions Pearcleaner/Logic/Styles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -624,49 +624,47 @@ struct CustomPickerButton: View {
// Expanded menu with selectable options
VStack(alignment: .leading, spacing: 0) {
ForEach(Array(options.enumerated()), id: \.element.title) { index, option in
HStack {
Image(systemName: option.icon)
Text(option.title)
Spacer()
switch option.title {
case "Applications":
Text(verbatim: "⌘1").font(.footnote).opacity(0.3)
case "Development":
Text(verbatim: "⌘2").font(.footnote).opacity(0.3)
case "Orphaned Files":
Text(verbatim: "⌘3").font(.footnote).opacity(0.3)
default:
EmptyView()
}

}
// .padding(.vertical, 8)
.contentShape(Rectangle())
// .bounds(.blue)
.opacity(hoveredItem == option.title ? 0.7 : 1.0) // Change opacity on hover
.onTapGesture {
selectedOption = option // Update selected option
onSelect?(option.title) // Call the selection handler
Button(action: {
selectedOption = option
onSelect?(option.title)
withAnimation {
isExpanded = false
}
}) {
HStack {
Image(systemName: option.icon)
Text(option.title)
Spacer()
switch option.title {
case "Applications":
Text(verbatim: "⌘1").font(.footnote).opacity(0.3)
case "Development":
Text(verbatim: "⌘2").font(.footnote).opacity(0.3)
case "Orphaned Files":
Text(verbatim: "⌘3").font(.footnote).opacity(0.3)
default:
EmptyView()
}

}
.contentShape(Rectangle())
.opacity(hoveredItem == option.title ? 0.7 : 1.0)
}
.buttonStyle(.borderless)
.foregroundStyle(.primary)
.onHover { isHovering in
// Update hoveredItem based on whether this HStack is hovered
hoveredItem = isHovering ? option.title : nil
}

if index < options.count - 1 {
Divider()
.padding(.vertical, 8)
// .padding(.trailing, 23)
.opacity(0.3)
}

}
}
.frame(maxWidth: 140, alignment: .leading)
// .bounds()
} else {
// Display the selected option when collapsed
HStack {
Expand All @@ -684,7 +682,6 @@ struct CustomPickerButton: View {
}
.padding(isExpanded ? 10 : 0)
.background(backgroundView(themeManager: themeManager, darker: true, glass: false))
// .background(.ultraThinMaterial)
.cornerRadius(8)
.overlay(
RoundedRectangle(cornerRadius: 8)
Expand Down
2 changes: 2 additions & 0 deletions Pearcleaner/PearcleanerApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ struct PearcleanerApp: App {
}
}

permissionManager.checkAllPermissions()


}
}
Expand Down
217 changes: 124 additions & 93 deletions Pearcleaner/Views/AppListItems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,130 +31,161 @@ struct AppListItems: View {

var body: some View {

VStack() {

HStack(alignment: .center) {

if let appIcon = appInfo.appIcon {
ZStack {
Image(nsImage: appIcon)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30)
.clipShape(RoundedRectangle(cornerRadius: 8))
Button(action: {
if !isSelected {
withAnimation(Animation.easeInOut(duration: animationEnabled ? 0.35 : 0)) {
showAppInFiles(appInfo: appInfo, appState: appState, locations: locations, showPopover: $showPopover)
}
} else {
withAnimation(Animation.easeInOut(duration: animationEnabled ? 0.35 : 0)) {
updateOnMain {
appState.appInfo = .empty
appState.selectedItems = []
appState.currentView = miniView ? .apps : .empty
showPopover = false
}

}
}

if minimalEnabled {
Text(appInfo.appName)
.font(.system(size: (isSelected) ? 14 : 12))
.lineLimit(1)
.truncationMode(.tail)
} else {
VStack(alignment: .center, spacing: 2) {
HStack {
Text(appInfo.appName)
.font(.system(size: (isSelected) ? 14 : 12))
.lineLimit(1)
.truncationMode(.tail)
Spacer()
}
}) {
VStack() {

HStack(alignment: .center) {

HStack(spacing: 5) {
Text(verbatim: "v\(appInfo.appVersion)")
.font(.footnote)
.lineLimit(1)
.truncationMode(.tail)
.opacity(0.5)
Text(verbatim: "").font(.footnote).opacity(0.5)

Text(appInfo.bundleSize == 0 ? String(localized: "calculating") : "\(formatByte(size: appInfo.bundleSize).human)")
.font(.footnote)
.lineLimit(1)
.truncationMode(.tail)
.opacity(0.5)
Spacer()
if let appIcon = appInfo.appIcon {
ZStack {
Image(nsImage: appIcon)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30)
.clipShape(RoundedRectangle(cornerRadius: 8))
}

}
}

if minimalEnabled {
Text(appInfo.appName)
.font(.system(size: (isSelected) ? 14 : 12))
.lineLimit(1)
.truncationMode(.tail)
} else {
VStack(alignment: .center, spacing: 2) {
HStack {
Text(appInfo.appName)
.font(.system(size: (isSelected) ? 14 : 12))
.lineLimit(1)
.truncationMode(.tail)
Spacer()
}

if appInfo.webApp {
Image(systemName: "safari")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
.foregroundStyle(.primary.opacity(0.3))
.symbolRenderingMode(.monochrome)
.help("Web app")
}
if appInfo.wrapped {
Image(systemName: "iphone")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
.foregroundStyle(.primary.opacity(0.3))
.symbolRenderingMode(.monochrome)
.help("iOS app")
}
HStack(spacing: 5) {
Text(verbatim: "v\(appInfo.appVersion)")
.font(.footnote)
.lineLimit(1)
.truncationMode(.tail)
.opacity(0.5)
Text(verbatim: "").font(.footnote).opacity(0.5)

Text(appInfo.bundleSize == 0 ? String(localized: "calculating") : "\(formatByte(size: appInfo.bundleSize).human)")
.font(.footnote)
.lineLimit(1)
.truncationMode(.tail)
.opacity(0.5)
Spacer()
}

Spacer()
}
}

if minimalEnabled && !isSelected {
Text(appInfo.bundleSize == 0 ? "v\(appInfo.appVersion)" : (isHovered ? "v\(appInfo.appVersion)" : formatByte(size: appInfo.bundleSize).human))
.font(.system(size: (isHovered || isSelected) ? 12 : 10))
.foregroundStyle(.primary.opacity(0.5))
}

if isSelected && !(mini || menubarEnabled) {
Button("Close") {
withAnimation(Animation.easeInOut(duration: animationEnabled ? 0.35 : 0)) {
updateOnMain {
appState.appInfo = .empty
appState.selectedItems = []
appState.currentView = miniView ? .apps : .empty
showPopover = false
}
}
if appInfo.webApp {
Image(systemName: "safari")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
.foregroundStyle(.primary.opacity(0.3))
.symbolRenderingMode(.monochrome)
.help("Web app")
.padding(.trailing, 5)
}
if appInfo.wrapped {
Image(systemName: "iphone")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
.foregroundStyle(.primary.opacity(0.3))
.symbolRenderingMode(.monochrome)
.help("iOS app")
.padding(.trailing, 5)
}

if minimalEnabled {
Spacer()
}
.buttonStyle(SimpleButtonStyle(icon: "x.circle", iconFlip: "x.circle.fill", help: String(localized: "Close"), size: 16))
}

if minimalEnabled && !isSelected {
// Text(appInfo.bundleSize == 0 ? "v\(appInfo.appVersion)" : (isHovered ? "v\(appInfo.appVersion)" : formatByte(size: appInfo.bundleSize).human))
Text(appInfo.bundleSize == 0 ? "v\(appInfo.appVersion)" : formatByte(size: appInfo.bundleSize).human)
.font(.system(size: 10))
.foregroundStyle(.primary.opacity(0.5))
}

}
// if isSelected && !(mini || menubarEnabled) {
// Button("Close") {
// withAnimation(Animation.easeInOut(duration: animationEnabled ? 0.35 : 0)) {
// updateOnMain {
// appState.appInfo = .empty
// appState.selectedItems = []
// appState.currentView = miniView ? .apps : .empty
// showPopover = false
// }
// }
//
// }
// .buttonStyle(SimpleButtonStyle(icon: "x.circle", iconFlip: "x.circle.fill", help: String(localized: "Close"), size: 16))
// }


}

}
.frame(height: 35)
.padding(.horizontal)
.padding(.vertical, 5)
}
.frame(height: 35)
.padding(.horizontal)
.padding(.vertical, 5)
.buttonStyle(.borderless)
.foregroundStyle(.primary)
.onHover { hovering in
withAnimation(Animation.easeInOut(duration: animationEnabled ? 0.35 : 0)) {
withAnimation(Animation.easeInOut(duration: animationEnabled ? 0.20 : 0)) {
self.isHovered = hovering
self.hoveredItemPath = isHovered ? appInfo.path : nil
}
}
.onTapGesture {
withAnimation(Animation.easeInOut(duration: animationEnabled ? 0.35 : 0)) {
showAppInFiles(appInfo: appInfo, appState: appState, locations: locations, showPopover: $showPopover)
}
}
.background{
Rectangle()
.fill(isSelected && !glass ? themeManager.pickerColor : .clear)
}
.overlay{
if (isHovered || isSelected) {
HStack {
Spacer()
RoundedRectangle(cornerRadius: 50)
.fill(isSelected ? Color("AccentColor") : .primary.opacity(0.5))
.frame(width: isSelected ? 4 : 2, height: 25)
.padding(.trailing, 5)
if !minimalEnabled {
HStack {
RoundedRectangle(cornerRadius: 50)
.fill(isSelected ? Color("AccentColor") : .primary.opacity(0.5))
.frame(width: isSelected ? 4 : 2, height: 25)
.padding(.leading, 9)
Spacer()
}
} else {
HStack {
Spacer()
RoundedRectangle(cornerRadius: 50)
.fill(isSelected ? Color("AccentColor") : .primary.opacity(0.5))
.frame(width: isSelected ? 4 : 2, height: 25)
.padding(.trailing, 7)
}
}


}
}
.onAppear {
Expand Down
2 changes: 1 addition & 1 deletion Pearcleaner/Views/AppSearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct AppSearchView: View {

.overlay {
LadderTopRoundedRectangle2(cornerRadius: 8, ladderHeight: 22, ladderPosition: 58, isFlipped: true)
.strokeBorder(.primary.opacity(0.1), lineWidth: 1)
.strokeBorder(.primary.opacity(0.05), lineWidth: 1)
}
#if DEBUG
.overlay {
Expand Down
4 changes: 2 additions & 2 deletions Pearcleaner/Views/ZombieView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct ZombieView: View {
// Item selection and sorting toolbar
HStack {
Toggle(isOn: selectAllBinding) { EmptyView() }
.toggleStyle(SimpleCheckboxToggleStyle())
// .toggleStyle(SimpleCheckboxToggleStyle())
.help("All checkboxes")

SearchBar(search: $searchZ, darker: true, glass: glass, sidebar: false)
Expand Down Expand Up @@ -439,7 +439,7 @@ struct ZombieFileDetailsItem: View {

HStack(alignment: .center, spacing: 20) {
Toggle(isOn: $isSelected) { EmptyView() }
.toggleStyle(SimpleCheckboxToggleStyle())
// .toggleStyle(SimpleCheckboxToggleStyle())

if let appIcon = icon {
appIcon
Expand Down

0 comments on commit a4b3d6d

Please sign in to comment.