This commit is contained in:
Alin
2023-12-14 11:14:51 -07:00
parent 477955a258
commit 64830e662f
11 changed files with 149 additions and 35 deletions
+4 -4
View File
@@ -535,7 +535,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 9; CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BK8443AXLU; DEVELOPMENT_TEAM = BK8443AXLU;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -552,7 +552,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.8; MARKETING_VERSION = 1.9;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner; PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
@@ -569,7 +569,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 9; CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BK8443AXLU; DEVELOPMENT_TEAM = BK8443AXLU;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -586,7 +586,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.8; MARKETING_VERSION = 1.9;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner; PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
+8 -5
View File
@@ -262,7 +262,6 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
} }
var collection: [URL] = [] var collection: [URL] = []
if let url = URL(string: appInfo.path.absoluteString) { if let url = URL(string: appInfo.path.absoluteString) {
// appState.paths.insert(url, at: 0)
collection.insert(url, at: 0) collection.insert(url, at: 0)
} }
@@ -270,16 +269,19 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
let dispatchGroup = DispatchGroup() let dispatchGroup = DispatchGroup()
let bundleComponents = appInfo.bundleIdentifier.components(separatedBy: ".") let bundleComponents = appInfo.bundleIdentifier.components(separatedBy: ".")
var bundle: String = "" var bundle: String = ""
var weirdFormatBundle: Bool = false
if bundleComponents.count >= 3 { // get last 2 or middle 2 components if bundleComponents.count >= 3 { // get last 2 or middle 2 components
bundle = bundleComponents[1...2].joined(separator: "").lowercased() bundle = bundleComponents[1...2].joined(separator: "").lowercased()
} }
if bundleComponents[0] != "com" {
weirdFormatBundle = true
}
let nameL = appInfo.appName.pearFormat() let nameL = appInfo.appName.pearFormat()
let bundleIdentifierL = appInfo.bundleIdentifier.pearFormat() let bundleIdentifierL = appInfo.bundleIdentifier.pearFormat()
let locations = Locations() let locations = Locations()
for location in locations.apps.paths { for location in locations.apps.paths {
if !fileManager.fileExists(atPath: location) { if !fileManager.fileExists(atPath: location) {
// print("Directory does not exist: \(location)")
continue continue
} }
@@ -292,7 +294,8 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
let itemURL = URL(fileURLWithPath: location).appendingPathComponent(item) let itemURL = URL(fileURLWithPath: location).appendingPathComponent(item)
let itemL = ("\(item)").replacingOccurrences(of: ".", with: "").replacingOccurrences(of: " ", with: "").lowercased() let itemL = ("\(item)").replacingOccurrences(of: ".", with: "").replacingOccurrences(of: " ", with: "").lowercased()
if collection.contains(itemURL) { if collection.contains(itemURL) {
return return
} }
@@ -318,7 +321,7 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
} }
// Catch Logitech files since Logi is part of word login and can return random files // Catch Logitech files since Logi is part of word login and can return random files
} else if itemL.contains("logi") && !itemL.contains("login") { } else if itemL.contains("logi") && !itemL.contains("login") {
if itemL.contains(bundleComponents[1]) || itemL.contains(bundle) || itemL.contains(bundleIdentifierL) || (nameL.count > 3 && itemL.contains(nameL)) { if itemL.contains(bundleComponents[weirdFormatBundle ? 0 : 1]) || itemL.contains(bundle) || itemL.contains(bundleIdentifierL) || (nameL.count > 3 && itemL.contains(nameL)) {
collection.append(itemURL) collection.append(itemURL)
} }
// Catch MS Office files since they have many random folder names and very short names // Catch MS Office files since they have many random folder names and very short names
+67 -13
View File
@@ -115,7 +115,25 @@ struct AnimatedSearchStyle: TextFieldStyle {
} }
} }
.help("Refresh app list")
if text != "" {
Image(systemName: "xmark")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 10, height: 10)
.padding(.trailing, 5)
.foregroundStyle(isHovered ? Color("mode").opacity(0.8) : Color("mode").opacity(0.5))
.onTapGesture {
withAnimation {
text = ""
}
}
.help("Clear search")
}
} else { } else {
Image(systemName: "magnifyingglass") Image(systemName: "magnifyingglass")
.resizable() .resizable()
@@ -191,18 +209,18 @@ struct SimpleSearchStyle: TextFieldStyle {
} }
// if trash { if trash && text != "" {
// Image(systemName: "xmark") Image(systemName: "xmark")
// .resizable() .resizable()
// .aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
// .frame(width: 10, height: 10) .frame(width: 10, height: 10)
// .padding(.trailing, 5) .padding(.trailing, 5)
// .foregroundStyle(isHovered ? Color("mode").opacity(0.8) : Color("mode").opacity(0.5)) .foregroundStyle(isHovered ? Color("mode").opacity(0.8) : Color("mode").opacity(0.5))
// .onTapGesture { .onTapGesture {
// text = "" text = ""
// } }
// .opacity(text.isEmpty ? 0 : 1) .help("Clear search")
// } }
} }
} }
@@ -290,6 +308,42 @@ struct WindowActionButton: ButtonStyle {
struct FilesViewActionButton: ButtonStyle {
enum UserAction {
case uninstall
case close
}
@State private var hovered = false
let action: UserAction
func makeBody(configuration: Configuration) -> some View {
configuration.label
.frame(width: 70)
.padding(6)
.background(
RoundedRectangle(cornerRadius: 6)
.strokeBorder(
configuration.isPressed ?
Color("AccentColor").opacity(0.7) :
hovered ? Color("AccentColor").opacity(0.8) : Color("AccentColor").opacity(0.9), lineWidth: 2
)
)
.foregroundColor(
action == .uninstall ? Color("AccentColor") : Color("mode")
)
.cornerRadius(6)
.onHover { hovering in
withAnimation(Animation.easeIn(duration: 0.15)) {
hovered = hovering
}
}
}
}
struct SentinelToggleStyle: ToggleStyle { struct SentinelToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View { func makeBody(configuration: Configuration) -> some View {
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0xCF",
"green" : "0xCF",
"red" : "0xCF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0x59",
"green" : "0x59",
"red" : "0x59"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ struct GeneralSettingsTab: View {
HStack { HStack {
VStack(alignment: .leading, spacing: 5) { VStack(alignment: .leading, spacing: 5) {
Text("Transparency").font(.title2) Text("Transparency").font(.title2)
Text("Toggles the sidebar material on the app list drawer") Text("Toggles the transparent sidebar material")
.font(.footnote) .font(.footnote)
.foregroundStyle(.gray) .foregroundStyle(.gray)
} }
+1 -1
View File
@@ -136,7 +136,7 @@ struct AppListView: View {
AppDetailsEmptyView(showPopover: $showPopover) AppDetailsEmptyView(showPopover: $showPopover)
} else if appState.currentView == .files { } else if appState.currentView == .files {
TopBar(reload: $reload) TopBar(reload: $reload)
FilesView(showPopover: $showPopover) FilesView(showPopover: $showPopover, search: $search)
.id(appState.appInfo.id) .id(appState.appInfo.id)
} }
} }
+5
View File
@@ -86,6 +86,11 @@ struct DropTarget: View, DropDelegate {
} }
.onDrop(of: types, delegate: self) .onDrop(of: types, delegate: self)
.onTapGesture {
withAnimation(.easeInOut(duration: 0.5)) {
appState.currentView = .apps
}
}
.padding(20) .padding(20)
.frame(maxWidth: mini ? 200 : .infinity) .frame(maxWidth: mini ? 200 : .infinity)
.frame(maxHeight: mini ? 200 : .infinity) .frame(maxHeight: mini ? 200 : .infinity)
+18 -4
View File
@@ -17,7 +17,8 @@ struct FilesView: View {
@AppStorage("settings.general.mini") private var mini: Bool = false @AppStorage("settings.general.mini") private var mini: Bool = false
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
@Binding var showPopover: Bool @Binding var showPopover: Bool
@Binding var search: String
var body: some View { var body: some View {
VStack(alignment: .center) { VStack(alignment: .center) {
if !self.showDetails { if !self.showDetails {
@@ -156,13 +157,26 @@ struct FilesView: View {
HStack() { HStack() {
Spacer() Spacer()
if mini {
Button("Close") {
updateOnMain {
appState.appInfo = AppInfo.empty
search = ""
appState.currentView = .apps
showPopover = false
}
}
// .buttonStyle(FilesViewActionButton(action: .close))
}
Button("Uninstall") { Button("Uninstall") {
Task { Task {
updateOnMain { updateOnMain {
appState.appInfo = AppInfo.empty appState.appInfo = AppInfo.empty
if mini { if mini {
search = ""
appState.currentView = .apps appState.currentView = .apps
showPopover = false showPopover = false
} else { } else {
@@ -191,7 +205,7 @@ struct FilesView: View {
} }
.disabled(appState.selectedItems.isEmpty) .disabled(appState.selectedItems.isEmpty)
.buttonStyle(WindowActionButton(action: .accept)) // .buttonStyle(FilesViewActionButton(action: .uninstall))
} }
// .padding(.top) // .padding(.top)
+2 -2
View File
@@ -30,7 +30,7 @@ struct MiniMode: View {
MiniEmptyView(showPopover: $showPopover) MiniEmptyView(showPopover: $showPopover)
} else if appState.currentView == .files { } else if appState.currentView == .files {
TopBarMini(reload: $reload, search: $search) TopBarMini(reload: $reload, search: $search)
FilesView(showPopover: $showPopover) FilesView(showPopover: $showPopover, search: $search)
.id(appState.appInfo.id) .id(appState.appInfo.id)
} else if appState.currentView == .apps { } else if appState.currentView == .apps {
TopBarMini(reload: $reload, search: $search) TopBarMini(reload: $reload, search: $search)
@@ -41,7 +41,7 @@ struct MiniMode: View {
.transition(.move(edge: .leading)) .transition(.move(edge: .leading))
.popover(isPresented: $showPopover, arrowEdge: .trailing) { .popover(isPresented: $showPopover, arrowEdge: .trailing) {
VStack { VStack {
FilesView(showPopover: $showPopover) FilesView(showPopover: $showPopover, search: $search)
.id(appState.appInfo.id) .id(appState.appInfo.id)
} }
.background( .background(
+1 -1
View File
@@ -45,7 +45,7 @@ struct TopBar: View {
appState.appInfo = AppInfo.empty appState.appInfo = AppInfo.empty
} }
} }
.buttonStyle(SimpleButtonStyle(icon: "arrow.down.app", help: "Drop", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "house", help: "Home", color: Color("mode")))
} }
+4 -4
View File
@@ -60,7 +60,7 @@ struct TopBarMini: View {
// } // }
} }
} }
.buttonStyle(SimpleButtonStyle(icon: "arrow.down.app", help: "Drop", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "arrow.down.app", help: "Back to Drop Zone", color: Color("mode")))
} else if appState.currentView == .empty { } else if appState.currentView == .empty {
Button("") { Button("") {
withAnimation(.easeInOut(duration: 0.5)) { withAnimation(.easeInOut(duration: 0.5)) {
@@ -69,7 +69,7 @@ struct TopBarMini: View {
// } // }
} }
} }
.buttonStyle(SimpleButtonStyle(icon: "list.triangle", help: "Apps", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "list.triangle", help: "Apps List", color: Color("mode")))
} else if appState.currentView == .files { } else if appState.currentView == .files {
Button("") { Button("") {
withAnimation(.easeInOut(duration: 0.5)) { withAnimation(.easeInOut(duration: 0.5)) {
@@ -80,7 +80,7 @@ struct TopBarMini: View {
} }
} }
.buttonStyle(SimpleButtonStyle(icon: "arrow.down.app", help: "Drop", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "arrow.down.app", help: "Back to Drop Zone", color: Color("mode")))
Button("") { Button("") {
withAnimation(.easeInOut(duration: 0.5)) { withAnimation(.easeInOut(duration: 0.5)) {
// updateOnMain { // updateOnMain {
@@ -88,7 +88,7 @@ struct TopBarMini: View {
// } // }
} }
} }
.buttonStyle(SimpleButtonStyle(icon: "list.triangle", help: "Apps", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "list.triangle", help: "Apps List", color: Color("mode")))
} }