mirror of
https://github.com/exituser/Pearcleaner.git
synced 2026-09-17 04:58:56 +00:00
v2.4
This commit is contained in:
@@ -543,7 +543,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 14;
|
||||
CURRENT_PROJECT_VERSION = 15;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BK8443AXLU;
|
||||
@@ -561,7 +561,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||
MARKETING_VERSION = 2.3;
|
||||
MARKETING_VERSION = 2.4;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
@@ -578,7 +578,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 14;
|
||||
CURRENT_PROJECT_VERSION = 15;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BK8443AXLU;
|
||||
@@ -596,7 +596,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||
MARKETING_VERSION = 2.3;
|
||||
MARKETING_VERSION = 2.4;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
|
||||
@@ -9,7 +9,13 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
class DeeplinkManager {
|
||||
|
||||
@Binding var showPopover: Bool
|
||||
@AppStorage("settings.general.mini") private var mini: Bool = false
|
||||
|
||||
init(showPopover: Binding<Bool>) {
|
||||
_showPopover = showPopover
|
||||
}
|
||||
|
||||
class DeepLinkConstants {
|
||||
static let scheme = "pear"
|
||||
static let host = "com.alienator88.Pearcleaner"
|
||||
@@ -29,7 +35,11 @@ class DeeplinkManager {
|
||||
updateOnMain {
|
||||
appState.appInfo = appInfo!
|
||||
findPathsForApp(appState: appState, appInfo: appState.appInfo)
|
||||
appState.currentView = .files
|
||||
if self.mini {
|
||||
self.showPopover = true
|
||||
} else {
|
||||
appState.currentView = .files
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print("No path query parameter found in the URL")
|
||||
@@ -67,7 +77,11 @@ class DeeplinkManager {
|
||||
updateOnMain {
|
||||
appState.appInfo = appInfo!
|
||||
findPathsForApp(appState: appState, appInfo: appState.appInfo)
|
||||
appState.currentView = .files
|
||||
if self.mini {
|
||||
self.showPopover = true
|
||||
} else {
|
||||
appState.currentView = .files
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -382,6 +382,7 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
|
||||
|
||||
|
||||
func getGroupContainers(bundleURL: URL) -> [URL] {
|
||||
let fileManager = FileManager.default
|
||||
|
||||
var staticCode: SecStaticCode?
|
||||
|
||||
@@ -406,13 +407,18 @@ func getGroupContainers(bundleURL: URL) -> [URL] {
|
||||
}
|
||||
|
||||
let groupContainersPath = appGroups.map { URL(fileURLWithPath: "\(home)/Library/Group Containers/" + $0) }
|
||||
let existingGroupContainers = groupContainersPath.filter { fileManager.fileExists(atPath: $0.path) }
|
||||
|
||||
return groupContainersPath
|
||||
return existingGroupContainers
|
||||
}
|
||||
|
||||
|
||||
// Move files to trash using applescript/Finder so it asks for user password if needed
|
||||
func moveFilesToTrash(at fileURLs: [URL], completion: @escaping () -> Void = {}) {
|
||||
@AppStorage("settings.sentinel.enable") var sentinel: Bool = false
|
||||
if sentinel {
|
||||
launchctl(load: false)
|
||||
}
|
||||
updateOnBackground {
|
||||
let posixFiles = fileURLs.map { "POSIX file \"\($0.path)\", " }.joined().dropLast(3)
|
||||
let scriptSource = """
|
||||
|
||||
@@ -283,7 +283,8 @@ func totalSizeOnDisk(for paths: [URL]) -> String? {
|
||||
}
|
||||
let pipe = Pipe()
|
||||
process.standardOutput = pipe
|
||||
|
||||
process.standardError = FileHandle.nullDevice
|
||||
|
||||
try? process.run()
|
||||
process.waitUntilExit()
|
||||
|
||||
|
||||
@@ -41,14 +41,14 @@ struct PearcleanerApp: App {
|
||||
.alert(isPresented: $appState.showAlert) { presentAlert(appState: appState) }
|
||||
.handlesExternalEvents(preferring: Set(arrayLiteral: "pear"), allowing: Set(arrayLiteral: "*"))
|
||||
.onOpenURL(perform: { url in
|
||||
let deeplinkManager = DeeplinkManager()
|
||||
let deeplinkManager = DeeplinkManager(showPopover: $showPopover)
|
||||
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()
|
||||
let deeplinkManager = DeeplinkManager(showPopover: $showPopover)
|
||||
deeplinkManager.manage(url: url, appState: appState)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ struct GeneralSettingsTab: View {
|
||||
@AppStorage("settings.general.glass") private var glass: Bool = true
|
||||
@AppStorage("settings.general.mini") private var mini: Bool = false
|
||||
@AppStorage("settings.general.dark") var isDark: Bool = true
|
||||
@AppStorage("settings.general.popover") private var popoverStay: Bool = true
|
||||
@AppStorage("displayMode") var displayMode: DisplayMode = .system
|
||||
@State private var selectedTheme = "Auto"
|
||||
private let themes = ["Auto", "Dark", "Light"]
|
||||
@@ -23,7 +24,7 @@ struct GeneralSettingsTab: View {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text("Transparency").font(.title2)
|
||||
Text("Toggles the transparent sidebar material")
|
||||
Text("Toggles transparent material")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.gray)
|
||||
}
|
||||
@@ -115,14 +116,37 @@ struct GeneralSettingsTab: View {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(Color("mode").opacity(0.05))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text("Mini - Files View").font(.title2)
|
||||
Text("Keeps file search view on top in mini mode")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.gray)
|
||||
}
|
||||
Spacer()
|
||||
Toggle(isOn: $popoverStay, label: {
|
||||
})
|
||||
.toggleStyle(.switch)
|
||||
}
|
||||
.padding()
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(Color("mode").opacity(0.05))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
}
|
||||
.padding(20)
|
||||
.frame(width: 400, height: 250)
|
||||
|
||||
.frame(width: 400, height: 350)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ struct FilesView: View {
|
||||
@State private var showPop: Bool = false
|
||||
@State private var itemDetails: [(size: String, icon: Image?)] = []
|
||||
@AppStorage("settings.general.mini") private var mini: Bool = false
|
||||
@AppStorage("settings.sentinel.enable") private var sentinel: Bool = false
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@Binding var showPopover: Bool
|
||||
@Binding var search: String
|
||||
@@ -196,6 +197,9 @@ struct FilesView: View {
|
||||
withAnimation {
|
||||
updateOnMain {
|
||||
appState.isReminderVisible.toggle()
|
||||
if sentinel {
|
||||
launchctl(load: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshAppList(appState.appInfo)
|
||||
|
||||
@@ -15,6 +15,7 @@ struct MiniMode: View {
|
||||
@State private var showSys: Bool = true
|
||||
@State private var showUsr: Bool = true
|
||||
@AppStorage("settings.general.glass") private var glass: Bool = false
|
||||
@AppStorage("settings.general.popover") private var popoverStay: Bool = true
|
||||
@Binding var showPopover: Bool
|
||||
|
||||
|
||||
@@ -25,14 +26,14 @@ struct MiniMode: View {
|
||||
// Main Mini View
|
||||
VStack(spacing: 0) {
|
||||
if appState.currentView == .empty {
|
||||
TopBarMini(search: $search)
|
||||
TopBarMini(search: $search, showPopover: $showPopover)
|
||||
MiniEmptyView(showPopover: $showPopover)
|
||||
} else if appState.currentView == .files {
|
||||
TopBarMini(search: $search)
|
||||
TopBarMini(search: $search, showPopover: $showPopover)
|
||||
FilesView(showPopover: $showPopover, search: $search)
|
||||
.id(appState.appInfo.id)
|
||||
} else if appState.currentView == .apps {
|
||||
TopBarMini(search: $search)
|
||||
TopBarMini(search: $search, showPopover: $showPopover)
|
||||
MiniAppView(search: $search, showPopover: $showPopover)
|
||||
}
|
||||
}
|
||||
@@ -43,7 +44,7 @@ struct MiniMode: View {
|
||||
FilesView(showPopover: $showPopover, search: $search)
|
||||
.id(appState.appInfo.id)
|
||||
}
|
||||
.interactiveDismissDisabled()
|
||||
.interactiveDismissDisabled(popoverStay)
|
||||
.background(
|
||||
Rectangle()
|
||||
.fill(Color("pop"))
|
||||
|
||||
@@ -13,6 +13,7 @@ struct TopBarMini: View {
|
||||
@AppStorage("settings.sentinel.enable") private var sentinel: Bool = false
|
||||
@AppStorage("settings.general.mini") private var mini: Bool = false
|
||||
@Binding var search: String
|
||||
@Binding var showPopover: Bool
|
||||
@EnvironmentObject var appState: AppState
|
||||
|
||||
var body: some View {
|
||||
@@ -56,6 +57,7 @@ struct TopBarMini: View {
|
||||
// updateOnMain {
|
||||
appState.currentView = .empty
|
||||
appState.appInfo = AppInfo.empty
|
||||
showPopover = false
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user