Skip to content

Commit

Permalink
v3.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
alienator88 committed Jun 4, 2024
1 parent a11c399 commit 1ffa58e
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 111 deletions.
8 changes: 4 additions & 4 deletions Pearcleaner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 43;
APP_VERSION = 3.6.4;
APP_BUILD = 44;
APP_VERSION = 3.6.5;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
Expand Down Expand Up @@ -638,8 +638,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 43;
APP_VERSION = 3.6.4;
APP_BUILD = 44;
APP_VERSION = 3.6.5;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
Expand Down
1 change: 1 addition & 0 deletions Pearcleaner/Logic/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class AppState: ObservableObject {
@Published var permissionsOkay: Bool = true
@Published var permissionResults: PermissionsCheckResults?
@Published var showUninstallAlert: Bool = false
@Published var oneShotMode: Bool = false



Expand Down
14 changes: 13 additions & 1 deletion Pearcleaner/Logic/DeepLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SwiftUI
class DeeplinkManager {
@Binding var showPopover: Bool
@AppStorage("settings.general.mini") private var mini: Bool = false
@AppStorage("settings.general.oneshot") private var oneShotMode: Bool = false

init(showPopover: Binding<Bool>) {
_showPopover = showPopover
Expand All @@ -27,14 +28,19 @@ class DeeplinkManager {
if url.pathExtension == "app" {
handleAppBundle(url: url, appState: appState, locations: locations)
} else if url.scheme == DeepLinkConstants.scheme,
// This handles SentinelMonitor FileWatcher
// This handles SentinelMonitor FileWatcher and FinderOpen extension
url.host == DeepLinkConstants.host,
let components = URLComponents(url: url, resolvingAgainstBaseURL: true),
let queryItems = components.queryItems {
if let path = queryItems.first(where: { $0.name == DeepLinkConstants.query })?.value {
let pathURL = URL(fileURLWithPath: path)
let appInfo = AppInfoFetcher.getAppInfo(atPath: pathURL)
showAppInFiles(appInfo: appInfo!, appState: appState, locations: locations, showPopover: $showPopover)
if oneShotMode {
updateOnMain {
appState.oneShotMode = true
}
}
} else {
printOS("No path query parameter found in the URL")
}
Expand All @@ -47,6 +53,12 @@ class DeeplinkManager {
func handleAppBundle(url: URL, appState: AppState, locations: Locations) {
let appInfo = AppInfoFetcher.getAppInfo(atPath: url)
showAppInFiles(appInfo: appInfo!, appState: appState, locations: locations, showPopover: $showPopover)
// Even if enabled, disable one-shot mode for app drops
if oneShotMode {
updateOnMain {
appState.oneShotMode = false
}
}
}

}
27 changes: 26 additions & 1 deletion Pearcleaner/Settings/General.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct GeneralSettingsTab: View {
@AppStorage("displayMode") var displayMode: DisplayMode = .system
@AppStorage("settings.sentinel.enable") private var sentinel: Bool = false
@AppStorage("settings.general.brew") private var brew: Bool = false
@AppStorage("settings.general.oneshot") private var oneShotMode: Bool = false
@AppStorage("settings.general.selectedSort") var selectedSortAlpha: Bool = true
@AppStorage("settings.general.sizeType") var sizeType: String = "Real"
@State private var diskStatus: Bool = false
Expand Down Expand Up @@ -68,6 +69,30 @@ struct GeneralSettingsTab: View {
.padding(.leading)


HStack(spacing: 0) {
Image(systemName: oneShotMode ? "scope" : "circlebadge")
.resizable()
.scaledToFit()
.frame(width: 20, height: 20)
.padding(.trailing)
.foregroundStyle(Color("mode").opacity(0.5))
VStack(alignment: .leading, spacing: 5) {
Text("\(oneShotMode ? "One-Shot Mode is enabled" : "One-Shot Mode is disabled")")
.font(.callout)
.foregroundStyle(Color("mode").opacity(0.5))
}

InfoButton(text: "When one-shot mode is enabled, clicking the Uninstall button to remove an app will also close Pearcleaner right after. This only affects Pearcleaner when it is opened via external means, like Sentinel Trash Monitor or the Finder extension. This allows for single use of the app, AKA one-shot mode. When Pearcleaner is opened normally, this setting is ignored and will work as usual.")

Spacer()
Toggle(isOn: $oneShotMode, label: {
})
.toggleStyle(.switch)
}
.padding(5)
.padding(.leading)


HStack(spacing: 0) {
Image(systemName: selectedSortAlpha ? "textformat.abc" : "textformat.123")
.resizable()
Expand Down Expand Up @@ -405,7 +430,7 @@ struct GeneralSettingsTab: View {

}
.padding(20)
.frame(width: 500, height: 670)
.frame(width: 500, height: 710)

}

Expand Down
60 changes: 30 additions & 30 deletions Pearcleaner/Settings/Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct InterfaceSettingsTab: View {
@AppStorage("settings.general.dark") var isDark: Bool = true
@AppStorage("settings.general.popover") private var popoverStay: Bool = true
@AppStorage("settings.general.miniview") private var miniView: Bool = true
@AppStorage("settings.general.animateLogo") private var animateLogo: Bool = true
// @AppStorage("settings.general.animateLogo") private var animateLogo: Bool = true
@AppStorage("settings.general.selectedTheme") var selectedTheme: String = "Auto"
@AppStorage("settings.interface.selectedMenubarIcon") var selectedMenubarIcon: String = "pear-4"
@State private var isLaunchAtLoginEnabled: Bool = false
Expand Down Expand Up @@ -76,34 +76,34 @@ struct InterfaceSettingsTab: View {
.padding(.leading)


HStack(spacing: 0) {
Image(systemName: animateLogo ? "play.fill" : "pause")
.resizable()
.scaledToFit()
.frame(width: 20, height: 20)
.padding(.trailing)
.foregroundStyle(Color("mode").opacity(0.5))
VStack(alignment: .leading, spacing: 5) {
Text("\(animateLogo ? "Logo animation enabled" : "Logo animation disabled")")
.font(.callout)
.foregroundStyle(Color("mode").opacity(0.5))

}
if !isMacOS14OrHigher {
Text("(macOS 14+)")
.font(.footnote)
.foregroundStyle(Color("mode").opacity(0.3))
.padding(.leading, 5)
}
// InfoButton(text: "The logo animation is only available in macOS 14 or higher")
Spacer()
Toggle(isOn: $animateLogo, label: {
})
.toggleStyle(.switch)
.disabled(!isMacOS14OrHigher)
}
.padding(5)
.padding(.leading)
// HStack(spacing: 0) {
// Image(systemName: animateLogo ? "play.fill" : "pause")
// .resizable()
// .scaledToFit()
// .frame(width: 20, height: 20)
// .padding(.trailing)
// .foregroundStyle(Color("mode").opacity(0.5))
// VStack(alignment: .leading, spacing: 5) {
// Text("\(animateLogo ? "Logo animation enabled" : "Logo animation disabled")")
// .font(.callout)
// .foregroundStyle(Color("mode").opacity(0.5))
//
// }
// if !isMacOS14OrHigher {
// Text("(macOS 14+)")
// .font(.footnote)
// .foregroundStyle(Color("mode").opacity(0.3))
// .padding(.leading, 5)
// }
//// InfoButton(text: "The logo animation is only available in macOS 14 or higher")
// Spacer()
// Toggle(isOn: $animateLogo, label: {
// })
// .toggleStyle(.switch)
// .disabled(!isMacOS14OrHigher)
// }
// .padding(5)
// .padding(.leading)



Expand Down Expand Up @@ -557,7 +557,7 @@ struct InterfaceSettingsTab: View {

}
.padding(20)
.frame(width: 500, height: 600)
.frame(width: 500, height: 580)

}

Expand Down
8 changes: 8 additions & 0 deletions Pearcleaner/Views/FilesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ struct FilesView: View {
}
// Match found, remove the app
removeApp(appState: appState, withPath: appState.appInfo.path)

if appState.oneShotMode {
NSApp.terminate(nil)
}

} else {
// Add deleted appInfo object to trashed array
appState.trashedFiles.append(appState.appInfo)
Expand All @@ -331,6 +336,9 @@ struct FilesView: View {
appState.appInfo.fileSize = appState.appInfo.fileSize.filter { !appState.selectedItems.contains($0.key) }
// Update the selectedFiles to remove references that are no longer present
appState.selectedItems.removeAll()
if appState.oneShotMode {
NSApp.terminate(nil)
}
}
}
}
Expand Down
115 changes: 63 additions & 52 deletions Pearcleaner/Views/MiniMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,59 +52,70 @@ struct MiniEmptyView: View {
@Environment(\.colorScheme) var colorScheme
@EnvironmentObject var appState: AppState
@EnvironmentObject var locations: Locations
@State private var animateGradient: Bool = false
// @State private var animateGradient: Bool = false
@AppStorage("settings.general.mini") private var mini: Bool = false
@AppStorage("settings.general.animateLogo") private var animateLogo: Bool = true
// @AppStorage("settings.general.animateLogo") private var animateLogo: Bool = true
@Binding var showPopover: Bool
@State private var animationStart = false
// @State private var animationStart = false

var body: some View {
VStack(alignment: .center) {

Spacer()

if #available(macOS 14, *) {
if animateLogo && animationStart {
LinearGradient(gradient: Gradient(colors: [.green, .orange]), startPoint: .leading, endPoint: .trailing)
.mask(
Image(systemName: "plus.square.dashed")
.resizable()
.scaledToFit()
.frame(width: 120, height: 120, alignment: .center)
.padding()
.fontWeight(.ultraLight)
.offset(x: 5, y: 5)
)
.phaseAnimator([false, true]) { wwdc24, chromaRotate in
wwdc24
.hueRotation(.degrees(chromaRotate ? 420 : 0))
} animation: { chromaRotate in
.easeInOut(duration: 6)
}
} else {
LinearGradient(gradient: Gradient(colors: [.green, .orange]), startPoint: .leading, endPoint: .trailing)
.mask(
Image(systemName: "plus.square.dashed")
.resizable()
.scaledToFit()
.frame(width: 120, height: 120, alignment: .center)
.padding()
.fontWeight(.ultraLight)
.offset(x: 5, y: 5)
)
}
} else {
LinearGradient(gradient: Gradient(colors: [.green, .orange]), startPoint: .leading, endPoint: .trailing)
.mask(
Image(systemName: "plus.square.dashed")
.resizable()
.scaledToFit()
.frame(width: 120, height: 120, alignment: .center)
.padding()
.fontWeight(.ultraLight)
.offset(x: 5, y: 5)
)
}

LinearGradient(gradient: Gradient(colors: [.green, .orange]), startPoint: .leading, endPoint: .trailing)
.mask(
Image(systemName: "plus.square.dashed")
.resizable()
.scaledToFit()
.frame(width: 120, height: 120, alignment: .center)
.padding()
.fontWeight(.ultraLight)
.offset(x: 5, y: 5)
)

// if #available(macOS 14, *) {
// if animateLogo && animationStart {
// LinearGradient(gradient: Gradient(colors: [.green, .orange]), startPoint: .leading, endPoint: .trailing)
// .mask(
// Image(systemName: "plus.square.dashed")
// .resizable()
// .scaledToFit()
// .frame(width: 120, height: 120, alignment: .center)
// .padding()
// .fontWeight(.ultraLight)
// .offset(x: 5, y: 5)
// )
// .phaseAnimator([false, true]) { wwdc24, chromaRotate in
// wwdc24
// .hueRotation(.degrees(chromaRotate ? 420 : 0))
// } animation: { chromaRotate in
// .easeInOut(duration: 6)
// }
// } else {
// LinearGradient(gradient: Gradient(colors: [.green, .orange]), startPoint: .leading, endPoint: .trailing)
// .mask(
// Image(systemName: "plus.square.dashed")
// .resizable()
// .scaledToFit()
// .frame(width: 120, height: 120, alignment: .center)
// .padding()
// .fontWeight(.ultraLight)
// .offset(x: 5, y: 5)
// )
// }
// } else {
// LinearGradient(gradient: Gradient(colors: [.green, .orange]), startPoint: .leading, endPoint: .trailing)
// .mask(
// Image(systemName: "plus.square.dashed")
// .resizable()
// .scaledToFit()
// .frame(width: 120, height: 120, alignment: .center)
// .padding()
// .fontWeight(.ultraLight)
// .offset(x: 5, y: 5)
// )
// }

Text("Drop an app here")
.font(.title3)
Expand All @@ -124,11 +135,11 @@ struct MiniEmptyView: View {
appState.currentView = .apps
}
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
animationStart = true
}
}
// .onAppear {
// DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
// animationStart = true
// }
// }
}
}

Expand All @@ -141,7 +152,7 @@ struct MiniAppView: View {
@EnvironmentObject var appState: AppState
@EnvironmentObject var locations: Locations
@EnvironmentObject var themeSettings: ThemeSettings
@State private var animateGradient: Bool = false
// @State private var animateGradient: Bool = false
@Binding var search: String
@State private var showSys: Bool = true
@State private var showUsr: Bool = true
Expand Down
Loading

0 comments on commit 1ffa58e

Please sign in to comment.