android: add embedded release notes after updates
This commit is contained in:
parent
f28958b192
commit
585dc43c61
438 changed files with 13991 additions and 56 deletions
|
|
@ -0,0 +1,32 @@
|
|||
--- /tmp/opencode/chesspenguin-openspec/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/data/AndroidReleaseNotes.kt 2026-12-04 03:44:10.969856585 +0300
|
||||
+++ /tmp/opencode/qa-android-release-notes/tree/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/data/AndroidReleaseNotes.kt 2026-12-04 03:58:15.511138257 +0300
|
||||
@@ -126,7 +126,7 @@
|
||||
val active = _state.value.activePresentation ?: return
|
||||
if (_state.value.presentedThisLaunch) return
|
||||
val attempted = markPresented(durablePrefs, active.currentCode)
|
||||
- val committed = withContext(Dispatchers.IO) { writePrefs(prefs, attempted) }
|
||||
+ val committed = withContext(Dispatchers.IO) { writePrefs(prefs, attempted, failCommitForQA = true) }
|
||||
durablePrefs = releaseNotesPrefsAfterCommit(durablePrefs, attempted, committed)
|
||||
if (!committed) Log.w(TAG, "Could not save Android release-notes presentation")
|
||||
_state.value = _state.value.copy(
|
||||
@@ -160,12 +160,18 @@
|
||||
return ReleaseNotesPrefs(launched, decodePendingCodes(pending), presented)
|
||||
}
|
||||
|
||||
-private fun writePrefs(prefs: SharedPreferences, state: ReleaseNotesPrefs): Boolean = runCatching {
|
||||
+private fun writePrefs(prefs: SharedPreferences, state: ReleaseNotesPrefs, failCommitForQA: Boolean = false): Boolean = runCatching {
|
||||
val editor = prefs.edit()
|
||||
if (state.lastLaunchedCode == null) editor.remove(LAST_LAUNCHED) else editor.putLong(LAST_LAUNCHED, state.lastLaunchedCode)
|
||||
editor.putStringSet(PENDING, encodePendingCodes(state.pendingCodes).toSet())
|
||||
editor.putLong(LAST_PRESENTED, state.lastPresentedCode)
|
||||
- editor.commit()
|
||||
+ if (failCommitForQA) {
|
||||
+ // QA only: model a failed presentation commit without changing durable or in-memory prefs.
|
||||
+ Log.w("AndroidReleaseNotes", "QA forced presentation commit=false; editor was not committed")
|
||||
+ false
|
||||
+ } else {
|
||||
+ editor.commit()
|
||||
+ }
|
||||
}.getOrDefault(false)
|
||||
|
||||
private fun Long.validStoredCode() = this in 1..Int.MAX_VALUE.toLong()
|
||||
Loading…
Add table
Add a link
Reference in a new issue