Road to v3

This commit is contained in:
Alin
2024-02-27 09:03:35 -07:00
parent 638aed7e1b
commit 80a128a619
21 changed files with 1374 additions and 525 deletions
+6 -6
View File
@@ -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)
+1 -1
View File
@@ -9,7 +9,7 @@ import SwiftUI
struct SettingsView: View {
@EnvironmentObject var appState: AppState
var body: some View {
TabView() {
+13 -6
View File
@@ -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)")
}
}