fix whats new showing every time

prevAppVersoin wasnt being set lol
remove .searchable()
rename WhatsNew -> WhatsNewChunk
This commit is contained in:
neon443
2025-05-13 10:59:22 +01:00
parent c935d4b1f0
commit 2b266e03ca
5 changed files with 14 additions and 12 deletions

View File

@@ -14,4 +14,4 @@ BUNDLE_ID_WIDGETS = com.neon443.NearFuture.widgets
GROUP_ID = group.NearFuture GROUP_ID = group.NearFuture
VERSION = 4.0.0 VERSION = 4.0.0
NAME = Near Future NAME = Near Future
BUILD_NUMBER = 2 BUILD_NUMBER = 3

View File

@@ -134,7 +134,6 @@ class SettingsViewModel: ObservableObject {
init(load: Bool = true) { init(load: Bool = true) {
self.device = getDevice() self.device = getDevice()
if load { if load {
loadSettings() loadSettings()
Task { Task {

View File

@@ -82,7 +82,6 @@ struct HomeView: View {
Spacer() Spacer()
} }
.animation(.default, value: filteredEvents) .animation(.default, value: filteredEvents)
.searchable(text: $searchInput)
} }
} }
.navigationTitle("Near Future") .navigationTitle("Near Future")

View File

@@ -67,6 +67,10 @@ struct SettingsView: View {
} }
} }
} }
Toggle("Show completed Events in Home", isOn: $settingsModel.settings.showCompletedInHome)
.onChange(of: settingsModel.settings.showCompletedInHome) { _ in
settingsModel.saveSettings()
}
NavigationLink() { NavigationLink() {
List { List {
if !settingsModel.notifsGranted { if !settingsModel.notifsGranted {

View File

@@ -10,25 +10,25 @@ import SwiftUI
struct WhatsNewView: View { struct WhatsNewView: View {
@ObservedObject var settingsModel: SettingsViewModel @ObservedObject var settingsModel: SettingsViewModel
@Environment(\.dismiss) var dismiss @Environment(\.dismiss) var dismiss
struct WhatsNew: Identifiable { struct WhatsNewChunk: Identifiable {
var id: UUID = UUID() var id: UUID = UUID()
var symbol: String var symbol: String
var title: String var title: String
var subtitle: String var subtitle: String
} }
var whatsNew: [WhatsNew] { var whatsNewChunks: [WhatsNewChunk] {
return [ return [
WhatsNew( WhatsNewChunk(
symbol: settingsModel.device.sf, symbol: settingsModel.device.sf,
title: "This Screen", title: "This Screen",
subtitle: "This update add a Whats New page that will tell you (suprise!) What's New" subtitle: "This update add a Whats New page that will tell you (suprise!) What's New"
), ),
WhatsNew( WhatsNewChunk(
symbol: "bell.badge.fill", symbol: "bell.badge.fill",
title: "Notifications", title: "Notifications",
subtitle: "Events now have notifications, reminding you to complete them!" subtitle: "Events now have notifications, reminding you to complete them!"
), ),
WhatsNew( WhatsNewChunk(
symbol: "list.bullet.indent", symbol: "list.bullet.indent",
title: "Animations!", title: "Animations!",
subtitle: "I added animations for adding, removing and ticking events" subtitle: "I added animations for adding, removing and ticking events"
@@ -44,8 +44,8 @@ struct WhatsNewView: View {
.bold() .bold()
AboutView() AboutView()
Divider() Divider()
ForEach(whatsNew) { new in ForEach(whatsNewChunks) { new in
WhatsNewChunk( WhatsNewChunkView(
symbol: new.symbol, symbol: new.symbol,
title: new.title, title: new.title,
subtitle: new.subtitle subtitle: new.subtitle
@@ -54,7 +54,7 @@ struct WhatsNewView: View {
} }
.onDisappear { .onDisappear {
settingsModel.settings.showWhatsNew = false settingsModel.settings.prevAppVersion = getVersion()+getBuildID()
settingsModel.saveSettings() settingsModel.saveSettings()
} }
} }
@@ -89,7 +89,7 @@ struct WhatsNewView: View {
} }
} }
struct WhatsNewChunk: View { struct WhatsNewChunkView: View {
@State var symbol: String @State var symbol: String
@State var title: String @State var title: String
@State var subtitle: String @State var subtitle: String