Release Inbe 1.8.9

This commit is contained in:
waozi committed 2026-07-17 17:35:00 -03:00
1 parent 5e350e1f5c
commit 12705f06a6
72 files changed
+2442 -668

No files matched your search

+3
View File
@@ -1,6 +1,7 @@
build-essential
ca-certificates
curl
dpkg
libcurl4-openssl-dev
libdrm-dev
libdrm2
@@ -20,4 +21,6 @@ libsdl2-2.0-0
libsdl2-dev
patchelf
pkg-config
podman
rpm
zip
+1 -1
View File
@@ -88,7 +88,7 @@ jobs:
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
- name: Set up Node.js
uses: actions/setup-node
uses: actions/setup-node@v4
with:
node-version: 22
+35 -1
View File
@@ -85,7 +85,7 @@ jobs:
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
- name: Set up Node.js
uses: actions/setup-node
uses: actions/setup-node@v4
with:
node-version: 22
@@ -303,6 +303,40 @@ jobs:
find build/dist/linux -maxdepth 1 -type f -name '*.AppImage' -exec cp {} build/release/linux/ \;
test -n "$(find build/release/linux -type f -print -quit)"
- name: Build Debian Package
run: |
set -euo pipefail
make deb
find build/dist/deb -maxdepth 1 -type f -name '*.deb' -exec cp {} build/release/linux/ \;
deb="$(find build/release/linux -maxdepth 1 -type f -name '*.deb' | head -n 1)"
test -n "$deb"
dpkg-deb --info "$deb"
dpkg-deb --contents "$deb" >/dev/null
- name: Build RPM Package
run: |
set -euo pipefail
make rpm
find build/dist/rpm -maxdepth 1 -type f -name '*.rpm' -exec cp {} build/release/linux/ \;
rpm_package="$(find build/release/linux -maxdepth 1 -type f -name '*.rpm' | head -n 1)"
test -n "$rpm_package"
rpm -qip "$rpm_package"
rpm -qlp "$rpm_package" >/dev/null
- name: Build Snap Package
run: |
set -euo pipefail
make snap
find build/dist/snap -maxdepth 1 -type f -name '*.snap' -exec cp {} build/release/linux/ \;
test -n "$(find build/release/linux -maxdepth 1 -type f -name '*.snap' -print -quit)"
- name: Build Flatpak Bundle
run: |
set -euo pipefail
make flatpak
find build/dist/flatpak -maxdepth 1 -type f -name '*.flatpak' -exec cp {} build/release/linux/ \;
test -n "$(find build/release/linux -maxdepth 1 -type f -name '*.flatpak' -print -quit)"
- name: Smoke Test Linux AppImage
env:
APPIMAGE_EXTRACT_AND_RUN: "1"
+7
View File
@@ -1,4 +1,11 @@
# Changelog
## [1.8.9] - 2026-07-17
### Changed
- Fixed Android native builds by embedding the current Noto font sources instead of stale generated `assets/fonts/ui.*` files.
- Fixed Android UI font loading by enabling TTF/OTF support in the Android raylib build.
- Updated sun-salutation assets to use pose sheets while keeping the figure setting focused on the man sequence for now.
- Improved release packaging automation, Linux package targets, and store metadata.
## [1.8.8] - 2026-07-13
### Changed
- Updated Flint icon integration to use categorized sprite sheets for app UI, language, payments, platforms, tiles, and profile pictures.
+208 -32
View File
@@ -41,6 +41,51 @@ LINUX_APPIMAGE_APPRUN := $(LINUX_APPIMAGE_DIR)/AppRun
LINUX_APPIMAGE_DESKTOP := $(LINUX_APPIMAGE_DIR)/$(APP_NAME).desktop
LINUX_APPIMAGE_ICON := $(LINUX_APPIMAGE_DIR)/$(APP_NAME).png
LINUX_APPIMAGE_APPDATA := $(LINUX_APPIMAGE_DIR)/$(APP_NAME).appdata.xml
DEB_BUILD_DIR := $(BUILD_OBJ_DIR)/deb
DEB_ROOT := $(DEB_BUILD_DIR)/root
DEB_DIST_DIR := $(BUILD_DIST_DIR)/deb
DEB_ARCH ?= $(if $(filter x86_64 amd64,$(ARCH)),amd64,$(if $(filter aarch64 arm64,$(ARCH)),arm64,$(ARCH)))
DEB_BIN_SOURCE ?=
DEB_BIN_INPUT = $(if $(strip $(DEB_BIN_SOURCE)),$(DEB_BIN_SOURCE),$(if $(filter linux,$(NATIVE_PLATFORM)),$(TARGET),))
DEB_PACKAGE_NAME ?= $(APP_NAME)
DEB_MAINTAINER ?= $(APP_MAINTAINER)
DEB_SECTION ?= utils
DEB_PRIORITY ?= optional
DEB_DEPENDS ?= libc6, libsdl2-2.0-0, libgtk-3-0, libcurl4, libdrm2, libgbm1, libegl1, libgles2, hicolor-icon-theme
DEB_TARGET = $(DEB_DIST_DIR)/$(DEB_PACKAGE_NAME)_$(APP_VERSION)_$(DEB_ARCH).deb
DEB_TARGET_PREREQS = Makefile $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPIMAGE_ICON) $(LINUX_APPIMAGE_APPDATA) $(VERSION_FILE) $(if $(filter linux,$(NATIVE_PLATFORM)),$(TARGET),)
RPM_BUILD_DIR := $(BUILD_OBJ_DIR)/rpm
RPM_TOPDIR := $(RPM_BUILD_DIR)/rpmbuild
RPM_DIST_DIR := $(BUILD_DIST_DIR)/rpm
RPM_ARCH ?= $(if $(filter x86_64 amd64,$(ARCH)),x86_64,$(if $(filter aarch64 arm64,$(ARCH)),aarch64,$(ARCH)))
RPM_BIN_SOURCE ?=
RPM_BIN_INPUT = $(if $(strip $(RPM_BIN_SOURCE)),$(RPM_BIN_SOURCE),$(if $(filter linux,$(NATIVE_PLATFORM)),$(TARGET),))
RPM_PACKAGE_NAME ?= $(APP_NAME)
RPM_RELEASE ?= 1
RPM_LICENSE ?= BSD-3-Clause
RPM_REQUIRES ?= glibc, SDL2, gtk3, libcurl, libdrm, mesa-libgbm, mesa-libEGL, mesa-libGLES, hicolor-icon-theme
RPM_SPEC := $(RPM_BUILD_DIR)/$(RPM_PACKAGE_NAME).spec
RPM_TARGET = $(RPM_DIST_DIR)/$(RPM_PACKAGE_NAME)-$(APP_VERSION)-$(RPM_RELEASE).$(RPM_ARCH).rpm
RPM_TARGET_PREREQS = Makefile $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPIMAGE_ICON) $(LINUX_APPIMAGE_APPDATA) $(VERSION_FILE) $(if $(filter linux,$(NATIVE_PLATFORM)),$(TARGET),)
PODMAN ?= $(shell if [ "$(UNAME_S)" = "FreeBSD" ] && [ "$$(id -u)" != "0" ]; then \
if command -v doas >/dev/null 2>&1; then printf 'doas podman'; \
elif command -v sudo >/dev/null 2>&1; then printf 'sudo podman'; \
else printf 'podman'; fi; \
else printf 'podman'; fi)
PODMAN_RUN_PLATFORM ?= $(if $(filter FreeBSD,$(UNAME_S)),--os linux --arch amd64,)
PODMAN_RUN_NETWORK ?= $(if $(filter FreeBSD,$(UNAME_S)),--network host,)
SNAP_BUILD_DIR := $(BUILD_OBJ_DIR)/snap
SNAP_DIST_DIR := $(BUILD_DIST_DIR)/snap
SNAP_IMAGE ?= docker.io/snapcore/snapcraft:latest
SNAP_APT_CACHE_VOLUME ?= $(APP_NAME)-snap-apt-cache
SNAP_ROOT_CACHE_VOLUME ?= $(APP_NAME)-snap-root-cache
SNAP_CACHE_VOLUMES := $(SNAP_APT_CACHE_VOLUME) $(SNAP_ROOT_CACHE_VOLUME)
SNAP_TARGET = $(SNAP_DIST_DIR)/$(APP_NAME)_$(APP_VERSION)_$(ARCH).snap
FLATPAK_BUILD_DIR := $(BUILD_OBJ_DIR)/flatpak
FLATPAK_DIST_DIR := $(BUILD_DIST_DIR)/flatpak
FLATPAK_IMAGE ?= ghcr.io/flathub-infra/flatpak-github-actions:gnome-46
FLATPAK_MANIFEST = packaging/flatpak/$(APP_ID).yml
FLATPAK_TARGET = $(FLATPAK_DIST_DIR)/$(APP_NAME)-$(APP_VERSION)-$(ARCH).flatpak
APP_ID := $(ANDROID_APP_ID)
APP_COMMENT := Syncable breathing, meditation, and habit practice app
APP_DESC := Inner Breeze is a free, open-source practice app for breathing, meditation, and habit tracking.
@@ -90,7 +135,7 @@ WEB_OBJ_DIR := $(BUILD_OBJ_DIR)/web
WEB_DIST_DIR := $(BUILD_DIST_DIR)/web
CHROME_WEB_STORE_DIR := $(BUILD_DIST_DIR)/chrome-web-store
VERSION_FILE := src/core/version.h
APP_VERSION := $(shell sed -n 's/^#define INBE_VERSION_STRING "\([^"]*\)".*/\1/p' $(VERSION_FILE) 2>/dev/null)
APP_VERSION := $(shell awk '/INBE_VERSION_STRING/ { print $$3; exit }' $(VERSION_FILE) 2>/dev/null | tr -d '"')
FLINT_DIR ?= vendor/flint
RAYLIB_DIR = $(FLINT_DIR)/vendor/raylib/src
@@ -193,7 +238,7 @@ CURL_INCLUDE_DIR := $(FLINT_CURL_INCLUDE_DIR)
CURL_LIB_DIR := $(FLINT_CURL_LIB_DIR)
CURL_SO := $(FLINT_CURL_SO)
CURL_PROTOCOL_CHECK := $(FLINT_CURL_PROTOCOL_CHECK)
FLINT_CURL_VERSION_NUM ?= $(shell printf '%s\n' '#include <curl/curlver.h>' 'LIBCURL_VERSION_NUM' | $(CC) -I$(FLINT_CURL_DIR)/include -E -P - 2>/dev/null | tail -n 1)
FLINT_CURL_VERSION_NUM ?= $(shell printf '%b\n' '\043include <curl/curlver.h>' 'LIBCURL_VERSION_NUM' | $(CC) -I$(FLINT_CURL_DIR)/include -E -P - 2>/dev/null | tail -n 1)
FLINT_CURL_VERSION_HEX := $(patsubst 0x%,%,$(FLINT_CURL_VERSION_NUM))
SQLITE_DIR := vendor/sqlite
SQLITE_BUILD_DIR := $(VENDOR_BUILD_DIR)/sqlite
@@ -299,14 +344,16 @@ SYSTEM_THEME_LDLIBS := $(shell pkg-config --libs $(SYSTEM_THEME_PKG))
endif
LOCALE_FILES := $(wildcard locales/*.txt)
IMAGE_FILES := assets/app/icon.png assets/easteregg/art.png assets/easteregg/waozi.png assets/practices/whm/1.png assets/practices/whm/2.png assets/practices/meditation/1.png assets/pet/egg1.png $(wildcard assets/practices/*/banner.png) $(wildcard assets/practices/sunsalutation/pos_*.png)
IMAGE_FILES := assets/app/icon.png assets/easteregg/art.png assets/easteregg/waozi.png assets/practices/whm/1.png assets/practices/whm/2.png assets/practices/meditation/1.png assets/pet/egg1.png $(wildcard assets/practices/*/banner.png) assets/practices/sunsalutation/poses_man_sheet.png assets/practices/sunsalutation/poses_woman_sheet.png
SOUND_FILES := $(wildcard assets/sounds/*.ogg)
FONT_OUTPUTS := assets/fonts/locales.png assets/fonts/locales.dat
OTFCHOP_DIR ?= $(FLINT_DIR)/tools/otfchop
FONT_TOOL := $(OTFCHOP_DIR)/otfchop
FONT_SOURCE := $(OTFCHOP_DIR)/unifont-17.0.04.otf
FONT_FILES := \
$(FLINT_DIR)/fonts/noto/NotoSans-Regular.ttf \
$(FLINT_DIR)/fonts/noto/NotoSansSC-Regular.otf \
$(FLINT_DIR)/fonts/noto/NotoSansJP-Regular.otf \
$(FLINT_DIR)/fonts/noto/NotoSansKR-Regular.otf \
$(FLINT_DIR)/fonts/noto/NotoSansTC-Regular.otf
EMBEDDED_ASSETS_C := $(BUILD_OBJ_DIR)/$(APP_NAME)_embedded_assets.c
EMBEDDED_ASSET_FILES := $(LOCALE_FILES) $(IMAGE_FILES) $(SOUND_FILES) $(FONT_OUTPUTS)
EMBEDDED_ASSET_FILES := $(LOCALE_FILES) $(IMAGE_FILES) $(SOUND_FILES) $(FONT_FILES)
SRC := $(APP_SRCS) $(EMBEDDED_ASSETS_C)
WEB_APP_SRCS := $(filter-out src/platform/inbe_desktop_tray.c,$(APP_SRCS))
WEB_SRC := $(WEB_APP_SRCS) $(EMBEDDED_ASSETS_C)
@@ -406,8 +453,8 @@ MEDITATION_AUDIO_TRACKS := \
include $(FLINT_DIR)/mk/package-freebsd.mk
.PHONY: all native install install-user uninstall stage package-freebsd validate-desktop 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-native clean-vendor-builds android-avd android-check-keystore android-copy-assets android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site chrome-web-store firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click
.PHONY: all native install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop 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-native clean-vendor-builds android-avd android-check-keystore android-copy-assets android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site chrome-web-store firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click deb package-deb rpm package-rpm snap package-snap flatpak package-flatpak
all: native
@@ -439,6 +486,17 @@ dist:
appimage: $(APPIMAGE_TARGET)
deb package-deb: $(DEB_TARGET)
rpm package-rpm: $(RPM_TARGET)
snap package-snap: $(SNAP_TARGET)
snap-cache-clean: podman-check
$(PODMAN) volume rm -f $(SNAP_CACHE_VOLUMES)
flatpak package-flatpak: $(FLATPAK_TARGET)
click: $(CLICK_TARGET)
click-verify: $(CLICK_TARGET)
@@ -529,22 +587,23 @@ $(SYNC_URL_TEST): tests/sync_url_test.c src/storage/sync_client.c src/storage/sy
tests/sync_url_test.c src/storage/sync_client.c $(FLINT_DIR)/src/lyra/lyra_sync.c $(FLINT_DIR)/src/lyra/lyra_account.c \
$(LIBOQS_A) -Wl,--gc-sections $(FLINT_CURL_LDLIBS) $(NATIVE_SYSTEM_LDLIBS)
$(SYNC_ACCOUNT_TEST): tests/sync_account_test.c src/storage/sync_account.c src/storage/sync_account.h $(FLINT_DIR)/src/lyra/lyra_account.c $(FLINT_DIR)/include/lyra_account.h src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/storage/storage.h src/storage/db.h src/storage/import.h src/third_party/miniz.c src/third_party/miniz.h $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(LIBOQS_A) | $(TEST_BIN_DIR)
$(SYNC_ACCOUNT_TEST): tests/sync_account_test.c tests/test_locale_stub.c src/storage/sync_account.c src/storage/sync_account.h $(FLINT_DIR)/src/lyra/lyra_account.c $(FLINT_DIR)/include/lyra_account.h src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/storage/storage.h src/storage/db.h src/storage/import.h src/third_party/miniz.c src/third_party/miniz.h $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(LIBOQS_A) | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE -D_GNU_SOURCE -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -DHAS_LIBOQS=1 -ffunction-sections -fdata-sections \
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/practices -Isrc/practices/whm -Isrc/practices/meditation -Isrc/storage -Isrc/platform/android -Isrc/third_party $(FLINT_INCLUDE) $(LIBOQS_INCLUDE) $(SQLITE_INCLUDE) \
-o $@ \
tests/sync_account_test.c src/storage/sync_account.c $(FLINT_DIR)/src/lyra/lyra_account.c src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/third_party/miniz.c $(SQLITE_SRC) \
tests/sync_account_test.c tests/test_locale_stub.c src/storage/sync_account.c $(FLINT_DIR)/src/lyra/lyra_account.c src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/third_party/miniz.c $(SQLITE_SRC) \
$(LIBOQS_A) -Wl,--gc-sections $(NATIVE_SYSTEM_LDLIBS)
$(SYNC_REVIEW_TEST): tests/sync_review_test.c src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/storage/storage.h src/storage/db.h src/storage/import.h src/screens/habits_screen.c src/screens/habits_screen.h src/third_party/miniz.c src/third_party/miniz.h $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) | $(TEST_BIN_DIR)
$(SYNC_REVIEW_TEST): tests/sync_review_test.c tests/test_locale_stub.c src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/storage/storage.h src/storage/db.h src/storage/import.h src/screens/habits_screen.c src/screens/habits_screen.h src/third_party/miniz.c src/third_party/miniz.h $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE -D_GNU_SOURCE -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES -ffunction-sections -fdata-sections \
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/practices -Isrc/practices/whm -Isrc/practices/meditation -Isrc/storage -Isrc/platform/android -Isrc/third_party $(FLINT_INCLUDE) $(SQLITE_INCLUDE) \
-o $@ \
tests/sync_review_test.c src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/screens/habits_screen.c src/third_party/miniz.c $(SQLITE_SRC) \
tests/sync_review_test.c tests/test_locale_stub.c src/storage/storage.c src/storage/storage_sessions.c src/storage/sync_review.c src/storage/db.c src/storage/import.c src/screens/habits_screen.c src/third_party/miniz.c $(SQLITE_SRC) \
-Wl,--gc-sections $(NATIVE_SYSTEM_LDLIBS)
$(FONT_LOCALE_TEST): tests/font_locale_test.c $(FONT_OUTPUTS) | $(TEST_BIN_DIR)
$(FONT_LOCALE_TEST): tests/font_locale_test.c $(FONT_FILES) | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE \
-DFLINT_DIR=\"$(FLINT_DIR)\" \
-o $@ \
tests/font_locale_test.c
@@ -560,23 +619,14 @@ $(APP_BOTTOM_NAV_TEST): tests/app_bottom_nav_test.c src/app/app_nav.c src/app/ap
-o $@ \
tests/app_bottom_nav_test.c
$(sort $(BUILD_OBJ_DIR) $(NATIVE_OBJ_DIR) $(NATIVE_BIN_DIR) $(NATIVE_DIST_DIR) $(LINUX_BIN_DIR) $(LINUX_DIST_DIR) $(LINUX_APPIMAGE_BUILD_DIR) $(CLICK_BIN_DIR) $(CLICK_BUILD_DIR) $(CLICK_DIST_DIR) $(WINDOWS_DIST_DIR) $(ANDROID_BUILD_DIR) $(TEST_BIN_DIR) $(WEB_OBJ_DIR) $(WEB_DIST_DIR) $(CHROME_WEB_STORE_DIR) $(FIREFOX_ADDONS_DIR)):
$(sort $(BUILD_OBJ_DIR) $(NATIVE_OBJ_DIR) $(NATIVE_BIN_DIR) $(NATIVE_DIST_DIR) $(LINUX_BIN_DIR) $(LINUX_DIST_DIR) $(LINUX_APPIMAGE_BUILD_DIR) $(DEB_BUILD_DIR) $(DEB_DIST_DIR) $(RPM_BUILD_DIR) $(RPM_DIST_DIR) $(SNAP_BUILD_DIR) $(SNAP_DIST_DIR) $(FLATPAK_BUILD_DIR) $(FLATPAK_DIST_DIR) $(CLICK_BIN_DIR) $(CLICK_BUILD_DIR) $(CLICK_DIST_DIR) $(WINDOWS_DIST_DIR) $(ANDROID_BUILD_DIR) $(TEST_BIN_DIR) $(WEB_OBJ_DIR) $(WEB_DIST_DIR) $(CHROME_WEB_STORE_DIR) $(FIREFOX_ADDONS_DIR)):
mkdir -p $@
$(WINDOWS_BIN_DIR)/$(WIN64_ARCH) $(WINDOWS_BIN_DIR)/$(WIN32_ARCH):
mkdir -p $@
assets/fonts:
mkdir -p $@
FORCE:
$(FONT_TOOL): $(OTFCHOP_DIR)/otfchop.c $(OTFCHOP_DIR)/stb_truetype.h $(OTFCHOP_DIR)/stb_image_write.h
$(MAKE) -C $(OTFCHOP_DIR) otfchop
assets/fonts/locales.png assets/fonts/locales.dat: $(LOCALE_FILES) $(FONT_TOOL) | assets/fonts
$(FONT_TOOL) $(FONT_SOURCE) $(LOCALE_FILES) assets/fonts/locales
$(EMBEDDED_ASSETS_C): Makefile $(EMBEDDED_ASSET_FILES) $(FLINT_DIR)/scripts/embed-assets.sh | $(BUILD_OBJ_DIR)
sh $(FLINT_DIR)/scripts/embed-assets.sh $@ $(EMBEDDED_ASSET_FILES)
@@ -722,7 +772,7 @@ $(WIN32_LIBOQS_A): $(LIBOQS_DIR)/CMakeLists.txt
-DOQS_MINIMAL_BUILD=$(FLINT_LIBOQS_MINIMAL_BUILD)
$(CMAKE) --build $(WIN32_LIBOQS_BUILD_DIR) --target oqs
$(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(RAYLIB_A) $(LIBOQS_A) $(CURL_PROTOCOL_CHECK) | $(NATIVE_BIN_DIR)
$(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(RAYLIB_A) $(LIBOQS_A) $(CURL_PROTOCOL_CHECK) | $(NATIVE_BIN_DIR)
$(CC) $(CFLAGS) \
$(APP_INCLUDE) \
$(FLINT_INCLUDE) \
@@ -745,7 +795,7 @@ $(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQL
$(NATIVE_SYSTEM_LDLIBS) \
$(LDFLAGS)
$(CLICK_BIN): Makefile $(SRC) $(FLINT_CLICK_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(CLICK_RAYLIB_A) $(CLICK_LIBOQS_A) | $(CLICK_BIN_DIR)
$(CLICK_BIN): Makefile $(SRC) $(FLINT_CLICK_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(CLICK_RAYLIB_A) $(CLICK_LIBOQS_A) | $(CLICK_BIN_DIR)
$(AARCH64_CC) $(CLICK_CFLAGS) \
$(APP_INCLUDE) \
$(FLINT_INCLUDE) \
@@ -827,7 +877,7 @@ $(CLICK_TARGET): Makefile $(CLICK_BIN_INPUT) $(CLICK_DIR)/inbe.apparmor $(CLICK_
fi
test -f $@
$(WIN64_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WIN64_RAYLIB_A) $(WIN64_CURL_A) $(WIN64_LIBOQS_A) | $(WINDOWS_BIN_DIR)/$(WIN64_ARCH)
$(WIN64_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(WIN64_RAYLIB_A) $(WIN64_CURL_A) $(WIN64_LIBOQS_A) | $(WINDOWS_BIN_DIR)/$(WIN64_ARCH)
$(WIN64_CC) $(WINDOWS_CFLAGS) \
$(APP_INCLUDE) \
$(FLINT_INCLUDE) \
@@ -849,7 +899,7 @@ $(WIN64_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(FLINT_ICON_STAMP) $(SQL
$(WINDOWS_LDFLAGS)
$(WIN64_STRIP) $@
$(WIN32_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WIN32_RAYLIB_A) $(WIN32_CURL_A) $(WIN32_LIBOQS_A) | $(WINDOWS_BIN_DIR)/$(WIN32_ARCH)
$(WIN32_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(WIN32_RAYLIB_A) $(WIN32_CURL_A) $(WIN32_LIBOQS_A) | $(WINDOWS_BIN_DIR)/$(WIN32_ARCH)
$(WIN32_CC) $(WINDOWS_CFLAGS) \
$(APP_INCLUDE) \
$(FLINT_INCLUDE) \
@@ -939,7 +989,131 @@ $(APPIMAGE_TARGET): $(TARGET) $(LINUX_APPIMAGE_APPRUN) $(LINUX_APPIMAGE_DESKTOP)
--output appimage
test -f $@
$(WEB_JS_TARGET): Makefile $(WEB_SRC) $(FLINT_WEB_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_OUTPUTS) $(EMBEDDED_ASSETS_C) $(WEB_RAYLIB_A) $(WEB_LIBOQS_A) web-tools-check | $(WEB_DIST_DIR)
deb-check:
@command -v dpkg-deb >/dev/null 2>&1 || { \
echo "dpkg-deb is missing. On FreeBSD install it with: pkg install dpkg"; \
echo "To build a Debian package on FreeBSD, pass DEB_BIN_SOURCE=/path/to/linux/inbe."; \
exit 1; \
}
@if [ -z "$(strip $(DEB_BIN_INPUT))" ]; then \
echo "No Linux binary is available for the Debian package."; \
echo "Run this target on Linux, or on FreeBSD pass DEB_BIN_SOURCE=/path/to/linux/inbe."; \
exit 1; \
fi
$(DEB_TARGET): $(DEB_TARGET_PREREQS) deb-check | $(DEB_BUILD_DIR) $(DEB_DIST_DIR)
rm -rf $(DEB_ROOT)
mkdir -p $(DEB_ROOT)/DEBIAN $(DEB_ROOT)/usr/bin $(DEB_ROOT)/usr/share/applications $(DEB_ROOT)/usr/share/icons/hicolor/512x512/apps $(DEB_ROOT)/usr/share/metainfo
cp $(DEB_BIN_INPUT) $(DEB_ROOT)/usr/bin/$(APP_NAME)
chmod 755 $(DEB_ROOT)/usr/bin/$(APP_NAME)
cp $(LINUX_APPIMAGE_DESKTOP) $(DEB_ROOT)/usr/share/applications/$(APP_NAME).desktop
cp $(LINUX_APPIMAGE_ICON) $(DEB_ROOT)/usr/share/icons/hicolor/512x512/apps/$(APP_NAME).png
sed -e 's/<release version="[^"]*"/<release version="$(APP_VERSION)"/' \
$(LINUX_APPIMAGE_APPDATA) > $(DEB_ROOT)/usr/share/metainfo/$(ANDROID_APP_ID).metainfo.xml
@installed_size=$$(find $(DEB_ROOT)/usr -type f -exec wc -c {} + | awk '$$2 != "total" { bytes += $$1 } END { print int((bytes + 1023) / 1024) }'); \
{ \
printf 'Package: %s\n' '$(DEB_PACKAGE_NAME)'; \
printf 'Version: %s\n' '$(APP_VERSION)'; \
printf 'Architecture: %s\n' '$(DEB_ARCH)'; \
printf 'Maintainer: %s\n' '$(DEB_MAINTAINER)'; \
printf 'Section: %s\n' '$(DEB_SECTION)'; \
printf 'Priority: %s\n' '$(DEB_PRIORITY)'; \
printf 'Installed-Size: %s\n' "$$installed_size"; \
printf 'Depends: %s\n' '$(DEB_DEPENDS)'; \
printf 'Homepage: %s\n' '$(APP_WWW)'; \
printf 'Description: %s\n' '$(APP_COMMENT)'; \
printf ' %s\n' '$(APP_DESC)'; \
} > $(DEB_ROOT)/DEBIAN/control
rm -f $(DEB_DIST_DIR)/$(DEB_PACKAGE_NAME)_*_$(DEB_ARCH).deb
dpkg-deb --build --root-owner-group $(DEB_ROOT) $(DEB_TARGET)
test -f $@
rpm-check:
@command -v rpmbuild >/dev/null 2>&1 || { \
echo "rpmbuild is missing. On FreeBSD install it with: pkg install rpm4"; \
echo "To build an RPM package on FreeBSD, pass RPM_BIN_SOURCE=/path/to/linux/inbe."; \
exit 1; \
}
@if [ -z "$(strip $(RPM_BIN_INPUT))" ]; then \
echo "No Linux binary is available for the RPM package."; \
echo "Run this target on Linux, or on FreeBSD pass RPM_BIN_SOURCE=/path/to/linux/inbe."; \
exit 1; \
fi
$(RPM_TARGET): $(RPM_TARGET_PREREQS) rpm-check | $(RPM_BUILD_DIR) $(RPM_DIST_DIR)
rm -rf $(RPM_TOPDIR)
mkdir -p $(RPM_TOPDIR)/BUILD $(RPM_TOPDIR)/BUILDROOT $(RPM_TOPDIR)/RPMS $(RPM_TOPDIR)/SOURCES $(RPM_TOPDIR)/SPECS $(RPM_TOPDIR)/SRPMS
{ \
printf '%s\n' 'Name: $(RPM_PACKAGE_NAME)'; \
printf '%s\n' 'Version: $(APP_VERSION)'; \
printf '%s\n' 'Release: $(RPM_RELEASE)%{?dist}'; \
printf '%s\n' 'Summary: $(APP_COMMENT)'; \
printf '%s\n' 'License: $(RPM_LICENSE)'; \
printf '%s\n' 'URL: $(APP_WWW)'; \
printf '%s\n' 'Requires: $(RPM_REQUIRES)'; \
printf '%s\n' ''; \
printf '%s\n' '%description'; \
printf '%s\n' '$(APP_DESC)'; \
printf '%s\n' ''; \
printf '%s\n' '%prep'; \
printf '%s\n' ''; \
printf '%s\n' '%build'; \
printf '%s\n' ''; \
printf '%s\n' '%install'; \
printf '%s\n' 'rm -rf %{buildroot}'; \
printf '%s\n' 'mkdir -p %{buildroot}/usr/bin %{buildroot}/usr/share/applications %{buildroot}/usr/share/icons/hicolor/512x512/apps %{buildroot}/usr/share/metainfo'; \
printf '%s\n' 'cp "$(abspath $(RPM_BIN_INPUT))" %{buildroot}/usr/bin/$(APP_NAME)'; \
printf '%s\n' 'chmod 755 %{buildroot}/usr/bin/$(APP_NAME)'; \
printf '%s\n' 'cp "$(abspath $(LINUX_APPIMAGE_DESKTOP))" %{buildroot}/usr/share/applications/$(APP_NAME).desktop'; \
printf '%s\n' 'cp "$(abspath $(LINUX_APPIMAGE_ICON))" %{buildroot}/usr/share/icons/hicolor/512x512/apps/$(APP_NAME).png'; \
printf '%s\n' 'sed -e '\''s/<release version="[^"]*"/<release version="$(APP_VERSION)"/'\'' "$(abspath $(LINUX_APPIMAGE_APPDATA))" > %{buildroot}/usr/share/metainfo/$(ANDROID_APP_ID).metainfo.xml'; \
printf '%s\n' ''; \
printf '%s\n' '%files'; \
printf '%s\n' '/usr/bin/$(APP_NAME)'; \
printf '%s\n' '/usr/share/applications/$(APP_NAME).desktop'; \
printf '%s\n' '/usr/share/icons/hicolor/512x512/apps/$(APP_NAME).png'; \
printf '%s\n' '/usr/share/metainfo/$(ANDROID_APP_ID).metainfo.xml'; \
} > $(RPM_SPEC)
rpmbuild -bb $(RPM_SPEC) \
--target $(RPM_ARCH) \
--define '_topdir $(abspath $(RPM_TOPDIR))' \
--define '_build_id_links none'
rm -f $(RPM_DIST_DIR)/$(RPM_PACKAGE_NAME)-*-$(RPM_RELEASE).$(RPM_ARCH).rpm
created=$$(find $(RPM_TOPDIR)/RPMS -type f -name '$(RPM_PACKAGE_NAME)-$(APP_VERSION)-$(RPM_RELEASE)*.$(RPM_ARCH).rpm' | head -n 1); \
if [ -z "$$created" ]; then echo "rpmbuild did not produce an RPM"; exit 1; fi; \
cp "$$created" $(RPM_TARGET)
test -f $@
podman-check:
@$(PODMAN) --version >/dev/null 2>&1 || { \
echo "podman check failed. Install podman, run with root privileges on FreeBSD, or set PODMAN=/path/to/podman."; \
exit 1; \
}
$(SNAP_TARGET): Makefile packaging/snap/snap/snapcraft.yaml | $(SNAP_BUILD_DIR) $(SNAP_DIST_DIR) podman-check
rm -f $(SNAP_DIST_DIR)/*.snap
$(PODMAN) run $(PODMAN_RUN_PLATFORM) $(PODMAN_RUN_NETWORK) --rm --privileged \
-v "$(SNAP_APT_CACHE_VOLUME):/var/cache/apt/archives" \
-v "$(SNAP_ROOT_CACHE_VOLUME):/root/.cache" \
-v "$(abspath .):/work" \
-w /work \
$(SNAP_IMAGE) \
sh -lc 'set -eu; printf "%s\n" "APT::Cache-Start \"100000000\";" > /etc/apt/apt.conf.d/99cache-start; apt-get update; rm -rf /tmp/inbe-snap; cp -a /work /tmp/inbe-snap; cd /tmp/inbe-snap; rm -rf build snap; mkdir snap; cp packaging/snap/snap/snapcraft.yaml snap/snapcraft.yaml; sed -i "s/^version:.*/version: '\''$(APP_VERSION)'\''/" snap/snapcraft.yaml; snapcraft --destructive-mode; cp *.snap /work/$(SNAP_DIST_DIR)/'
created=$$(find $(SNAP_DIST_DIR) -maxdepth 1 -type f -name '*.snap' | head -n 1); \
if [ -z "$$created" ]; then echo "snapcraft did not produce a snap"; exit 1; fi; \
mv "$$created" $(SNAP_TARGET)
test -f $@
$(FLATPAK_TARGET): Makefile $(FLATPAK_MANIFEST) | $(FLATPAK_BUILD_DIR) $(FLATPAK_DIST_DIR) podman-check
rm -f $(FLATPAK_DIST_DIR)/*.flatpak
$(PODMAN) run $(PODMAN_RUN_PLATFORM) $(PODMAN_RUN_NETWORK) --rm --privileged \
-v "$(abspath .):/work" \
-w /work \
$(FLATPAK_IMAGE) \
sh -lc 'set -eu; rm -rf .flatpak-builder $(FLATPAK_BUILD_DIR)/repo $(FLATPAK_BUILD_DIR)/build-dir; flatpak-builder --disable-rofiles-fuse --force-clean --repo=$(FLATPAK_BUILD_DIR)/repo $(FLATPAK_BUILD_DIR)/build-dir $(FLATPAK_MANIFEST) || { rm -rf $(FLATPAK_BUILD_DIR)/repo $(FLATPAK_BUILD_DIR)/build-dir vendor-builds/linux build/bin/linux; make vendor-prebuilds-native; make native; flatpak build-init $(FLATPAK_BUILD_DIR)/build-dir $(APP_ID) org.gnome.Sdk org.gnome.Platform 46; install -D -m755 "$$(find build/bin/linux -maxdepth 1 -type f -name '\''inbe-linux-*'\'' | head -n 1)" $(FLATPAK_BUILD_DIR)/build-dir/files/bin/inbe; install -D -m644 packaging/linux/appimage/inbe.desktop $(FLATPAK_BUILD_DIR)/build-dir/files/share/applications/$(APP_ID).desktop; sed -i '\''s/^Icon=.*/Icon=$(APP_ID)/'\'' $(FLATPAK_BUILD_DIR)/build-dir/files/share/applications/$(APP_ID).desktop; install -D -m644 packaging/linux/appimage/inbe.png $(FLATPAK_BUILD_DIR)/build-dir/files/share/icons/hicolor/512x512/apps/$(APP_ID).png; install -D -m644 packaging/linux/appimage/inbe.appdata.xml $(FLATPAK_BUILD_DIR)/build-dir/files/share/metainfo/$(APP_ID).metainfo.xml; flatpak build-finish --share=ipc --share=network --socket=fallback-x11 --socket=wayland --socket=pulseaudio --device=dri --filesystem=home $(FLATPAK_BUILD_DIR)/build-dir; flatpak build-export $(FLATPAK_BUILD_DIR)/repo $(FLATPAK_BUILD_DIR)/build-dir; }; flatpak build-bundle $(FLATPAK_BUILD_DIR)/repo $(FLATPAK_TARGET) $(APP_ID)'
test -f $@
$(WEB_JS_TARGET): Makefile $(WEB_SRC) $(FLINT_WEB_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(WEB_RAYLIB_A) $(WEB_LIBOQS_A) web-tools-check | $(WEB_DIST_DIR)
rm -f $(WEB_DIST_DIR)/index.data
$(WEB_CC) $(WEB_CFLAGS) \
$(APP_INCLUDE) \
@@ -980,7 +1154,7 @@ $(WEB_TARGET): src/web_shell.html $(WEB_BOOT_JS) $(WEB_JS_TARGET) manifest.json
cp manifest.json $(WEB_DIST_DIR)/webmanifest.json
android-copy-assets:
$(MAKE) $(FONT_OUTPUTS)
$(MAKE) $(FONT_FILES)
$(MAKE) $(EMBEDDED_ASSETS_C)
rm -rf droid/app/src/main/assets
mkdir -p droid/app/src/main/assets
@@ -1230,7 +1404,9 @@ clean-native:
clean-vendor-builds:
rm -rf $(VENDOR_BUILD_DIR)
NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native install install-user stage package-freebsd run run-fresh dist appimage vendor-prebuilds vendor-prebuilds-native,$(MAKECMDGOALS)),native)
NEEDS_DEB_NATIVE := $(if $(strip $(DEB_BIN_SOURCE)),,$(if $(filter linux,$(NATIVE_PLATFORM)),$(filter deb package-deb,$(MAKECMDGOALS))))
NEEDS_RPM_NATIVE := $(if $(strip $(RPM_BIN_SOURCE)),,$(if $(filter linux,$(NATIVE_PLATFORM)),$(filter rpm package-rpm,$(MAKECMDGOALS))))
NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native install install-user stage package-freebsd run run-fresh dist appimage vendor-prebuilds vendor-prebuilds-native,$(MAKECMDGOALS)) $(NEEDS_DEB_NATIVE) $(NEEDS_RPM_NATIVE),native)
ifneq ($(strip $(NEEDS_NATIVE_ENV)),)
ifeq ($(strip $(RAY_CFLAGS)),)
$(error RAY_CFLAGS is not set. Install pkg-config metadata for $(RAY_PKGS), or set RAY_CFLAGS explicitly)
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 934 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+2 -2
View File
@@ -35,8 +35,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 35
versionCode 83
versionName "1.8.8"
versionCode 84
versionName "1.8.9"
}
+8 -11
View File
@@ -46,16 +46,13 @@ set(INBE_EMBEDDED_INPUTS
assets/practices/meditation/1.png
assets/pet/egg1.png
${INBE_PRACTICE_BANNER_ASSETS}
assets/practices/sunsalutation/pos_0001.png
assets/practices/sunsalutation/pos_0002.png
assets/practices/sunsalutation/pos_0003.png
assets/practices/sunsalutation/pos_0004.png
assets/practices/sunsalutation/pos_0005.png
assets/practices/sunsalutation/pos_0006.png
assets/practices/sunsalutation/pos_0007.png
assets/practices/sunsalutation/pos_0008.png
assets/fonts/locales.png
assets/fonts/locales.dat
assets/practices/sunsalutation/poses_man_sheet.png
assets/practices/sunsalutation/poses_woman_sheet.png
vendor/flint/fonts/noto/NotoSans-Regular.ttf
vendor/flint/fonts/noto/NotoSansSC-Regular.otf
vendor/flint/fonts/noto/NotoSansJP-Regular.otf
vendor/flint/fonts/noto/NotoSansKR-Regular.otf
vendor/flint/fonts/noto/NotoSansTC-Regular.otf
${INBE_SOUND_ASSETS}
)
set(INBE_EMBEDDED_DEPS)
@@ -100,7 +97,7 @@ target_compile_definitions(raylib PRIVATE
SUPPORT_FILEFORMAT_GIF=0
SUPPORT_FILEFORMAT_QOI=0
SUPPORT_FILEFORMAT_DDS=0
SUPPORT_FILEFORMAT_TTF=0
SUPPORT_FILEFORMAT_TTF=1
SUPPORT_FILEFORMAT_JPG=1
SUPPORT_FILEFORMAT_PNG=1
SUPPORT_FILEFORMAT_OGG=1
@@ -0,0 +1,6 @@
Changed
---
- Fixed Android native builds by embedding the current Noto font sources instead of stale generated `assets/fonts/ui.*` files.
- Fixed Android UI font loading by enabling TTF/OTF support in the Android raylib build.
- Updated sun-salutation assets to use pose sheets while keeping the figure setting focused on the man sequence for now.
- Improved release packaging automation, Linux package targets, and store metadata.
+88
View File
@@ -0,0 +1,88 @@
{
description = "Inner Breeze breathing, meditation, and habit practice app";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
versionLine =
pkgs.lib.lists.findFirst
(line: builtins.match ''#define INBE_VERSION_STRING "([^"]+)".*'' line != null)
null
(pkgs.lib.strings.splitString "\n" (builtins.readFile ./src/core/version.h));
versionMatch = builtins.match ''#define INBE_VERSION_STRING "([^"]+)".*'' versionLine;
in {
default = pkgs.stdenv.mkDerivation rec {
pname = "inbe";
version = builtins.elemAt versionMatch 0;
src = self;
nativeBuildInputs = with pkgs; [
cmake
gnumake
pkg-config
];
buildInputs = with pkgs; [
curl
gtk3
libdrm
libglvnd
mesa
openssl
SDL2
zlib
];
buildPhase = ''
runHook preBuild
make native
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -d "$out/bin"
install -m755 "$(find build/bin/linux -maxdepth 1 -type f -name 'inbe-linux-*' | head -n 1)" "$out/bin/inbe"
install -D -m644 packaging/linux/appimage/inbe.desktop \
"$out/share/applications/inbe.desktop"
install -D -m644 packaging/linux/appimage/inbe.png \
"$out/share/icons/hicolor/512x512/apps/inbe.png"
install -D -m644 packaging/linux/appimage/inbe.appdata.xml \
"$out/share/metainfo/xyz.waozi.inbe.metainfo.xml"
runHook postInstall
'';
meta = with pkgs.lib; {
description = "Syncable breathing, meditation, and habit practice app";
homepage = "https://inbe.waozi.xyz/";
license = licenses.bsd3;
mainProgram = "inbe";
platforms = platforms.linux;
};
};
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/inbe";
};
});
};
}
+50 -2
View File
@@ -70,6 +70,9 @@ Zadny ucet
[profile_add_friend_button]
Pridat pritele
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Prichozi
---
@@ -115,7 +118,7 @@ Wim Hofovo dýchání
Meditace
---
[exercise_sun_salutation]
Sun Salutation
Pozdrav slunci
---
[sun_salutation_work_in_progress]
Pracuje se
@@ -129,6 +132,15 @@ Pocatecni tempo
[sun_salutation_end_speed_label]
Koncove tempo
---
[sun_salutation_figure_label]
Postava
---
[sun_salutation_figure_man]
Muz
---
[sun_salutation_figure_woman]
Zena
---
[sun_salutation_tempo_preview_label]
Nahled tempa
---
@@ -298,7 +310,7 @@ Klidny pruvodce pro dychani, navyky a synchronizaci.
Motiv
---
[theme_mode_label]
Theme mode
Rezim motivu
---
[theme_follow_device]
System
@@ -506,6 +518,42 @@ Inner Breeze
[theme_palette_label]
Paleta
---
[theme_sky]
Nebe
---
[theme_ocean]
Ocean
---
[theme_forest]
Les
---
[theme_sunset]
Zapad slunce
---
[theme_lavender]
Levandule
---
[theme_cherry]
Tresen
---
[theme_dawn]
Usvit
---
[theme_sage]
Salvej
---
[theme_sepia]
Sepie
---
[theme_mono]
Mono
---
[theme_mint]
Mata
---
[theme_cobalt]
Kobalt
---
[orientation_label]
Orientace
---
+50 -2
View File
@@ -70,6 +70,9 @@ Kein Konto
[profile_add_friend_button]
Freund hinzufuegen
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Eingehend
---
@@ -115,7 +118,7 @@ Wim-Hof-Atmung
Meditation
---
[exercise_sun_salutation]
Sun Salutation
Sonnengruß
---
[sun_salutation_work_in_progress]
In Arbeit
@@ -129,6 +132,15 @@ Starttempo
[sun_salutation_end_speed_label]
Endtempo
---
[sun_salutation_figure_label]
Figur
---
[sun_salutation_figure_man]
Mann
---
[sun_salutation_figure_woman]
Frau
---
[sun_salutation_tempo_preview_label]
Tempo-Vorschau
---
@@ -298,7 +310,7 @@ Ein ruhiger Begleiter fuer Atemuebungen, Gewohnheiten und Synchronisierung.
Thema
---
[theme_mode_label]
Theme mode
Themenmodus
---
[theme_follow_device]
System
@@ -506,6 +518,42 @@ Inner Breeze
[theme_palette_label]
Palette
---
[theme_sky]
Himmel
---
[theme_ocean]
Ozean
---
[theme_forest]
Wald
---
[theme_sunset]
Sonnenuntergang
---
[theme_lavender]
Lavendel
---
[theme_cherry]
Kirsche
---
[theme_dawn]
Morgendammerung
---
[theme_sage]
Salbei
---
[theme_sepia]
Sepia
---
[theme_mono]
Mono
---
[theme_mint]
Minze
---
[theme_cobalt]
Kobalt
---
[orientation_label]
Ausrichtung
---
+48
View File
@@ -70,6 +70,9 @@ No account
[profile_add_friend_button]
Add friend
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Incoming
---
@@ -129,6 +132,15 @@ Start tempo
[sun_salutation_end_speed_label]
End tempo
---
[sun_salutation_figure_label]
Figure
---
[sun_salutation_figure_man]
Man
---
[sun_salutation_figure_woman]
Woman
---
[sun_salutation_tempo_preview_label]
Tempo preview
---
@@ -318,6 +330,42 @@ Inner Breeze
[theme_palette_label]
Palette
---
[theme_sky]
Sky
---
[theme_ocean]
Ocean
---
[theme_forest]
Forest
---
[theme_sunset]
Sunset
---
[theme_lavender]
Lavender
---
[theme_cherry]
Cherry
---
[theme_dawn]
Dawn
---
[theme_sage]
Sage
---
[theme_sepia]
Sepia
---
[theme_mono]
Mono
---
[theme_mint]
Mint
---
[theme_cobalt]
Cobalt
---
[orientation_label]
Orientation
---
+51 -3
View File
@@ -70,6 +70,9 @@ Sin cuenta
[profile_add_friend_button]
Anadir amigo
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Entrantes
---
@@ -115,7 +118,7 @@ Respiración Wim Hof
Meditación
---
[exercise_sun_salutation]
Sun Salutation
Saludo al sol
---
[sun_salutation_work_in_progress]
Trabajo en curso
@@ -129,6 +132,15 @@ Tempo inicial
[sun_salutation_end_speed_label]
Tempo final
---
[sun_salutation_figure_label]
Figura
---
[sun_salutation_figure_man]
Hombre
---
[sun_salutation_figure_woman]
Mujer
---
[sun_salutation_tempo_preview_label]
Vista previa del tempo
---
@@ -298,10 +310,10 @@ Un companero tranquilo para respiracion, habitos y sincronizacion.
Tema
---
[theme_mode_label]
Theme mode
Modo de tema
---
[theme_follow_device]
System
Sistema
---
[speed_label]
Velocidad
@@ -506,6 +518,42 @@ Inner Breeze
[theme_palette_label]
Paleta
---
[theme_sky]
Cielo
---
[theme_ocean]
Oceano
---
[theme_forest]
Bosque
---
[theme_sunset]
Atardecer
---
[theme_lavender]
Lavanda
---
[theme_cherry]
Cereza
---
[theme_dawn]
Amanecer
---
[theme_sage]
Salvia
---
[theme_sepia]
Sepia
---
[theme_mono]
Mono
---
[theme_mint]
Menta
---
[theme_cobalt]
Cobalto
---
[orientation_label]
Orientación
---
+51 -3
View File
@@ -70,6 +70,9 @@ Aucun compte
[profile_add_friend_button]
Ajouter un ami
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Recues
---
@@ -115,7 +118,7 @@ Respiration Wim Hof
Méditation
---
[exercise_sun_salutation]
Sun Salutation
Salutation au soleil
---
[sun_salutation_work_in_progress]
Travail en cours
@@ -129,6 +132,15 @@ Tempo initial
[sun_salutation_end_speed_label]
Tempo final
---
[sun_salutation_figure_label]
Silhouette
---
[sun_salutation_figure_man]
Homme
---
[sun_salutation_figure_woman]
Femme
---
[sun_salutation_tempo_preview_label]
Apercu du tempo
---
@@ -301,10 +313,10 @@ Un compagnon discret pour la respiration, les habitudes et la synchronisation.
Thème
---
[theme_mode_label]
Theme mode
Mode du theme
---
[theme_follow_device]
System
Systeme
---
[speed_label]
Vitesse
@@ -509,6 +521,42 @@ Inner Breeze
[theme_palette_label]
Palette
---
[theme_sky]
Ciel
---
[theme_ocean]
Ocean
---
[theme_forest]
Foret
---
[theme_sunset]
Coucher de soleil
---
[theme_lavender]
Lavande
---
[theme_cherry]
Cerise
---
[theme_dawn]
Aube
---
[theme_sage]
Sauge
---
[theme_sepia]
Sepia
---
[theme_mono]
Mono
---
[theme_mint]
Menthe
---
[theme_cobalt]
Cobalt
---
[orientation_label]
Orientation
---
+51 -3
View File
@@ -70,6 +70,9 @@ Tidak ada akun
[profile_add_friend_button]
Tambah teman
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Masuk
---
@@ -115,7 +118,7 @@ Pernapasan Wim Hof
Meditasi
---
[exercise_sun_salutation]
Sun Salutation
Salam Matahari
---
[sun_salutation_work_in_progress]
Sedang dikerjakan
@@ -129,6 +132,15 @@ Tempo awal
[sun_salutation_end_speed_label]
Tempo akhir
---
[sun_salutation_figure_label]
Figur
---
[sun_salutation_figure_man]
Pria
---
[sun_salutation_figure_woman]
Wanita
---
[sun_salutation_tempo_preview_label]
Pratinjau tempo
---
@@ -298,10 +310,10 @@ Pendamping tenang untuk pernapasan, kebiasaan, dan sinkronisasi.
Tema
---
[theme_mode_label]
Theme mode
Mode tema
---
[theme_follow_device]
System
Sistem
---
[speed_label]
Kecepatan
@@ -506,6 +518,42 @@ Inner Breeze
[theme_palette_label]
Palet
---
[theme_sky]
Langit
---
[theme_ocean]
Laut
---
[theme_forest]
Hutan
---
[theme_sunset]
Senja
---
[theme_lavender]
Lavender
---
[theme_cherry]
Ceri
---
[theme_dawn]
Fajar
---
[theme_sage]
Sage
---
[theme_sepia]
Sepia
---
[theme_mono]
Mono
---
[theme_mint]
Mint
---
[theme_cobalt]
Kobalt
---
[orientation_label]
Orientasi
---
+51 -3
View File
@@ -70,6 +70,9 @@ Nessun account
[profile_add_friend_button]
Aggiungi amico
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
In arrivo
---
@@ -115,7 +118,7 @@ Respirazione Wim Hof
Meditazione
---
[exercise_sun_salutation]
Sun Salutation
Saluto al sole
---
[sun_salutation_work_in_progress]
Lavoro in corso
@@ -129,6 +132,15 @@ Tempo iniziale
[sun_salutation_end_speed_label]
Tempo finale
---
[sun_salutation_figure_label]
Figura
---
[sun_salutation_figure_man]
Uomo
---
[sun_salutation_figure_woman]
Donna
---
[sun_salutation_tempo_preview_label]
Anteprima del tempo
---
@@ -298,10 +310,10 @@ Un compagno discreto per respirazione, abitudini e sincronizzazione.
Tema
---
[theme_mode_label]
Theme mode
Modalita tema
---
[theme_follow_device]
System
Sistema
---
[theme_system]
Sistema
@@ -312,6 +324,42 @@ Inner Breeze
[theme_palette_label]
Palette
---
[theme_sky]
Cielo
---
[theme_ocean]
Oceano
---
[theme_forest]
Foresta
---
[theme_sunset]
Tramonto
---
[theme_lavender]
Lavanda
---
[theme_cherry]
Ciliegia
---
[theme_dawn]
Alba
---
[theme_sage]
Salvia
---
[theme_sepia]
Seppia
---
[theme_mono]
Mono
---
[theme_mint]
Menta
---
[theme_cobalt]
Cobalto
---
[orientation_label]
Orientamento
---
+51 -3
View File
@@ -70,6 +70,9 @@ Sync
[profile_add_friend_button]
フレンドを追加
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
受信
---
@@ -115,7 +118,7 @@ Add item
瞑想
---
[exercise_sun_salutation]
Sun Salutation
太陽礼拝
---
[sun_salutation_work_in_progress]
作業中
@@ -129,6 +132,15 @@ Sun Salutation
[sun_salutation_end_speed_label]
終了テンポ
---
[sun_salutation_figure_label]
フィギュア
---
[sun_salutation_figure_man]
男性
---
[sun_salutation_figure_woman]
女性
---
[sun_salutation_tempo_preview_label]
テンポのプレビュー
---
@@ -298,10 +310,10 @@ OK
テーマ
---
[theme_mode_label]
Theme mode
テーマモード
---
[theme_follow_device]
System
システム
---
[speed_label]
速度
@@ -508,6 +520,42 @@ Inner Breeze
[theme_palette_label]
パレット
---
[theme_sky]
空
---
[theme_ocean]
海
---
[theme_forest]
森
---
[theme_sunset]
夕焼け
---
[theme_lavender]
ラベンダー
---
[theme_cherry]
チェリー
---
[theme_dawn]
夜明け
---
[theme_sage]
セージ
---
[theme_sepia]
セピア
---
[theme_mono]
モノ
---
[theme_mint]
ミント
---
[theme_cobalt]
コバルト
---
[orientation_label]
向き
---
+51 -3
View File
@@ -70,6 +70,9 @@ Sync
[profile_add_friend_button]
친구 추가
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
받은 요청
---
@@ -115,7 +118,7 @@ Add item
명상
---
[exercise_sun_salutation]
Sun Salutation
태양 경배
---
[sun_salutation_work_in_progress]
작업 중
@@ -129,6 +132,15 @@ Sun Salutation
[sun_salutation_end_speed_label]
종료 템포
---
[sun_salutation_figure_label]
인물
---
[sun_salutation_figure_man]
남성
---
[sun_salutation_figure_woman]
여성
---
[sun_salutation_tempo_preview_label]
템포 미리보기
---
@@ -298,10 +310,10 @@ Finish
테마
---
[theme_mode_label]
Theme mode
테마 모드
---
[theme_follow_device]
System
시스템
---
[theme_system]
시스템
@@ -312,6 +324,42 @@ Inner Breeze
[theme_palette_label]
팔레트
---
[theme_sky]
하늘
---
[theme_ocean]
바다
---
[theme_forest]
숲
---
[theme_sunset]
노을
---
[theme_lavender]
라벤더
---
[theme_cherry]
체리
---
[theme_dawn]
새벽
---
[theme_sage]
세이지
---
[theme_sepia]
세피아
---
[theme_mono]
모노
---
[theme_mint]
민트
---
[theme_cobalt]
코발트
---
[orientation_label]
화면 방향
---
+51 -3
View File
@@ -70,6 +70,9 @@ Sem conta
[profile_add_friend_button]
Adicionar amigo
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Recebidos
---
@@ -115,7 +118,7 @@ Respiração Wim Hof
Meditação
---
[exercise_sun_salutation]
Sun Salutation
Saudacao ao sol
---
[sun_salutation_work_in_progress]
Trabalho em andamento
@@ -129,6 +132,15 @@ Ritmo inicial
[sun_salutation_end_speed_label]
Ritmo final
---
[sun_salutation_figure_label]
Figura
---
[sun_salutation_figure_man]
Homem
---
[sun_salutation_figure_woman]
Mulher
---
[sun_salutation_tempo_preview_label]
Previa do ritmo
---
@@ -298,10 +310,10 @@ Um companheiro tranquilo para respiracao, habitos e sincronizacao.
Tema
---
[theme_mode_label]
Theme mode
Modo do tema
---
[theme_follow_device]
System
Sistema
---
[speed_label]
Velocidade
@@ -506,6 +518,42 @@ Inner Breeze
[theme_palette_label]
Paleta
---
[theme_sky]
Ceu
---
[theme_ocean]
Oceano
---
[theme_forest]
Floresta
---
[theme_sunset]
Por do sol
---
[theme_lavender]
Lavanda
---
[theme_cherry]
Cereja
---
[theme_dawn]
Amanhecer
---
[theme_sage]
Salvia
---
[theme_sepia]
Sepia
---
[theme_mono]
Mono
---
[theme_mint]
Menta
---
[theme_cobalt]
Cobalto
---
[orientation_label]
Orientação
---
+51 -3
View File
@@ -70,6 +70,9 @@ Sync
[profile_add_friend_button]
Добавить друга
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
Входящие
---
@@ -115,7 +118,7 @@ Add item
Медитация
---
[exercise_sun_salutation]
Sun Salutation
Приветствие солнцу
---
[sun_salutation_work_in_progress]
В работе
@@ -129,6 +132,15 @@ Sun Salutation
[sun_salutation_end_speed_label]
Конечный темп
---
[sun_salutation_figure_label]
Фигура
---
[sun_salutation_figure_man]
Мужчина
---
[sun_salutation_figure_woman]
Женщина
---
[sun_salutation_tempo_preview_label]
Предпросмотр темпа
---
@@ -301,10 +313,10 @@ OK
Тема
---
[theme_mode_label]
Theme mode
Режим темы
---
[theme_follow_device]
System
Система
---
[theme_system]
Системная
@@ -315,6 +327,42 @@ Inner Breeze
[theme_palette_label]
Палитра
---
[theme_sky]
Небо
---
[theme_ocean]
Океан
---
[theme_forest]
Лес
---
[theme_sunset]
Закат
---
[theme_lavender]
Лаванда
---
[theme_cherry]
Вишня
---
[theme_dawn]
Рассвет
---
[theme_sage]
Шалфей
---
[theme_sepia]
Сепия
---
[theme_mono]
Моно
---
[theme_mint]
Мята
---
[theme_cobalt]
Кобальт
---
[orientation_label]
Ориентация
---
+51 -3
View File
@@ -70,6 +70,9 @@ Sync
[profile_add_friend_button]
添加好友
---
[profile_friend_invalid]
Enter @alias or a public ID
---
[profile_incoming_title]
收到
---
@@ -115,7 +118,7 @@ Wim Hof 呼吸
冥想
---
[exercise_sun_salutation]
Sun Salutation
拜日式
---
[sun_salutation_work_in_progress]
进行中
@@ -129,6 +132,15 @@ Sun Salutation
[sun_salutation_end_speed_label]
结束节奏
---
[sun_salutation_figure_label]
体型
---
[sun_salutation_figure_man]
男性
---
[sun_salutation_figure_woman]
女性
---
[sun_salutation_tempo_preview_label]
节奏预览
---
@@ -298,10 +310,10 @@ Finish
主题
---
[theme_mode_label]
Theme mode
主题模式
---
[theme_follow_device]
System
系统
---
[speed_label]
速度
@@ -506,6 +518,42 @@ Inner Breeze
[theme_palette_label]
调色板
---
[theme_sky]
天空
---
[theme_ocean]
海洋
---
[theme_forest]
森林
---
[theme_sunset]
日落
---
[theme_lavender]
薰衣草
---
[theme_cherry]
樱桃
---
[theme_dawn]
黎明
---
[theme_sage]
鼠尾草
---
[theme_sepia]
棕褐
---
[theme_mono]
单色
---
[theme_mint]
薄荷
---
[theme_cobalt]
钴蓝
---
[orientation_label]
方向
---
+1 -1
View File
@@ -1,5 +1,5 @@
Package: inbe.waozi
Version: 1.8.8
Version: 1.8.9
Architecture: arm64
Maintainer: Waozi <[email protected]>
Click-Version: 0.4
+1 -1
View File
@@ -28,7 +28,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="1.8.8" date="2026-07-12"/>
<release version="1.8.9" date="2026-07-17"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "inbe",
"title": "Inner Breeze",
"version": "1.8.8",
"version": "1.8.9",
"architecture": "arm64",
"framework": "ubuntu-sdk-20.04",
"description": "Syncable breathing, meditation, and habit practice app.",
+1 -1
View File
@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Inner Breeze",
"short_name": "Inbe",
"version": "1.8.8",
"version": "1.8.9",
"description": "Breathing, meditation, habit tracking, and encrypted sync.",
"permissions": [
"contextMenus"
+27
View File
@@ -0,0 +1,27 @@
app-id: xyz.waozi.inbe
runtime: org.gnome.Platform
runtime-version: '46'
sdk: org.gnome.Sdk
command: inbe
finish-args:
- --share=ipc
- --share=network
- --socket=fallback-x11
- --socket=wayland
- --socket=pulseaudio
- --device=dri
- --filesystem=home
modules:
- name: inbe
buildsystem: simple
build-commands:
- make vendor-prebuilds-native
- make native
- install -D -m755 "$(find build/bin/linux -maxdepth 1 -type f -name 'inbe-linux-*' | head -n 1)" /app/bin/inbe
- install -D -m644 packaging/linux/appimage/inbe.desktop /app/share/applications/xyz.waozi.inbe.desktop
- sed -i 's/^Icon=.*/Icon=xyz.waozi.inbe/' /app/share/applications/xyz.waozi.inbe.desktop
- install -D -m644 packaging/linux/appimage/inbe.png /app/share/icons/hicolor/512x512/apps/xyz.waozi.inbe.png
- install -D -m644 packaging/linux/appimage/inbe.appdata.xml /app/share/metainfo/xyz.waozi.inbe.metainfo.xml
sources:
- type: dir
path: ../..
+19 -15
View File
@@ -12,17 +12,12 @@ base: core22
confinement: strict
grade: stable
contact: [email protected]
website: https://inbe.waozi.xyz/
issues: https://github.com/waozixyz/inbe/issues
architectures:
- build-on: amd64
- build-on: arm64
apps:
inbe:
command-chain: [bin/desktop-launch]
command: bin/inbe
desktop: gui/inbe.desktop
environment:
@@ -39,8 +34,6 @@ apps:
- alsa
- network
- home
extensions:
- gnome-3-38-2204
parts:
desktop-glib:
@@ -51,16 +44,16 @@ parts:
sdl2-runtime:
plugin: nil
stage-packages:
- libSDL2-2.0-0
- libSDL2-image-2.0-0
- libSDL2-ttf-2.0-0
- libsdl2-2.0-0
- libsdl2-image-2.0-0
- libsdl2-ttf-2.0-0
- libgl1-mesa-glx
- libgl1-mesa-dri
- libgles2-mesa
- libglvnd0
- libgtk-3-0
- libdrm2
- libgbm1
- libegl1
- libegl1-mesa
- libxkbcommon0
- libpulse0
- libasound2
@@ -70,8 +63,8 @@ parts:
openssl:
plugin: nil
stage-packages:
- libssl3
- libcrypto++7
- libssl1.0.0
- libcrypto++9v5
inbe:
plugin: make
@@ -81,11 +74,22 @@ parts:
- cmake
- libssl-dev
- libcurl4-openssl-dev
- libgtk-3-dev
- libsdl2-dev
- libdrm-dev
- libgbm-dev
- libegl1-mesa-dev
- libgles2-mesa-dev
- pkg-config
override-build: |
make vendor-prebuilds-native
make native
install -D -m755 build/bin/linux/inbe-linux-$SNAPCRAFT_ARCH_TRIPLET $SNAPCRAFT_PART_INSTALL/bin/inbe
binary="$(find build/bin/linux -maxdepth 1 -type f -name 'inbe-linux-*' | head -n 1)"
if [ -z "$binary" ]; then
echo "No Linux binary was produced"
exit 1
fi
install -D -m755 "$binary" $SNAPCRAFT_PART_INSTALL/bin/inbe
strip $SNAPCRAFT_PART_INSTALL/bin/inbe
prime:
- bin/inbe
+8 -16
View File
@@ -22,20 +22,7 @@ ASSETS_DIR="$ANDROID_DIR/app/src/main/assets"
rm -rf "$ASSETS_DIR"
mkdir -p "$ASSETS_DIR"
# Build fonts only when explicitly requested. Android/F-Droid builds use the
# committed glyph atlas so they do not need host build tools beyond Gradle.
if [ "${INBE_REBUILD_FONTS:-0}" = "1" ]; then
echo "Building fonts..."
mkdir -p assets/fonts
OTFCHOP_DIR="${OTFCHOP_DIR:-vendor/otfchop}"
if [ ! -x "$OTFCHOP_DIR/otfchop" ]; then
OTFCHOP_DIR="vendor/otfchop"
make -C "$OTFCHOP_DIR" otfchop
fi
"$OTFCHOP_DIR/otfchop" "$OTFCHOP_DIR/unifont-17.0.04.otf" locales/*.txt assets/fonts/locales
else
echo "Using versioned fonts..."
fi
echo "Using versioned Noto font sources..."
mkdir -p build
sh vendor/flint/scripts/embed-assets.sh build/inbe_embedded_assets.c \
@@ -46,8 +33,13 @@ sh vendor/flint/scripts/embed-assets.sh build/inbe_embedded_assets.c \
assets/practices/whm/2.png \
assets/practices/meditation/1.png \
assets/practices/*/banner.png \
assets/fonts/locales.png \
assets/fonts/locales.dat \
assets/practices/sunsalutation/poses_man_sheet.png \
assets/practices/sunsalutation/poses_woman_sheet.png \
vendor/flint/fonts/noto/NotoSans-Regular.ttf \
vendor/flint/fonts/noto/NotoSansSC-Regular.otf \
vendor/flint/fonts/noto/NotoSansJP-Regular.otf \
vendor/flint/fonts/noto/NotoSansKR-Regular.otf \
vendor/flint/fonts/noto/NotoSansTC-Regular.otf \
assets/sounds/*.ogg
echo "Embedded assets generated successfully!"
+245 -45
View File
@@ -368,10 +368,13 @@ app_enter_route(InbeApp *app, AppRoute route)
if(app == NULL)
return;
if(route.screen == InbeScreenProfile) {
if(route.profile_tab == PROFILE_TAB_FRIENDS)
if(route.profile_tab == PROFILE_TAB_FRIENDS) {
profile_social_load_friends_cache(app);
else if(route.profile_tab == PROFILE_TAB_LEADERBOARD)
app_request_social_refresh(app);
} else if(route.profile_tab == PROFILE_TAB_LEADERBOARD) {
profile_social_load_leaderboard_cache(app);
app_request_social_refresh(app);
}
}
}
@@ -758,48 +761,257 @@ mark_exercise_manual_seen(InbeApp *app, int exercise_type)
}
}
typedef struct UIFontCodepoints {
int *values;
int count;
int cap;
} UIFontCodepoints;
static void
ui_font_codepoints_free(UIFontCodepoints *set)
{
if(set == NULL)
return;
free(set->values);
set->values = NULL;
set->count = 0;
set->cap = 0;
}
static int
ui_font_codepoints_has(const UIFontCodepoints *set, int codepoint)
{
if(set == NULL)
return 0;
for(int i = 0; i < set->count; i++) {
if(set->values[i] == codepoint)
return 1;
}
return 0;
}
static int
ui_font_codepoints_add(UIFontCodepoints *set, int codepoint)
{
int *next;
int next_cap;
if(set == NULL || codepoint <= 0 || codepoint >= 0x110000)
return 0;
if(codepoint >= 0xD800 && codepoint <= 0xDFFF)
return 0;
if(ui_font_codepoints_has(set, codepoint))
return 1;
if(set->count >= set->cap) {
next_cap = set->cap == 0 ? 128 : set->cap * 2;
next = realloc(set->values, (size_t)next_cap * sizeof(*next));
if(next == NULL)
return 0;
set->values = next;
set->cap = next_cap;
}
set->values[set->count++] = codepoint;
return 1;
}
static void
ui_font_codepoints_add_ascii(UIFontCodepoints *set)
{
for(int codepoint = 0x20; codepoint <= 0x7E; codepoint++)
(void)ui_font_codepoints_add(set, codepoint);
}
static void
ui_font_codepoints_add_data(UIFontCodepoints *set, const unsigned char *text, unsigned int size)
{
if(set == NULL || text == NULL)
return;
for(unsigned int i = 0; i < size;) {
int codepoint;
unsigned char c = text[i];
if(c < 0x80) {
codepoint = c;
i++;
} else if((c & 0xE0) == 0xC0 && i + 1 < size) {
codepoint = ((int)(c & 0x1F) << 6) | (int)(text[i + 1] & 0x3F);
i += 2;
} else if((c & 0xF0) == 0xE0 && i + 2 < size) {
codepoint = ((int)(c & 0x0F) << 12) |
((int)(text[i + 1] & 0x3F) << 6) |
(int)(text[i + 2] & 0x3F);
i += 3;
} else if((c & 0xF8) == 0xF0 && i + 3 < size) {
codepoint = ((int)(c & 0x07) << 18) |
((int)(text[i + 1] & 0x3F) << 12) |
((int)(text[i + 2] & 0x3F) << 6) |
(int)(text[i + 3] & 0x3F);
i += 4;
} else {
i++;
continue;
}
if(codepoint != '\n' && codepoint != '\r' && codepoint != '\t')
(void)ui_font_codepoints_add(set, codepoint);
}
}
static const char *
ui_font_asset_for_locale(const char *code)
{
if(code != NULL) {
if(strcmp(code, "zh") == 0)
return "vendor/flint/fonts/noto/NotoSansSC-Regular.otf";
if(strcmp(code, "ja") == 0)
return "vendor/flint/fonts/noto/NotoSansJP-Regular.otf";
if(strcmp(code, "ko") == 0)
return "vendor/flint/fonts/noto/NotoSansKR-Regular.otf";
if(strcmp(code, "zh-TW") == 0 || strcmp(code, "zh_Hant") == 0)
return "vendor/flint/fonts/noto/NotoSansTC-Regular.otf";
}
return "vendor/flint/fonts/noto/NotoSans-Regular.ttf";
}
static int
load_locale_font_codepoints(const char *code, UIFontCodepoints *set)
{
char path[64];
const EmbeddedAsset *asset;
if(set == NULL)
return 0;
ui_font_codepoints_add_ascii(set);
if(code == NULL || code[0] == '\0')
code = "en";
asset = GetEmbeddedAsset("locales/index.txt");
if(asset != NULL)
ui_font_codepoints_add_data(set, asset->data, asset->size);
snprintf(path, sizeof(path), "locales/%s.txt", code);
asset = GetEmbeddedAsset(path);
if(asset != NULL)
ui_font_codepoints_add_data(set, asset->data, asset->size);
if(strcmp(code, "en") != 0) {
asset = GetEmbeddedAsset("locales/en.txt");
if(asset != NULL)
ui_font_codepoints_add_data(set, asset->data, asset->size);
}
return set->count > 0;
}
static int
load_language_picker_font_codepoints(UIFontCodepoints *set)
{
const EmbeddedAsset *asset;
if(set == NULL)
return 0;
ui_font_codepoints_add_ascii(set);
asset = GetEmbeddedAsset("locales/index.txt");
if(asset != NULL)
ui_font_codepoints_add_data(set, asset->data, asset->size);
return set->count > 0;
}
static int
register_ui_font_source(const char *name, const char *path,
const UIFontCodepoints *codepoints)
{
const EmbeddedAsset *asset;
if(name == NULL || path == NULL || codepoints == NULL || codepoints->count <= 0)
return 0;
asset = GetEmbeddedAsset(path);
if(asset == NULL)
return 0;
return RegisterUIFontSource(name, GetEmbeddedAssetExtension(path),
asset->data, asset->size,
codepoints->values, codepoints->count);
}
static void
register_language_picker_fonts(void)
{
UIFontCodepoints codepoints = {0};
if(!load_language_picker_font_codepoints(&codepoints)) {
ui_font_codepoints_free(&codepoints);
return;
}
(void)register_ui_font_source("ui-lang-latin",
"vendor/flint/fonts/noto/NotoSans-Regular.ttf",
&codepoints);
(void)register_ui_font_source("ui-lang-ja",
"vendor/flint/fonts/noto/NotoSansJP-Regular.otf",
&codepoints);
(void)register_ui_font_source("ui-lang-ko",
"vendor/flint/fonts/noto/NotoSansKR-Regular.otf",
&codepoints);
(void)register_ui_font_source("ui-lang-zh",
"vendor/flint/fonts/noto/NotoSansSC-Regular.otf",
&codepoints);
ui_font_codepoints_free(&codepoints);
}
static int
load_locale_font(InbeApp *app)
{
Font font;
Image white;
const EmbeddedAsset *png;
const EmbeddedAsset *dat;
UIFontCodepoints codepoints = {0};
const char *code;
const char *font_path;
const EmbeddedAsset *font_asset;
int ok = 0;
if(app == NULL)
return 0;
png = GetEmbeddedAsset("assets/fonts/locales.png");
dat = GetEmbeddedAsset("assets/fonts/locales.dat");
if(png == NULL || dat == NULL)
code = GetCurrentLocaleCode();
if(code == NULL || code[0] == '\0')
code = "en";
font_path = ui_font_asset_for_locale(code);
font_asset = GetEmbeddedAsset(font_path);
if(font_asset == NULL)
return 0;
if(!load_locale_font_codepoints(code, &codepoints))
goto done;
font = LoadUIChoppedFontFromMemory(png->data, png->size,
dat->data, dat->size,
UI_TEXT_BASE_SIZE);
if(font.texture.id == 0)
return 0;
ClearUIFonts();
if(!RegisterUIFontSource("ui", GetEmbeddedAssetExtension(font_path),
font_asset->data, font_asset->size,
codepoints.values, codepoints.count))
goto done;
register_language_picker_fonts();
if(!UseUIFont("ui"))
goto done;
white = GenImageColor(1, 1, WHITE);
app->font_shapes_texture = LoadTextureFromImage(white);
UnloadImage(white);
if(app->font_shapes_texture.id == 0) {
UnloadUIFont(&font);
goto fail;
}
if(app->font_shapes_texture.id == 0)
goto done;
SetTextureFilter(app->font_shapes_texture, TEXTURE_FILTER_POINT);
app->locale_font = font;
app->locale_font_8 = font;
SetUIFont(app->locale_font);
SetUISmallFont(app->locale_font);
SetShapesTexture(app->font_shapes_texture, (Rectangle){0, 0, 1, 1});
return 1;
ok = 1;
fail:
app->locale_font = (Font){0};
app->locale_font_8 = (Font){0};
return 0;
done:
ui_font_codepoints_free(&codepoints);
if(!ok)
ClearUIFonts();
return ok;
}
static void
@@ -807,12 +1019,7 @@ unload_locale_font(InbeApp *app)
{
if(app == NULL)
return;
SetUIFont((Font){0});
SetUISmallFont((Font){0});
UnloadUIFont(&app->locale_font);
app->locale_font = (Font){0};
app->locale_font_8 = (Font){0};
ClearUIFonts();
}
static void
@@ -820,12 +1027,7 @@ discard_locale_font_cpu(InbeApp *app)
{
if(app == NULL)
return;
free(app->locale_font.glyphs);
free(app->locale_font.recs);
app->locale_font = (Font){0};
app->locale_font_8 = (Font){0};
SetUIFont((Font){0});
SetUISmallFont((Font){0});
ClearUIFonts();
}
static void
@@ -847,7 +1049,7 @@ app_reload_graphics_resources(InbeApp *app)
app->font_shapes_texture = (Texture2D){0};
discard_locale_font_cpu(app);
if(!load_locale_font(app))
TraceLog(LOG_WARNING, "FONT: Failed to reload chopped locale font");
TraceLog(LOG_WARNING, "FONT: Failed to reload Noto UI font");
}
void
@@ -887,6 +1089,8 @@ apply_language_selection(InbeApp *app, int language_index, int save_now)
snprintf(app->language, sizeof(app->language), "%s", code);
app->language_selected = 1;
if(!load_locale_font(app))
TraceLog(LOG_WARNING, "FONT: Failed to load Noto UI font for locale %s", code);
refresh_locale_dependent_text(app);
if(save_now)
@@ -1336,9 +1540,6 @@ app_init(void *vapp) {
if(app == 0)
return;
app->locale_font = (Font){0};
app->locale_font_8 = (Font){0};
#if ANDROID_BUILD
if (practice_active(app) != NULL) {
android_allow_screen_off();
@@ -1350,9 +1551,6 @@ app_init(void *vapp) {
InitUIDPI();
TraceLog(LOG_INFO, "INBE: app init width=%d height=%d embedded=%d",
config.width, config.height, config.loaded);
if(!load_locale_font(app)) {
TraceLog(LOG_WARNING, "FONT: Failed to load chopped locale font -> using built-in default");
}
load_config();
view_width = config.width > 0 ? config.width : INBE_DEFAULT_WIDTH;
@@ -1367,6 +1565,8 @@ app_init(void *vapp) {
data_init();
if(app_load_settings(app))
save_settings(app);
if(!load_locale_font(app))
TraceLog(LOG_WARNING, "FONT: Failed to load Noto UI font -> using built-in default");
app->practice_tab = PRACTICE_TAB_PLAY;
app->practice_config_tab = 0;
if(app->language_needs_save) {
+2 -3
View File
@@ -274,13 +274,14 @@ typedef struct MeditationPracticeState {
typedef struct SunSalutationPracticeState {
Texture2D banner;
Texture2D poses[8];
Texture2D pose_sheets[2];
int step;
int repetition;
int repetitions;
int start_seconds;
int end_seconds;
int step_ticks;
int figure;
} SunSalutationPracticeState;
typedef struct PetPreviewState {
@@ -330,8 +331,6 @@ struct InbeApp {
Texture2D easteregg_art;
Texture2D easteregg_waozi;
Texture2D font_shapes_texture;
Font locale_font;
Font locale_font_8;
Sound breath_in_sound;
Sound breath_out_sound;
Sound bell_sound;
+44
View File
@@ -0,0 +1,44 @@
#ifndef INBE_APP_SETTING_KEYS_H
#define INBE_APP_SETTING_KEYS_H
#define INBE_IMPORTABLE_SETTING_KEYS(X) \
X("speed") \
X("max_rounds") \
X("max_breaths") \
X("pause_seconds") \
X("sound_volume") \
X("tutorial_seen") \
X("exercise_manual_seen_mask") \
X("theme") \
X("theme_source") \
X("dark_mode") \
X("theme_mode") \
X("orientation_mode") \
X("main_tab") \
X("fullscreen") \
X("on_screen_keyboard") \
X("progressive_speed") \
X("progressive_start_speed") \
X("breath_animation") \
X("double_tap_to_breathe") \
X("advanced_session_controls") \
X("hold_display_mode") \
X("exercise_type") \
X("sun_salutation_repetitions") \
X("sun_salutation_start_seconds") \
X("sun_salutation_end_seconds") \
X("sun_salutation_figure") \
X("meditation_duration_mode") \
X("meditation_custom_minutes") \
X("meditation_show_extend_controls") \
X("meditation_music_track") \
X("practice_music_mask") \
X("practice_music_track_wim_hof") \
X("practice_music_track_meditation") \
X("practice_music_track_sun_salutation") \
X("play_in_background") \
X("language") \
X("practice_category_tab") \
X("practice_visible_mask")
#endif
+4
View File
@@ -5,6 +5,7 @@
#include "device_preferences.h"
#include "locale.h"
#include "practices/meditation/meditation_music.h"
#include "practices/sun_salutation/sun_salutation_practice.h"
#include "practices/whm/whm_session.h"
#include "storage.h"
#include "theme.h"
@@ -306,6 +307,7 @@ save_settings(InbeApp *app)
{"sun_salutation_repetitions", app->sun_salutation.repetitions},
{"sun_salutation_start_seconds", app->sun_salutation.start_seconds},
{"sun_salutation_end_seconds", app->sun_salutation.end_seconds},
{"sun_salutation_figure", app->sun_salutation.figure},
{"meditation_duration_mode", app->meditation.duration_mode},
{"meditation_custom_minutes", app->meditation.custom_minutes},
{"meditation_show_extend_controls", app->meditation.show_extend_controls ? 1 : 0},
@@ -447,6 +449,8 @@ app_load_settings(InbeApp *app)
3, 12},
{&app->sun_salutation.end_seconds, "sun_salutation_end_seconds", 5,
3, 12},
{&app->sun_salutation.figure, "sun_salutation_figure", 0,
0, SUN_SALUTATION_ACTIVE_FIGURE_COUNT - 1},
{&app->meditation.duration_mode, "meditation_duration_mode", 1,
0, 5},
{&app->meditation.custom_minutes, "meditation_custom_minutes", 20,
+282 -116
View File
@@ -28,6 +28,7 @@
#define INBE_SYNC_SERVER_URL_KEY "sync_server_url"
#define INBE_SYNC_SERVER_URL_DEFAULT "https://api.waozi.xyz"
#define INBE_SYNC_INPUT_QUIET_SECONDS 0.45
#define INBE_SOCIAL_ACTION_QUEUE_MAX 8
typedef struct InbeSyncCoordinator {
double dirty_sync_at;
@@ -37,8 +38,10 @@ typedef struct InbeSyncCoordinator {
int social_refresh_pending;
int social_refresh_running;
int remote_sync_due;
char social_action[16];
char social_action_value[96];
int social_action_head;
int social_action_count;
char social_actions[INBE_SOCIAL_ACTION_QUEUE_MAX][16];
char social_action_values[INBE_SOCIAL_ACTION_QUEUE_MAX][96];
} InbeSyncCoordinator;
static InbeSyncCoordinator g_sync = {0};
@@ -57,6 +60,21 @@ typedef struct InbeSocialWorkerArgs {
char action_value[96];
} InbeSocialWorkerArgs;
typedef struct InbeSyncWorkerResult {
int finished;
int result;
int changed;
} InbeSyncWorkerResult;
typedef struct InbeSocialWorkerResult {
int finished;
int result;
char friend_requests_json[8192];
char friends_json[8192];
char leaderboard_json[8192];
char leaderboard_key[96];
} InbeSocialWorkerResult;
#if defined(_WIN32)
#define sync_thread_return DWORD WINAPI
#define sync_thread_done 0
@@ -98,15 +116,8 @@ sync_thread_detach(SyncThread thread)
}
#endif
static int g_sync_finished = 0;
static int g_sync_finished_result = LYRA_SYNC_OK;
static int g_sync_finished_changed = 0;
static int g_social_finished = 0;
static int g_social_finished_result = LYRA_SYNC_OK;
static char g_social_friend_requests_json[8192];
static char g_social_friends_json[8192];
static char g_social_leaderboard_json[8192];
static char g_social_leaderboard_key[96];
static InbeSyncWorkerResult g_sync_result = {0, LYRA_SYNC_OK, 0};
static InbeSocialWorkerResult g_social_result = {0, LYRA_SYNC_OK, "", "", "", ""};
static int g_sync_events_running = 0;
static char g_sync_events_url[256];
#else
@@ -123,6 +134,17 @@ static const char *app_social_practice_id(int practice);
static const char *app_social_metric_id(int practice, int metric);
static void app_social_leaderboard_key(char *out, size_t out_size,
int practice, int metric);
static LyraSyncResult app_social_fetch(const char *url, const char *practice,
const char *metric, const char *action,
const char *action_value,
char *requests_json, size_t requests_size,
char *friends_json, size_t friends_size,
char *leaderboard_json,
size_t leaderboard_size);
static void app_social_apply_result(InbeApp *app, const char *requests_json,
const char *friends_json,
const char *leaderboard_json,
const char *leaderboard_key);
static void
app_queue_social_refresh(void)
@@ -130,6 +152,154 @@ app_queue_social_refresh(void)
g_sync.social_refresh_pending = 1;
}
static int
app_social_peek_action(char *action, size_t action_size,
char *value, size_t value_size)
{
int index;
if(action != NULL && action_size > 0)
action[0] = '\0';
if(value != NULL && value_size > 0)
value[0] = '\0';
if(g_sync.social_action_count <= 0)
return 0;
index = g_sync.social_action_head;
if(action != NULL && action_size > 0)
snprintf(action, action_size, "%s", g_sync.social_actions[index]);
if(value != NULL && value_size > 0)
snprintf(value, value_size, "%s", g_sync.social_action_values[index]);
return 1;
}
static int
app_social_pop_action(char *action, size_t action_size,
char *value, size_t value_size)
{
int index;
if(action != NULL && action_size > 0)
action[0] = '\0';
if(value != NULL && value_size > 0)
value[0] = '\0';
if(g_sync.social_action_count <= 0)
return 0;
index = g_sync.social_action_head;
if(action != NULL && action_size > 0)
snprintf(action, action_size, "%s", g_sync.social_actions[index]);
if(value != NULL && value_size > 0)
snprintf(value, value_size, "%s", g_sync.social_action_values[index]);
g_sync.social_actions[index][0] = '\0';
g_sync.social_action_values[index][0] = '\0';
g_sync.social_action_head = (g_sync.social_action_head + 1) %
INBE_SOCIAL_ACTION_QUEUE_MAX;
g_sync.social_action_count--;
return 1;
}
static int
app_social_push_action(const char *action, const char *value)
{
int index;
if(action == NULL || action[0] == '\0' || value == NULL || value[0] == '\0')
return 0;
if(g_sync.social_action_count >= INBE_SOCIAL_ACTION_QUEUE_MAX) {
TraceLog(LOG_WARNING, "SYNC: social action queue full");
return 0;
}
index = (g_sync.social_action_head + g_sync.social_action_count) %
INBE_SOCIAL_ACTION_QUEUE_MAX;
snprintf(g_sync.social_actions[index], sizeof(g_sync.social_actions[index]),
"%s", action);
snprintf(g_sync.social_action_values[index],
sizeof(g_sync.social_action_values[index]), "%s", value);
g_sync.social_action_count++;
g_sync.social_refresh_pending = 1;
return 1;
}
static LyraSyncResult
app_social_fetch(const char *url, const char *practice, const char *metric,
const char *action, const char *action_value,
char *requests_json, size_t requests_size,
char *friends_json, size_t friends_size,
char *leaderboard_json, size_t leaderboard_size)
{
LyraSyncResult result = LYRA_SYNC_INVALID_URL;
LyraSyncResult friends_result = LYRA_SYNC_REQUEST_FAILED;
LyraSyncResult leaderboard_result = LYRA_SYNC_REQUEST_FAILED;
if(requests_json != NULL && requests_size > 0)
snprintf(requests_json, requests_size, "{\"incoming\":[],\"outgoing\":[]}");
if(friends_json != NULL && friends_size > 0)
snprintf(friends_json, friends_size, "{\"friends\":[]}");
if(leaderboard_json != NULL && leaderboard_size > 0)
snprintf(leaderboard_json, leaderboard_size, "{\"rows\":[]}");
if(url == NULL || url[0] == '\0')
return LYRA_SYNC_INVALID_URL;
if(action != NULL && strcmp(action, "send") == 0) {
result = sync_client_send_friend_request(url, action_value);
if(result != LYRA_SYNC_OK)
return result;
} else if(action != NULL && strcmp(action, "accept") == 0) {
result = sync_client_accept_friend_request(url, action_value);
if(result != LYRA_SYNC_OK)
return result;
} else if(action != NULL && strcmp(action, "decline") == 0) {
result = sync_client_decline_friend_request(url, action_value);
if(result != LYRA_SYNC_OK)
return result;
} else if(action != NULL && strcmp(action, "remove") == 0) {
result = sync_client_remove_friend(url, action_value);
if(result != LYRA_SYNC_OK)
return result;
}
result = sync_client_get_friend_requests(url, requests_json, requests_size);
if(result != LYRA_SYNC_OK)
return result;
friends_result = sync_client_get_friends(url, friends_json, friends_size);
if(friends_result != LYRA_SYNC_OK)
return friends_result;
leaderboard_result = sync_client_get_friend_stats(url, "inbe", practice,
metric, leaderboard_json,
leaderboard_size);
return leaderboard_result;
}
static void
app_social_apply_result(InbeApp *app, const char *requests_json,
const char *friends_json,
const char *leaderboard_json,
const char *leaderboard_key)
{
storage_set_social_cache_json("friends.requests", requests_json);
storage_set_social_cache_json("friends.list", friends_json);
if(leaderboard_key != NULL && leaderboard_key[0] != '\0')
storage_set_social_cache_json(leaderboard_key, leaderboard_json);
if(app != NULL) {
snprintf(app->profile_friend_requests_json,
sizeof(app->profile_friend_requests_json), "%s",
requests_json != NULL ? requests_json : "{\"incoming\":[],\"outgoing\":[]}");
snprintf(app->profile_friends_json, sizeof(app->profile_friends_json),
"%s", friends_json != NULL ? friends_json : "{\"friends\":[]}");
if(leaderboard_key != NULL && leaderboard_key[0] != '\0') {
char current_key[96];
app_social_leaderboard_key(current_key, sizeof(current_key),
app->profile_leaderboard_practice,
app->profile_leaderboard_metric);
if(strcmp(current_key, leaderboard_key) == 0)
snprintf(app->profile_leaderboard_json,
sizeof(app->profile_leaderboard_json), "%s",
leaderboard_json != NULL ? leaderboard_json : "{\"rows\":[]}");
}
app->profile_friends_loaded = 1;
app->profile_leaderboard_loaded = 1;
}
}
#if !defined(PLATFORM_WEB)
static sync_thread_return
app_sync_worker(void *userdata)
@@ -145,9 +315,9 @@ app_sync_worker(void *userdata)
}
sync_lock();
g_sync_finished_result = result;
g_sync_finished_changed = changed;
g_sync_finished = 1;
g_sync_result.result = result;
g_sync_result.changed = changed;
g_sync_result.finished = 1;
g_sync.sync_running = 0;
sync_unlock();
return sync_thread_done;
@@ -158,59 +328,35 @@ app_social_worker(void *userdata)
{
InbeSocialWorkerArgs *args = userdata;
LyraSyncResult result = LYRA_SYNC_INVALID_URL;
LyraSyncResult friends_result = LYRA_SYNC_REQUEST_FAILED;
LyraSyncResult leaderboard_result = LYRA_SYNC_REQUEST_FAILED;
char requests_json[8192] = "{\"incoming\":[],\"outgoing\":[]}";
char friends_json[8192] = "{\"friends\":[]}";
char leaderboard_json[8192] = "{\"rows\":[]}";
char requests_json[8192];
char friends_json[8192];
char leaderboard_json[8192];
if(args != NULL) {
if(strcmp(args->action, "send") == 0) {
result = sync_client_send_friend_request(args->url, args->action_value);
if(result != LYRA_SYNC_OK)
goto done;
} else if(strcmp(args->action, "accept") == 0) {
result = sync_client_accept_friend_request(args->url, args->action_value);
if(result != LYRA_SYNC_OK)
goto done;
} else if(strcmp(args->action, "decline") == 0) {
result = sync_client_decline_friend_request(args->url, args->action_value);
if(result != LYRA_SYNC_OK)
goto done;
} else if(strcmp(args->action, "remove") == 0) {
result = sync_client_remove_friend(args->url, args->action_value);
if(result != LYRA_SYNC_OK)
goto done;
}
result = sync_client_get_friend_requests(args->url, requests_json,
sizeof(requests_json));
if(result == LYRA_SYNC_OK) {
friends_result = sync_client_get_friends(args->url, friends_json,
sizeof(friends_json));
leaderboard_result =
sync_client_get_friend_stats(args->url, "inbe", args->practice,
args->metric, leaderboard_json,
sizeof(leaderboard_json));
if(friends_result != LYRA_SYNC_OK)
result = friends_result;
else if(leaderboard_result != LYRA_SYNC_OK)
result = leaderboard_result;
}
if(args != NULL)
result = app_social_fetch(args->url, args->practice, args->metric,
args->action, args->action_value,
requests_json, sizeof(requests_json),
friends_json, sizeof(friends_json),
leaderboard_json, sizeof(leaderboard_json));
else {
snprintf(requests_json, sizeof(requests_json), "{\"incoming\":[],\"outgoing\":[]}");
snprintf(friends_json, sizeof(friends_json), "{\"friends\":[]}");
snprintf(leaderboard_json, sizeof(leaderboard_json), "{\"rows\":[]}");
}
done:
sync_lock();
g_social_finished_result = result;
snprintf(g_social_friend_requests_json, sizeof(g_social_friend_requests_json),
g_social_result.result = result;
snprintf(g_social_result.friend_requests_json,
sizeof(g_social_result.friend_requests_json),
"%s", requests_json);
snprintf(g_social_friends_json, sizeof(g_social_friends_json), "%s",
snprintf(g_social_result.friends_json, sizeof(g_social_result.friends_json), "%s",
friends_json);
snprintf(g_social_leaderboard_json, sizeof(g_social_leaderboard_json), "%s",
snprintf(g_social_result.leaderboard_json,
sizeof(g_social_result.leaderboard_json), "%s",
leaderboard_json);
snprintf(g_social_leaderboard_key, sizeof(g_social_leaderboard_key), "%s",
snprintf(g_social_result.leaderboard_key, sizeof(g_social_result.leaderboard_key), "%s",
args != NULL ? args->leaderboard_key : "");
g_social_finished = 1;
g_social_result.finished = 1;
g_sync.social_refresh_running = 0;
sync_unlock();
free(args);
@@ -256,10 +402,10 @@ app_collect_finished_sync(void)
int changed;
sync_lock();
finished = g_sync_finished;
result = g_sync_finished_result;
changed = g_sync_finished_changed;
g_sync_finished = 0;
finished = g_sync_result.finished;
result = g_sync_result.result;
changed = g_sync_result.changed;
g_sync_result.finished = 0;
sync_unlock();
if(!finished)
@@ -485,37 +631,34 @@ app_apply_pending_social_refresh(InbeApp *app)
if(!g_sync.social_refresh_pending || !app_background_sync_safe(app))
return;
if(g_sync.dirty_sync_at > 0.0)
return;
#if !defined(PLATFORM_WEB)
{
SyncThread thread;
InbeSocialWorkerArgs *args;
sync_lock();
if(g_sync.sync_running || g_sync.social_refresh_running) {
sync_unlock();
return;
}
snprintf(action, sizeof(action), "%s", g_sync.social_action);
snprintf(action_value, sizeof(action_value), "%s", g_sync.social_action_value);
g_sync.social_action[0] = '\0';
g_sync.social_action_value[0] = '\0';
g_sync.social_refresh_running = 1;
sync_unlock();
if(!app_sync_url(url, sizeof(url))) {
sync_lock();
g_sync.social_refresh_running = 0;
g_sync.social_refresh_pending = g_sync.social_action_count > 0;
sync_unlock();
g_sync.social_refresh_pending = 0;
return;
}
args = malloc(sizeof(*args));
if(args == NULL) {
sync_lock();
g_sync.social_refresh_running = 0;
if(args == NULL)
return;
sync_lock();
if(g_sync.sync_running || g_sync.social_refresh_running) {
sync_unlock();
free(args);
return;
}
app_social_peek_action(action, sizeof(action), action_value,
sizeof(action_value));
g_sync.social_refresh_pending = 0;
g_sync.social_refresh_running = 1;
sync_unlock();
snprintf(args->url, sizeof(args->url), "%s", url);
snprintf(args->practice, sizeof(args->practice), "%s",
app_social_practice_id(app->profile_leaderboard_practice));
@@ -533,17 +676,57 @@ app_apply_pending_social_refresh(InbeApp *app)
free(args);
sync_lock();
g_sync.social_refresh_running = 0;
g_sync.social_refresh_pending = 1;
sync_unlock();
TraceLog(LOG_WARNING, "SYNC: failed to start social refresh thread");
return;
}
sync_lock();
app_social_pop_action(action, sizeof(action), action_value,
sizeof(action_value));
sync_unlock();
sync_thread_detach(thread);
}
#else
TraceLog(LOG_INFO, "SYNC: refreshing social cache");
profile_social_refresh_cache(app);
if(!app_sync_url(url, sizeof(url))) {
g_sync.social_refresh_pending = g_sync.social_action_count > 0;
return;
}
app_social_peek_action(action, sizeof(action), action_value,
sizeof(action_value));
{
char requests_json[8192];
char friends_json[8192];
char leaderboard_json[8192];
char leaderboard_key[96];
LyraSyncResult result;
app_social_leaderboard_key(leaderboard_key, sizeof(leaderboard_key),
app->profile_leaderboard_practice,
app->profile_leaderboard_metric);
TraceLog(LOG_INFO, "SYNC: refreshing social cache");
result = app_social_fetch(url,
app_social_practice_id(app->profile_leaderboard_practice),
app_social_metric_id(app->profile_leaderboard_practice,
app->profile_leaderboard_metric),
action, action_value,
requests_json, sizeof(requests_json),
friends_json, sizeof(friends_json),
leaderboard_json, sizeof(leaderboard_json));
if(result == LYRA_SYNC_OK)
app_social_apply_result(app, requests_json, friends_json,
leaderboard_json, leaderboard_key);
else
TraceLog(LOG_WARNING, "SYNC: social refresh failed result=%d name=%s",
result, GetLyraSyncResultName(result));
if(result == LYRA_SYNC_OK)
app_social_pop_action(action, sizeof(action), action_value,
sizeof(action_value));
}
#endif
#if defined(PLATFORM_WEB)
g_sync.social_refresh_pending = g_sync.social_action_count > 0;
#endif
g_sync.social_refresh_pending = 0;
}
#if !defined(PLATFORM_WEB)
@@ -558,17 +741,18 @@ app_collect_finished_social_refresh(InbeApp *app)
char leaderboard_key[96];
sync_lock();
finished = g_social_finished;
result = g_social_finished_result;
finished = g_social_result.finished;
result = g_social_result.result;
if(finished) {
snprintf(requests_json, sizeof(requests_json), "%s",
g_social_friend_requests_json);
snprintf(friends_json, sizeof(friends_json), "%s", g_social_friends_json);
g_social_result.friend_requests_json);
snprintf(friends_json, sizeof(friends_json), "%s",
g_social_result.friends_json);
snprintf(leaderboard_json, sizeof(leaderboard_json), "%s",
g_social_leaderboard_json);
g_social_result.leaderboard_json);
snprintf(leaderboard_key, sizeof(leaderboard_key), "%s",
g_social_leaderboard_key);
g_social_finished = 0;
g_social_result.leaderboard_key);
g_social_result.finished = 0;
}
sync_unlock();
@@ -579,28 +763,12 @@ app_collect_finished_social_refresh(InbeApp *app)
result, GetLyraSyncResultName(result));
return;
}
storage_set_social_cache_json("friends.requests", requests_json);
storage_set_social_cache_json("friends.list", friends_json);
if(leaderboard_key[0] != '\0')
storage_set_social_cache_json(leaderboard_key, leaderboard_json);
if(app != NULL) {
snprintf(app->profile_friend_requests_json,
sizeof(app->profile_friend_requests_json), "%s", requests_json);
snprintf(app->profile_friends_json, sizeof(app->profile_friends_json),
"%s", friends_json);
if(leaderboard_key[0] != '\0') {
char current_key[96];
app_social_leaderboard_key(current_key, sizeof(current_key),
app->profile_leaderboard_practice,
app->profile_leaderboard_metric);
if(strcmp(current_key, leaderboard_key) == 0)
snprintf(app->profile_leaderboard_json,
sizeof(app->profile_leaderboard_json), "%s",
leaderboard_json);
}
app->profile_friends_loaded = 1;
app->profile_leaderboard_loaded = 1;
}
app_social_apply_result(app, requests_json, friends_json, leaderboard_json,
leaderboard_key);
sync_lock();
if(g_sync.social_action_count > 0)
g_sync.social_refresh_pending = 1;
sync_unlock();
TraceLog(LOG_INFO, "SYNC: social cache refreshed");
}
#else
@@ -625,12 +793,10 @@ app_request_social_action(const char *action, const char *value)
return;
#if !defined(PLATFORM_WEB)
sync_lock();
snprintf(g_sync.social_action, sizeof(g_sync.social_action), "%s", action);
snprintf(g_sync.social_action_value, sizeof(g_sync.social_action_value), "%s", value);
g_sync.social_refresh_pending = 1;
app_social_push_action(action, value);
sync_unlock();
#else
g_sync.social_refresh_pending = 1;
app_social_push_action(action, value);
#endif
}
+2 -2
View File
@@ -3,7 +3,7 @@
#define INBE_VERSION_MAJOR 1
#define INBE_VERSION_MINOR 8
#define INBE_VERSION_PATCH 8
#define INBE_VERSION_STRING "1.8.8"
#define INBE_VERSION_PATCH 9
#define INBE_VERSION_STRING "1.8.9"
#endif
+4 -18
View File
@@ -68,23 +68,6 @@ GetTrayWindowAction(int visible)
return visible ? INBE_DESKTOP_TRAY_ACTION_HIDE : INBE_DESKTOP_TRAY_ACTION_SHOW;
}
static void
InitTraySnapshotLabels(InbeTraySnapshot *snapshot)
{
if(snapshot == NULL)
return;
snprintf(snapshot->show_hide_label, sizeof(snapshot->show_hide_label),
"Show Inner Breeze");
snprintf(snapshot->start_practice_label, sizeof(snapshot->start_practice_label),
"Start Practice");
snprintf(snapshot->habits_label, sizeof(snapshot->habits_label), "Mark Complete");
snprintf(snapshot->quit_label, sizeof(snapshot->quit_label), "Quit Inner Breeze");
snprintf(snapshot->whm_label, sizeof(snapshot->whm_label), "Wim Hof");
snprintf(snapshot->meditation_label, sizeof(snapshot->meditation_label), "Meditation");
snprintf(snapshot->sun_salutation_label, sizeof(snapshot->sun_salutation_label),
"Sun Salutation");
}
static void
FillTraySnapshotLabels(InbeTraySnapshot *snapshot)
{
@@ -132,7 +115,7 @@ BuildTrayMenu(const InbeTraySnapshot *snapshot,
return 0;
memset(&local_snapshot, 0, sizeof(local_snapshot));
InitTraySnapshotLabels(&local_snapshot);
FillTraySnapshotLabels(&local_snapshot);
if(snapshot != NULL)
local_snapshot = *snapshot;
@@ -427,6 +410,9 @@ inbe_desktop_tray_update_status(InbeApp *app)
FormatLocaleText(text, sizeof(text), "tray_wim_hof_hold", count);
break;
case InbePhaseRecover:
count = 15 - count;
if(count < 0)
count = 0;
FormatLocaleText(text, sizeof(text), "tray_wim_hof_breathe_in",
count);
break;
@@ -14,7 +14,7 @@ extern int view_width;
extern int view_height;
static const int g_sun_salutation_pose_sequence[SUN_SALUTATION_STEP_COUNT] = {
0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 0
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
};
static const char *g_sun_salutation_step_label_keys[SUN_SALUTATION_STEP_COUNT] = {
@@ -74,17 +74,21 @@ sun_salutation_normalize_settings(InbeApp *app)
SUN_SALUTATION_SECONDS_MAX);
if(app->sun_salutation.start_seconds < app->sun_salutation.end_seconds)
app->sun_salutation.end_seconds = app->sun_salutation.start_seconds;
app->sun_salutation.figure =
sun_salutation_clampi(app->sun_salutation.figure, 0,
SUN_SALUTATION_ACTIVE_FIGURE_COUNT - 1);
}
void
sun_salutation_practice_init(InbeApp *app)
{
char path[64];
if(app == NULL)
return;
if(app->sun_salutation.banner.id == 0)
app->sun_salutation.banner = app_load_asset_texture("practices/sunsalutation/banner.png");
if(app->sun_salutation.pose_sheets[SUN_SALUTATION_FIGURE_MAN].id == 0)
app->sun_salutation.pose_sheets[SUN_SALUTATION_FIGURE_MAN] =
app_load_asset_texture("practices/sunsalutation/poses_man_sheet.png");
if(app->sun_salutation.repetitions < 2 || app->sun_salutation.repetitions > 12)
app->sun_salutation.repetitions = SUN_SALUTATION_DEFAULT_REPETITIONS;
if(app->sun_salutation.start_seconds < SUN_SALUTATION_SECONDS_MIN ||
@@ -94,12 +98,6 @@ sun_salutation_practice_init(InbeApp *app)
app->sun_salutation.end_seconds > SUN_SALUTATION_SECONDS_MAX)
app->sun_salutation.end_seconds = SUN_SALUTATION_DEFAULT_END_SECONDS;
sun_salutation_normalize_settings(app);
for(int i = 0; i < SUN_SALUTATION_POSE_COUNT; i++) {
if(app->sun_salutation.poses[i].id != 0)
continue;
snprintf(path, sizeof(path), "practices/sunsalutation/pos_%04d.png", i + 1);
app->sun_salutation.poses[i] = app_load_asset_texture(path);
}
}
void
@@ -109,14 +107,14 @@ sun_salutation_practice_destroy(InbeApp *app)
return;
app_unload_texture(app->sun_salutation.banner);
app->sun_salutation.banner = (Texture2D){0};
for(int i = 0; i < SUN_SALUTATION_POSE_COUNT; i++) {
app_unload_texture(app->sun_salutation.poses[i]);
app->sun_salutation.poses[i] = (Texture2D){0};
for(int i = 0; i < SUN_SALUTATION_FIGURE_COUNT; i++) {
app_unload_texture(app->sun_salutation.pose_sheets[i]);
app->sun_salutation.pose_sheets[i] = (Texture2D){0};
}
}
static void
draw_preview_pose(Texture2D texture, int x, int y, int w, int h, Color tint)
draw_preview_pose(Texture2D texture, int pose_index, int x, int y, int w, int h, Color tint)
{
Rectangle src;
Rectangle dst;
@@ -126,12 +124,23 @@ draw_preview_pose(Texture2D texture, int x, int y, int w, int h, Color tint)
if(texture.id == 0 || w <= 0 || h <= 0)
return;
scale = (float)w / (float)texture.width;
if((float)texture.height * scale > (float)h)
scale = (float)h / (float)texture.height;
draw_w = (float)texture.width * scale;
draw_h = (float)texture.height * scale;
src = (Rectangle){0, 0, (float)texture.width, (float)texture.height};
if(pose_index < 0)
pose_index = 0;
if(pose_index >= SUN_SALUTATION_POSE_COUNT)
pose_index = SUN_SALUTATION_POSE_COUNT - 1;
scale = (float)w / (float)SUN_SALUTATION_POSE_FRAME_W;
if((float)SUN_SALUTATION_POSE_FRAME_H * scale > (float)h)
scale = (float)h / (float)SUN_SALUTATION_POSE_FRAME_H;
draw_w = (float)SUN_SALUTATION_POSE_FRAME_W * scale;
draw_h = (float)SUN_SALUTATION_POSE_FRAME_H * scale;
src = (Rectangle){
(float)((pose_index % SUN_SALUTATION_POSE_SHEET_COLS) *
SUN_SALUTATION_POSE_FRAME_W),
(float)((pose_index / SUN_SALUTATION_POSE_SHEET_COLS) *
SUN_SALUTATION_POSE_FRAME_H),
(float)SUN_SALUTATION_POSE_FRAME_W,
(float)SUN_SALUTATION_POSE_FRAME_H
};
dst = (Rectangle){(float)x + ((float)w - draw_w) * 0.5f,
(float)y + ((float)h - draw_h) * 0.5f,
draw_w, draw_h};
@@ -191,7 +200,8 @@ draw_sun_salutation_preview(InbeApp *app, int x, int y, int w)
DrawRectangle(px, py, thumb_w, thumb_h, DarkenUIColor(GetThemeBackground(), 6));
if(i == active_step)
DrawRectangleLines(px, py, thumb_w, thumb_h, GetThemeButtonHover());
draw_preview_pose(app->sun_salutation.poses[pose_index], px, py, thumb_w, thumb_h, tint);
draw_preview_pose(app->sun_salutation.pose_sheets[app->sun_salutation.figure], pose_index,
px, py, thumb_w, thumb_h, tint);
if(i < SUN_SALUTATION_STEP_COUNT - 1) {
int next_col = (i + 1) % 6;
if(next_col != 0)
@@ -208,6 +218,77 @@ draw_sun_salutation_preview(InbeApp *app, int x, int y, int w)
small_font, muted);
}
static int
draw_sun_salutation_figure_selector(InbeApp *app, int x, int y, int w)
{
int label_font = GetUIFontSize();
int small_font = GetUISmallFontSize();
int label_w;
int row_y;
int option_gap = ScaleUIPx(10);
int option_w = (w - option_gap) / 2;
int option_h = ScaleUIPx(118);
int image_h = ScaleUIPx(72);
int changed = 0;
Vector2 mouse = GetMousePosition();
if(app == NULL || SUN_SALUTATION_ACTIVE_FIGURE_COUNT <= 1)
return 0;
label_w = MeasureUIText(GetLocaleText("sun_salutation_figure_label"), label_font);
DrawUIText(GetLocaleText("sun_salutation_figure_label"), x + (w - label_w) / 2,
y, label_font, GetThemeText());
row_y = y + ScaleUIPx(30);
for(int i = 0; i < SUN_SALUTATION_ACTIVE_FIGURE_COUNT; i++) {
Rectangle bounds = {
(float)(x + i * (option_w + option_gap)),
(float)row_y,
(float)option_w,
(float)option_h
};
Rectangle image_bounds = {
bounds.x + ScaleUIPx(8),
bounds.y + ScaleUIPx(8),
bounds.width - ScaleUIPx(16),
(float)image_h
};
int selected = app->sun_salutation.figure == i;
int hover = CheckCollisionPointRec(mouse, bounds);
Color bg = selected ? Fade(GetThemeButtonHover(), 0.18f)
: DarkenUIColor(GetThemeBackground(), hover ? 10 : 6);
Color border = selected ? GetThemeButtonHover()
: DarkenUIColor(GetThemeText(), 45);
const char *label;
int text_w;
int pose_index = sun_salutation_step_pose_index(1);
if(i == SUN_SALUTATION_FIGURE_MAN)
label = GetLocaleText("sun_salutation_figure_man");
else
label = GetLocaleText("sun_salutation_figure_woman");
text_w = MeasureUIText(label, small_font);
DrawRectangleRec(bounds, bg);
DrawRectangleLinesEx(bounds, selected ? 2.0f : 1.0f, border);
draw_preview_pose(app->sun_salutation.pose_sheets[i], pose_index,
(int)image_bounds.x, (int)image_bounds.y,
(int)image_bounds.width, (int)image_bounds.height,
WHITE);
DrawUIText(label, (int)(bounds.x + (bounds.width - text_w) * 0.5f),
(int)(bounds.y + bounds.height - ScaleUIPx(28)),
small_font, GetThemeText());
if(hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) &&
!UIInputCapturesClick(mouse) && !selected) {
app->sun_salutation.figure = i;
changed = 1;
}
}
return changed;
}
typedef struct SunSalutationConfigScrollPageContext {
InbeApp *app;
} SunSalutationConfigScrollPageContext;
@@ -227,7 +308,8 @@ sun_salutation_config_content_height(int content_w, void *user_data)
EXERCISE_SUN_SALUTATION,
content_w, 1, 1) +
bottom_padding;
return sun_salutation_preview_height(content_w) + ScaleUIPx(16) +
return (SUN_SALUTATION_ACTIVE_FIGURE_COUNT > 1 ? ScaleUIPx(148) + ScaleUIPx(16) : 0) +
sun_salutation_preview_height(content_w) + ScaleUIPx(16) +
ScaleUIPx(74) * 3 + bottom_padding;
}
@@ -309,6 +391,13 @@ sun_salutation_config_screen_draw(InbeApp *app)
int y = page.content_y;
if(app->practice_config_tab == 0) {
if(SUN_SALUTATION_ACTIVE_FIGURE_COUNT > 1) {
if(draw_sun_salutation_figure_selector(app, page.content_x, y, page.content_w)) {
save_settings(app);
}
y += ScaleUIPx(148) + ScaleUIPx(16);
}
draw_sun_salutation_preview(app, page.content_x, y, page.content_w);
y += sun_salutation_preview_height(page.content_w) + ScaleUIPx(16);
@@ -3,8 +3,15 @@
#include "app_fwd.h"
#define SUN_SALUTATION_POSE_COUNT 8
#define SUN_SALUTATION_STEP_COUNT 12
#define SUN_SALUTATION_POSE_COUNT SUN_SALUTATION_STEP_COUNT
#define SUN_SALUTATION_FIGURE_COUNT 2
#define SUN_SALUTATION_ACTIVE_FIGURE_COUNT 1
#define SUN_SALUTATION_FIGURE_MAN 0
#define SUN_SALUTATION_FIGURE_WOMAN 1
#define SUN_SALUTATION_POSE_SHEET_COLS 4
#define SUN_SALUTATION_POSE_FRAME_W 106
#define SUN_SALUTATION_POSE_FRAME_H 96
#define SUN_SALUTATION_SECONDS_MIN 3
#define SUN_SALUTATION_SECONDS_MAX 12
#define SUN_SALUTATION_DEFAULT_REPETITIONS 3
@@ -29,11 +29,14 @@ sun_salutation_exit_to_start(InbeApp *app)
static void
sun_salutation_finish(InbeApp *app)
{
int seconds = 1;
int repetitions;
if(app == NULL)
return;
if(data_save_session_path_for_activity(&seconds, 1, 0, EXERCISE_SUN_SALUTATION,
repetitions = app->sun_salutation.repetitions;
if(repetitions < 1)
repetitions = 1;
if(data_save_session_path_for_activity(&repetitions, 1, 0, EXERCISE_SUN_SALUTATION,
NULL, 0)) {
sync_habits_for_activity(app, EXERCISE_SUN_SALUTATION);
app_auto_sync(app);
@@ -155,7 +158,7 @@ sun_salutation_update_timer(InbeApp *app)
}
static void
draw_pose_image(Texture2D texture, int top_y, int bottom_y)
draw_pose_image(Texture2D texture, int pose_index, int top_y, int bottom_y)
{
Rectangle src;
Rectangle dst;
@@ -167,36 +170,91 @@ draw_pose_image(Texture2D texture, int top_y, int bottom_y)
if(texture.id == 0 || bottom_y <= top_y)
return;
if(pose_index < 0)
pose_index = 0;
if(pose_index >= SUN_SALUTATION_POSE_COUNT)
pose_index = SUN_SALUTATION_POSE_COUNT - 1;
max_w = (float)(view_width - ScaleUIPx(48));
max_h = (float)(bottom_y - top_y);
scale = max_w / (float)texture.width;
if((float)texture.height * scale > max_h)
scale = max_h / (float)texture.height;
scale = max_w / (float)SUN_SALUTATION_POSE_FRAME_W;
if((float)SUN_SALUTATION_POSE_FRAME_H * scale > max_h)
scale = max_h / (float)SUN_SALUTATION_POSE_FRAME_H;
if(scale <= 0.0f)
return;
w = (float)texture.width * scale;
h = (float)texture.height * scale;
src = (Rectangle){0, 0, (float)texture.width, (float)texture.height};
w = (float)SUN_SALUTATION_POSE_FRAME_W * scale;
h = (float)SUN_SALUTATION_POSE_FRAME_H * scale;
src = (Rectangle){
(float)((pose_index % SUN_SALUTATION_POSE_SHEET_COLS) *
SUN_SALUTATION_POSE_FRAME_W),
(float)((pose_index / SUN_SALUTATION_POSE_SHEET_COLS) *
SUN_SALUTATION_POSE_FRAME_H),
(float)SUN_SALUTATION_POSE_FRAME_W,
(float)SUN_SALUTATION_POSE_FRAME_H
};
dst = (Rectangle){((float)view_width - w) * 0.5f,
(float)top_y + (max_h - h) * 0.5f,
w, h};
DrawTexturePro(texture, src, dst, (Vector2){0}, 0.0f, WHITE);
}
static void
draw_pose_timer(InbeApp *app, int seconds, int top_y, int bottom_y)
{
char timer_text[24];
int elapsed_seconds;
int text_w;
int x;
int y;
int w;
int h = ScaleUIPx(5);
int fill_w;
int font = GetUISmallFontSize();
Color muted = DarkenUIColor(GetThemeText(), 32);
if(app == NULL || seconds <= 0 || bottom_y <= top_y)
return;
elapsed_seconds = app->sun_salutation.step_ticks / 60;
if(elapsed_seconds > seconds)
elapsed_seconds = seconds;
snprintf(timer_text, sizeof(timer_text), "%ds / %ds", elapsed_seconds, seconds);
text_w = MeasureUIText(timer_text, font);
x = (view_width - text_w) / 2;
y = top_y + ScaleUIPx(4);
DrawUIText(timer_text, x, y, font, muted);
w = view_width / 3;
if(w < ScaleUIPx(96))
w = ScaleUIPx(96);
if(w > ScaleUIPx(220))
w = ScaleUIPx(220);
x = (view_width - w) / 2;
y += font + ScaleUIPx(6);
fill_w = (w * app->sun_salutation.step_ticks) / (seconds * 60);
if(fill_w < 0)
fill_w = 0;
if(fill_w > w)
fill_w = w;
DrawRectangle(x, y, w, h, DarkenUIColor(GetThemeBackground(), 12));
DrawRectangle(x, y, fill_w, h, GetThemeButtonHover());
}
void
sun_salutation_draw_screen(InbeApp *app, int center_x, int center_y)
{
UIIconRowItem controls[3];
UIIconRowResult row;
Texture2D pose;
const char *step_label;
char step_title[32];
int step;
int repetition;
int repetitions;
int figure;
int pose_index;
int step_seconds;
int ticks_per_step;
int text_w;
int title_h = GetUITitleBarHeight();
int subtitle_h = ScaleUIPx(34);
@@ -242,12 +300,18 @@ sun_salutation_draw_screen(InbeApp *app, int center_x, int center_y)
repetition = 0;
if(repetition >= repetitions)
repetition = repetitions - 1;
figure = app->sun_salutation.figure;
if(figure < 0 || figure >= SUN_SALUTATION_ACTIVE_FIGURE_COUNT)
figure = SUN_SALUTATION_FIGURE_MAN;
app->sun_salutation.step = step;
app->sun_salutation.repetition = repetition;
app->sun_salutation.repetitions = repetitions;
app->sun_salutation.figure = figure;
pose_index = sun_salutation_step_pose_index(step);
pose = app->sun_salutation.poses[pose_index];
step_seconds = sun_salutation_step_seconds(app);
ticks_per_step = step_seconds * 60;
if(ticks_per_step <= 0)
ticks_per_step = SUN_SALUTATION_DEFAULT_START_SECONDS * 60;
step_label = sun_salutation_step_label(step);
FormatLocaleText(step_title, sizeof(step_title), "sun_salutation_session_step_title",
step + 1, SUN_SALUTATION_STEP_COUNT);
@@ -288,7 +352,9 @@ sun_salutation_draw_screen(InbeApp *app, int center_x, int center_y)
});
image_bottom = row.y - ScaleUIPx(18);
draw_pose_image(pose, content_top, image_bottom);
draw_pose_timer(app, step_seconds, content_top, image_bottom);
draw_pose_image(app->sun_salutation.pose_sheets[figure], pose_index,
content_top + ScaleUIPx(28), image_bottom);
if(row.clicked_index == 0)
sun_salutation_step_back(app);
+101 -18
View File
@@ -438,28 +438,111 @@ finish_round(InbeApp *app)
}
static void
session_step_back(InbeApp *app)
clear_round_results_from(InbeApp *app, int first_round)
{
int speed = app->inbe.speed_level;
int max_rounds = app->inbe.max_rounds;
int max_breaths = int_from_count(app->inbe.maxbreaths);
int pause_seconds = app->saved_pause_seconds;
int progressive_speed = app->inbe.progressive_speed;
int progressive_start_speed = app->inbe.progressive_start_speed;
int play_in_background = app->inbe.play_in_background;
if(app == NULL)
return;
inbeinit(&app->inbe);
app->inbe.progressive_speed = progressive_speed;
app->inbe.progressive_start_speed = progressive_start_speed;
app->inbe.play_in_background = play_in_background;
apply_settings(&app->inbe, speed, max_rounds, max_breaths, pause_seconds);
app->saved_pause_seconds = pause_seconds;
app->inbe.pause_seconds = 3;
session_update_circle_bounds_for_view(&app->inbe, GetUITitleBarHeight(), ScaleUIPx(56) + 80);
app->inbe.screen = InbeScreenSession;
app->session_paused = 0;
if(first_round < 0)
first_round = 0;
if(first_round >= MaxRounds)
return;
for(int i = first_round; i < MaxRounds; i++)
cpcount(app->inbe.results[i], "000");
app->results_saved = 0;
app->results_path[0] = '\0';
}
static int
session_round_has_starting_step(InbeApp *app)
{
if(app == NULL)
return 0;
return app->inbe.round == 0 || app->inbe.pause_seconds > 0;
}
static void
session_enter_starting_step(InbeApp *app)
{
app->inbe.phase = InbePhaseStarting;
app->inbe.dir = 0;
app->inbe.r = app->inbe.rmin;
app->inbe.breath_frame = 0;
app->inbe.breathtick = 0;
app->inbe.sectick = 0;
app->inbe.halftick = 0;
cpcount(app->inbe.count, "000");
}
static void
session_enter_previous_round_last_step(InbeApp *app)
{
if(app->inbe.round <= 0)
return;
clear_round_results_from(app, app->inbe.round);
app->inbe.round--;
app->inbe.phase = InbePhaseNext;
app->inbe.dir = 0;
app->inbe.r = app->inbe.rmax;
app->inbe.breath_frame = 0;
app->inbe.breathtick = 0;
app->inbe.sectick = 0;
app->inbe.halftick = 0;
cpcount(app->inbe.count, "000");
}
static void
session_step_back(InbeApp *app)
{
if(app == NULL)
return;
switch(app->inbe.phase) {
case InbePhaseStarting:
if(app->inbe.round > 0)
session_enter_previous_round_last_step(app);
else
session_enter_starting_step(app);
break;
case InbePhaseBreathe:
clear_round_results_from(app, app->inbe.round);
if(session_round_has_starting_step(app))
session_enter_starting_step(app);
else if(app->inbe.round > 0)
session_enter_previous_round_last_step(app);
else
session_reset_round_breathe(&app->inbe);
break;
case InbePhaseHold:
clear_round_results_from(app, app->inbe.round);
session_reset_round_breathe(&app->inbe);
break;
case InbePhaseRecover:
app->inbe.phase = InbePhaseHold;
app->inbe.dir = 0;
app->inbe.r = app->inbe.rmin;
app->inbe.breath_frame = 0;
app->inbe.breathtick = 0;
app->inbe.sectick = 0;
app->inbe.halftick = 0;
cpcount(app->inbe.count, app->inbe.results[app->inbe.round]);
clear_round_results_from(app, app->inbe.round);
break;
case InbePhaseNext:
app->inbe.phase = InbePhaseRecover;
app->inbe.dir = 0;
app->inbe.r = app->inbe.rmax;
app->inbe.breath_frame = 0;
app->inbe.breathtick = 0;
app->inbe.sectick = 0;
app->inbe.halftick = 0;
count_from_int(app->inbe.count, 14);
break;
}
remember_sound_state(app);
}
+4 -1
View File
@@ -276,7 +276,10 @@ draw_habit_session_edit_content(InbeApp *app, HabitLinkedContext *ctx, int conte
ctx->entries[i].hour, ctx->entries[i].minute);
if(activity == EXERCISE_SUN_SALUTATION)
FormatLocaleText(summary_text, sizeof(summary_text),
"session_count_singular", 1);
"practice_home_repetitions",
ctx->entries[i].round_count > 0
? ctx->entries[i].rounds[0]
: 1);
else if(activity == EXERCISE_MEDITATION)
habit_format_duration(ctx->entries[i].total_seconds,
summary_text, sizeof(summary_text));
+24 -5
View File
@@ -6,13 +6,29 @@
#include "ui.h"
#include "flint.h"
#include <string.h>
extern int view_width;
extern int view_height;
static const char *g_language_options[64];
static UIDropdownOption g_language_options[64];
static int g_language_option_count = 0;
static const char *
language_font_name_for_code(const char *code)
{
if(code == NULL)
return "ui-lang-latin";
if(strcmp(code, "ja") == 0)
return "ui-lang-ja";
if(strcmp(code, "ko") == 0)
return "ui-lang-ko";
if(strcmp(code, "zh") == 0)
return "ui-lang-zh";
return "ui-lang-latin";
}
static void
build_language_options(const char **options, int max_options, int *count)
build_language_options(UIDropdownOption *options, int max_options, int *count)
{
int total = GetLocaleCount();
@@ -21,8 +37,10 @@ build_language_options(const char **options, int max_options, int *count)
if(total < 0)
total = 0;
for(int i = 0; i < total; i++)
options[i] = GetLocaleLabel(i);
for(int i = 0; i < total; i++) {
options[i].label = GetLocaleLabel(i);
options[i].font_name = language_font_name_for_code(GetLocaleCode(i));
}
*count = total;
}
@@ -46,7 +64,8 @@ language_dropdown_button(InbeApp *app, int id, int x, int y, int w, int h, int *
if(*selected_index < 0 || *selected_index >= g_language_option_count)
*selected_index = 0;
return DrawUIDropdownButton(id, x, y, w, h, g_language_options, g_language_option_count, selected_index);
return DrawUIDropdownButtonEx(id, x, y, w, h, g_language_options,
g_language_option_count, selected_index);
}
int
+5 -2
View File
@@ -267,10 +267,13 @@ profile_screen_draw(InbeApp *app)
int previous_tab = profile_draw_tab_dropdown(app, selector_y, view_width);
if(app->profile_tab != previous_tab) {
app->profile_scroll = 0;
if(app->profile_tab == PROFILE_TAB_FRIENDS)
if(app->profile_tab == PROFILE_TAB_FRIENDS) {
profile_social_load_friends_cache(app);
else if(app->profile_tab == PROFILE_TAB_LEADERBOARD)
app_request_social_refresh(app);
} else if(app->profile_tab == PROFILE_TAB_LEADERBOARD) {
profile_social_load_leaderboard_cache(app);
app_request_social_refresh(app);
}
}
}
+89 -137
View File
@@ -162,78 +162,16 @@ profile_social_load_leaderboard_cache(InbeApp *app)
app->profile_leaderboard_loaded = 1;
}
static const char *
profile_json_string_value(const char *object, const char *key, char *out, size_t out_size)
{
char pattern[48];
const char *p;
char *w;
size_t left;
if(out == NULL || out_size == 0)
return NULL;
out[0] = '\0';
snprintf(pattern, sizeof(pattern), "\"%s\"", key);
p = strstr(object, pattern);
if(p == NULL)
return NULL;
p = strchr(p + strlen(pattern), ':');
if(p == NULL)
return NULL;
p++;
while(*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')
p++;
if(*p++ != '"')
return NULL;
w = out;
left = out_size - 1;
while(*p != '\0' && *p != '"' && left > 0) {
if(*p == '\\' && p[1] != '\0')
p++;
*w++ = *p++;
left--;
}
*w = '\0';
return *p == '"' ? p + 1 : NULL;
}
static double
profile_json_number_value(const char *object, const char *key)
{
char pattern[48];
const char *p;
snprintf(pattern, sizeof(pattern), "\"%s\"", key);
p = strstr(object, pattern);
if(p == NULL)
return 0.0;
p = strchr(p + strlen(pattern), ':');
if(p == NULL)
return 0.0;
return atof(p + 1);
}
static int
profile_json_array_count(const char *json, const char *array_key)
{
char key_pattern[48];
const char *p;
const char *end;
int count = 0;
char path[48];
snprintf(key_pattern, sizeof(key_pattern), "\"%s\"", array_key);
p = strstr(json != NULL ? json : "", key_pattern);
if(p == NULL)
if(array_key == NULL || array_key[0] == '\0')
return 0;
p = strchr(p, '[');
end = p != NULL ? strchr(p, ']') : NULL;
if(p == NULL || end == NULL)
if(snprintf(path, sizeof(path), "$.%s", array_key) >= (int)sizeof(path))
return 0;
while((p = strchr(p, '{')) != NULL && p < end) {
count++;
p++;
}
return count;
return storage_json_array_count_path(json, path);
}
int
@@ -301,32 +239,28 @@ static void
profile_draw_json_people(const char *json, const char *array_key,
int x, int w, int *y, int with_actions, InbeApp *app)
{
char key_pattern[48];
const char *p;
const char *end;
int rows = 0;
char array_path[48];
int count;
int font = GetUIFontSize();
int small = GetUISmallFontSize();
int with_remove = !with_actions && strcmp(array_key, "friends") == 0;
int with_cancel = !with_actions && strcmp(array_key, "outgoing") == 0;
snprintf(key_pattern, sizeof(key_pattern), "\"%s\"", array_key);
p = strstr(json != NULL ? json : "", key_pattern);
if(p == NULL) {
if(snprintf(array_path, sizeof(array_path), "$.%s", array_key) >=
(int)sizeof(array_path)) {
DrawUIText(GetLocaleText("profile_none_label"), x, *y, small,
DarkenUIColor(GetThemeText(), 35));
*y += ScaleUIPx(24);
return;
}
p = strchr(p, '[');
end = p != NULL ? strchr(p, ']') : NULL;
if(p == NULL || end == NULL) {
count = storage_json_array_count_path(json, array_path);
if(count <= 0) {
DrawUIText(GetLocaleText("profile_none_label"), x, *y, small,
DarkenUIColor(GetThemeText(), 35));
*y += ScaleUIPx(24);
return;
}
while((p = strchr(p, '{')) != NULL && p < end && rows < 8) {
for(int rows = 0; rows < count; rows++) {
char id[80];
char alias[48];
char display_id[80];
@@ -341,23 +275,34 @@ profile_draw_json_people(const char *json, const char *array_key,
id[0] = '\0';
alias[0] = '\0';
display_id[0] = '\0';
if(profile_json_string_value(p, "id", id, sizeof(id)) == NULL &&
profile_json_string_value(p, "user_id_hash", id, sizeof(id)) == NULL)
break;
if(!storage_json_array_object_text(json, array_path, rows, "id",
id, sizeof(id)))
storage_json_array_object_text(json, array_path, rows,
"user_id_hash", id, sizeof(id));
if(id[0] == '\0')
continue;
if(strcmp(array_key, "incoming") == 0) {
profile_json_string_value(p, "requester_alias", alias, sizeof(alias));
profile_json_string_value(p, "requester_user_id_hash", display_id,
sizeof(display_id));
storage_json_array_object_text(json, array_path, rows,
"requester_alias", alias, sizeof(alias));
storage_json_array_object_text(json, array_path, rows,
"requester_user_id_hash", display_id,
sizeof(display_id));
} else if(strcmp(array_key, "outgoing") == 0) {
profile_json_string_value(p, "target_alias", alias, sizeof(alias));
profile_json_string_value(p, "target_user_id_hash", display_id,
sizeof(display_id));
storage_json_array_object_text(json, array_path, rows,
"target_alias", alias, sizeof(alias));
storage_json_array_object_text(json, array_path, rows,
"target_user_id_hash", display_id,
sizeof(display_id));
} else {
profile_json_string_value(p, "alias", alias, sizeof(alias));
profile_json_string_value(p, "user_id_hash", display_id, sizeof(display_id));
storage_json_array_object_text(json, array_path, rows,
"alias", alias, sizeof(alias));
storage_json_array_object_text(json, array_path, rows,
"user_id_hash", display_id,
sizeof(display_id));
}
if(alias[0] == '\0')
profile_json_string_value(p, "alias", alias, sizeof(alias));
storage_json_array_object_text(json, array_path, rows,
"alias", alias, sizeof(alias));
if(display_id[0] == '\0')
snprintf(display_id, sizeof(display_id), "%s", id);
profile_display_name(title, sizeof(title), alias, display_id);
@@ -406,13 +351,6 @@ profile_draw_json_people(const char *json, const char *array_key,
}
}
*y += row_h;
rows++;
p++;
}
if(rows == 0) {
DrawUIText(GetLocaleText("profile_none_label"), x, *y, small,
DarkenUIColor(GetThemeText(), 35));
*y += ScaleUIPx(24);
}
}
@@ -496,11 +434,18 @@ profile_social_draw_friends(InbeApp *app, int x, int w, int *y)
app->profile_friend_input[0] == '\0', &hover_add) || commit) &&
app->profile_friend_input[0] != '\0') {
if(profile_sync_url(url, sizeof(url))) {
app_request_friend_send(app, app->profile_friend_input);
settings_screen_set_status_success(GetLocaleText("profile_updating_status"), NULL);
profile_social_load_friends_cache(app);
app->profile_friend_input[0] = '\0';
app->profile_friend_input_cursor = 0;
char target[80];
if(sync_client_normalize_friend_target(app->profile_friend_input,
target, sizeof(target))) {
app_request_friend_send(app, target);
settings_screen_set_status_success(GetLocaleText("profile_updating_status"), NULL);
profile_social_load_friends_cache(app);
app->profile_friend_input[0] = '\0';
app->profile_friend_input_cursor = 0;
} else {
settings_screen_set_status_error(GetLocaleText("profile_friend_invalid"));
}
} else {
settings_screen_set_status_error(GetLocaleText("sync_server_url_invalid"));
}
@@ -544,14 +489,13 @@ profile_social_friends_content_height(InbeApp *app, int content_w)
friends_count = profile_json_array_count(app->profile_friends_json, "friends");
if(incoming_count > 0)
h += ScaleUIPx(28) +
(incoming_count > 8 ? 8 : incoming_count) * ScaleUIPx(42) +
incoming_count * ScaleUIPx(42) +
ScaleUIPx(16);
h += ScaleUIPx(28) +
(friends_count > 0 ? (friends_count > 8 ? 8 : friends_count) * ScaleUIPx(30)
: ScaleUIPx(24));
(friends_count > 0 ? friends_count * ScaleUIPx(30) : ScaleUIPx(24));
if(outgoing_count > 0)
h += ScaleUIPx(16) + ScaleUIPx(28) +
(outgoing_count > 8 ? 8 : outgoing_count) * ScaleUIPx(30);
outgoing_count * ScaleUIPx(30);
return h + ScaleUIPx(16);
}
@@ -637,8 +581,9 @@ profile_leaderboard_row_compare(const void *left_ptr, const void *right_ptr)
static void
profile_draw_leaderboard_rows(InbeApp *app, const char *json, int x, int w, int *y)
{
const char *p = strstr(json != NULL ? json : "", "\"rows\"");
int rows = 0;
int cache_rows;
int friend_rows;
int font = GetUIFontSize();
int small = GetUISmallFontSize();
ProfileLeaderboardDrawRow draw_rows[24];
@@ -650,18 +595,24 @@ profile_draw_leaderboard_rows(InbeApp *app, const char *json, int x, int w, int
self_sort_value = profile_local_leaderboard_value(app, self_value, sizeof(self_value));
while(p != NULL && (p = strchr(p, '{')) != NULL && rows < 24) {
cache_rows = storage_json_array_count_path(json, "$.rows");
for(int i = 0; i < cache_rows && rows < 24; i++) {
char alias[48];
char user_id[80];
char value[48];
char label[48];
double number;
if(profile_json_string_value(p, "user_id_hash", user_id, sizeof(user_id)) == NULL)
break;
profile_json_string_value(p, "alias", alias, sizeof(alias));
profile_json_string_value(p, "label", label, sizeof(label));
number = profile_json_number_value(p, "value");
alias[0] = '\0';
label[0] = '\0';
if(!storage_json_array_object_text(json, "$.rows", i, "user_id_hash",
user_id, sizeof(user_id)))
continue;
storage_json_array_object_text(json, "$.rows", i, "alias",
alias, sizeof(alias));
storage_json_array_object_text(json, "$.rows", i, "label",
label, sizeof(label));
number = storage_json_array_object_number(json, "$.rows", i, "value");
if(has_account && strcmp(user_id, account.public_id) == 0) {
snprintf(value, sizeof(value), "%s", self_value);
number = self_sort_value;
@@ -679,7 +630,6 @@ profile_draw_leaderboard_rows(InbeApp *app, const char *json, int x, int w, int
snprintf(draw_rows[rows].value, sizeof(draw_rows[rows].value), "%s", value);
draw_rows[rows].sort_value = number;
rows++;
p++;
}
if(has_account && !self_seen && rows < 24) {
@@ -694,29 +644,28 @@ profile_draw_leaderboard_rows(InbeApp *app, const char *json, int x, int w, int
rows++;
}
p = strstr(app != NULL ? app->profile_friends_json : "", "\"friends\"");
while(p != NULL && (p = strchr(p, '{')) != NULL && rows < 24) {
friend_rows = storage_json_array_count_path(app != NULL ? app->profile_friends_json : "",
"$.friends");
for(int i = 0; i < friend_rows && rows < 24; i++) {
char alias[48];
char user_id[80];
if(profile_json_string_value(p, "user_id_hash", user_id, sizeof(user_id)) == NULL)
break;
alias[0] = '\0';
if(!storage_json_array_object_text(app != NULL ? app->profile_friends_json : "",
"$.friends", i, "user_id_hash",
user_id, sizeof(user_id)))
continue;
if(profile_leaderboard_row_seen(draw_rows, rows, user_id)) {
p++;
continue;
}
profile_json_string_value(p, "alias", alias, sizeof(alias));
storage_json_array_object_text(app != NULL ? app->profile_friends_json : "",
"$.friends", i, "alias", alias,
sizeof(alias));
snprintf(draw_rows[rows].user_id, sizeof(draw_rows[rows].user_id), "%s", user_id);
snprintf(draw_rows[rows].alias, sizeof(draw_rows[rows].alias), "%s", alias);
snprintf(draw_rows[rows].value, sizeof(draw_rows[rows].value), "%s",
app != NULL &&
app->profile_leaderboard_practice == EXERCISE_MEDITATION &&
app->profile_leaderboard_metric == PROFILE_LEADERBOARD_AVG_HOLD
? "0:00"
: "0");
draw_rows[rows].sort_value = 0.0;
snprintf(draw_rows[rows].value, sizeof(draw_rows[rows].value), "...");
draw_rows[rows].sort_value = -1.0;
rows++;
p++;
}
qsort(draw_rows, (size_t)rows, sizeof(draw_rows[0]), profile_leaderboard_row_compare);
@@ -742,42 +691,45 @@ profile_draw_leaderboard_rows(InbeApp *app, const char *json, int x, int w, int
static int
profile_leaderboard_row_count(InbeApp *app, const char *json)
{
const char *p = strstr(json != NULL ? json : "", "\"rows\"");
ProfileLeaderboardDrawRow draw_rows[24];
InbeSyncAccount account;
int has_account = sync_account_load(&account) && account.public_id[0] != '\0';
int self_seen = 0;
int rows = 0;
int cache_rows = storage_json_array_count_path(json, "$.rows");
int friend_rows;
while(p != NULL && (p = strchr(p, '{')) != NULL && rows < 24) {
for(int i = 0; i < cache_rows && rows < 24; i++) {
char user_id[80];
if(profile_json_string_value(p, "user_id_hash", user_id, sizeof(user_id)) == NULL)
break;
if(!storage_json_array_object_text(json, "$.rows", i, "user_id_hash",
user_id, sizeof(user_id)))
continue;
if(has_account && strcmp(user_id, account.public_id) == 0)
self_seen = 1;
snprintf(draw_rows[rows].user_id, sizeof(draw_rows[rows].user_id), "%s", user_id);
draw_rows[rows].alias[0] = '\0';
rows++;
p++;
}
if(has_account && !self_seen && rows < 24) {
snprintf(draw_rows[rows].user_id, sizeof(draw_rows[rows].user_id), "%s",
account.public_id);
rows++;
}
p = strstr(app != NULL ? app->profile_friends_json : "", "\"friends\"");
while(p != NULL && (p = strchr(p, '{')) != NULL && rows < 24) {
friend_rows = storage_json_array_count_path(app != NULL ? app->profile_friends_json : "",
"$.friends");
for(int i = 0; i < friend_rows && rows < 24; i++) {
char user_id[80];
if(profile_json_string_value(p, "user_id_hash", user_id, sizeof(user_id)) == NULL)
break;
if(!storage_json_array_object_text(app != NULL ? app->profile_friends_json : "",
"$.friends", i, "user_id_hash",
user_id, sizeof(user_id)))
continue;
if(!profile_leaderboard_row_seen(draw_rows, rows, user_id)) {
snprintf(draw_rows[rows].user_id, sizeof(draw_rows[rows].user_id), "%s",
user_id);
rows++;
}
p++;
}
return rows > 12 ? 12 : rows;
}
+27 -1
View File
@@ -12,6 +12,32 @@
extern int view_width;
extern int view_height;
static const char *
settings_theme_label_key(ThemeId theme)
{
switch(NormalizeTheme(theme)) {
case THEME_SKY: return "theme_sky";
case THEME_OCEAN: return "theme_ocean";
case THEME_FOREST: return "theme_forest";
case THEME_SUNSET: return "theme_sunset";
case THEME_LAVENDER: return "theme_lavender";
case THEME_CHERRY: return "theme_cherry";
case THEME_DAWN: return "theme_dawn";
case THEME_SAGE: return "theme_sage";
case THEME_INK: return "theme_sepia";
case THEME_MONO: return "theme_mono";
case THEME_MINT: return "theme_mint";
case THEME_COBALT: return "theme_cobalt";
default: return "theme_sky";
}
}
static const char *
settings_theme_label(ThemeId theme)
{
return GetLocaleText(settings_theme_label_key(theme));
}
int
settings_theme_content_height(int content_w)
{
@@ -60,7 +86,7 @@ settings_theme_draw(InbeApp *app, int x, int w, int *y, SettingsThemeState *stat
if(app->theme_source == APP_THEME_SOURCE_APP) {
for(int i = 0; i < THEME_COUNT; i++)
theme_options[i] = GetThemeLabel((ThemeId)i);
theme_options[i] = settings_theme_label((ThemeId)i);
app->theme_id = clampi(app->theme_id, 0, THEME_COUNT - 1);
DrawUIText(GetLocaleText("theme_palette_label"), x, *y, GetUIFontSize(), GetThemeText());
DrawUIDropdownButton(103, x, *y + ScaleUIPx(26), w, ScaleUIPx(36),
+8
View File
@@ -262,6 +262,14 @@ schema_create(void)
" round_index INTEGER NOT NULL,"
" seconds INTEGER NOT NULL,"
" PRIMARY KEY(session_id,round_index)"
");"
"CREATE TABLE IF NOT EXISTS meditation_logs("
" id TEXT PRIMARY KEY,"
" user_id TEXT NOT NULL,"
" session_id TEXT NOT NULL,"
" duration_seconds INTEGER NOT NULL,"
" completed_at INTEGER NOT NULL,"
" updated_at INTEGER NOT NULL DEFAULT 0"
");") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS habits("
+4 -34
View File
@@ -1,5 +1,6 @@
#include "import.h"
#include "app_setting_keys.h"
#include "db.h"
#include "screens/habits_screen.h"
#include "breath_engine.h"
@@ -73,40 +74,9 @@ source_count_rows(sqlite3 *db, const char *sql)
}
static const char *const importable_setting_keys[] = {
"speed",
"max_rounds",
"max_breaths",
"pause_seconds",
"sound_volume",
"tutorial_seen",
"exercise_manual_seen_mask",
"theme",
"theme_source",
"dark_mode",
"theme_mode",
"orientation_mode",
"main_tab",
"fullscreen",
"on_screen_keyboard",
"progressive_speed",
"progressive_start_speed",
"breath_animation",
"double_tap_to_breathe",
"advanced_session_controls",
"hold_display_mode",
"exercise_type",
"meditation_duration_mode",
"meditation_custom_minutes",
"meditation_show_extend_controls",
"meditation_music_track",
"practice_music_mask",
"practice_music_track_wim_hof",
"practice_music_track_meditation",
"practice_music_track_sun_salutation",
"play_in_background",
"language",
"practice_category_tab",
"practice_visible_mask"
#define INBE_SETTING_KEY_ENTRY(key) key,
INBE_IMPORTABLE_SETTING_KEYS(INBE_SETTING_KEY_ENTRY)
#undef INBE_SETTING_KEY_ENTRY
};
static int
+190 -20
View File
@@ -65,7 +65,6 @@ storage_next_change_time(void)
" SELECT COALESCE(MAX(updated_at),0) AS updated_at FROM habits"
" UNION ALL SELECT COALESCE(MAX(updated_at),0) FROM habit_days"
" UNION ALL SELECT COALESCE(MAX(updated_at),0) FROM sessions"
" UNION ALL SELECT COALESCE(MAX(updated_at),0) FROM social_snapshots"
")",
0);
return latest >= now ? latest + 1 : now;
@@ -395,9 +394,7 @@ storage_has_local_syncable_data(void)
"WHERE user_id=(SELECT id FROM users LIMIT 1) AND deleted_at=0 LIMIT 1) "
"OR EXISTS(SELECT 1 FROM habit_days hd JOIN habits h ON h.id=hd.habit_id "
"WHERE h.user_id=(SELECT id FROM users LIMIT 1) "
"AND (hd.completed!=0 OR hd.count>0) LIMIT 1) "
"OR EXISTS(SELECT 1 FROM social_snapshots "
"WHERE user_id=(SELECT id FROM users LIMIT 1) LIMIT 1)",
"AND (hd.completed!=0 OR hd.count>0) LIMIT 1)",
0) != 0;
}
@@ -1496,6 +1493,56 @@ storage_json_array_count(const char *json, const char *path)
return count;
}
int
storage_json_array_count_path(const char *json, const char *path)
{
return storage_json_array_count(json, path);
}
int
storage_json_array_object_text(const char *json, const char *array_path,
int index, const char *key,
char *out, size_t out_size)
{
char path[128];
if(out == NULL || out_size == 0)
return 0;
out[0] = '\0';
if(array_path == NULL || key == NULL || index < 0)
return 0;
if(snprintf(path, sizeof(path), "%s[%d].%s", array_path, index, key) >=
(int)sizeof(path))
return 0;
return storage_json_extract_text(json, path, out, out_size);
}
double
storage_json_array_object_number(const char *json, const char *array_path,
int index, const char *key)
{
char path[128];
sqlite3_stmt *stmt = NULL;
double value = 0.0;
if(g_storage.db == NULL || json == NULL || array_path == NULL ||
key == NULL || index < 0)
return 0.0;
if(snprintf(path, sizeof(path), "%s[%d].%s", array_path, index, key) >=
(int)sizeof(path))
return 0.0;
if(sqlite3_prepare_v2(g_storage.db,
"SELECT CAST(COALESCE(json_extract(?1,?2),0) AS REAL)",
-1, &stmt, NULL) != SQLITE_OK)
return 0.0;
bind_text(stmt, 1, json);
bind_text(stmt, 2, path);
if(sqlite3_step(stmt) == SQLITE_ROW)
value = sqlite3_column_double(stmt, 0);
sqlite3_finalize(stmt);
return value;
}
static int
storage_sync_response_has_changes(const char *json)
{
@@ -1911,8 +1958,8 @@ storage_merge_duplicate_habit_names(void)
return ok;
}
int
storage_apply_sync_response_json(const char *response_json)
static int
storage_apply_sync_habits_json(const char *response_json)
{
static const char *habits_sql =
"INSERT INTO "
@@ -1951,6 +1998,13 @@ storage_apply_sync_response_json(const char *response_json)
" SELECT 1 FROM sync_outbox "
" WHERE entity_type='habit' AND entity_id=habits.id AND local_date=0"
"))";
return storage_exec_json_user_sql(habits_sql, response_json);
}
static int
storage_apply_sync_habit_days_json(const char *response_json)
{
static const char *habit_days_sql =
"INSERT INTO habit_days(habit_id,local_date,completed,count,updated_at) "
"SELECT COALESCE(json_extract(value,'$.habit_id'),''),"
@@ -1974,6 +2028,13 @@ storage_apply_sync_response_json(const char *response_json)
" WHERE entity_type='habit_day' AND entity_id=habit_days.habit_id "
" AND local_date=habit_days.local_date"
" ))";
return storage_exec_json_user_sql(habit_days_sql, response_json);
}
static int
storage_apply_sync_sessions_json(const char *response_json)
{
static const char *sessions_sql =
"INSERT INTO "
"sessions(id,user_id,started_at,local_date,topic,activity,source,"
@@ -2009,6 +2070,13 @@ storage_apply_sync_response_json(const char *response_json)
" SELECT 1 FROM sync_outbox "
" WHERE entity_type='session' AND entity_id=sessions.id AND local_date=0"
"))";
return storage_exec_json_user_sql(sessions_sql, response_json);
}
static int
storage_apply_sync_session_rounds_json(const char *response_json)
{
static const char *delete_rounds_sql =
"DELETE FROM session_rounds WHERE session_id IN ("
" SELECT COALESCE(json_extract(value,'$.id'),'') "
@@ -2057,6 +2125,40 @@ storage_apply_sync_response_json(const char *response_json)
" AND NOT EXISTS (SELECT 1 FROM sync_outbox "
" WHERE entity_type='session' AND "
"entity_id=COALESCE(json_extract(s.value,'$.id'),'') AND local_date=0)))";
return storage_exec_json_user_sql(delete_rounds_sql, response_json) &&
storage_exec_json_user_sql(rounds_sql, response_json);
}
static int
storage_apply_sync_meditation_logs_json(const char *response_json)
{
static const char *meditation_logs_sql =
"INSERT INTO "
"meditation_logs(id,user_id,session_id,duration_seconds,completed_at,updated_at) "
"SELECT COALESCE(json_extract(value,'$.id'),''),?2,"
" COALESCE(json_extract(value,'$.session_id'),''),"
" CAST(COALESCE(json_extract(value,'$.duration_seconds'),"
" json_extract(value,'$.duration'),0) AS INTEGER),"
" CAST(COALESCE(strftime('%s',json_extract(value,'$.completed_at')),"
" strftime('%s',json_extract(value,'$.timestamp')),'0') AS INTEGER),"
" CAST(COALESCE(strftime('%s',json_extract(value,'$.completed_at')),"
" strftime('%s',json_extract(value,'$.timestamp')),'0') AS INTEGER) "
"FROM (SELECT value FROM json_each(?1,'$.changes.meditation_logs') "
" UNION ALL SELECT value FROM json_each(?1,'$.data.meditation_logs')) "
"WHERE COALESCE(json_extract(value,'$.id'),'')<>'' "
"ON CONFLICT(id) DO UPDATE SET "
" user_id=excluded.user_id,session_id=excluded.session_id,"
" duration_seconds=excluded.duration_seconds,"
" completed_at=excluded.completed_at,updated_at=excluded.updated_at "
"WHERE excluded.updated_at > meditation_logs.updated_at";
return storage_exec_json_user_sql(meditation_logs_sql, response_json);
}
static int
storage_apply_sync_social_json(const char *response_json)
{
static const char *social_cache_sql =
"INSERT INTO social_snapshots(user_id,kind,json,updated_at) "
"SELECT ?2,"
@@ -2077,6 +2179,14 @@ storage_apply_sync_response_json(const char *response_json)
"WHERE COALESCE(json_extract(value,'$.kind'),'')<>'' "
"ON CONFLICT(user_id,kind) DO UPDATE SET "
" json=excluded.json,updated_at=excluded.updated_at";
return storage_exec_json_user_sql(social_sql, response_json) &&
storage_exec_json_user_sql(social_cache_sql, response_json);
}
int
storage_apply_sync_response_json(const char *response_json)
{
long long server_version;
long long server_clock;
long long old_server_version;
@@ -2120,14 +2230,13 @@ storage_apply_sync_response_json(const char *response_json)
return 0;
storage_clear_uploaded_outbox(g_storage.pending_sync_outbox_seq);
if(!storage_reconcile_remote_habit_ids(response_json) ||
!storage_exec_json_user_sql(habits_sql, response_json) ||
!storage_exec_json_user_sql(habit_days_sql, response_json) ||
!storage_apply_sync_habits_json(response_json) ||
!storage_apply_sync_habit_days_json(response_json) ||
!storage_merge_duplicate_habit_names() ||
!storage_exec_json_user_sql(delete_rounds_sql, response_json) ||
!storage_exec_json_user_sql(rounds_sql, response_json) ||
!storage_exec_json_user_sql(sessions_sql, response_json) ||
!storage_exec_json_user_sql(social_sql, response_json) ||
!storage_exec_json_user_sql(social_cache_sql, response_json)) {
!storage_apply_sync_session_rounds_json(response_json) ||
!storage_apply_sync_sessions_json(response_json) ||
!storage_apply_sync_meditation_logs_json(response_json) ||
!storage_apply_sync_social_json(response_json)) {
exec_sql("ROLLBACK TO inbe_sync_apply");
exec_sql("RELEASE inbe_sync_apply");
return 0;
@@ -2195,8 +2304,11 @@ storage_apply_remote_full_snapshot(const char *response_json)
static int
storage_clear_local_sync_data(void)
{
static const char *const sqls[] = {"DELETE FROM session_rounds", "DELETE FROM sessions",
"DELETE FROM habit_days", "DELETE FROM habits",
static const char *const sqls[] = {"DELETE FROM meditation_logs",
"DELETE FROM session_rounds",
"DELETE FROM sessions",
"DELETE FROM habit_days",
"DELETE FROM habits",
"DELETE FROM social_snapshots",
"DELETE FROM sync_outbox"};
@@ -2306,6 +2418,21 @@ storage_profile_day_offset(int local_date, int today_date)
return (int)(diff_days + 0.5);
}
static int
storage_profile_date_from_epoch(long long epoch)
{
time_t value = (time_t)epoch;
struct tm *tm_value;
if(epoch <= 0)
return 0;
tm_value = gmtime(&value);
if(tm_value == NULL)
return 0;
return (tm_value->tm_year + 1900) * 10000 +
(tm_value->tm_mon + 1) * 100 + tm_value->tm_mday;
}
int
storage_profile_activity_stats(int activity, int today_date,
int *streak_out, long *avg_hold_out)
@@ -2313,6 +2440,7 @@ storage_profile_activity_stats(int activity, int today_date,
sqlite3_stmt *stmt = NULL;
int seen[371] = {0};
int streak = 0;
int latest_offset = -1;
long avg_value = 0;
if(streak_out != NULL)
@@ -2332,12 +2460,42 @@ storage_profile_activity_stats(int activity, int today_date,
sqlite3_bind_int(stmt, 2, activity);
while(sqlite3_step(stmt) == SQLITE_ROW) {
int offset = storage_profile_day_offset(sqlite3_column_int(stmt, 0), today_date);
if(offset >= 0 && offset <= 370)
if(offset >= 0 && offset <= 370) {
seen[offset] = 1;
if(latest_offset < 0 || offset < latest_offset)
latest_offset = offset;
}
}
sqlite3_finalize(stmt);
stmt = NULL;
if(activity == 1 &&
sqlite3_prepare_v2(g_storage.db,
"SELECT completed_at FROM meditation_logs "
"WHERE user_id=?1 AND duration_seconds>0",
-1, &stmt, NULL) == SQLITE_OK) {
bind_text(stmt, 1, g_storage.user_id);
while(sqlite3_step(stmt) == SQLITE_ROW) {
int local_date = storage_profile_date_from_epoch(sqlite3_column_int64(stmt, 0));
int offset = storage_profile_day_offset(local_date, today_date);
if(offset >= 0 && offset <= 370) {
seen[offset] = 1;
if(latest_offset < 0 || offset < latest_offset)
latest_offset = offset;
}
}
sqlite3_finalize(stmt);
stmt = NULL;
}
if(latest_offset > 0) {
int i;
for(i = 0; i + latest_offset <= 370; i++)
seen[i] = seen[i + latest_offset];
for(; i <= 370; i++)
seen[i] = 0;
}
while(streak <= 370 && seen[streak])
streak++;
@@ -2356,14 +2514,26 @@ storage_profile_activity_stats(int activity, int today_date,
}
} else if(activity == 1) {
if(sqlite3_prepare_v2(g_storage.db,
"SELECT COALESCE(AVG(total_seconds),0) "
"FROM ("
" SELECT SUM(sr.seconds) AS total_seconds "
"WITH session_totals AS ("
" SELECT s.id, SUM(sr.seconds) AS seconds "
" FROM sessions s JOIN session_rounds sr ON sr.session_id=s.id "
" WHERE s.user_id=?1 AND s.deleted_at=0 AND s.activity=?2 "
" AND sr.seconds>0 "
" GROUP BY s.id"
")",
"),"
"log_totals AS ("
" SELECT ml.session_id AS id, ml.duration_seconds AS seconds "
" FROM meditation_logs ml "
" WHERE ml.user_id=?1 AND ml.duration_seconds>0 "
" AND NOT EXISTS (SELECT 1 FROM session_totals st "
" WHERE st.id=ml.session_id)"
"),"
"all_totals AS ("
" SELECT seconds FROM session_totals "
" UNION ALL "
" SELECT seconds FROM log_totals"
") "
"SELECT COALESCE(AVG(seconds),0) FROM all_totals",
-1, &stmt, NULL) == SQLITE_OK) {
bind_text(stmt, 1, g_storage.user_id);
sqlite3_bind_int(stmt, 2, activity);
+6
View File
@@ -58,6 +58,12 @@ void storage_settings_end_write(void);
int storage_settings_empty(void);
int storage_get_social_cache_json(const char *kind, char *out, size_t out_size);
int storage_set_social_cache_json(const char *kind, const char *json);
int storage_json_array_count_path(const char *json, const char *path);
int storage_json_array_object_text(const char *json, const char *array_path,
int index, const char *key,
char *out, size_t out_size);
double storage_json_array_object_number(const char *json, const char *array_path,
int index, const char *key);
int storage_save_session(const int *round_times, int round_count,
char *out_id, size_t out_id_size);
+1
View File
@@ -485,6 +485,7 @@ storage_delete_all_sessions(void)
if(!exec_sql("DELETE FROM session_rounds WHERE session_id IN "
"(SELECT id FROM sessions WHERE user_id=(SELECT id FROM users "
"LIMIT 1));"
"DELETE FROM meditation_logs WHERE user_id=(SELECT id FROM users LIMIT 1);"
"DELETE FROM sessions WHERE user_id=(SELECT id FROM users LIMIT 1);"
"DELETE FROM habit_days WHERE habit_id IN "
"(SELECT id FROM habits WHERE user_id=(SELECT id FROM users LIMIT "
+4 -3
View File
@@ -1,5 +1,6 @@
#include "storage.h"
#include "db.h"
#include "locale.h"
#include <sqlite3.h>
#include <stdarg.h>
@@ -239,9 +240,9 @@ static const char *
review_activity_name(int activity)
{
switch(activity) {
case 0: return "Wim Hof";
case 1: return "Meditation";
case 2: return "Sun Salutation";
case 0: return GetLocaleText("exercise_wim_hof");
case 1: return GetLocaleText("exercise_meditation");
case 2: return GetLocaleText("exercise_sun_salutation");
default: break;
}
return NULL;
+50 -106
View File
@@ -1,136 +1,80 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct UIChoppedGlyph {
int32_t value;
int32_t x;
int32_t y;
int32_t w;
int32_t h;
int32_t offsetX;
int32_t offsetY;
int32_t advanceX;
} UIChoppedGlyph;
#ifndef FLINT_DIR
#define FLINT_DIR "vendor/flint"
#endif
typedef struct RequiredGlyph {
int32_t codepoint;
const char *label;
} RequiredGlyph;
typedef struct LocaleFontCase {
const char *locale;
const char *font;
} LocaleFontCase;
static int
read_file(const char *path, unsigned char **out_data, size_t *out_size)
static const char *
font_for_locale(const char *locale)
{
FILE *fp;
long size;
unsigned char *data;
fp = fopen(path, "rb");
if(fp == NULL) {
fprintf(stderr, "FAIL open %s\n", path);
return 0;
if(locale != NULL) {
if(strcmp(locale, "zh") == 0)
return FLINT_DIR "/fonts/noto/NotoSansSC-Regular.otf";
if(strcmp(locale, "ja") == 0)
return FLINT_DIR "/fonts/noto/NotoSansJP-Regular.otf";
if(strcmp(locale, "ko") == 0)
return FLINT_DIR "/fonts/noto/NotoSansKR-Regular.otf";
if(strcmp(locale, "zh-TW") == 0 || strcmp(locale, "zh_Hant") == 0)
return FLINT_DIR "/fonts/noto/NotoSansTC-Regular.otf";
}
if(fseek(fp, 0, SEEK_END) != 0) {
fclose(fp);
fprintf(stderr, "FAIL seek %s\n", path);
return 0;
}
size = ftell(fp);
if(size <= 0) {
fclose(fp);
fprintf(stderr, "FAIL empty %s\n", path);
return 0;
}
if(fseek(fp, 0, SEEK_SET) != 0) {
fclose(fp);
fprintf(stderr, "FAIL rewind %s\n", path);
return 0;
}
data = (unsigned char *)malloc((size_t)size);
if(data == NULL) {
fclose(fp);
fprintf(stderr, "FAIL allocate %ld bytes\n", size);
return 0;
}
if(fread(data, 1, (size_t)size, fp) != (size_t)size) {
free(data);
fclose(fp);
fprintf(stderr, "FAIL read %s\n", path);
return 0;
}
fclose(fp);
*out_data = data;
*out_size = (size_t)size;
return 1;
return FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf";
}
static int
has_glyph(const UIChoppedGlyph *glyphs, int32_t glyph_count, int32_t codepoint)
file_exists(const char *path)
{
for(int32_t i = 0; i < glyph_count; i++) {
if(glyphs[i].value == codepoint)
return 1;
}
return 0;
FILE *fp = fopen(path, "rb");
if(fp == NULL)
return 0;
fclose(fp);
return 1;
}
int
main(void)
{
static const RequiredGlyph required[] = {
{0x8BBE, "Chinese 设"},
{0x5B9A, "Chinese 定"},
{0x8A2D, "Japanese 設"},
{0xC124, "Korean 설"},
{0xC815, "Korean 정"},
{0x041D, "Cyrillic Н"},
{0x0430, "Cyrillic а"},
{0x010D, "Czech č"},
{0x00E9, "Latin é"},
{0x00E3, "Latin ã"}
static const LocaleFontCase cases[] = {
{"en", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"cs", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"de", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"es", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"fr", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"id", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"it", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"pt", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"ru", FLINT_DIR "/fonts/noto/NotoSans-Regular.ttf"},
{"zh", FLINT_DIR "/fonts/noto/NotoSansSC-Regular.otf"},
{"ja", FLINT_DIR "/fonts/noto/NotoSansJP-Regular.otf"},
{"ko", FLINT_DIR "/fonts/noto/NotoSansKR-Regular.otf"}
};
unsigned char *data = NULL;
size_t size = 0;
int32_t glyph_count;
size_t glyph_bytes;
const UIChoppedGlyph *glyphs;
int failures = 0;
if(!read_file("assets/fonts/locales.dat", &data, &size))
return 1;
if(size < sizeof(glyph_count)) {
free(data);
fprintf(stderr, "FAIL locales.dat too small\n");
return 1;
}
memcpy(&glyph_count, data, sizeof(glyph_count));
if(glyph_count <= 0) {
free(data);
fprintf(stderr, "FAIL locales.dat has no glyphs\n");
return 1;
}
glyph_bytes = (size_t)glyph_count * sizeof(UIChoppedGlyph);
if(size - sizeof(glyph_count) < glyph_bytes) {
free(data);
fprintf(stderr, "FAIL locales.dat truncated glyph table\n");
return 1;
}
glyphs = (const UIChoppedGlyph *)(const void *)(data + sizeof(glyph_count));
for(size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {
const char *actual = font_for_locale(cases[i].locale);
for(size_t i = 0; i < sizeof(required) / sizeof(required[0]); i++) {
if(!has_glyph(glyphs, glyph_count, required[i].codepoint)) {
fprintf(stderr, "FAIL missing %s U+%04X in chopped locale font\n",
required[i].label, (unsigned int)required[i].codepoint);
if(strcmp(actual, cases[i].font) != 0) {
fprintf(stderr, "FAIL locale %s mapped to %s, expected %s\n",
cases[i].locale, actual, cases[i].font);
failures++;
}
if(!file_exists(cases[i].font)) {
fprintf(stderr, "FAIL missing font file %s\n", cases[i].font);
failures++;
}
}
free(data);
if(failures != 0) {
fprintf(stderr, "%d chopped locale font failure(s)\n", failures);
fprintf(stderr, "%d locale font failure(s)\n", failures);
return 1;
}
printf("font locale tests passed\n");
return 0;
}
+13 -1
View File
@@ -329,7 +329,19 @@ add_dynamic_locale_keys(LocaleKeys *used)
"tray_meditation_paused",
"tray_meditation_left",
"tray_sun_salutation",
"tray_sun_salutation_paused"
"tray_sun_salutation_paused",
"theme_sky",
"theme_ocean",
"theme_forest",
"theme_sunset",
"theme_lavender",
"theme_cherry",
"theme_dawn",
"theme_sage",
"theme_sepia",
"theme_mono",
"theme_mint",
"theme_cobalt"
};
for(size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); i++)
+55 -3
View File
@@ -1149,6 +1149,40 @@ test_existing_sessions_materialize_after_habit_save(void)
remove_tree(root);
}
static void
test_sync_apply_meditation_logs_feed_profile_stats(void)
{
char root[512];
int streak = -1;
long avg_hold = -1;
make_clean_root(root, sizeof(root), "meditation-log-profile-stats");
check_true("init meditation log profile db", storage_init(root));
check_true("apply meditation log profile sync",
storage_apply_sync_response_json(
"{\"server_version\":1,\"server_state_hash\":\"h1\","
"\"changes\":{\"habits\":[],\"habit_days\":[],"
"\"sessions\":[{\"id\":\"med-session-1\","
"\"started_at\":\"2026-07-15T00:00:00Z\","
"\"local_date\":20260715,\"topic\":0,\"activity\":1,"
"\"source\":\"sync\",\"rounds_hash\":101,\"deleted_at\":0,"
"\"updated_at\":\"2026-07-15T00:00:00Z\","
"\"rounds\":[{\"round_index\":0,\"hold_seconds\":600}]}],"
"\"meditation_logs\":["
"{\"id\":\"med-log-external\",\"session_id\":\"external-log-session\","
"\"duration_seconds\":1200,"
"\"completed_at\":\"2026-07-14T00:00:00Z\"},"
"{\"id\":\"med-log-duplicate\",\"session_id\":\"med-session-1\","
"\"duration_seconds\":3000,"
"\"completed_at\":\"2026-07-15T00:00:00Z\"}]}}"));
check_true("meditation log profile stats call",
storage_profile_activity_stats(1, 20260716, &streak, &avg_hold));
check_int("meditation log profile streak", streak, 2);
check_int("meditation log profile average", (int)avg_hold, 900);
storage_close();
remove_tree(root);
}
static void
metadata_history_callback(const char *id, int year, int month, int day, int hour, int minute,
int second, int topic, int activity, const int *rounds, int round_count,
@@ -1647,6 +1681,10 @@ write_multi_habit_source_database(const char *root, const char *zip_path)
habit_set_day(&habits, 2, 20260617, 1);
habits_save(&habits);
storage_set_setting_int("speed", 7);
storage_set_setting_int("sun_salutation_repetitions", 6);
storage_set_setting_int("sun_salutation_start_seconds", 9);
storage_set_setting_int("sun_salutation_end_seconds", 4);
storage_set_setting_int("sun_salutation_figure", 1);
storage_set_setting_text("language", "en");
storage_set_setting_text("future_unknown_key", "ignore-me");
check_true("export multi habit source", storage_export_zip(zip_path));
@@ -1654,7 +1692,7 @@ write_multi_habit_source_database(const char *root, const char *zip_path)
}
static void
assert_multi_habits_imported(const char *root, int want_speed)
assert_multi_habits_imported(const char *root, int want_speed, int expect_settings)
{
InbeHabits habits;
InbeHabit *habit;
@@ -1676,6 +1714,19 @@ assert_multi_habits_imported(const char *root, int want_speed)
habit = find_habit_ci(&habits, "Cold Shower");
check_true("multi cold shower day", habit != NULL && habit_completed_day(habit, 20260617));
check_int("multi import speed setting", storage_get_setting_int("speed", -1), want_speed);
if(expect_settings) {
check_int("multi import sun reps setting",
storage_get_setting_int("sun_salutation_repetitions", -1), 6);
check_int("multi import sun start setting",
storage_get_setting_int("sun_salutation_start_seconds", -1), 9);
check_int("multi import sun end setting",
storage_get_setting_int("sun_salutation_end_seconds", -1), 4);
check_int("multi import sun figure setting",
storage_get_setting_int("sun_salutation_figure", -1), 1);
} else {
check_int("multi data-only skips sun figure",
storage_get_setting_int("sun_salutation_figure", -1), -1);
}
check_str("multi import unknown setting", storage_get_setting_text("future_unknown_key"), NULL);
storage_close();
}
@@ -1704,14 +1755,14 @@ test_import_modes_preserve_habits_and_settings_choice(void)
check_true("multi data only import",
storage_import_zip_ex(zip_path, INBE_STORAGE_IMPORT_DATA_ONLY));
storage_close();
assert_multi_habits_imported(dest_data, 1);
assert_multi_habits_imported(dest_data, 1, 0);
check_true("init settings import dest", storage_init(dest_settings));
storage_set_setting_int("speed", 1);
check_true("multi data settings import",
storage_import_zip_ex(zip_path, INBE_STORAGE_IMPORT_DATA_AND_SETTINGS));
storage_close();
assert_multi_habits_imported(dest_settings, 7);
assert_multi_habits_imported(dest_settings, 7, 1);
remove_tree(source);
remove_tree(dest_data);
@@ -2011,6 +2062,7 @@ main(void)
test_deleted_linked_session_clears_synced_habit_day();
test_deleted_linked_session_preserves_manual_habit_count();
test_existing_sessions_materialize_after_habit_save();
test_sync_apply_meditation_logs_feed_profile_stats();
test_session_metadata();
if(g_failures != 0) {
+45
View File
@@ -504,6 +504,50 @@ test_different_account_requires_clear_local_data(void)
remove_tree(root);
}
static void
test_social_cache_does_not_block_account_switch(void)
{
char root[512];
char key_path_one[1024];
char key_path_two[1024];
char public_id_one[65];
char public_key_one[2625];
char private_key_one[5121];
char public_id_two[65];
char public_key_two[2625];
char private_key_two[5121];
InbeSyncAccount account;
InbeSyncAccount loaded;
make_clean_root(root, sizeof(root), "social-cache-account-switch");
snprintf(key_path_one, sizeof(key_path_one), "%s/one.key", root);
snprintf(key_path_two, sizeof(key_path_two), "%s/two.key", root);
make_account_values_variant(1, public_id_one, public_key_one, private_key_one);
make_account_values_variant(2, public_id_two, public_key_two, private_key_two);
write_key_file(key_path_one, public_id_one, public_key_one, private_key_one);
write_key_file(key_path_two, public_id_two, public_key_two, private_key_two);
check_true("init social cache switch storage", storage_init(root));
check_true("first social cache account",
import_key_and_save(&account, key_path_one, 0) ==
INBE_SYNC_ACCOUNT_SAVE_OK);
check_true("store social-only cache",
storage_set_social_cache_json("friends.list",
"{\"friends\":[{\"user_id_hash\":\"friend\"}]}"));
check_false("social-only cache is not local syncable data",
storage_has_local_syncable_data());
check_true("logout social cache account", sync_account_clear());
check_true("second social cache account saves without clear",
import_key_and_save(&account, key_path_two, 0) ==
INBE_SYNC_ACCOUNT_SAVE_OK);
check_true("second social cache account stored", sync_account_load(&loaded));
check_str("second social cache owner", storage_sync_data_owner_public_id(),
public_id_two);
storage_close();
remove_tree(root);
}
int
main(void)
{
@@ -512,6 +556,7 @@ main(void)
test_imported_account_backfills_existing_local_data();
test_logout_preserves_data_owner();
test_different_account_requires_clear_local_data();
test_social_cache_does_not_block_account_switch();
if(g_failures != 0) {
fprintf(stderr, "%d sync account test failure(s)\n", g_failures);
+2
View File
@@ -858,6 +858,8 @@ test_social_cache_is_server_authored_sync_state(void)
check_true("store local social cache",
storage_set_social_cache_json("friends.list",
"{\"friends\":[{\"user_id_hash\":\"local-edit\"}]}"));
check_false("social cache alone is not local syncable data",
storage_has_local_syncable_data());
payload = storage_build_sync_payload_json("test-public-id", "test-public-key");
check_not_contains("social cache not uploaded as typed data", payload, "social_cache");
check_not_contains("social cache not uploaded as op", payload, "friends.list");
+6
View File
@@ -17,5 +17,11 @@ GetLocaleText(const char *key)
return "Yoga practice sessions.";
if(strcmp(key, "habit_new_default_name") == 0)
return "New Habit";
if(strcmp(key, "exercise_wim_hof") == 0)
return "Wim Hof Breathing";
if(strcmp(key, "exercise_meditation") == 0)
return "Meditation";
if(strcmp(key, "exercise_sun_salutation") == 0)
return "Sun Salutation";
return key;
}
+1 -1
+4 -4
View File
@@ -3,8 +3,8 @@
IDI_APP_ICON ICON "inbe.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,8,8,0
PRODUCTVERSION 1,8,8,0
FILEVERSION 1,8,9,0
PRODUCTVERSION 1,8,9,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -21,11 +21,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "waozi"
VALUE "FileDescription", "Inner Breeze"
VALUE "FileVersion", "1.8.8"
VALUE "FileVersion", "1.8.9"
VALUE "InternalName", "inbe"
VALUE "OriginalFilename", "inbe-windows-x86_64.exe"
VALUE "ProductName", "Inner Breeze"
VALUE "ProductVersion", "1.8.8"
VALUE "ProductVersion", "1.8.9"
END
END
BLOCK "VarFileInfo"