mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 22:56:15 +00:00
Whats New!
add AboutView move getVersion() and geBuildID() reorg of presentaion related modifiers
This commit is contained in:
@@ -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)"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user