From 8dc9ee6cf2d6b9c061ef6dc16d41564b36e45012 Mon Sep 17 00:00:00 2001 From: Alin Date: Sat, 16 Mar 2024 18:52:24 -0600 Subject: [PATCH] v3.2.0 --- Pearcleaner.xcodeproj/project.pbxproj | 12 ++ Pearcleaner/Logic/AppState.swift | 2 + Pearcleaner/Logic/MenuBarItem.swift | 60 ++++++++++ Pearcleaner/Logic/WindowSettings.swift | 18 +++ Pearcleaner/PearcleanerApp.swift | 41 ++++++- Pearcleaner/Settings/General.swift | 14 +-- Pearcleaner/Settings/MenuBar.swift | 112 ++++++++++++++++++ Pearcleaner/Settings/SettingsWindow.swift | 15 ++- Pearcleaner/Views/MenuBarMiniAppView.swift | 130 +++++++++++++++++++++ Pearcleaner/Views/MiniMode.swift | 1 + Pearcleaner/Views/RegularMode.swift | 1 + Pearcleaner/Views/TopBarMini.swift | 4 +- 12 files changed, 390 insertions(+), 20 deletions(-) create mode 100644 Pearcleaner/Logic/MenuBarItem.swift create mode 100644 Pearcleaner/Settings/MenuBar.swift create mode 100644 Pearcleaner/Views/MenuBarMiniAppView.swift diff --git a/Pearcleaner.xcodeproj/project.pbxproj b/Pearcleaner.xcodeproj/project.pbxproj index a79a2cc..365627a 100644 --- a/Pearcleaner.xcodeproj/project.pbxproj +++ b/Pearcleaner.xcodeproj/project.pbxproj @@ -37,6 +37,9 @@ C7D31D4A2AFEB26700C7ED9E /* AppListItems.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D31D492AFEB26700C7ED9E /* AppListItems.swift */; }; C7D31D512AFF00F300C7ED9E /* Locations.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D31D502AFF00F300C7ED9E /* Locations.swift */; }; C7DC1FEE2B9F7D3D009AC317 /* features.json in Resources */ = {isa = PBXBuildFile; fileRef = C7DC1FED2B9F7D3D009AC317 /* features.json */; }; + C7DE67272BA61E8D00EB1633 /* MenuBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7DE67262BA61E8D00EB1633 /* MenuBar.swift */; }; + C7DE672B2BA6343D00EB1633 /* MenuBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7DE672A2BA6343D00EB1633 /* MenuBarItem.swift */; }; + C7DE672D2BA6356500EB1633 /* MenuBarMiniAppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7DE672C2BA6356500EB1633 /* MenuBarMiniAppView.swift */; }; C7F539382AF60865007DF1B2 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F539372AF60865007DF1B2 /* Utilities.swift */; }; C7FB173B2B96321300B96F9A /* AppsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7FB173A2B96321300B96F9A /* AppsListView.swift */; }; /* End PBXBuildFile section */ @@ -97,6 +100,9 @@ C7D31D492AFEB26700C7ED9E /* AppListItems.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppListItems.swift; sourceTree = ""; }; C7D31D502AFF00F300C7ED9E /* Locations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Locations.swift; sourceTree = ""; }; C7DC1FED2B9F7D3D009AC317 /* features.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = features.json; sourceTree = SOURCE_ROOT; }; + C7DE67262BA61E8D00EB1633 /* MenuBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBar.swift; sourceTree = ""; }; + C7DE672A2BA6343D00EB1633 /* MenuBarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarItem.swift; sourceTree = ""; }; + C7DE672C2BA6356500EB1633 /* MenuBarMiniAppView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarMiniAppView.swift; sourceTree = ""; }; C7F539372AF60865007DF1B2 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; }; C7FB173A2B96321300B96F9A /* AppsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppsListView.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -134,6 +140,7 @@ isa = PBXGroup; children = ( C77B90192AF1938F009CC655 /* Logic.swift */, + C7DE672A2BA6343D00EB1633 /* MenuBarItem.swift */, C77B90172AF19382009CC655 /* AppCommands.swift */, C77B90152AF19377009CC655 /* AppState.swift */, C7F539372AF60865007DF1B2 /* Utilities.swift */, @@ -168,6 +175,7 @@ children = ( C77B901D2AF1A9DB009CC655 /* SettingsWindow.swift */, C76D08492AF83C6E00D07867 /* General.swift */, + C7DE67262BA61E8D00EB1633 /* MenuBar.swift */, C76D08472AF83C3F00D07867 /* Update.swift */, C76D08502AF850F300D07867 /* About.swift */, ); @@ -229,6 +237,7 @@ C7045A272B03E71D00376976 /* MiniMode.swift */, C71848432B8D2D600046CB13 /* ZombieView.swift */, C7FB173A2B96321300B96F9A /* AppsListView.swift */, + C7DE672C2BA6356500EB1633 /* MenuBarMiniAppView.swift */, ); path = Views; sourceTree = ""; @@ -347,6 +356,7 @@ C7045A342B068B2900376976 /* UpdateView.swift in Sources */, C77B90162AF19377009CC655 /* AppState.swift in Sources */, C7045A322B068AD700376976 /* NewWin.swift in Sources */, + C7DE672D2BA6356500EB1633 /* MenuBarMiniAppView.swift in Sources */, C7D31D512AFF00F300C7ED9E /* Locations.swift in Sources */, C77B901A2AF1938F009CC655 /* Logic.swift in Sources */, C7045A2A2B03FAF000376976 /* TopBarMini.swift in Sources */, @@ -354,6 +364,7 @@ C7045A282B03E71D00376976 /* MiniMode.swift in Sources */, C72893052AFD42E600C8C1CD /* DeepLink.swift in Sources */, C71848442B8D2D600046CB13 /* ZombieView.swift in Sources */, + C7DE672B2BA6343D00EB1633 /* MenuBarItem.swift in Sources */, C76D084A2AF83C6E00D07867 /* General.swift in Sources */, C77B90042AF18E2E009CC655 /* PearcleanerApp.swift in Sources */, C7045A362B068DD700376976 /* PermView.swift in Sources */, @@ -367,6 +378,7 @@ C76D08552AF89CDE00D07867 /* RegularMode.swift in Sources */, C7A9CE472B89164700EB6E78 /* Authorization.swift in Sources */, C7CF47242B3B3F1700979C5F /* WindowSettings.swift in Sources */, + C7DE67272BA61E8D00EB1633 /* MenuBar.swift in Sources */, C77B90232AF2D616009CC655 /* FilesView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Pearcleaner/Logic/AppState.swift b/Pearcleaner/Logic/AppState.swift index da6bb4b..bed5c96 100644 --- a/Pearcleaner/Logic/AppState.swift +++ b/Pearcleaner/Logic/AppState.swift @@ -105,6 +105,7 @@ struct ZombieFile: Identifiable, Equatable, Hashable { enum CurrentTabView:Int { case general + case menubar // case permissions // case sentinel case update @@ -113,6 +114,7 @@ enum CurrentTabView:Int var title: String { switch self { case .general: return "General" + case .menubar: return "MenuBar" // case .permissions: return "Permissions" // case .sentinel: return "Sentinel" case .update: return "Update" diff --git a/Pearcleaner/Logic/MenuBarItem.swift b/Pearcleaner/Logic/MenuBarItem.swift new file mode 100644 index 0000000..b43bd4a --- /dev/null +++ b/Pearcleaner/Logic/MenuBarItem.swift @@ -0,0 +1,60 @@ +// +// MenuBarItem.swift +// Pearcleaner +// +// Created by Alin Lupascu on 3/16/24. +// + +import AppKit +import SwiftUI + +class MenuBarExtraManager { + static let shared = MenuBarExtraManager() + private var statusItem: NSStatusItem? + private var popover = NSPopover() + + func addMenuBarExtra(withView view: @escaping () -> V) { + guard statusItem == nil else { return } + + // Initialize the status item + statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) + + // Set up the status item's button + if let button = statusItem?.button { + button.image = NSImage(systemSymbolName: "menubar.rectangle", accessibilityDescription: "Pearcleaner") + button.action = #selector(togglePopover(_:)) + button.target = self + } + + // Set up the popover + popover.contentSize = NSSize(width: 300, height: 370) + popover.behavior = .transient + popover.contentViewController = NSHostingController(rootView: view()) + } + + + func removeMenuBarExtra() { + if let item = statusItem { + NSStatusBar.system.removeStatusItem(item) + statusItem = nil + } + } + + func getStatus() -> Bool { + if let item = statusItem { + return true + } else { + return false + } + } + + @objc func togglePopover(_ sender: AnyObject?) { + if let button = statusItem?.button { + if popover.isShown { + popover.performClose(sender) + } else { + popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) + } + } + } +} diff --git a/Pearcleaner/Logic/WindowSettings.swift b/Pearcleaner/Logic/WindowSettings.swift index b2a13b5..03ddeba 100644 --- a/Pearcleaner/Logic/WindowSettings.swift +++ b/Pearcleaner/Logic/WindowSettings.swift @@ -15,6 +15,7 @@ class WindowSettings { private let windowXKey = "windowXKey" private let windowYKey = "windowYKey" @AppStorage("settings.general.mini") private var mini: Bool = false + var window: NSWindow? func saveWindowSettings(frame: NSRect) { @@ -32,4 +33,21 @@ class WindowSettings { let y = CGFloat(UserDefaults.standard.float(forKey: windowYKey)) return NSRect(x: x, y: y, width: width, height: height) } + + func newWindow(withView view: @escaping () -> V) { + let contentView = view + let frame = self.loadWindowSettings() + // Create the window and set the content view + let newWindow = NSWindow( + contentRect: frame, + styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], + backing: .buffered, defer: false) + newWindow.titlebarAppearsTransparent = true + newWindow.isMovableByWindowBackground = true + newWindow.center() + newWindow.setFrameAutosaveName("Main Window") + newWindow.contentView = NSHostingView(rootView: contentView()) + self.window = newWindow + newWindow.makeKeyAndOrderFront(nil) + } } diff --git a/Pearcleaner/PearcleanerApp.swift b/Pearcleaner/PearcleanerApp.swift index c87372e..a664426 100644 --- a/Pearcleaner/PearcleanerApp.swift +++ b/Pearcleaner/PearcleanerApp.swift @@ -7,6 +7,7 @@ import SwiftUI import AppKit +import ServiceManagement @main struct PearcleanerApp: App { @@ -24,10 +25,15 @@ struct PearcleanerApp: App { @AppStorage("settings.general.instant") private var instantSearch: Bool = true @AppStorage("settings.general.features") private var features: String = "" @AppStorage("settings.general.brew") private var brew: Bool = false + @AppStorage("settings.menubar.enabled") private var menubarEnabled: Bool = false + @AppStorage("settings.menubar.mainWin") private var mainWinEnabled: Bool = false + @State private var search = "" @State private var showPopover: Bool = false @State private var showFeature: Bool = false + + var body: some Scene { WindowGroup { @@ -100,6 +106,15 @@ struct PearcleanerApp: App { loadAllPaths(allApps: sortedApps, appState: appState, locations: locations) } + if menubarEnabled { + MenuBarExtraManager.shared.addMenuBarExtra { + MenuBarMiniAppView(search: $search, showPopover: $showPopover) + .environmentObject(locations) + .environmentObject(appState) + } + } + + #if !DEBUG Task { @@ -135,6 +150,7 @@ struct PearcleanerApp: App { #endif } } + .windowStyle(.hiddenTitleBar) .windowResizability(.contentMinSize) .commands { @@ -143,10 +159,13 @@ struct PearcleanerApp: App { } + + Settings { - SettingsView(showPopover: $showPopover, showFeature: $showFeature) + SettingsView(showPopover: $showPopover, search: $search, showFeature: $showFeature) .environmentObject(appState) + .environmentObject(locations) .toolbarBackground(.clear) .preferredColorScheme(displayMode.colorScheme) } @@ -157,14 +176,24 @@ struct PearcleanerApp: App { class AppDelegate: NSObject, NSApplicationDelegate { + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { - return true + let menubarEnabled = UserDefaults.standard.bool(forKey: "settings.menubar.enabled") + return !menubarEnabled } -// func applicationDidFinishLaunching(_ notification: Notification, win: WindowSettings) { -// let frame = win.loadWindowSettings() -// NSApplication.shared.windows.first?.setFrame(frame, display: true) -// } + + func applicationDidFinishLaunching(_ notification: Notification) { + let menubarEnabled = UserDefaults.standard.bool(forKey: "settings.menubar.enabled") + +#if !DEBUG + if menubarEnabled { + NSApp.windows.first?.close() + NSApplication.shared.setActivationPolicy(.accessory) + } +#endif + + } } diff --git a/Pearcleaner/Settings/General.swift b/Pearcleaner/Settings/General.swift index 57783fe..b9afcf0 100644 --- a/Pearcleaner/Settings/General.swift +++ b/Pearcleaner/Settings/General.swift @@ -7,9 +7,11 @@ import Foundation import SwiftUI +import ServiceManagement struct GeneralSettingsTab: View { @EnvironmentObject var appState: AppState + @EnvironmentObject var locations: Locations @State private var windowSettings = WindowSettings() @AppStorage("settings.general.glass") private var glass: Bool = true @AppStorage("settings.general.mini") private var mini: Bool = false @@ -26,6 +28,7 @@ struct GeneralSettingsTab: View { @State private var accessStatus: Bool = false private let themes = ["Auto", "Dark", "Light"] @Binding var showPopover: Bool + @Binding var search: String var body: some View { Form { @@ -148,7 +151,7 @@ struct GeneralSettingsTab: View { .padding(5) .padding(.leading) - // ========================================================================================================= + // === Mini ================================================================================================= Divider() .padding() @@ -247,7 +250,7 @@ struct GeneralSettingsTab: View { .padding(.leading) - // ========================================================================================================= + // === Perms ================================================================================================ Divider() @@ -312,7 +315,7 @@ struct GeneralSettingsTab: View { .padding(.leading) - // ========================================================================================================= + // === Sentinel ============================================================================================= Divider() .padding() @@ -362,11 +365,6 @@ struct GeneralSettingsTab: View { .onAppear { diskStatus = checkAndRequestFullDiskAccess(appState: appState, skipAlert: true) accessStatus = checkAndRequestAccessibilityAccess(appState: appState) -// if displayMode.colorScheme == .dark { -// selectedTheme = "Dark" -// } else if displayMode.colorScheme == .light { -// selectedTheme = "Light" -// } } } diff --git a/Pearcleaner/Settings/MenuBar.swift b/Pearcleaner/Settings/MenuBar.swift new file mode 100644 index 0000000..eb43329 --- /dev/null +++ b/Pearcleaner/Settings/MenuBar.swift @@ -0,0 +1,112 @@ +// +// MenuBar.swift +// Pearcleaner +// +// Created by Alin Lupascu on 3/16/24. +// +import Foundation +import SwiftUI +import ServiceManagement + +struct MenuBarSettingsTab: View { + @EnvironmentObject var appState: AppState + @EnvironmentObject var locations: Locations + @AppStorage("settings.menubar.enabled") private var menubarEnabled: Bool = false + @State private var isLaunchAtLoginEnabled: Bool = false + + @Binding var showPopover: Bool + @Binding var search: String + + var body: some View { + Form { + VStack { + + HStack() { + Text("Configuration").font(.title2) + Spacer() + } + .padding(.leading) + + + HStack(spacing: 0) { + Image(systemName: "menubar.rectangle") + .resizable() + .scaledToFit() + .frame(width: 20, height: 20) + .padding(.trailing) + .foregroundStyle(.gray) + VStack(alignment: .leading, spacing: 5) { + Text("\(menubarEnabled ? "Menubar icon enabled" : "Menubar icon disabled")") + .font(.callout) + .foregroundStyle(.gray) + } + Spacer() + Toggle(isOn: $menubarEnabled, label: { + }) + .toggleStyle(.switch) + .onChange(of: menubarEnabled) { newVal in + if newVal { + MenuBarExtraManager.shared.addMenuBarExtra { + MenuBarMiniAppView(search: $search, showPopover: $showPopover) + .environmentObject(locations) + .environmentObject(appState) + } + } else { + MenuBarExtraManager.shared.removeMenuBarExtra() + } + } + + } + .padding(5) + .padding(.leading) + + + HStack(spacing: 0) { + Image(systemName: isLaunchAtLoginEnabled ? "person.crop.circle.badge.checkmark" : "person.crop.circle") + .resizable() + .scaledToFit() + .frame(width: 20, height: 20) + .padding(.trailing) + .foregroundStyle(.gray) + VStack(alignment: .leading, spacing: 5) { + Text("\(isLaunchAtLoginEnabled ? "Launch at login enabled" : "Launch at login disabled")") + .font(.callout) + .foregroundStyle(.gray) + } + Spacer() + Toggle(isOn: $isLaunchAtLoginEnabled, label: { + }) + .toggleStyle(.switch) + .onAppear { + isLaunchAtLoginEnabled = SMAppService.mainApp.status == .enabled + } + .onChange(of: isLaunchAtLoginEnabled) { newValue in + do { + if newValue { + if SMAppService.mainApp.status == .enabled { + try? SMAppService.mainApp.unregister() + } + + try SMAppService.mainApp.register() + } else { + try SMAppService.mainApp.unregister() + } + } catch { + printOS("Failed to \(newValue ? "enable" : "disable") launch at login: \(error.localizedDescription)") + } + } + + } + .padding(5) + .padding(.leading) + + Spacer() + } + + } + .padding(20) + .frame(width: 500, height: 690) + + } + +} diff --git a/Pearcleaner/Settings/SettingsWindow.swift b/Pearcleaner/Settings/SettingsWindow.swift index 6522a5f..5b3e1ab 100644 --- a/Pearcleaner/Settings/SettingsWindow.swift +++ b/Pearcleaner/Settings/SettingsWindow.swift @@ -10,30 +10,37 @@ import SwiftUI struct SettingsView: View { @EnvironmentObject var appState: AppState @Binding var showPopover: Bool + @Binding var search: String @Binding var showFeature: Bool @AppStorage("settings.general.glass") private var glass: Bool = true var body: some View { TabView() { - GeneralSettingsTab(showPopover: $showPopover) + GeneralSettingsTab(showPopover: $showPopover, search: $search) .tabItem { Label(CurrentTabView.general.title, systemImage: "gear") } .tag(CurrentTabView.general) - + + MenuBarSettingsTab(showPopover: $showPopover, search: $search) + .tabItem { + Label(CurrentTabView.menubar.title, systemImage: "menubar.rectangle") + } + .tag(CurrentTabView.menubar) + UpdateSettingsTab(showFeature: $showFeature) .tabItem { Label(CurrentTabView.update.title, systemImage: "cloud") } .tag(CurrentTabView.update) - + AboutSettingsTab() .tabItem { Label(CurrentTabView.about.title, systemImage: "info.circle") } .tag(CurrentTabView.about) - + } .background(glass ? GlassEffect(material: .sidebar, blendingMode: .behindWindow).edgesIgnoringSafeArea(.all) : nil) diff --git a/Pearcleaner/Views/MenuBarMiniAppView.swift b/Pearcleaner/Views/MenuBarMiniAppView.swift new file mode 100644 index 0000000..9b5b397 --- /dev/null +++ b/Pearcleaner/Views/MenuBarMiniAppView.swift @@ -0,0 +1,130 @@ +// +// MenuBarAppsListView.swift +// Pearcleaner +// +// Created by Alin Lupascu on 3/16/24. +// + +import Foundation +import SwiftUI + +struct MenuBarMiniAppView: View { + @Environment(\.colorScheme) var colorScheme + @EnvironmentObject var appState: AppState + @EnvironmentObject var locations: Locations + @State private var windowSettings = WindowSettings() + @State private var animateGradient: Bool = false + @Binding var search: String + @State private var showSys: Bool = true + @State private var showUsr: Bool = true + @AppStorage("settings.general.mini") private var mini: Bool = false + @AppStorage("settings.general.instant") private var instantSearch: Bool = true + @AppStorage("settings.general.glass") private var glass: Bool = true + @AppStorage("settings.general.popover") private var popoverStay: Bool = true + @Binding var showPopover: Bool + + var body: some View { + + var filteredApps: [AppInfo] { + if search.isEmpty { + return appState.sortedApps + } else { + return appState.sortedApps.filter { $0.appName.localizedCaseInsensitiveContains(search) } + } + } + + ZStack { + HStack(spacing: 0){ + + if appState.reload { + VStack { + Spacer() + ProgressView(instantSearch ? "Refreshing app list and caching files" : "Refreshing app list") + if instantSearch { + Image(systemName: "bolt.fill") + .resizable() + .scaledToFit() + .foregroundStyle(Color("mode").opacity(0.5)) + .frame(width: 30, height: 30) + .padding() + } + Spacer() + } + .padding(.vertical) + } else { + VStack(alignment: .center) { + + AppsListView(search: $search, showPopover: $showPopover, filteredApps: filteredApps).padding(0) + HStack(spacing: 10) { + if #available(macOS 14.0, *) { + SettingsLink() + .buttonStyle(SimpleButtonStyle(icon: "gear", help: "Settings", color: Color("mode"))) + } else { + Button("Settings") { + NSApp.sendAction(Selector(("showPreferencesWindow:")), to: NSApp.delegate, from: nil) + } + .buttonStyle(SimpleButtonStyle(icon: "gear", help: "Settings", color: Color("mode"))) + } + + SearchBarMiniBottom(search: $search) + + Button("Main") { + windowSettings.newWindow { + MiniMode(search: $search, showPopover: $showPopover) + .environmentObject(locations) + .environmentObject(appState) + } + } + .buttonStyle(SimpleButtonStyle(icon: "macwindow", help: "Show Main Window", color: Color("mode"))) + + Button("Kill") { + NSApp.terminate(nil) + } + .buttonStyle(SimpleButtonStyle(icon: "x.circle.fill", help: "Quit", color: Color("mode"))) + } + .padding(.horizontal) + + } + .padding(.vertical, 5) + .padding(.bottom, 8) + } + + + } + } + .frame(minWidth: 300, minHeight: 370) + .edgesIgnoringSafeArea(.all) + .background( + Group { + if glass { + GlassEffect(material: .sidebar, blendingMode: .behindWindow) + .edgesIgnoringSafeArea(.all) + } else { + Color("pop") + .padding(-80) + } + } + ) + .transition(.opacity) + .popover(isPresented: $showPopover, arrowEdge: .trailing) { + VStack { + if appState.currentView == .files { + FilesView(showPopover: $showPopover, search: $search) + .id(appState.appInfo.id) + } else if appState.currentView == .zombie { + ZombieView(showPopover: $showPopover, search: $search) + .id(appState.appInfo.id) + } + + } + .interactiveDismissDisabled(popoverStay) + .background( + Rectangle() + .fill(Color("pop")) + .padding(-80) + ) + .frame(width: 650, height: 550) + + } + } +} diff --git a/Pearcleaner/Views/MiniMode.swift b/Pearcleaner/Views/MiniMode.swift index 2ccc120..20f19c7 100644 --- a/Pearcleaner/Views/MiniMode.swift +++ b/Pearcleaner/Views/MiniMode.swift @@ -183,6 +183,7 @@ struct MiniAppView: View { if appState.currentView != .empty { SearchBarMiniBottom(search: $search) + .padding(.horizontal) } } .padding(.bottom) diff --git a/Pearcleaner/Views/RegularMode.swift b/Pearcleaner/Views/RegularMode.swift index 5d2e51a..1dbd887 100644 --- a/Pearcleaner/Views/RegularMode.swift +++ b/Pearcleaner/Views/RegularMode.swift @@ -56,6 +56,7 @@ struct RegularMode: View { VStack(alignment: .center, spacing: 20) { HStack { SearchBarMiniBottom(search: $search) + .padding(.horizontal) } } diff --git a/Pearcleaner/Views/TopBarMini.swift b/Pearcleaner/Views/TopBarMini.swift index 14d15e1..2be97f8 100644 --- a/Pearcleaner/Views/TopBarMini.swift +++ b/Pearcleaner/Views/TopBarMini.swift @@ -133,7 +133,7 @@ struct SearchBarMiniBottom: View { TextField(" Search", text: $search) .textFieldStyle(SimpleSearchStyle(trash: true, text: $search)) } - .padding(.horizontal) - .padding(.bottom, 0) +// .padding(.horizontal) +// .padding(.bottom, 0) } }