From e72875f3672e40a33aa5c07f7b4d48a9d4678f1b Mon Sep 17 00:00:00 2001 From: Waozi Date: Sun, 25 Oct 2026 03:28:08 -0300 Subject: [PATCH] Keep device game saves off sync and show actual app loading progress --- locales/cs.txt | 24 ++++++++ locales/de.txt | 24 ++++++++ locales/en.txt | 24 ++++++++ locales/es.txt | 24 ++++++++ locales/fr.txt | 24 ++++++++ locales/id.txt | 24 ++++++++ locales/it.txt | 24 ++++++++ locales/ja.txt | 24 ++++++++ locales/ko.txt | 24 ++++++++ locales/pt.txt | 24 ++++++++ locales/ru.txt | 24 ++++++++ locales/zh.txt | 24 ++++++++ mk/tests-storage.mk | 7 +++ mk/tests-suite.mk | 2 + src/apps/module_host.zi | 11 ++++ src/apps/node_app_open.zi | 9 +++ src/apps/node_app_tree.zi | 6 +- src/apps/node_apps.zi | 3 +- src/screens/node_app_screen.zi | 88 ++++++++++++++++++++-------- src/storage/app_records.zi | 14 +++++ src/storage/entity_records.zi | 4 +- src/storage/entity_service.zi | 2 +- src/storage/storage_layout_laws.zi | 4 ++ src/storage/storage_settings.zi | 2 +- src/storage/sync_apply.zi | 2 +- src/storage/sync_record_crypto.zi | 2 +- tests/local_game_records_behavior.zi | 11 ++++ 27 files changed, 424 insertions(+), 31 deletions(-) create mode 100644 tests/local_game_records_behavior.zi diff --git a/locales/cs.txt b/locales/cs.txt index d9559fc72..bf79cec49 100644 --- a/locales/cs.txt +++ b/locales/cs.txt @@ -7467,3 +7467,27 @@ Uložení se nezdařilo. Zkuste to znovu. [library_select_passage] Vyberte pasáž pro poznámku --- + +--- +[app_loading_wait] +Čeká na otevření + +--- +[app_loading_read] +Čtení a ověřování + +--- +[app_loading_open] +Otevírání aplikace + +--- +[app_loading_ready] +Příprava obrazovky + +--- +[app_loading_pictures] +Načítání obrázků + +--- +[app_loading_apps] +Otevírání aplikací diff --git a/locales/de.txt b/locales/de.txt index 40832e9af..1a225cca1 100644 --- a/locales/de.txt +++ b/locales/de.txt @@ -7461,3 +7461,27 @@ Speichern fehlgeschlagen. Bitte erneut versuchen. [library_select_passage] Wähle eine Textstelle für eine Anmerkung --- + +--- +[app_loading_wait] +Wartet auf das Öffnen + +--- +[app_loading_read] +Lesen und prüfen + +--- +[app_loading_open] +App wird geöffnet + +--- +[app_loading_ready] +Ansicht vorbereiten + +--- +[app_loading_pictures] +Bilder werden geladen + +--- +[app_loading_apps] +Apps werden geöffnet diff --git a/locales/en.txt b/locales/en.txt index d03004f97..51eda7913 100644 --- a/locales/en.txt +++ b/locales/en.txt @@ -7485,3 +7485,27 @@ Could not save. Please try again. [library_select_passage] Select a passage to annotate --- + +--- +[app_loading_wait] +Waiting to open + +--- +[app_loading_read] +Reading and verifying + +--- +[app_loading_open] +Opening app + +--- +[app_loading_ready] +Preparing screen + +--- +[app_loading_pictures] +Loading pictures + +--- +[app_loading_apps] +Opening apps diff --git a/locales/es.txt b/locales/es.txt index 934d678e4..ade6b52a9 100644 --- a/locales/es.txt +++ b/locales/es.txt @@ -7461,3 +7461,27 @@ No se pudo guardar. Inténtalo de nuevo. [library_select_passage] Selecciona un pasaje para anotarlo --- + +--- +[app_loading_wait] +Esperando para abrir + +--- +[app_loading_read] +Leyendo y verificando + +--- +[app_loading_open] +Abriendo aplicación + +--- +[app_loading_ready] +Preparando pantalla + +--- +[app_loading_pictures] +Cargando imágenes + +--- +[app_loading_apps] +Abriendo aplicaciones diff --git a/locales/fr.txt b/locales/fr.txt index e3c0ff65e..2584dc82c 100644 --- a/locales/fr.txt +++ b/locales/fr.txt @@ -7449,3 +7449,27 @@ Enregistrement impossible. Réessayez. [library_select_passage] Sélectionnez un passage à annoter --- + +--- +[app_loading_wait] +En attente d’ouverture + +--- +[app_loading_read] +Lecture et vérification + +--- +[app_loading_open] +Ouverture de l’application + +--- +[app_loading_ready] +Préparation de l’écran + +--- +[app_loading_pictures] +Chargement des images + +--- +[app_loading_apps] +Ouverture des applications diff --git a/locales/id.txt b/locales/id.txt index 099b68a8f..5c1eaf3dc 100644 --- a/locales/id.txt +++ b/locales/id.txt @@ -7450,3 +7450,27 @@ Tidak dapat menyimpan. Silakan coba lagi. [library_select_passage] Pilih bagian teks untuk diberi catatan --- + +--- +[app_loading_wait] +Menunggu untuk dibuka + +--- +[app_loading_read] +Membaca dan memverifikasi + +--- +[app_loading_open] +Membuka aplikasi + +--- +[app_loading_ready] +Menyiapkan layar + +--- +[app_loading_pictures] +Memuat gambar + +--- +[app_loading_apps] +Membuka aplikasi-aplikasi diff --git a/locales/it.txt b/locales/it.txt index 8d9aa305a..6e33bc8ab 100644 --- a/locales/it.txt +++ b/locales/it.txt @@ -7450,3 +7450,27 @@ Impossibile salvare. Riprova. [library_select_passage] Seleziona un brano da annotare --- + +--- +[app_loading_wait] +In attesa di apertura + +--- +[app_loading_read] +Lettura e verifica + +--- +[app_loading_open] +Apertura dell’app + +--- +[app_loading_ready] +Preparazione schermata + +--- +[app_loading_pictures] +Caricamento immagini + +--- +[app_loading_apps] +Apertura delle app diff --git a/locales/ja.txt b/locales/ja.txt index a2d710464..da57cd4e9 100644 --- a/locales/ja.txt +++ b/locales/ja.txt @@ -7446,3 +7446,27 @@ Lumi や日記など、Inner Breeze 内のアプリを waozi.xyz から自動で [library_select_passage] メモを付ける文章を選択 --- + +--- +[app_loading_wait] +起動を待っています + +--- +[app_loading_read] +読み込みと検証中 + +--- +[app_loading_open] +アプリを起動中 + +--- +[app_loading_ready] +画面を準備中 + +--- +[app_loading_pictures] +画像を読み込み中 + +--- +[app_loading_apps] +アプリを読み込み中 diff --git a/locales/ko.txt b/locales/ko.txt index a45239f38..092aef9df 100644 --- a/locales/ko.txt +++ b/locales/ko.txt @@ -7456,3 +7456,27 @@ Lumi, 일기 등 Inner Breeze 안의 앱을 waozi.xyz에서 자동으로 업데 [library_select_passage] 주석을 달 구절을 선택하세요 --- + +--- +[app_loading_wait] +열기 대기 중 + +--- +[app_loading_read] +읽기 및 확인 중 + +--- +[app_loading_open] +앱 여는 중 + +--- +[app_loading_ready] +화면 준비 중 + +--- +[app_loading_pictures] +이미지 불러오는 중 + +--- +[app_loading_apps] +앱 불러오는 중 diff --git a/locales/pt.txt b/locales/pt.txt index e69a69245..960461e52 100644 --- a/locales/pt.txt +++ b/locales/pt.txt @@ -7459,3 +7459,27 @@ Não foi possível salvar. Tente novamente. [library_select_passage] Selecione um trecho para anotar --- + +--- +[app_loading_wait] +Aguardando para abrir + +--- +[app_loading_read] +Lendo e verificando + +--- +[app_loading_open] +Abrindo aplicativo + +--- +[app_loading_ready] +Preparando tela + +--- +[app_loading_pictures] +Carregando imagens + +--- +[app_loading_apps] +Abrindo aplicativos diff --git a/locales/ru.txt b/locales/ru.txt index f23796fae..e914f2bdd 100644 --- a/locales/ru.txt +++ b/locales/ru.txt @@ -7455,3 +7455,27 @@ Inner Breeze обновлён до версии %s. [library_select_passage] Выберите отрывок для заметки --- + +--- +[app_loading_wait] +Ожидание открытия + +--- +[app_loading_read] +Чтение и проверка + +--- +[app_loading_open] +Открытие приложения + +--- +[app_loading_ready] +Подготовка экрана + +--- +[app_loading_pictures] +Загрузка изображений + +--- +[app_loading_apps] +Открытие приложений diff --git a/locales/zh.txt b/locales/zh.txt index 22f68b674..25abd037f 100644 --- a/locales/zh.txt +++ b/locales/zh.txt @@ -7461,3 +7461,27 @@ Inner Breeze 已更新至 %s 版本。 [library_select_passage] 选择要添加批注的段落 --- + +--- +[app_loading_wait] +等待打开 + +--- +[app_loading_read] +正在读取和验证 + +--- +[app_loading_open] +正在打开应用 + +--- +[app_loading_ready] +正在准备界面 + +--- +[app_loading_pictures] +正在加载图片 + +--- +[app_loading_apps] +正在打开各个应用 diff --git a/mk/tests-storage.mk b/mk/tests-storage.mk index bc03fe49a..3820efd9a 100644 --- a/mk/tests-storage.mk +++ b/mk/tests-storage.mk @@ -253,3 +253,10 @@ dew-test: $(ZIRAN_BIN) $(LIBOQS_A) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) | buil .PHONY: lists-sharing-test lists-sharing-test: $(ZIRAN_BIN) $(LIBOQS_A) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) | build-laws @sh tests/lists_sharing_test.sh $(ZIRAN_BIN) $(LIBOQS_A) + +.PHONY: local-game-records-test +local-game-records-test: + mkdir -p build/local-game-records-test + $(ZIRAN_BIN) build --root . --target=c --entry local_game_records_behavior:main -o build/local-game-records-test tests/local_game_records_behavior.zi + $(CC) -O1 -I$(ZIRAN_DIR)/include -Ibuild/local-game-records-test $$(find build/local-game-records-test -name '*.c') -o build/local-game-records-test/test + build/local-game-records-test/test diff --git a/mk/tests-suite.mk b/mk/tests-suite.mk index 2a9999eb4..896f30bfc 100644 --- a/mk/tests-suite.mk +++ b/mk/tests-suite.mk @@ -162,3 +162,5 @@ test: android-sdk-install-test ## Run before pushing to catch web-only breakage -- e.g. code under ## #if defined(PLATFORM_WEB) -- that `make test` (desktop-native) misses. ci: test web + +test: local-game-records-test diff --git a/src/apps/module_host.zi b/src/apps/module_host.zi index f932386a9..45abec755 100644 --- a/src/apps/module_host.zi +++ b/src/apps/module_host.zi @@ -1857,3 +1857,14 @@ DiaryPortableReset :: () { unused ModuleRestart(*slots[4]) } } + +// How many bundled feature programs have finished opening. The loading UI +// reports completed work rather than inventing an elapsed-time percentage. +#program_export +AppsFeaturesReadyCount :: () -> s32 { + count: s32 = 0 + for slot: cast(s32)0..PackageCount - 1 { + if slot != 3 && slots[slot].app.instance != null { count += 1 } + } + return count +} diff --git a/src/apps/node_app_open.zi b/src/apps/node_app_open.zi index 716ca7200..5b1b938c3 100644 --- a/src/apps/node_app_open.zi +++ b/src/apps/node_app_open.zi @@ -238,3 +238,12 @@ NodeOpenPump :: (activate: bool) -> bool { unused NodeOpenDiscard() return true } + +// Completed opening stages, not an estimate of elapsed time or bytes. +NodeOpenStep :: (slot: s32) -> s32 { + if NodeAppRunning(slot) { return 3 } + if node_open_work == null || node_open_slot != slot { return 0 } + if !PackageWorkReady(node_open_work) { return 1 } + if node_open_preparation == null || !AppPreparationReady(node_open_preparation) { return 2 } + return 3 +} diff --git a/src/apps/node_app_tree.zi b/src/apps/node_app_tree.zi index 52b595609..a0bfd46d0 100644 --- a/src/apps/node_app_tree.zi +++ b/src/apps/node_app_tree.zi @@ -148,8 +148,12 @@ NodeTreeRecordKey :: (runner: *NodeAppRunner, node: *AppNode, record: string) -> if legacy != "" { return NodeAppRecordKey(legacy, record) } - return AppIdentityRecordKey(TextUntilNul(node.identity.authority[:]), + key := AppIdentityRecordKey(TextUntilNul(node.identity.authority[:]), TextUntilNul(node.identity.id[:]), record) + if !NodeAppRecordIsLocal(record) { return key } + local_key := PackageText("local.", key) + PackageFree(key) + return local_key } NodeTreeAllows :: (context: *void, node: *AppNode, name: string) -> bool { diff --git a/src/apps/node_apps.zi b/src/apps/node_apps.zi index 862cc8d25..d3c9304b5 100644 --- a/src/apps/node_apps.zi +++ b/src/apps/node_apps.zi @@ -893,12 +893,13 @@ NodeAppLocaleText :: (slot: s32, locale: string, key: string) -> string { NodeAppRecordKey :: (app: string, record: string) -> string { out: Vec(u8) + if NodeAppRecordIsLocal(record) { BuilderPrint(*out, "local.") } BuilderPrint(*out, "cell.%.%", app, record) return BuilderFinish(out) } NodeAppRecordRead :: (key: string) -> string { - if !NodeAppRecordKeyValid(key) { + if !NodeAppRecordKeyValid(key) && !NodeAppLocalRecordKeyValid(key) { return "" } statement: *void diff --git a/src/screens/node_app_screen.zi b/src/screens/node_app_screen.zi index 4f15a1f57..c8290bd1c 100644 --- a/src/screens/node_app_screen.zi +++ b/src/screens/node_app_screen.zi @@ -18,6 +18,8 @@ #import "kryon/app_context_host" #import "layout_props" #import "loading_indicator" +#import "progress_widget" +#import "progress_props" #import "drawing_props" #import "box_widget" #import "box_props" @@ -32,6 +34,7 @@ } #import, file "../apps/node_apps.zi"; #import, file "../apps/node_app_runner.zi"; +#import, file "../apps/node_app_open.zi"; #import, file "../apps/node_app_tree.zi"; #import, file "../app/smooth_frames.zi"; #import, file "../apps/node_app_input.zi"; @@ -65,6 +68,7 @@ using HostValueKind; using TextWrap; +using TextAlign; using AndroidImportKind; c :: #system_library "c"; @@ -288,32 +292,69 @@ NodeScreenShown :: (identity: u64) -> bool { return false } -// Pictures the backend still reads or decodes; the browser draws each one -// itself when it is ready. -NodeScreenImagesPending :: () -> s32 { - #if #defined(PLATFORM_WEB) { - return 0 - } else { - return ImagesPending() +// Count only this app's requested pictures. Images queued by a background +// app cannot hold the visible app behind its loading cover. +NodeScreenPictures :: struct { ready: s32; total: s32 } +NodeScreenPictureProgress :: (slot: s32) -> NodeScreenPictures { + result: NodeScreenPictures + #if #defined(PLATFORM_WEB) == false { + runtime := NodeTreeRuntime(slot) + if runtime == null || runtime.node == null { return result } + digest := TextUntilNul(runtime.node.entry.sha256[:]) + for image: node_tree_images { + if TextUntilNul(image.digest[:]) != digest { continue } + result.total += 1 + if ImageWidth(image.path) >= 0 { result.ready += 1 } + } } + return result } -NodeScreenCover :: (app: *InnerBreeze, area: Rectangle) { +NodeScreenProgress :: (app: *InnerBreeze, area: Rectangle, title: string, + stage: string, done: s32, total: s32) { + scale := MetricsScale() + width := area.width - 48.0 * scale + if width > 320.0 * scale { width = 320.0 * scale } + left := area.x + (area.width - width) / 2.0 + middle := area.y + area.height / 2.0 + Text(app.ui.session, TextProps.{.key = KeyHash("inbe/node-app/loading-title"), + .text = title, .font = AppFontSize(), + .bounds = Rectangle.{left, middle - 56.0 * scale, width, 28.0 * scale}, + .align = cast(TextAlign)TextAlignCenter}) + Text(app.ui.session, TextProps.{.key = KeyHash("inbe/node-app/loading-stage"), + .text = stage, .font = AppFontSize(), + .bounds = Rectangle.{left, middle - 24.0 * scale, width, 28.0 * scale}, + .align = cast(TextAlign)TextAlignCenter}) + counts: Vec(u8) + BuilderPrint(*counts, "% / %", done, total) + Progress(app.ui.session, ProgressProps.{.key = KeyHash("inbe/node-app/loading-progress"), + .bounds = Rectangle.{left, middle + 16.0 * scale, width, 24.0 * scale}, + .min = 0, .max = total, .value = done, .label = TextView(VecSlice(counts, 0, counts.count))}) + VecFree(counts) + AppRequestSmoothFrames(2) +} + +NodeScreenCover :: (app: *InnerBreeze, area: Rectangle, pictures: NodeScreenPictures) { Box(app.ui.session, BoxProps.{.key = KeyHash("inbe/node-app/cover"), .bounds = area, .fill = StyleTokenColor("canvas")}) - LoadingIndicator(app.ui.session, LoadingIndicatorProps.{.key = KeyHash("inbe/node-app/cover-loading"), - .bounds = area, .now = GetTime(), .scale = MetricsScale()}) - AppRequestSmoothFrames(2) + NodeScreenProgress(app, area, NodeAppName(app.node_app_slot), + LocaleText("app_loading_pictures"), pictures.ready, ifx pictures.total > 0 then pictures.total else 1) } -// While an app opens: Kryon's loading dots, the same everywhere, in the -// middle of the app's area. NodeScreenLoading :: (app: *InnerBreeze) { - LoadingIndicator(app.ui.session, LoadingIndicatorProps.{.key = KeyHash("inbe/node-app/loading"), - .bounds = Rectangle.{0.0, 0.0, cast(float32)app.ui.view_width, - cast(float32)(app.ui.view_height - app_content_bottom_reserved(app))}, - .now = GetTime(), .scale = MetricsScale()}) - AppRequestSmoothFrames(2) + area := Rectangle.{0.0, 0.0, cast(float32)app.ui.view_width, + cast(float32)(app.ui.view_height - app_content_bottom_reserved(app))} + slot := AppScreenSlot(app) + if slot >= 0 { + done := AppsFeaturesReadyCount() + total := cast(s32)PackageCount - 1 + NodeScreenProgress(app, area, LocaleText("app_loading_apps"), + LocaleText("app_loading_open"), done, total) + return + } + step := NodeOpenStep(app.node_app_slot) + stages: [4]string = .["app_loading_wait", "app_loading_read", "app_loading_open", "app_loading_ready"] + NodeScreenProgress(app, area, NodeAppName(app.node_app_slot), LocaleText(stages[step]), step, 3) } // The bundled app that draws the current screen, by module slot, or -1 for @@ -403,13 +444,14 @@ node_app_screen_draw :: (app: *InnerBreeze) { unused NodeAppRunMessage(slot, message) NodeAppUiEnd() identity := NodeScreenIdentity(slot) - if !NodeScreenShown(identity) { + pictures := NodeScreenPictureProgress(slot) + if !NodeScreenShown(identity) || pictures.ready < pictures.total { if node_screen_opening != identity { node_screen_opening = identity - NodeScreenCover(app, area) - } else if NodeScreenImagesPending() > 0 { - NodeScreenCover(app, area) - } else { + NodeScreenCover(app, area, pictures) + } else if pictures.ready < pictures.total { + NodeScreenCover(app, area, pictures) + } else if !NodeScreenShown(identity) { node_screen_shown[node_screen_shown_next] = identity node_screen_shown_next = (node_screen_shown_next + 1) % 16 } diff --git a/src/storage/app_records.zi b/src/storage/app_records.zi index 8085493ae..bfaa82231 100644 --- a/src/storage/app_records.zi +++ b/src/storage/app_records.zi @@ -181,3 +181,17 @@ SharedIdLooksLikeList :: (id: string) -> bool { } return true } + +// The local prefix is outside every synchronized collection. The nested +// app identity still scopes the record to its publisher and account. +NodeAppLocalRecordKeyValid :: (key: string) -> bool { + return key.count > 6 && key[:6] == "local." && NodeAppRecordKeyValid(key[6:]) +} + +NodeAppRecordIsLocal :: (record: string) -> bool { + return record.count > 6 && record[:6] == "local." && NodeAppRecordNameValid(record[6:]) +} + +NodeAppRecordMaySync :: (device_only: bool, valid: bool) -> bool { + return valid && !device_only +} diff --git a/src/storage/entity_records.zi b/src/storage/entity_records.zi index 34a8587f8..cc2775450 100644 --- a/src/storage/entity_records.zi +++ b/src/storage/entity_records.zi @@ -47,12 +47,12 @@ EntityGameProgressValid :: (id: string, text: string) -> bool { ProgressID.GameProgressID(TextUntilNul(value.game[:]), canonical[:]) && TextUntilNul(canonical[:]) == id } -EntityGameProgressMerge :: (current: string, incoming: string, incoming_position: bool) -> string { +EntityGameProgressMerge :: (current: string, incoming: string) -> string { right: Progress.GameProgressRecord if !Progress.GameProgressRead(incoming, *right) { return "" } left: Progress.GameProgressRecord if Progress.GameProgressRead(current, *left) { - if !Progress.GameProgressMerge(*left, *right, incoming_position) { return "" } + if !Progress.GameProgressMerge(*left, *right) { return "" } } else { left = right } out: Vec(u8) Progress.GameProgressWrite(*left, *out) diff --git a/src/storage/entity_service.zi b/src/storage/entity_service.zi index 35704efdd..69f1391cc 100644 --- a/src/storage/entity_service.zi +++ b/src/storage/entity_service.zi @@ -99,7 +99,7 @@ EntityServiceBuild :: (request: string, out: *Vec(u8)) { defer { PackageFree(existing) } previous: Progress.GameProgressRecord if Progress.GameProgressRead(existing, *previous) { - if !Progress.GameProgressMerge(*incoming, *previous, false) { BuilderPrint(out, "{\"status\":\"rejected\"}"); return } + if !Progress.GameProgressMerge(*incoming, *previous) { BuilderPrint(out, "{\"status\":\"rejected\"}"); return } } incoming.updated_at = now_seconds() encoded: Vec(u8) diff --git a/src/storage/storage_layout_laws.zi b/src/storage/storage_layout_laws.zi index 016b82376..390d41eeb 100644 --- a/src/storage/storage_layout_laws.zi +++ b/src/storage/storage_layout_laws.zi @@ -32,3 +32,7 @@ storage_layout_laws_entry :: () -> s32 { return 0 } + +#import, file "app_records.zi"; +#law LocalGamesStayOffSync theorem valid: bool => !NodeAppRecordMaySync(true, valid); +#proof LocalGamesStayOffSync { unfold NodeAppRecordMaySync; refl; } diff --git a/src/storage/storage_settings.zi b/src/storage/storage_settings.zi index 7fd27e63a..ab33b5c94 100644 --- a/src/storage/storage_settings.zi +++ b/src/storage/storage_settings.zi @@ -346,7 +346,7 @@ storage_set_setting_text :: (key: string, value: string) { if NodeAppInstallKeyValid(key) { unused storage_enqueue_sync_entity("app_install", key, 0) } - if NodeAppRecordKeyValid(key) { + if NodeAppRecordMaySync(NodeAppLocalRecordKeyValid(key), NodeAppRecordKeyValid(key)) { unused storage_enqueue_sync_entity("app_record", key, 0) } if MediaRecordKeyAccepted(key) { diff --git a/src/storage/sync_apply.zi b/src/storage/sync_apply.zi index 400ebdffe..f1415bff5 100644 --- a/src/storage/sync_apply.zi +++ b/src/storage/sync_apply.zi @@ -322,7 +322,7 @@ storage_apply_entity_record :: (collection: string, record_id: string, plaintext if !EntityGameProgressValid(record_id, plaintext) { return 1 } key := PackageText(ENTITY_GAME_PROGRESS_PREFIX, record_id) current := EntityServiceRead(key) - merged := EntityGameProgressMerge(current, plaintext, !EntityServicePending(key)) + merged := EntityGameProgressMerge(current, plaintext) defer { PackageFree(key); PackageFree(current); PackageFree(merged) } if merged == "" || merged == current { return 1 } statement: *void diff --git a/src/storage/sync_record_crypto.zi b/src/storage/sync_record_crypto.zi index a01866538..3f492045d 100644 --- a/src/storage/sync_record_crypto.zi +++ b/src/storage/sync_record_crypto.zi @@ -178,7 +178,7 @@ storage_sync_record_merge :: (plain: *StorageJsonBuilder, collection: string, re value := SqliteColumnText(stmt, 0) if value != null { if collection == EntityGameProgressCollection { - union := EntityGameProgressMerge(AppTextFromCString(value, 65536), own, true) + union := EntityGameProgressMerge(AppTextFromCString(value, 65536), own) storage_json_builder_append_text(*merged, union) PackageFree(union) } else { storage_json_builder_append(*merged, value) } diff --git a/tests/local_game_records_behavior.zi b/tests/local_game_records_behavior.zi new file mode 100644 index 000000000..e060da6cd --- /dev/null +++ b/tests/local_game_records_behavior.zi @@ -0,0 +1,11 @@ +#import, file "../src/storage/app_records.zi"; +#program_export +main :: () -> s32 { + if !NodeAppRecordIsLocal("local.campaign") || NodeAppRecordIsLocal("campaign") { return 1 } + if !NodeAppLocalRecordKeyValid("local.cell.arcade.local.campaign") || + NodeAppRecordKeyValid("local.cell.arcade.local.campaign") || + NodeAppRecordKeyValid("local.cell.shovey.local.campaign") { return 2 } + if NodeAppRecordMaySync(true, true) || !NodeAppRecordMaySync(false, true) { return 3 } + if NodeAppLocalRecordKeyValid("local.cell.arcade.INVALID") { return 4 } + return 0 +}