mirror of
https://github.com/pepaskopec-blip/Graduately.git
synced 2026-10-28 15:44:34 +00:00
Show a what's-new card on the home screen after each update.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
dd8d992bf8
commit
6556c6691b
21 changed files with 490 additions and 0 deletions
|
|
@ -14,11 +14,13 @@ final class AppModel: ObservableObject {
|
|||
@Published var searchQuery = ""
|
||||
@Published var tick = 0
|
||||
@Published var update = UpdateState()
|
||||
@Published var showChangelog = false
|
||||
|
||||
init() {
|
||||
themeId = progress.themeId
|
||||
mode = progress.mode
|
||||
lang = progress.lang
|
||||
showChangelog = !content.changelog.isEmpty && !sameBuild(AppConfig.commit, progress.seenCommit)
|
||||
#if DEBUG
|
||||
// `xcrun simctl launch <udid> org.maturita.maturita -route u1e3` opens a page for screenshots.
|
||||
if let page = UserDefaults.standard.string(forKey: "route"), let r = routeFromPage(page) {
|
||||
|
|
@ -141,4 +143,16 @@ final class AppModel: ObservableObject {
|
|||
self?.update = state
|
||||
}
|
||||
}
|
||||
|
||||
func dismissChangelog() {
|
||||
progress.seenCommit = AppConfig.commit
|
||||
showChangelog = false
|
||||
}
|
||||
}
|
||||
|
||||
func sameBuild(_ a: String?, _ b: String?) -> Bool {
|
||||
guard let a, let b, !a.isEmpty, !b.isEmpty else { return false }
|
||||
if a.caseInsensitiveCompare(b) == .orderedSame { return true }
|
||||
let n = min(a.count, b.count)
|
||||
return n >= 7 && a.prefix(n).caseInsensitiveCompare(b.prefix(n)) == .orderedSame
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue