mirror of
https://github.com/exituser/Pearcleaner.git
synced 2026-09-17 07:19:04 +00:00
v1.7
This commit is contained in:
@@ -82,6 +82,8 @@ func getAppInfo(atPath path: URL) -> AppInfo? {
|
||||
appName = localizedName
|
||||
} else if let bundleName = bundle.infoDictionary?["CFBundleName"] as? String {
|
||||
appName = bundleName
|
||||
} else {
|
||||
appName = path.deletingPathExtension().lastPathComponent
|
||||
}
|
||||
// Check if the icon file name has an .icns extension, if not, add it
|
||||
if !appIconFileName.hasSuffix(".icns") {
|
||||
|
||||
@@ -39,6 +39,29 @@ struct PearcleanerApp: App {
|
||||
.preferredColorScheme(displayMode.colorScheme)
|
||||
.alert(isPresented: $appState.showAlert) { presentAlert(appState: appState) }
|
||||
.handlesExternalEvents(preferring: Set(arrayLiteral: "pear"), allowing: Set(arrayLiteral: "*"))
|
||||
.onOpenURL(perform: { url in
|
||||
let deeplinkManager = DeeplinkManager()
|
||||
deeplinkManager.manage(url: url, appState: appState)
|
||||
})
|
||||
.onDrop(of: ["public.file-url"], isTargeted: nil) { providers, _ in
|
||||
for provider in providers {
|
||||
provider.loadItem(forTypeIdentifier: "public.file-url") { data, error in
|
||||
if let data = data as? Data, let url = URL(dataRepresentation: data, relativeTo: nil) {
|
||||
let deeplinkManager = DeeplinkManager()
|
||||
deeplinkManager.manage(url: url, appState: appState)
|
||||
// // Check if the file URL has a ".app" extension
|
||||
// if url.pathExtension.lowercased() == "app" {
|
||||
// // Handle the dropped file URL here
|
||||
// print("Dropped .app file URL: \(url)")
|
||||
// } else {
|
||||
// // Print a message for non-.app files
|
||||
// print("Unsupported file type. Only .app files are accepted.")
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
.onAppear {
|
||||
NSWindow.allowsAutomaticWindowTabbing = false
|
||||
|
||||
@@ -110,9 +133,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
// func application(_ sender: NSApplication, open urls: [URL]) {
|
||||
// for url in urls {
|
||||
// if url.pathExtension == "app" {
|
||||
// writeLog(string: url.path)
|
||||
// print("Dropped app path:", url.path)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,7 @@ struct AppListItems: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
HStack(alignment: .center) {
|
||||
// if isHovered || isSelected {
|
||||
// Circle()
|
||||
// .fill(Color("AccentColor"))
|
||||
// .frame(width: 10)
|
||||
// .padding(5)
|
||||
// }
|
||||
|
||||
if let appIcon = appInfo.appIcon {
|
||||
Image(nsImage: appIcon)
|
||||
.resizable()
|
||||
@@ -106,18 +101,5 @@ struct AppListItems: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
// .popover(isPresented: $appState.showPopover, arrowEdge: .trailing) {
|
||||
// VStack {
|
||||
// FilesView()
|
||||
// .id(appState.appInfo.id)
|
||||
// }
|
||||
// .background(
|
||||
// Rectangle()
|
||||
// .background(colorScheme == .dark ? .black.opacity(0.8) : .white)
|
||||
// .padding(-80)
|
||||
// )
|
||||
// .frame(minWidth: 500, minHeight: 500)
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,10 +146,29 @@ struct AppListView: View {
|
||||
Spacer()
|
||||
}
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.onOpenURL(perform: { url in
|
||||
let deeplinkManager = DeeplinkManager()
|
||||
deeplinkManager.manage(url: url, appState: appState)
|
||||
})
|
||||
// .onOpenURL(perform: { url in
|
||||
// let deeplinkManager = DeeplinkManager()
|
||||
// deeplinkManager.manage(url: url, appState: appState)
|
||||
// })
|
||||
// .onDrop(of: ["public.file-url"], isTargeted: nil) { providers, _ in
|
||||
// for provider in providers {
|
||||
// provider.loadItem(forTypeIdentifier: "public.file-url") { data, error in
|
||||
// if let data = data as? Data, let url = URL(dataRepresentation: data, relativeTo: nil) {
|
||||
// let deeplinkManager = DeeplinkManager()
|
||||
// deeplinkManager.manage(url: url, appState: appState)
|
||||
// // // Check if the file URL has a ".app" extension
|
||||
// // if url.pathExtension.lowercased() == "app" {
|
||||
// // // Handle the dropped file URL here
|
||||
// // print("Dropped .app file URL: \(url)")
|
||||
// // } else {
|
||||
// // // Print a message for non-.app files
|
||||
// // print("Unsupported file type. Only .app files are accepted.")
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true
|
||||
// }
|
||||
// MARK: Background for whole app
|
||||
// .background(Color("bg").opacity(1))
|
||||
// .background(VisualEffect(material: .sidebar, blendingMode: .behindWindow).edgesIgnoringSafeArea(.all))
|
||||
|
||||
@@ -34,6 +34,15 @@ struct DropTarget: View, DropDelegate {
|
||||
Spacer()
|
||||
|
||||
ZStack {
|
||||
// Color("mode")
|
||||
// .mask(
|
||||
// Image(mini ? "pear" : "logo")
|
||||
// .resizable()
|
||||
// .scaledToFit()
|
||||
// .frame(minWidth: mini ? 104 : 300)
|
||||
// .frame(maxWidth: mini ? 104 : 500)
|
||||
// .padding(mini ? 20 : 10)
|
||||
// )
|
||||
LinearGradient(gradient: Gradient(colors: [.pink, .orange]), startPoint: .leading, endPoint: .trailing)
|
||||
.mask(
|
||||
Image(mini ? "pear" : "logo")
|
||||
@@ -54,6 +63,7 @@ struct DropTarget: View, DropDelegate {
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
// .fill(LinearGradient(gradient: Gradient(colors: [.pink, .orange]), startPoint: .leading, endPoint: .trailing))
|
||||
.strokeBorder(LinearGradient(gradient: Gradient(colors: [.pink, .orange]), startPoint: .leading, endPoint: .trailing), style: StrokeStyle(lineWidth: 3, dash: [11.0], dashPhase: phase))
|
||||
.onAppear {
|
||||
withAnimation(.linear.speed(0.5).repeat(while: ants, autoreverses: false)) {
|
||||
|
||||
@@ -39,16 +39,49 @@ struct MiniMode: View {
|
||||
}
|
||||
// .padding(.leading, appState.sidebar ? 0 : 10)
|
||||
.transition(.move(edge: .leading))
|
||||
|
||||
.popover(isPresented: $showPopover, arrowEdge: .trailing) {
|
||||
VStack {
|
||||
FilesView(showPopover: $showPopover)
|
||||
.id(appState.appInfo.id)
|
||||
}
|
||||
.background(
|
||||
Rectangle()
|
||||
.fill(Color("pop"))
|
||||
.padding(-80)
|
||||
)
|
||||
.frame(minWidth: 600, minHeight: 500)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.frame(minWidth: 300, minHeight: 300)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.background(glass ? GlassEffect(material: .sidebar, blendingMode: .behindWindow).edgesIgnoringSafeArea(.all) : nil)
|
||||
.onOpenURL(perform: { url in
|
||||
let deeplinkManager = DeeplinkManager()
|
||||
deeplinkManager.manage(url: url, appState: appState)
|
||||
})
|
||||
|
||||
// .onOpenURL(perform: { url in
|
||||
// let deeplinkManager = DeeplinkManager()
|
||||
// deeplinkManager.manage(url: url, appState: appState)
|
||||
// })
|
||||
// .onDrop(of: ["public.file-url"], isTargeted: nil) { providers, _ in
|
||||
// for provider in providers {
|
||||
// provider.loadItem(forTypeIdentifier: "public.file-url") { data, error in
|
||||
// if let data = data as? Data, let url = URL(dataRepresentation: data, relativeTo: nil) {
|
||||
// let deeplinkManager = DeeplinkManager()
|
||||
// deeplinkManager.manage(url: url, appState: appState)
|
||||
//// // Check if the file URL has a ".app" extension
|
||||
//// if url.pathExtension.lowercased() == "app" {
|
||||
//// // Handle the dropped file URL here
|
||||
//// print("Dropped .app file URL: \(url)")
|
||||
//// } else {
|
||||
//// // Print a message for non-.app files
|
||||
//// print("Unsupported file type. Only .app files are accepted.")
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true
|
||||
// }
|
||||
// MARK: Background for whole app
|
||||
// .background(Color("bg").opacity(1))
|
||||
// .background(VisualEffect(material: .sidebar, blendingMode: .behindWindow).edgesIgnoringSafeArea(.all))
|
||||
@@ -193,20 +226,20 @@ struct MiniAppView: View {
|
||||
}
|
||||
}
|
||||
.transition(.move(edge: .leading))
|
||||
.popover(isPresented: $showPopover, arrowEdge: .trailing) {
|
||||
VStack {
|
||||
FilesView(showPopover: $showPopover)
|
||||
.id(appState.appInfo.id)
|
||||
}
|
||||
.background(
|
||||
Rectangle()
|
||||
.fill(Color("pop"))
|
||||
// .background(Color("pop"))
|
||||
.padding(-80)
|
||||
)
|
||||
.frame(minWidth: 600, minHeight: 500)
|
||||
|
||||
}
|
||||
// .popover(isPresented: $showPopover, arrowEdge: .trailing) {
|
||||
// VStack {
|
||||
// FilesView(showPopover: $showPopover)
|
||||
// .id(appState.appInfo.id)
|
||||
// }
|
||||
// .background(
|
||||
// Rectangle()
|
||||
// .fill(Color("pop"))
|
||||
//// .background(Color("pop"))
|
||||
// .padding(-80)
|
||||
// )
|
||||
// .frame(minWidth: 600, minHeight: 500)
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user