Files
breeze/tests/sync_safety_behavior.zi
T
waozi 4c2089d62e Keep sync from getting stuck on Review sync changes
Android gives the app no writable temporary directory, and the debug and
Play builds changed into the release package's files path, which failed and
left the process in "/". Any SQLite statement journal or temporary table that
spilled to a file failed with "disk I/O error", rolled back the whole
transaction, and made every review merge fail, so the review window came
back each time it closed.

Temporary data now stays in memory on every connection, Android changes into
the package's own files directory, a step failure logs SQLite's reason, and a
review is merged or shown once per account snapshot instead of reopening
right after it closes.
2026-10-15 22:27:39 -03:00

67 lines
2.7 KiB
Ziran

#import, file "../src/app/sync_safety_policy.zi";
#import, file "../src/core/types.zi";
#program_export
Answer :: () -> s32 {
state: SyncSafetyState
state.screen = ScreenHabits
if !BackgroundSyncSafe(state) { return 1 }
state.modal_active = 1
if BackgroundSyncSafe(state) { return 2 }
state.modal_active = 0
state.habit_edit_active = 1
if BackgroundSyncSafe(state) { return 4 }
state.habit_edit_active = 0
state.server_url_focused = 1
if BackgroundSyncSafe(state) { return 5 }
state.server_url_focused = 0
state.alias_focused = 1
if BackgroundSyncSafe(state) { return 6 }
state.alias_focused = 0
state.friend_input_focused = 1
if BackgroundSyncSafe(state) { return 7 }
state.friend_input_focused = 0
state.screen = ScreenPracticeSession
if !BackgroundSyncSafe(state) || SyncUiRefreshSafe(state, 3.0, 1.0, false) { return 8 }
state.screen = ScreenMeditation
if !BackgroundSyncSafe(state) || SyncUiRefreshSafe(state, 3.0, 1.0, false) { return 9 }
state.screen = ScreenSunSalutation
if !BackgroundSyncSafe(state) || SyncUiRefreshSafe(state, 3.0, 1.0, false) { return 10 }
state.screen = ScreenPatterns
if !BackgroundSyncSafe(state) || SyncUiRefreshSafe(state, 3.0, 1.0, false) { return 14 }
state.screen = ScreenTaiChi
if !BackgroundSyncSafe(state) || SyncUiRefreshSafe(state, 3.0, 1.0, false) { return 19 }
state.screen = ScreenHabits
// Where sync runs on the frame thread, a running practice waits for it,
// also while the practice shows in its small window.
state.frame_thread_transport = true
if !BackgroundSyncSafe(state) { return 15 }
state.practice_screen = ScreenPracticeSession
if BackgroundSyncSafe(state) { return 16 }
state.practice_screen = ScreenMeditation
if BackgroundSyncSafe(state) { return 17 }
state.frame_thread_transport = false
if !BackgroundSyncSafe(state) { return 18 }
state.practice_screen = ScreenStart
if SyncUserIdle(2.49, 1.0, false) ||
!SyncUserIdle(2.50, 1.0, false) ||
SyncUserIdle(3.0, 1.0, true) { return 11 }
if !SyncUiRefreshSafe(state, 2.50, 1.0, false) ||
SyncUiRefreshSafe(state, 2.50, 1.0, true) { return 12 }
state.screen = ScreenStart
if SyncUiRefreshSafe(state, 3.0, 1.0, false) { return 13 }
// A review the merge could not apply, or the person closed, does not
// come back until the account sends a newer snapshot.
if !SyncReviewDue(true, true, 35326, -1) { return 20 }
if SyncReviewDue(true, true, 35326, 35326) { return 21 }
if !SyncReviewDue(true, true, 35400, 35326) { return 22 }
if SyncReviewDue(false, true, 35400, -1) || SyncReviewDue(true, false, 35400, -1) { return 23 }
return 42
}