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;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 41;
APP_VERSION = 3.6.2;
APP_BUILD = 43;
APP_VERSION = 3.6.4;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
@@ -638,8 +638,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 41;
APP_VERSION = 3.6.2;
APP_BUILD = 43;
APP_VERSION = 3.6.4;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+1 -1
View File
@@ -67,7 +67,7 @@ var conditions: [Condition] = [
),
Condition(
bundle_id: "orgmozillafirefox",
include: ["mozilla"],
include: ["mozilla", "firefox"],
exclude: []
),
Condition(
+2 -1
View File
@@ -95,7 +95,7 @@ struct PearcleanerApp: App {
// Enable menubar item
if menubarEnabled {
MenuBarExtraManager.shared.addMenuBarExtra(withView: {
MiniAppView(search: $search, showPopover: $showPopover)
MiniAppView(search: $search, showPopover: $showPopover, isMenuBar: true)
.environmentObject(locations)
.environmentObject(appState)
.environmentObject(fsm)
@@ -179,6 +179,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
let menubarEnabled = UserDefaults.standard.bool(forKey: "settings.menubar.enabled")
// UserDefaults.standard.register(defaults: ["NSQuitAlwaysKeepsWindows" : false])
findAndSetWindowFrame(named: ["Pearcleaner"], windowSettings: windowSettings)
if UserDefaults.standard.object(forKey: "themeColor") == nil {
+1 -1
View File
@@ -425,7 +425,7 @@ struct InterfaceSettingsTab: View {
.onChange(of: menubarEnabled) { newVal in
if newVal {
MenuBarExtraManager.shared.addMenuBarExtra(withView: {
MiniAppView(search: $search, showPopover: $showPopover)
MiniAppView(search: $search, showPopover: $showPopover, isMenuBar: true)
.environmentObject(locations)
.environmentObject(appState)
.environmentObject(fsm)
+25 -7
View File
@@ -21,12 +21,13 @@ struct AppSearchView: View {
@State private var showMenu = false
@State private var showSys: Bool = true
@State private var showUsr: Bool = true
@Binding var isMenuBar: Bool
var body: some View {
VStack(alignment: .center, spacing: 0) {
Spacer()
.frame(height: 10)
.padding(.top, !menubarEnabled ? 25 : 0)
.padding(.top, !isMenuBar ? 25 : 0)
if appState.updateAvailable {
UpdateNotificationView(appState: appState)
@@ -40,13 +41,30 @@ struct AppSearchView: View {
Divider()
#if DEBUG
Rectangle()
.fill(.orange)
.frame(height: 2)
#endif
HStack(spacing: 10) {
#if DEBUG
Image(systemName: "ant.fill")
.foregroundStyle(.orange)
.help("DEBUG")
#endif
if search.isEmpty {
Button("Refresh") {
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()
}
}
}
.buttonStyle(SimpleButtonStyle(icon: "arrow.uturn.backward.circle", help: "Refresh apps (⌘+R)", size: 16))
}
SearchBar(search: $search, darker: (mini || menubarEnabled) ? false : true, glass: glass)
@@ -55,7 +73,7 @@ struct AppSearchView: View {
Button("More") {
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) {
VStack(alignment: .leading) {
+1 -26
View File
@@ -62,7 +62,7 @@ struct SectionView: View {
struct Header: View {
let title: String
let count: Int
@State private var hovered = false
// @State private var hovered = false
@EnvironmentObject var appState: AppState
@EnvironmentObject var locations: Locations
@EnvironmentObject var fsm: FolderSettingsManager
@@ -84,33 +84,8 @@ struct Header: View {
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)
.help("Click header or ⌘+R to refresh apps list")
.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
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 })) {
// 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
removeApp(appState: appState, withPath: appState.appInfo.path)
} else {
+2 -1
View File
@@ -152,6 +152,7 @@ struct MiniAppView: View {
@AppStorage("settings.general.sidebarWidth") private var sidebarWidth: Double = 280
@Binding var showPopover: Bool
@State private var showMenu = false
@State var isMenuBar: Bool = false
var body: some View {
@@ -166,7 +167,7 @@ struct MiniAppView: View {
}
.padding(.vertical)
} 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
@Binding var showPopover: Bool
@State private var showMenu = false
@State var isMenuBar: Bool = false
var body: some View {
@@ -39,7 +39,7 @@ struct RegularMode: View {
.frame(width: sidebarWidth)
.padding(.vertical)
} 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)
}
+1 -1
View File
@@ -45,7 +45,7 @@ struct FeatureView: View {
}) {
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)
+1 -1
View File
@@ -97,7 +97,7 @@ struct PermView: View {
if #available(macOS 14.0, *) {
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 {
Button("Settings") {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: NSApp.delegate, from: nil)
+5 -5
View File
@@ -56,7 +56,7 @@ struct UpdateView: View {
if !isAppInCorrectDirectory {
Text("To avoid permission issues, please move Pearcleaner to the \(isUserAdmin ? "/Applications" : "\(home)/Applications") folder before updating!")
.font(.callout)
.foregroundStyle(Color.accentColor)
.foregroundStyle(Color("mode"))
.padding(.horizontal)
.padding(.top, 0)
}
@@ -81,7 +81,7 @@ struct UpdateView: View {
}) {
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 {
Button(action: {
NewWin.close()
@@ -89,7 +89,7 @@ struct UpdateView: View {
}) {
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")
}
.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")
}
.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)
-3
View File
@@ -67,9 +67,6 @@ func checkApp(file: String) {
// --- Trash Relationship ---
extension FileManager {
public func isInTrash(_ file: URL) -> Bool {