Fix start screen and first-sync schema

This commit is contained in:
waozi authored and Waozi committed 2026-07-11 18:49:15 -03:00
1 parent 6f03e693ac
commit 749be66d5d
18 files changed
+153 -55

No files matched your search

+1
View File
@@ -10,6 +10,7 @@
.codex/
.agents/
.cache/
.ccache
*.wasm
build/
tmp/
+5
View File
@@ -1,4 +1,9 @@
# Changelog
## [1.4.8] - 2026-06-21
### Changed
- Fixed start screen
- Fixed schema on first sync
## [1.4.7] - 2026-06-21
### Changed
- Rework Practice into Manual, start, and configuration tabs with a new localized first-run guide.
+14 -1
View File
@@ -57,6 +57,8 @@ WINDOWS_OBJ_DIR := $(BUILD_OBJ_DIR)/windows
WINDOWS_BIN_DIR := $(BUILD_BIN_DIR)/windows
WINDOWS_DIST_DIR := $(BUILD_DIST_DIR)/windows
ANDROID_BUILD_DIR := $(BUILD_DIR)/android
ANDROID_FAST_ABI ?= $(shell adb shell getprop ro.product.cpu.abi 2>/dev/null | tr -d '\r' | head -n 1)
ANDROID_DEBUG_ABIS ?= $(if $(strip $(ANDROID_FAST_ABI)),$(ANDROID_FAST_ABI),arm64-v8a)
WEB_OBJ_DIR := $(BUILD_OBJ_DIR)/web
WEB_DIST_DIR := $(BUILD_DIST_DIR)/web
CHROME_WEB_STORE_DIR := $(BUILD_DIST_DIR)/chrome-web-store
@@ -241,7 +243,7 @@ UNPACKAGED_AUDIO_DIR := unpackaged_assets/audio
UNPACKAGED_AUDIO_FILES := $(shell find $(UNPACKAGED_AUDIO_DIR) -type f 2>/dev/null)
MEDITATION_AUDIO_ZIP := web-assets/dl/inbe-meditation-audio-v1.zip
.PHONY: all native run run-fresh screenshot test dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows clean clean-linux clean-vendor-builds android-check-keystore android-copy-assets android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web chrome-web-store
.PHONY: all native run run-fresh screenshot test dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows clean clean-linux clean-vendor-builds android-check-keystore android-copy-assets android-local-properties android-debug android-debug-fast android-release android-bundle android-install android-install-fast android-install-release android-clean package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web chrome-web-store
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click
all: native
@@ -848,6 +850,10 @@ android-debug: android-copy-assets android-local-properties
unset ANDROID_HOME; $(GRADLE) -p droid assembleDebug
$(MAKE) android-copy-debug-apks
android-debug-fast: android-copy-assets android-local-properties
unset ANDROID_HOME; $(GRADLE) -p droid assembleDebug -Pinbe.abis="$(ANDROID_DEBUG_ABIS)"
$(MAKE) android-copy-debug-apks
android-release:
$(MAKE) android-check-keystore PASSWORD="$(PASSWORD)"
$(MAKE) android-copy-assets
@@ -930,6 +936,13 @@ android-install: android-debug
adb install -r "$$APK"; \
adb shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
android-install-fast: android-debug-fast
@ABI=$$(adb shell getprop ro.product.cpu.abi | tr -d '\r'); \
APK=droid/app/build/outputs/apk/debug/app-$${ABI}-debug.apk; \
if [ ! -f "$$APK" ]; then APK=droid/app/build/outputs/apk/debug/app-debug.apk; fi; \
adb install -r "$$APK"; \
adb shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
android-install-release: android-release
@ABI=$$(adb shell getprop ro.product.cpu.abi | tr -d '\r'); \
APK=droid/app/build/outputs/apk/release/app-$${ABI}-release.apk; \
+8 -4
View File
@@ -35,8 +35,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 35
versionCode 42
versionName "1.4.7"
versionCode 43
versionName "1.4.8"
}
@@ -61,8 +61,12 @@ android {
abi {
enable true
reset()
include 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
universalApk true
def selectedAbis = (project.findProperty('inbe.abis') ?: 'arm64-v8a,armeabi-v7a,x86,x86_64')
.split(',')
.collect { it.trim() }
.findAll { it.length() > 0 }
include(*selectedAbis)
universalApk !project.hasProperty('inbe.abis')
}
}
+5
View File
@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.22)
project(Inbe C)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
endif()
set(REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
set(SRC_DIR "${REPO_ROOT}/src")
set(RAYLIB_DIR "${REPO_ROOT}/vendor/raylib/src")
+1
View File
@@ -2,3 +2,4 @@ android.useAndroidX=true
android.suppressUnsupportedCompileSdk=35
org.gradle.caching=true
org.gradle.parallel=true
android.nativeBuildCache.enabled=true
@@ -0,0 +1,2 @@
### Changed
- Fixed start screen
+4
View File
@@ -195,6 +195,7 @@ EOF
butler
binutils
clickable
ccache
cmake
curl
curl.dev
@@ -254,6 +255,9 @@ EOF
export ANDROID_HOME="${sdk}/libexec/android-sdk"
export ANDROID_SDK_ROOT="${sdk}/libexec/android-sdk"
export ANDROID_NDK_ROOT="${ndkPath}"
export CCACHE_DIR="$PWD/.ccache"
export CCACHE_BASEDIR="$PWD"
export CCACHE_COMPRESS=1
export PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:${pkgConfigPath}:$PKG_CONFIG_PATH"
+2
View File
@@ -1411,6 +1411,8 @@ app_init(void *vapp) {
data_init();
if(app_load_settings(app))
save_settings(app);
app->practice_tab = PRACTICE_TAB_PLAY;
app->practice_config_tab = 0;
if(app->language_needs_save) {
save_settings(app);
app->language_needs_save = 0;
+2 -2
View File
@@ -3,7 +3,7 @@
#define INBE_VERSION_MAJOR 1
#define INBE_VERSION_MINOR 4
#define INBE_VERSION_PATCH 7
#define INBE_VERSION_STRING "1.4.7"
#define INBE_VERSION_PATCH 8
#define INBE_VERSION_STRING "1.4.8"
#endif
+3 -2
View File
@@ -13,7 +13,8 @@ extern int view_height;
static int
meditation_config_content_height(InbeApp *app, int content_w)
{
return meditation_music_measure_settings(app, content_w, 1, 1);
return meditation_music_measure_settings(app, content_w, 1, 1) +
app_content_bottom_reserved(app) + flint_px(24);
}
typedef struct MeditationConfigScrollPageContext {
@@ -50,7 +51,7 @@ meditation_config_screen_draw(InbeApp *app)
}
scroll_y = title_h + flint_px(16);
scroll_h = view_height - scroll_y;
scroll_h = view_height - scroll_y - app_content_bottom_reserved(app) - flint_px(8);
if(scroll_h < 0)
scroll_h = 0;
+6 -3
View File
@@ -287,6 +287,8 @@ whm_config_draw_session_tab(InbeApp *app, int content_x, int content_w, int y)
static int
whm_config_content_height(InbeApp *app, int content_w)
{
int bottom_padding = app_content_bottom_reserved(app) + flint_px(24);
if(app->practice_config_tab == 0) {
int span = content_w < flint_px(240) ? content_w : flint_px(240);
int preview_radius = span / 2;
@@ -301,13 +303,14 @@ whm_config_content_height(InbeApp *app, int content_w)
if(app->inbe.progressive_speed)
h += flint_px(58);
h += flint_px(76);
return h;
return h + bottom_padding;
}
return flint_px(66) * 3 +
flint_px(26) + flint_px(52) +
flint_px(76) +
flint_px(36) + flint_px(28);
flint_px(36) + flint_px(28) +
bottom_padding;
}
typedef struct WhmConfigScrollPageContext {
@@ -362,7 +365,7 @@ whm_config_screen_draw(InbeApp *app)
app->settings_scroll = 0;
}
scroll_y = title_h + config_tab_h + config_tab_gap;
scroll_h = view_height - scroll_y;
scroll_h = view_height - scroll_y - app_content_bottom_reserved(app) - flint_px(8);
if(scroll_h < 0)
scroll_h = 0;
+2
View File
@@ -96,6 +96,8 @@ language_screen_draw(InbeApp *app)
flint_text_draw(locale_get("language_label"), dropdown_x, dropdown_y - flint_px(24), label_font, theme_get_text());
if(ui_draw_text_btn(button_x, button_y, locale_get("next_button"), &next_hover)) {
app->main_tab = APP_MAIN_TAB_PRACTICE;
app->practice_tab = PRACTICE_TAB_PLAY;
app_switch_screen(app, InbeScreenStart);
}
+12 -18
View File
@@ -94,26 +94,20 @@ manual_screen_guide_draw_nav(InbeApp *app, ManualGuideNav nav)
DrawLine(0, nav.y + h - 1, view_width, nav.y + h - 1,
flint_darken(theme_get_bg(), 28));
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {(float)inner_x, (float)button_y,
(float)button_size, (float)button_size},
.icon = app->icons[UI_ICON_TYPE_BACKWARD],
.icon_size = flint_px(20),
.icon_padding = button_pad,
.disabled = page <= 0 && !nav.show_left_on_first,
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
if(page > 0) {
if(page > 0) {
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {(float)inner_x, (float)button_y,
(float)button_size, (float)button_size},
.icon = app->icons[UI_ICON_TYPE_BACKWARD],
.icon_size = flint_px(20),
.icon_padding = button_pad,
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
app->tutorial_step = page - 1;
app->manual_scroll = 0;
} else if(nav.show_left_on_first) {
if(nav.close != NULL)
nav.close(app, 1);
else
nav.start(app);
}
}
+19 -20
View File
@@ -245,7 +245,7 @@ practice_screen_prepare_first_run_guide(InbeApp *app)
return;
step = clampi(app->tutorial_step, 0, PRACTICE_GUIDE_STEPS - 1);
if(step <= 1)
if(step == 1)
app->practice_tab = PRACTICE_TAB_MANUAL;
else
app->practice_tab = PRACTICE_TAB_PLAY;
@@ -343,7 +343,6 @@ practice_screen_draw_first_run_guide(InbeApp *app)
int tip_h;
Rectangle tip;
int y;
int back_disabled;
int finish;
if(app == NULL || app->tutorial_seen || app->modal.active)
@@ -420,25 +419,25 @@ practice_screen_draw_first_run_guide(InbeApp *app)
(button_size - page_font) / 2,
page_font, theme_get_text());
back_disabled = step <= 0;
finish = step >= PRACTICE_GUIDE_STEPS - 1;
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {
tip.x + tip.width - pad - button_size * 2 - flint_px(8),
tip.y + tip.height - pad - button_size,
(float)button_size,
(float)button_size
},
.icon = app->icons[UI_ICON_TYPE_BACKWARD],
.icon_size = flint_px(19),
.icon_padding = flint_px(7),
.disabled = back_disabled,
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
app->tutorial_step = step - 1;
if(step > 0) {
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {
tip.x + tip.width - pad - button_size * 2 - flint_px(8),
tip.y + tip.height - pad - button_size,
(float)button_size,
(float)button_size
},
.icon = app->icons[UI_ICON_TYPE_BACKWARD],
.icon_size = flint_px(19),
.icon_padding = flint_px(7),
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
app->tutorial_step = step - 1;
}
}
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {
+15 -1
View File
@@ -24,6 +24,8 @@
static long long storage_max_sync_outbox_seq(void);
#define STORAGE_SYNC_BACKFILL_KEY "sync_backfill_v2_done"
static long long
storage_next_change_time(void)
{
@@ -1190,8 +1192,12 @@ storage_build_sync_payload_json(const char *user_id_hash, const char *public_key
if(g_storage.db == NULL || user_id_hash == NULL || user_id_hash[0] == '\0')
return NULL;
if(!migrate_schema())
return NULL;
if(!storage_materialize_session_habit_days())
return NULL;
if(!get_meta_int64(STORAGE_SYNC_BACKFILL_KEY, 0))
storage_enqueue_all_sync_state();
since_server_version = get_meta_int64("sync_last_server_version", 0);
full_upload_done = get_meta_int64("sync_full_upload_done", 0) != 0;
through_seq = storage_max_sync_outbox_seq();
@@ -1331,10 +1337,15 @@ storage_exec_json_user_sql(const char *sql, const char *json)
{
sqlite3_stmt *stmt = NULL;
int rc;
int attempt;
if(g_storage.db == NULL || sql == NULL || json == NULL)
return 0;
if(sqlite3_prepare_v2(g_storage.db, sql, -1, &stmt, NULL) != SQLITE_OK) {
for(attempt = 0; attempt < 2; attempt++) {
if(sqlite3_prepare_v2(g_storage.db, sql, -1, &stmt, NULL) == SQLITE_OK)
break;
if(attempt == 0 && migrate_schema())
continue;
TraceLog(LOG_WARNING, "SYNC: changes SQL prepare failed: %s", sqlite3_errmsg(g_storage.db));
return 0;
}
@@ -1439,6 +1450,8 @@ storage_apply_sync_response_json(const char *response_json)
if(g_storage.db == NULL || response_json == NULL || response_json[0] == '\0')
return 0;
if(!migrate_schema())
return 0;
g_storage.last_sync_changed = 0;
if(!storage_json_valid(response_json))
return 0;
@@ -1466,6 +1479,7 @@ storage_apply_sync_response_json(const char *response_json)
storage_clear_uploaded_outbox(g_storage.pending_sync_outbox_seq);
g_storage.pending_sync_outbox_seq = 0;
set_meta_int64("sync_full_upload_done", 1);
set_meta_int64(STORAGE_SYNC_BACKFILL_KEY, 1);
storage_mark_habits_initialized();
storage_schedule_persist();
return 1;
+48
View File
@@ -250,6 +250,10 @@ test_sync_payload_omits_uploaded_state_after_upload_marker(void)
sqlite3_exec(db,
"INSERT OR REPLACE INTO meta(key,value) VALUES('sync_full_upload_done','1');",
NULL, NULL, NULL) == SQLITE_OK);
check_true("set sync backfill marker raw meta",
sqlite3_exec(db,
"INSERT OR REPLACE INTO meta(key,value) VALUES('sync_backfill_v2_done','1');",
NULL, NULL, NULL) == SQLITE_OK);
if(updated_at > 0) {
char sql[192];
snprintf(sql, sizeof(sql),
@@ -275,6 +279,49 @@ test_sync_payload_omits_uploaded_state_after_upload_marker(void)
remove_tree(root);
}
static void
test_sync_backfill_includes_existing_habits(void)
{
char root[512];
InbeHabits habits;
char *payload;
make_clean_root(root, sizeof(root), "sync-existing-habit-backfill");
check_true("init backfill sync db", storage_init(root));
memset(&habits, 0, sizeof(habits));
habits_add_default_set(&habits);
habits_save(&habits);
storage_close();
{
char db_path[512];
sqlite3 *db = NULL;
make_path(db_path, sizeof(db_path), root, "inbe.db");
check_true("open backfill raw db", sqlite3_open(db_path, &db) == SQLITE_OK);
if(db != NULL) {
check_true("mark old full upload done",
sqlite3_exec(db,
"INSERT OR REPLACE INTO meta(key,value) VALUES('sync_full_upload_done','1');",
NULL, NULL, NULL) == SQLITE_OK);
check_true("clear old outbox",
sqlite3_exec(db, "DELETE FROM sync_outbox;", NULL, NULL, NULL) == SQLITE_OK);
sqlite3_close(db);
}
}
check_true("reopen backfill sync db", storage_init(root));
payload = storage_build_sync_payload_json("test-hash", "test-public-key");
check_true("existing habit included by one-time sync backfill",
payload != NULL &&
strstr(payload, "\"habits\":[{") != NULL &&
strstr(payload, "\"habit_days\"") != NULL);
storage_free_sync_payload_json(payload);
storage_close();
remove_tree(root);
}
static void
test_sync_payload_includes_queued_current_edits(void)
{
@@ -1212,6 +1259,7 @@ main(void)
test_tickmate_reimport_recovers_counter_data();
test_external_tickmate_db_import();
test_sync_payload_omits_uploaded_state_after_upload_marker();
test_sync_backfill_includes_existing_habits();
test_sync_payload_includes_queued_current_edits();
test_sync_outbox_preserves_edits_after_snapshot();
test_sync_apply_preserves_counter_counts();
+4 -4
View File
@@ -3,8 +3,8 @@
IDI_APP_ICON ICON "inbe.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,7,0
PRODUCTVERSION 1,4,7,0
FILEVERSION 1,4,8,0
PRODUCTVERSION 1,4,8,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -21,11 +21,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "waozi"
VALUE "FileDescription", "Inner Breeze"
VALUE "FileVersion", "1.4.7"
VALUE "FileVersion", "1.4.8"
VALUE "InternalName", "inbe"
VALUE "OriginalFilename", "inbe-windows-x86_64.exe"
VALUE "ProductName", "Inner Breeze"
VALUE "ProductVersion", "1.4.7"
VALUE "ProductVersion", "1.4.8"
END
END
BLOCK "VarFileInfo"