Keep device game saves off sync and show actual app loading progress
This commit is contained in:
1 parent
9e57756051
commit
e72875f367
27 files changed
+424
-31
No files matched your search
@@ -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í
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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]
|
||||
アプリを読み込み中
|
||||
@@ -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]
|
||||
앱 불러오는 중
|
||||
@@ -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
|
||||
@@ -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]
|
||||
Открытие приложений
|
||||
@@ -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]
|
||||
正在打开各个应用
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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; }
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user