This commit is contained in:
Alin
2023-11-13 13:40:42 -07:00
parent 9cbde6493a
commit 46125d8cbc
5 changed files with 91 additions and 9 deletions
+4 -4
View File
@@ -517,7 +517,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BK8443AXLU; DEVELOPMENT_TEAM = BK8443AXLU;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -534,7 +534,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner; PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
@@ -551,7 +551,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BK8443AXLU; DEVELOPMENT_TEAM = BK8443AXLU;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -568,7 +568,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner; PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
+74 -2
View File
@@ -13,7 +13,15 @@ struct SimpleButtonStyle: ButtonStyle {
let icon: String let icon: String
let help: String let help: String
let color: Color let color: Color
let shield: Bool?
init(icon: String, help: String, color: Color, shield: Bool? = nil) {
self.icon = icon
self.help = help
self.color = color
self.shield = shield
}
func makeBody(configuration: Self.Configuration) -> some View { func makeBody(configuration: Self.Configuration) -> some View {
HStack { HStack {
Image(systemName: icon) Image(systemName: icon)
@@ -24,7 +32,7 @@ struct SimpleButtonStyle: ButtonStyle {
} }
.padding(8) .padding(8)
.background { .background {
if hovered { if hovered && !(shield ?? false) {
// Circle() // Circle()
// .strokeBorder(Color("AccentColor"), lineWidth: 1) // .strokeBorder(Color("AccentColor"), lineWidth: 1)
RoundedRectangle(cornerRadius: 8) RoundedRectangle(cornerRadius: 8)
@@ -250,9 +258,73 @@ struct WindowActionButton: ButtonStyle {
struct SentinelToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View {
HStack {
ZStack{
RoundedRectangle(cornerRadius: 50)
.fill(configuration.isOn ? greenBG : redBG)
.frame(width: 70, height: 40)
HStack{
Image(systemName: "lock.shield")
.resizable()
.scaledToFit()
.frame(width: 26, height: 26)
.padding(.leading, 10)
.foregroundColor(.white)
Spacer()
Image(systemName: "shield")
.resizable()
.scaledToFit()
.frame(width: 26, height: 26)
.padding(.trailing, 10)
.foregroundColor(.white)
}
}
.frame(width: 70, height: 40, alignment: .center)
.overlay(
Circle()
.foregroundColor(.white)
.shadow(color: .black.opacity(0.5), radius: 3, x: 0, y: 0)
.padding(.all, 4)
.offset(x: configuration.isOn ? 15 : -15, y: 0)
)
.overlay(
Image(systemName: "power")
.resizable()
.scaledToFit()
.frame(width: 20, height: 20)
.foregroundColor(.black.opacity(0.3))
.offset(x: configuration.isOn ? 15 : -15, y: 0)
)
.onTapGesture {
withAnimation(.easeInOut(duration: 0.5)) {
configuration.isOn.toggle()
}
}
.animation(.default, value: configuration.isOn)
}
}
}
private let greenBG: AnyShapeStyle = AnyShapeStyle(
.green.shadow(.inner(radius: 2, x: 0, y: 1))
)
private let redBG: AnyShapeStyle = AnyShapeStyle(
.red.shadow(.inner(radius: 2, x: 0, y: 1))
)
// Picker // Picker
//struct PillPicker: View { //struct PillPicker: View {
+1 -1
View File
@@ -40,7 +40,7 @@ struct PearcleanerApp: App {
#if !DEBUG #if !DEBUG
// Make sure App Support folder exists in the future if needed for storage // Make sure App Support folder exists in the future if needed for storage
// ensureApplicationSupportFolderExists(appState: appState) ensureApplicationSupportFolderExists(appState: appState)
// Check for updates // Check for updates
if diskP && diskE { if diskP && diskE {
+2 -2
View File
@@ -25,7 +25,7 @@ struct SentinelSettingsTab: View {
Spacer() Spacer()
Toggle(isOn: $sentinel, label: { Toggle(isOn: $sentinel, label: {
}) })
.toggleStyle(.switch) .toggleStyle(SentinelToggleStyle())
.onChange(of: sentinel) { newValue in .onChange(of: sentinel) { newValue in
if newValue { if newValue {
launchctl(load: true) launchctl(load: true)
@@ -45,7 +45,7 @@ struct SentinelSettingsTab: View {
} }
.padding(20) .padding(20)
.frame(width: 400, height: 100) .frame(width: 450, height: 100)
} }
+10
View File
@@ -13,6 +13,7 @@ struct TopBar: View {
@Binding var reload: Bool @Binding var reload: Bool
@AppStorage("displayMode") var displayMode: DisplayMode = .system @AppStorage("displayMode") var displayMode: DisplayMode = .system
@AppStorage("settings.general.glass") private var glass: Bool = false @AppStorage("settings.general.glass") private var glass: Bool = false
@AppStorage("settings.sentinel.enable") private var sentinel: Bool = false
@EnvironmentObject var appState: AppState @EnvironmentObject var appState: AppState
var body: some View { var body: some View {
@@ -75,6 +76,15 @@ struct TopBar: View {
Spacer() Spacer()
HStack(alignment: .center, spacing: 5) { HStack(alignment: .center, spacing: 5) {
if sentinel {
Button("") {
//
}
.buttonStyle(SimpleButtonStyle(icon: "lock.shield", help: "Sentinel enabled", color: .green, shield: true))
}
Button("") { Button("") {
withAnimation(.easeInOut(duration: 0.5)) { withAnimation(.easeInOut(duration: 0.5)) {
glass.toggle() glass.toggle()