Whats New!

add AboutView
move getVersion() and geBuildID()
reorg of presentaion related modifiers
This commit is contained in:
neon443
2025-05-12 20:49:28 +01:00
parent 7bef3bc4e6
commit c82ce5fa17
12 changed files with 189 additions and 131 deletions

View File

@@ -107,12 +107,16 @@ func daysUntilEvent(_ eventDate: Date) -> (long: String, short: String) {
struct Settings: Codable, Equatable {
var showCompletedInHome: Bool
var tint: ColorCodable
var showWhatsNew: Bool
var prevAppVersion: String
}
class SettingsViewModel: ObservableObject {
@Published var settings: Settings = Settings(
showCompletedInHome: false,
tint: ColorCodable(uiColor: UIColor(named: "AccentColor")!)
tint: ColorCodable(uiColor: UIColor(named: "AccentColor")!),
showWhatsNew: true,
prevAppVersion: getVersion()+getBuildID()
)
@Published var notifsGranted: Bool = false
@@ -152,6 +156,9 @@ class SettingsViewModel: ObservableObject {
self.settings = decodedSetts
}
}
if self.settings.prevAppVersion != getVersion()+getBuildID() {
self.settings.showWhatsNew = true
}
}
func saveSettings() {
@@ -528,3 +535,17 @@ func cancelNotif(_ id: String) {
func cancelAllNotifs() {
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
}
func getVersion() -> String {
guard let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] else {
fatalError("no bundle id wtf lol")
}
return "\(version)"
}
func getBuildID() -> String {
guard let build = Bundle.main.infoDictionary?["CFBundleVersion"] else {
fatalError("wtf did u do w the build number")
}
return "\(build)"
}