Update view

This commit is contained in:
Alin
2024-03-11 12:27:57 -06:00
parent 0dfe1c8d2b
commit f62148d08a
4 changed files with 20 additions and 7 deletions
+4
View File
@@ -152,6 +152,10 @@ public struct NewFeatureView: View {
public var body: some View { public var body: some View {
VStack { VStack {
HStack { HStack {
Image(systemName: "star")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 20, height: 20)
Text("New features for v\((Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String)!)!") Text("New features for v\((Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String)!)!")
.font(.headline).bold() .font(.headline).bold()
Spacer() Spacer()
+1 -1
View File
@@ -144,7 +144,7 @@ struct PearcleanerApp: App {
Settings { Settings {
SettingsView(showPopover: $showPopover) SettingsView(showPopover: $showPopover, showFeature: $showFeature)
.environmentObject(appState) .environmentObject(appState)
.toolbarBackground(.clear) .toolbarBackground(.clear)
.preferredColorScheme(displayMode.colorScheme) .preferredColorScheme(displayMode.colorScheme)
+2 -1
View File
@@ -10,6 +10,7 @@ import SwiftUI
struct SettingsView: View { struct SettingsView: View {
@EnvironmentObject var appState: AppState @EnvironmentObject var appState: AppState
@Binding var showPopover: Bool @Binding var showPopover: Bool
@Binding var showFeature: Bool
@AppStorage("settings.general.glass") private var glass: Bool = true @AppStorage("settings.general.glass") private var glass: Bool = true
var body: some View { var body: some View {
@@ -21,7 +22,7 @@ struct SettingsView: View {
} }
.tag(CurrentTabView.general) .tag(CurrentTabView.general)
UpdateSettingsTab() UpdateSettingsTab(showFeature: $showFeature)
.tabItem { .tabItem {
Label(CurrentTabView.update.title, systemImage: "cloud") Label(CurrentTabView.update.title, systemImage: "cloud")
} }
+13 -5
View File
@@ -34,7 +34,8 @@ struct UpdateSettingsTab: View {
@State private var showAlert = false @State private var showAlert = false
@State private var showDone = false @State private var showDone = false
@AppStorage("settings.updater.updateTimeframe") private var updateTimeframe: Int = 1 @AppStorage("settings.updater.updateTimeframe") private var updateTimeframe: Int = 1
@Binding var showFeature: Bool
var body: some View { var body: some View {
VStack { VStack {
@@ -72,21 +73,28 @@ struct UpdateSettingsTab: View {
HStack(alignment: .center, spacing: 20) { HStack(alignment: .center, spacing: 20) {
Spacer() Spacer()
Button("Update Notes"){ Button(""){
loadGithubReleases(appState: appState) loadGithubReleases(appState: appState)
} }
.buttonStyle(SimpleButtonStyle(icon: "list.bullet", help: "Check release notes", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "arrow.uturn.left.circle", help: "Reload release notes", color: Color("mode")))
Spacer() Spacer()
Button("Force Update"){ Button(""){
showFeature.toggle()
}
.buttonStyle(SimpleButtonStyle(icon: "star", help: "Show last feature alert", color: Color("mode")))
Spacer()
Button(""){
loadGithubReleases(appState: appState, manual: true) loadGithubReleases(appState: appState, manual: true)
} }
.buttonStyle(SimpleButtonStyle(icon: "arrow.down.square", help: "Check for updates", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "arrow.down.square", help: "Check for updates", color: Color("mode")))
Spacer() Spacer()
Button("GitHub"){ Button(""){
NSWorkspace.shared.open(URL(string: "https://github.com/alienator88/Pearcleaner/releases")!) NSWorkspace.shared.open(URL(string: "https://github.com/alienator88/Pearcleaner/releases")!)
} }
.buttonStyle(SimpleButtonStyle(icon: "link", help: "View releases on GitHub", color: Color("mode"))) .buttonStyle(SimpleButtonStyle(icon: "link", help: "View releases on GitHub", color: Color("mode")))