This commit is contained in:
Alin
2024-05-28 17:16:22 -06:00
parent 50038412f1
commit 03ba815454
13 changed files with 57 additions and 53 deletions
+4 -4
View File
@@ -568,8 +568,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 41; APP_BUILD = 43;
APP_VERSION = 3.6.2; APP_VERSION = 3.6.4;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
@@ -638,8 +638,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 41; APP_BUILD = 43;
APP_VERSION = 3.6.2; APP_VERSION = 3.6.4;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+1 -1
View File
@@ -67,7 +67,7 @@ var conditions: [Condition] = [
), ),
Condition( Condition(
bundle_id: "orgmozillafirefox", bundle_id: "orgmozillafirefox",
include: ["mozilla"], include: ["mozilla", "firefox"],
exclude: [] exclude: []
), ),
Condition( Condition(
+2 -1
View File
@@ -95,7 +95,7 @@ struct PearcleanerApp: App {
// Enable menubar item // Enable menubar item
if menubarEnabled { if menubarEnabled {
MenuBarExtraManager.shared.addMenuBarExtra(withView: { MenuBarExtraManager.shared.addMenuBarExtra(withView: {
MiniAppView(search: $search, showPopover: $showPopover) MiniAppView(search: $search, showPopover: $showPopover, isMenuBar: true)
.environmentObject(locations) .environmentObject(locations)
.environmentObject(appState) .environmentObject(appState)
.environmentObject(fsm) .environmentObject(fsm)
@@ -179,6 +179,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
func applicationDidFinishLaunching(_ notification: Notification) { func applicationDidFinishLaunching(_ notification: Notification) {
let menubarEnabled = UserDefaults.standard.bool(forKey: "settings.menubar.enabled") let menubarEnabled = UserDefaults.standard.bool(forKey: "settings.menubar.enabled")
// UserDefaults.standard.register(defaults: ["NSQuitAlwaysKeepsWindows" : false]) // UserDefaults.standard.register(defaults: ["NSQuitAlwaysKeepsWindows" : false])
findAndSetWindowFrame(named: ["Pearcleaner"], windowSettings: windowSettings) findAndSetWindowFrame(named: ["Pearcleaner"], windowSettings: windowSettings)
if UserDefaults.standard.object(forKey: "themeColor") == nil { if UserDefaults.standard.object(forKey: "themeColor") == nil {
+1 -1
View File
@@ -425,7 +425,7 @@ struct InterfaceSettingsTab: View {
.onChange(of: menubarEnabled) { newVal in .onChange(of: menubarEnabled) { newVal in
if newVal { if newVal {
MenuBarExtraManager.shared.addMenuBarExtra(withView: { MenuBarExtraManager.shared.addMenuBarExtra(withView: {
MiniAppView(search: $search, showPopover: $showPopover) MiniAppView(search: $search, showPopover: $showPopover, isMenuBar: true)
.environmentObject(locations) .environmentObject(locations)
.environmentObject(appState) .environmentObject(appState)
.environmentObject(fsm) .environmentObject(fsm)
+25 -7
View File
@@ -21,12 +21,13 @@ struct AppSearchView: View {
@State private var showMenu = false @State private var showMenu = false
@State private var showSys: Bool = true @State private var showSys: Bool = true
@State private var showUsr: Bool = true @State private var showUsr: Bool = true
@Binding var isMenuBar: Bool
var body: some View { var body: some View {
VStack(alignment: .center, spacing: 0) { VStack(alignment: .center, spacing: 0) {
Spacer() Spacer()
.frame(height: 10) .frame(height: 10)
.padding(.top, !menubarEnabled ? 25 : 0) .padding(.top, !isMenuBar ? 25 : 0)
if appState.updateAvailable { if appState.updateAvailable {
UpdateNotificationView(appState: appState) UpdateNotificationView(appState: appState)
@@ -40,13 +41,30 @@ struct AppSearchView: View {
Divider() Divider()
#if DEBUG
Rectangle()
.fill(.orange)
.frame(height: 2)
#endif
HStack(spacing: 10) { HStack(spacing: 10) {
#if DEBUG if search.isEmpty {
Image(systemName: "ant.fill") Button("Refresh") {
.foregroundStyle(.orange) withAnimation {
.help("DEBUG") // Refresh Apps list
#endif appState.reload.toggle()
showPopover = false
let sortedApps = getSortedApps(paths: fsm.folderPaths, appState: appState)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
appState.sortedApps = sortedApps
appState.reload.toggle()
}
}
}
.buttonStyle(SimpleButtonStyle(icon: "arrow.uturn.backward.circle", help: "Refresh apps (⌘+R)", size: 16))
}
SearchBar(search: $search, darker: (mini || menubarEnabled) ? false : true, glass: glass) SearchBar(search: $search, darker: (mini || menubarEnabled) ? false : true, glass: glass)
@@ -55,7 +73,7 @@ struct AppSearchView: View {
Button("More") { Button("More") {
self.showMenu.toggle() self.showMenu.toggle()
} }
.buttonStyle(SimpleButtonStyle(icon: "ellipsis.circle", help: "More", rotate: true)) .buttonStyle(SimpleButtonStyle(icon: "ellipsis.circle", help: "More", size: 16, rotate: true))
.popover(isPresented: $showMenu) { .popover(isPresented: $showMenu) {
VStack(alignment: .leading) { VStack(alignment: .leading) {
+1 -26
View File
@@ -62,7 +62,7 @@ struct SectionView: View {
struct Header: View { struct Header: View {
let title: String let title: String
let count: Int let count: Int
@State private var hovered = false // @State private var hovered = false
@EnvironmentObject var appState: AppState @EnvironmentObject var appState: AppState
@EnvironmentObject var locations: Locations @EnvironmentObject var locations: Locations
@EnvironmentObject var fsm: FolderSettingsManager @EnvironmentObject var fsm: FolderSettingsManager
@@ -84,33 +84,8 @@ struct Header: View {
Spacer() Spacer()
if hovered {
Text("REFRESH")
.font(.system(size: 10))
.monospaced()
.foregroundStyle(Color("mode").opacity(0.8))
}
}
.onHover { hovering in
withAnimation() {
hovered = hovering
}
}
.onTapGesture {
withAnimation {
// Refresh Apps list
appState.reload.toggle()
showPopover = false
let sortedApps = getSortedApps(paths: fsm.folderPaths, appState: appState)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
appState.sortedApps = sortedApps
appState.reload.toggle()
}
}
} }
.frame(minHeight: 20) .frame(minHeight: 20)
.help("Click header or ⌘+R to refresh apps list")
.padding(5) .padding(5)
} }
} }
+12
View File
@@ -303,6 +303,18 @@ struct FilesView: View {
// Remove app from app list if main app bundle is removed for regular and wrapped apps // Remove app from app list if main app bundle is removed for regular and wrapped apps
if (appState.appInfo.wrapped && selectedItemsArray.contains(where: { $0.absoluteString == appState.appInfo.path.deletingLastPathComponent().deletingLastPathComponent().absoluteString })) || if (appState.appInfo.wrapped && selectedItemsArray.contains(where: { $0.absoluteString == appState.appInfo.path.deletingLastPathComponent().deletingLastPathComponent().absoluteString })) ||
(!appState.appInfo.wrapped && selectedItemsArray.contains(where: { $0.absoluteString == appState.appInfo.path.absoluteString })) { (!appState.appInfo.wrapped && selectedItemsArray.contains(where: { $0.absoluteString == appState.appInfo.path.absoluteString })) {
// Change view back to empty/apps if main app bundle is removed
updateOnMain {
search = ""
withAnimation {
if mini || menubarEnabled {
appState.currentView = .apps
showPopover = false
} else {
appState.currentView = .empty
}
}
}
// Match found, remove the app // Match found, remove the app
removeApp(appState: appState, withPath: appState.appInfo.path) removeApp(appState: appState, withPath: appState.appInfo.path)
} else { } else {
+2 -1
View File
@@ -152,6 +152,7 @@ struct MiniAppView: View {
@AppStorage("settings.general.sidebarWidth") private var sidebarWidth: Double = 280 @AppStorage("settings.general.sidebarWidth") private var sidebarWidth: Double = 280
@Binding var showPopover: Bool @Binding var showPopover: Bool
@State private var showMenu = false @State private var showMenu = false
@State var isMenuBar: Bool = false
var body: some View { var body: some View {
@@ -166,7 +167,7 @@ struct MiniAppView: View {
} }
.padding(.vertical) .padding(.vertical)
} else { } else {
AppSearchView(glass: glass, sidebarWidth: sidebarWidth, menubarEnabled: menubarEnabled, mini: mini, search: $search, showPopover: $showPopover) AppSearchView(glass: glass, sidebarWidth: sidebarWidth, menubarEnabled: menubarEnabled, mini: mini, search: $search, showPopover: $showPopover, isMenuBar: $isMenuBar)
} }
} }
+2 -2
View File
@@ -21,7 +21,7 @@ struct RegularMode: View {
@State private var showUsr: Bool = true @State private var showUsr: Bool = true
@Binding var showPopover: Bool @Binding var showPopover: Bool
@State private var showMenu = false @State private var showMenu = false
@State var isMenuBar: Bool = false
var body: some View { var body: some View {
@@ -39,7 +39,7 @@ struct RegularMode: View {
.frame(width: sidebarWidth) .frame(width: sidebarWidth)
.padding(.vertical) .padding(.vertical)
} else { } else {
AppSearchView(glass: glass, sidebarWidth: sidebarWidth, menubarEnabled: menubarEnabled, mini: mini, search: $search, showPopover: $showPopover) AppSearchView(glass: glass, sidebarWidth: sidebarWidth, menubarEnabled: menubarEnabled, mini: mini, search: $search, showPopover: $showPopover, isMenuBar: $isMenuBar)
.frame(width: sidebarWidth) .frame(width: sidebarWidth)
} }
+1 -1
View File
@@ -45,7 +45,7 @@ struct FeatureView: View {
}) { }) {
Text("Okay") Text("Okay")
} }
.buttonStyle(SimpleButtonBrightStyle(icon: "checkmark.circle", label: "Ok", help: "Ok", color: .accentColor)) .buttonStyle(SimpleButtonBrightStyle(icon: "checkmark.circle", label: "Ok", help: "Ok", color: Color("mode")))
} }
.padding(.bottom) .padding(.bottom)
+1 -1
View File
@@ -97,7 +97,7 @@ struct PermView: View {
if #available(macOS 14.0, *) { if #available(macOS 14.0, *) {
SettingsLink {} SettingsLink {}
.buttonStyle(SimpleButtonBrightStyle(icon: "gear", label: "Settings", help: "Check permissions in Settings", color: .accentColor)) .buttonStyle(SimpleButtonBrightStyle(icon: "gear", label: "Settings", help: "Check permissions in Settings", color: Color("mode")))
} else { } else {
Button("Settings") { Button("Settings") {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: NSApp.delegate, from: nil) NSApp.sendAction(Selector(("showPreferencesWindow:")), to: NSApp.delegate, from: nil)
+5 -5
View File
@@ -56,7 +56,7 @@ struct UpdateView: View {
if !isAppInCorrectDirectory { if !isAppInCorrectDirectory {
Text("To avoid permission issues, please move Pearcleaner to the \(isUserAdmin ? "/Applications" : "\(home)/Applications") folder before updating!") Text("To avoid permission issues, please move Pearcleaner to the \(isUserAdmin ? "/Applications" : "\(home)/Applications") folder before updating!")
.font(.callout) .font(.callout)
.foregroundStyle(Color.accentColor) .foregroundStyle(Color("mode"))
.padding(.horizontal) .padding(.horizontal)
.padding(.top, 0) .padding(.top, 0)
} }
@@ -81,7 +81,7 @@ struct UpdateView: View {
}) { }) {
Text("Update") Text("Update")
} }
.buttonStyle(SimpleButtonBrightStyle(icon: "arrow.down.circle", label: "Update", help: "Update", color: .accentColor)) .buttonStyle(SimpleButtonBrightStyle(icon: "arrow.down.circle", label: "Update", help: "Update", color: Color("mode")))
} else { } else {
Button(action: { Button(action: {
NewWin.close() NewWin.close()
@@ -89,7 +89,7 @@ struct UpdateView: View {
}) { }) {
Text("Restart") Text("Restart")
} }
.buttonStyle(SimpleButtonBrightStyle(icon: "arrow.uturn.left.circle", label: "Restart", help: "Restart", color: .accentColor)) .buttonStyle(SimpleButtonBrightStyle(icon: "arrow.uturn.left.circle", label: "Restart", help: "Restart", color: Color("mode")))
} }
} }
@@ -185,7 +185,7 @@ struct NoUpdateView: View {
}) { }) {
Text("Okay") Text("Okay")
} }
.buttonStyle(SimpleButtonBrightStyle(icon: "checkmark.circle", label: "Ok", help: "Ok", color: .accentColor)) .buttonStyle(SimpleButtonBrightStyle(icon: "checkmark.circle", label: "Ok", help: "Ok", color: Color("mode")))
} }
@@ -197,7 +197,7 @@ struct NoUpdateView: View {
}) { }) {
Text("Restart") Text("Restart")
} }
.buttonStyle(SimpleButtonBrightStyle(icon: "arrow.uturn.left.circle", label: "Restart", help: "Restart", color: .accentColor)) .buttonStyle(SimpleButtonBrightStyle(icon: "arrow.uturn.left.circle", label: "Restart", help: "Restart", color: Color("mode")))
} }
} }
.padding(.bottom) .padding(.bottom)
-3
View File
@@ -67,9 +67,6 @@ func checkApp(file: String) {
// --- Trash Relationship --- // --- Trash Relationship ---
extension FileManager { extension FileManager {
public func isInTrash(_ file: URL) -> Bool { public func isInTrash(_ file: URL) -> Bool {