mirror of
https://github.com/exituser/Pearcleaner.git
synced 2026-09-17 08:29:07 +00:00
Road to v3
This commit is contained in:
@@ -102,7 +102,8 @@ struct GeneralSettingsTab: View {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(Color("mode").opacity(0.05))
|
||||
)
|
||||
|
||||
|
||||
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text("Mini").font(.title2)
|
||||
@@ -117,11 +118,10 @@ struct GeneralSettingsTab: View {
|
||||
.onChange(of: mini) { newVal in
|
||||
if mini {
|
||||
resizeWindowAuto(windowSettings: windowSettings)
|
||||
// resizeWindow(width: 300, height: 300)
|
||||
appState.currentView = miniView ? .apps : .empty
|
||||
// showPopover = false
|
||||
// appState.currentView = miniView ? .apps : .empty
|
||||
} else {
|
||||
resizeWindowAuto(windowSettings: windowSettings)
|
||||
// resizeWindow(width: 700, height: 500)
|
||||
if appState.appInfo.appName.isEmpty {
|
||||
appState.currentView = .empty
|
||||
} else {
|
||||
@@ -139,7 +139,7 @@ struct GeneralSettingsTab: View {
|
||||
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text("Mini - Default View").font(.title2)
|
||||
Text("Mini - \(miniView ? "Apps List" : "Drop Target")").font(.title2)
|
||||
Text("Toggles drop target or apps list view on launch")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.gray)
|
||||
@@ -160,7 +160,7 @@ struct GeneralSettingsTab: View {
|
||||
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text("Mini - Popover").font(.title2)
|
||||
Text("Mini - \(popoverStay ? "Popover on Top" : "Popover not on Top")").font(.title2)
|
||||
Text("Keeps file search popover on top in mini mode")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.gray)
|
||||
|
||||
@@ -9,7 +9,7 @@ import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
@EnvironmentObject var appState: AppState
|
||||
|
||||
|
||||
var body: some View {
|
||||
|
||||
TabView() {
|
||||
|
||||
@@ -22,6 +22,12 @@ struct Asset: Codable {
|
||||
let browser_download_url: String
|
||||
}
|
||||
|
||||
extension Release {
|
||||
var modifiedBody: String {
|
||||
return body.replacingOccurrences(of: "- [x]", with: "").replacingOccurrences(of: "###", with: "")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct UpdateSettingsTab: View {
|
||||
@EnvironmentObject var appState: AppState
|
||||
@@ -46,7 +52,7 @@ struct UpdateSettingsTab: View {
|
||||
ForEach(appState.releases, id: \.id) { release in
|
||||
VStack(alignment: .leading) {
|
||||
LabeledDivider(label: "\(release.tag_name)")
|
||||
Text(release.body)
|
||||
Text(release.modifiedBody)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,15 +105,16 @@ func loadGithubReleases(appState: AppState, manual: Bool = false) {
|
||||
if let data = data {
|
||||
if let decodedResponse = try? JSONDecoder().decode([Release].self, from: data) {
|
||||
DispatchQueue.main.async {
|
||||
let lastFiveReleases = Array(decodedResponse.prefix(3)) // Get only the last 3 recent releases
|
||||
appState.releases = lastFiveReleases
|
||||
let lastFewReleases = Array(decodedResponse.prefix(3)) // Get only the last 3 recent releases
|
||||
appState.releases = lastFewReleases
|
||||
|
||||
checkForUpdate(appState: appState, manual: manual)
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
print("Fetch failed: \(error?.localizedDescription ?? "Unknown error")")
|
||||
printOS("Fetch failed: \(error?.localizedDescription ?? "Unknown error")")
|
||||
}.resume()
|
||||
}
|
||||
|
||||
@@ -172,7 +179,7 @@ func downloadUpdate(appState: AppState) {
|
||||
|
||||
|
||||
} catch {
|
||||
print("Error moving downloaded file: \(error.localizedDescription)")
|
||||
printOS("Error moving downloaded file: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +240,7 @@ func UnzipAndReplace(DownloadedFileURL fileURL: String, appState: AppState) {
|
||||
|
||||
|
||||
} catch {
|
||||
print("Error updating the app: \(error)")
|
||||
printOS("Error updating the app: \(error)")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user