mirror of
https://github.com/exituser/Pearcleaner.git
synced 2026-09-17 07:19:04 +00:00
3.6.4
This commit is contained in:
@@ -67,7 +67,7 @@ var conditions: [Condition] = [
|
||||
),
|
||||
Condition(
|
||||
bundle_id: "orgmozillafirefox",
|
||||
include: ["mozilla"],
|
||||
include: ["mozilla", "firefox"],
|
||||
exclude: []
|
||||
),
|
||||
Condition(
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user