Refine profile navigation and sidebar flows

This commit is contained in:
waozi committed 2026-07-11 18:49:15 -03:00
1 parent b0a9bb0cee
commit 4b62a3e7f3
75 files changed
+4107 -2129

No files matched your search

+34
View File
@@ -267,6 +267,39 @@ jobs:
path: build/release/linux/*
if-no-files-found: error
build-freebsd:
name: Build FreeBSD Package
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Build FreeBSD .pkg
uses: vmactions/freebsd-vm@v1
with:
release: "14.3"
usesh: true
prepare: |
pkg install -y gmake cmake pkgconf sdl2 gtk3 curl sqlite3 mesa-libs libdrm hicolor-icon-theme desktop-file-utils
run: |
set -eu
gmake package-freebsd
mkdir -p build/release/freebsd
find build/dist/freebsd -maxdepth 1 -type f -name '*.pkg' -exec cp {} build/release/freebsd/ \;
test -n "$(find build/release/freebsd -type f -print -quit)"
- name: Upload FreeBSD Artifact
uses: actions/upload-artifact@v4
with:
name: release-freebsd
path: build/release/freebsd/*
if-no-files-found: error
build-windows:
name: Build Windows
runs-on: ubuntu-latest
@@ -444,6 +477,7 @@ jobs:
- build-web
- build-chrome-extension
- build-linux
- build-freebsd
- build-windows
- build-android
outputs:
+56 -150
View File
@@ -39,6 +39,19 @@ 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
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.
APP_CATEGORIES := Utility;Education;
APP_MAINTAINER := Waozi <[email protected]>
APP_WWW := https://inbe.waozi.xyz/
APP_ORIGIN := games/inbe
APP_LICENSE := GPLv3
APP_DESKTOP := $(LINUX_APPIMAGE_DESKTOP)
APP_ICON := $(LINUX_APPIMAGE_ICON)
APP_ICON_SIZE := 512x512
APP_METAINFO := $(LINUX_APPIMAGE_APPDATA)
FREEBSD_PKG_DEPS := curl:ftp/curl gtk3:x11-toolkits/gtk30 hicolor-icon-theme:misc/hicolor-icon-theme libdrm:graphics/libdrm mesa-libs:graphics/mesa-libs sdl2:devel/sdl20 sqlite3:databases/sqlite3
CLICK_PACKAGE ?= inbe
CLICK_ID ?= inbe
CLICK_TITLE ?= $(APP_TITLE)
@@ -71,8 +84,6 @@ WINDOWS_OBJ_DIR := $(BUILD_OBJ_DIR)/windows
WINDOWS_BIN_DIR := $(BUILD_BIN_DIR)/windows
WINDOWS_DIST_DIR := $(BUILD_DIST_DIR)/windows
ANDROID_BUILD_DIR := $(BUILD_DIR)/android
ANDROID_FAST_ABI ?= $(shell $(ADB) shell getprop ro.product.cpu.abi 2>/dev/null | tr -d '\r' | head -n 1)
ANDROID_DEBUG_ABIS ?= $(if $(strip $(ANDROID_FAST_ABI)),$(ANDROID_FAST_ABI),arm64-v8a)
WEB_OBJ_DIR := $(BUILD_OBJ_DIR)/web
WEB_DIST_DIR := $(BUILD_DIST_DIR)/web
CHROME_WEB_STORE_DIR := $(BUILD_DIST_DIR)/chrome-web-store
@@ -121,13 +132,13 @@ WEB_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/web/raylib
WEB_RAYLIB_A := $(WEB_RAYLIB_BUILD_DIR)/libraylib.web.a
RAYLIB_SOURCES := $(shell find $(RAYLIB_DIR) -type f \( -name '*.c' -o -name '*.h' \))
FLINT_ICON_FILES := $(wildcard $(FLINT_DIR)/icons/*.png)
FLINT_ICON_ASSETS_C := $(FLINT_DIR)/src/ui_icon_assets.c
FLINT_ICON_FILES := $(wildcard $(FLINT_DIR)/icons/*.png) $(wildcard $(FLINT_DIR)/pfp/*.png)
FLINT_ICON_ASSETS_C := $(FLINT_DIR)/src/ui/ui_icon_assets.c
FLINT_ICON_STAMP := $(BUILD_OBJ_DIR)/flint-icons.sha256
FLINT_SRCS := $(filter-out $(FLINT_ICON_ASSETS_C),$(wildcard $(FLINT_DIR)/src/*.c) $(wildcard $(FLINT_DIR)/src/ui/*.c)) $(FLINT_ICON_ASSETS_C)
FLINT_WEB_SRCS := $(filter-out $(FLINT_DIR)/src/file_dialog.c,$(FLINT_SRCS))
FLINT_WINDOWS_SRCS := $(filter-out $(FLINT_DIR)/src/file_dialog.c,$(FLINT_SRCS))
FLINT_CLICK_SRCS := $(filter-out $(FLINT_DIR)/src/file_dialog.c,$(FLINT_SRCS))
FLINT_SRCS := $(filter-out $(FLINT_ICON_ASSETS_C),$(shell find $(FLINT_DIR)/src -type f -name '*.c' | LC_ALL=C sort)) $(FLINT_ICON_ASSETS_C)
FLINT_WEB_SRCS := $(filter-out $(FLINT_DIR)/src/file_dialog/file_dialog.c,$(FLINT_SRCS))
FLINT_WINDOWS_SRCS := $(filter-out $(FLINT_DIR)/src/file_dialog/file_dialog.c,$(FLINT_SRCS))
FLINT_CLICK_SRCS := $(filter-out $(FLINT_DIR)/src/file_dialog/file_dialog.c,$(FLINT_SRCS))
FLINT_INCLUDE := -I$(FLINT_DIR)/include
FLINT_VENDOR_BUILD_DIR := $(NATIVE_VENDOR_BUILD_DIR)
FLINT_LIBOQS_BUILD_DIR := $(FLINT_VENDOR_BUILD_DIR)/liboqs
@@ -256,15 +267,15 @@ APP_SRCS := \
ifeq ($(NATIVE_PLATFORM),linux)
DESKTOP_TRAY_PKG := $(shell if pkg-config --exists ayatana-appindicator3-0.1; then printf '%s' ayatana-appindicator3-0.1; elif pkg-config --exists appindicator3-0.1; then printf '%s' appindicator3-0.1; fi)
DESKTOP_TRAY_DEFINE := $(if $(filter ayatana-appindicator3-0.1,$(DESKTOP_TRAY_PKG)),-DINBE_DESKTOP_TRAY_AYATANA,-DINBE_DESKTOP_TRAY_APPINDICATOR)
DESKTOP_TRAY_DEFINE := $(if $(filter ayatana-appindicator3-0.1,$(DESKTOP_TRAY_PKG)),-DINBE_DESKTOP_TRAY_AYATANA -DFLINT_DESKTOP_TRAY_AYATANA,-DINBE_DESKTOP_TRAY_APPINDICATOR -DFLINT_DESKTOP_TRAY_APPINDICATOR)
endif
ifeq ($(NATIVE_PLATFORM),freebsd)
DESKTOP_TRAY_PKG := $(shell if pkg-config --exists gtk+-3.0; then printf '%s' gtk+-3.0; fi)
DESKTOP_TRAY_DEFINE := -DINBE_DESKTOP_TRAY_GTK_STATUS_ICON
DESKTOP_TRAY_DEFINE := -DINBE_DESKTOP_TRAY_GTK_STATUS_ICON -DFLINT_DESKTOP_TRAY_GTK_STATUS_ICON
endif
ifneq ($(strip $(DESKTOP_TRAY_PKG)),)
APP_SRCS += src/platform/desktop_tray.c
DESKTOP_TRAY_CFLAGS := $(shell pkg-config --cflags $(DESKTOP_TRAY_PKG)) -DINBE_DESKTOP_TRAY_ENABLED $(DESKTOP_TRAY_DEFINE)
APP_SRCS += src/platform/inbe_desktop_tray.c
DESKTOP_TRAY_CFLAGS := $(shell pkg-config --cflags $(DESKTOP_TRAY_PKG)) -DINBE_DESKTOP_TRAY_ENABLED -DFLINT_DESKTOP_TRAY_ENABLED $(DESKTOP_TRAY_DEFINE)
DESKTOP_TRAY_LDLIBS := $(shell pkg-config --libs $(DESKTOP_TRAY_PKG))
endif
@@ -292,7 +303,7 @@ FONT_SOURCE := $(OTFCHOP_DIR)/unifont-17.0.04.otf
EMBEDDED_ASSETS_C := $(BUILD_OBJ_DIR)/$(APP_NAME)_embedded_assets.c
EMBEDDED_ASSET_FILES := $(LOCALE_FILES) $(IMAGE_FILES) $(SOUND_FILES) $(FONT_OUTPUTS)
SRC := $(APP_SRCS) $(EMBEDDED_ASSETS_C)
WEB_APP_SRCS := $(filter-out src/platform/desktop_tray.c,$(APP_SRCS))
WEB_APP_SRCS := $(filter-out src/platform/inbe_desktop_tray.c,$(APP_SRCS))
WEB_SRC := $(WEB_APP_SRCS) $(EMBEDDED_ASSETS_C)
APP_INCLUDE := -Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/practices -Isrc/practices/whm -Isrc/practices/meditation -Isrc/practices/sun_salutation -Isrc/storage -Isrc/platform -Isrc/platform/android -Isrc/third_party
@@ -345,11 +356,18 @@ LINUXDEPLOY ?= linuxdeploy
WEB_CC ?= emcc
WEB_AR ?= emar
WEB_RANLIB ?= emranlib
include $(FLINT_DIR)/mk/raylib.mk
FLINT_SRCS += $(FLINT_RAYLIB_WRAPPERS_C)
FLINT_WEB_SRCS += $(FLINT_RAYLIB_WRAPPERS_C)
FLINT_WINDOWS_SRCS += $(FLINT_RAYLIB_WRAPPERS_C)
FLINT_CLICK_SRCS += $(FLINT_RAYLIB_WRAPPERS_C)
WEB_CACHE_BUSTER ?= $(shell if git diff --quiet --ignore-submodules HEAD -- 2>/dev/null; then git rev-parse --short HEAD 2>/dev/null; else date +%s; fi)
WEB_TARGET := $(WEB_DIST_DIR)/index.html
WEB_JS_TARGET := $(WEB_DIST_DIR)/index.js
WEB_BOOT_JS := src/web_boot.js
WEB_DIST_ZIP := $(BUILD_DIST_DIR)/$(APP_NAME)-web.zip
WEB_SMOKE_BROWSER ?= auto
WEB_SMOKE_TEST := scripts/web-smoke-test.mjs
WEB_APP_URL ?= https://inbe.waozi.xyz/
CHROME_WEB_STORE_ZIP := $(BUILD_DIST_DIR)/$(APP_NAME)-chrome-web-store.zip
CHROME_WEB_STORE_MANIFEST := packaging/chrome-web-store/manifest.json
@@ -365,28 +383,15 @@ UNPACKAGED_AUDIO_DIR := unpackaged_assets/audio
UNPACKAGED_AUDIO_FILES := $(shell find $(UNPACKAGED_AUDIO_DIR) -type f 2>/dev/null)
MEDITATION_AUDIO_ZIP := web-assets/dl/inbe-meditation-audio-v1.zip
.PHONY: all native install 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-debug-fast android-release android-bundle android-install android-install-fast android-install-release android-clean package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check site chrome-web-store
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 package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test site chrome-web-store
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click
all: native
native: $(TARGET)
install: $(TARGET)
@install_dir="$(HOME)/.local/lib/$(APP_NAME)"; \
bin_dir="$(HOME)/.local/bin"; \
mkdir -p "$$install_dir" "$$bin_dir"; \
cp "$(TARGET)" "$$install_dir/$(APP_NAME)"; \
cp "$(LINUX_APPIMAGE_ICON)" "$$install_dir/$(APP_NAME).png"; \
chmod 755 "$$install_dir/$(APP_NAME)"; \
ln -sf "$$install_dir/$(APP_NAME)" "$$bin_dir/$(APP_NAME)"; \
if [ -d "$(HOME)/bin" ]; then \
ln -sf "$$install_dir/$(APP_NAME)" "$(HOME)/bin/$(APP_NAME)"; \
echo "Installed $(APP_NAME) to $$install_dir and linked $$bin_dir/$(APP_NAME), $(HOME)/bin/$(APP_NAME)"; \
else \
echo "Installed $(APP_NAME) to $$install_dir and linked $$bin_dir/$(APP_NAME)"; \
fi
dist:
@password="$(PASSWORD)"; \
if [ -z "$$password" ]; then \
@@ -486,7 +491,7 @@ test: $(TESTS)
$(STORAGE_IMPORT_TEST): tests/storage_import_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/edit.c src/screens/habits/session.c src/screens/habits_screen.h src/screens/habits/habits.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 -I$(RAYLIB_DIR) $(FLINT_INCLUDE) $(SQLITE_INCLUDE) \
-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/storage_import_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/screens/habits/edit.c src/screens/habits/session.c src/third_party/miniz.c $(SQLITE_SRC) \
-Wl,--gc-sections $(NATIVE_SYSTEM_LDLIBS)
@@ -496,22 +501,22 @@ $(LOCALE_KEYS_TEST): tests/locale_keys_test.c $(LOCALE_FILES) | $(TEST_BIN_DIR)
-o $@ \
tests/locale_keys_test.c
$(SYNC_URL_TEST): tests/sync_url_test.c src/storage/sync_client.c src/storage/sync_client.h $(FLINT_DIR)/src/lyra_sync.c $(FLINT_DIR)/src/lyra_account.c $(CURL_PROTOCOL_CHECK) | $(TEST_BIN_DIR)
$(SYNC_URL_TEST): tests/sync_url_test.c src/storage/sync_client.c src/storage/sync_client.h $(FLINT_DIR)/src/lyra/lyra_sync.c $(FLINT_DIR)/src/lyra/lyra_account.c $(CURL_PROTOCOL_CHECK) | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -Wno-unused-function -std=c99 -D_DEFAULT_SOURCE -DINBE_SYNC_CLIENT_TESTS -ffunction-sections -fdata-sections \
-Isrc/storage -Isrc -Isrc/core $(FLINT_INCLUDE) -I$(RAYLIB_DIR) $(FLINT_CURL_CFLAGS) -o $@ \
tests/sync_url_test.c src/storage/sync_client.c $(FLINT_DIR)/src/lyra_sync.c $(FLINT_DIR)/src/lyra_account.c \
-Isrc/storage -Isrc -Isrc/core $(FLINT_INCLUDE) $(FLINT_CURL_CFLAGS) -o $@ \
tests/sync_url_test.c src/storage/sync_client.c $(FLINT_DIR)/src/lyra/lyra_sync.c $(FLINT_DIR)/src/lyra/lyra_account.c \
-Wl,--gc-sections $(FLINT_CURL_LDLIBS)
$(SYNC_ACCOUNT_TEST): tests/sync_account_test.c src/storage/sync_account.c src/storage/sync_account.h $(FLINT_DIR)/src/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 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) -I$(RAYLIB_DIR) $(SQLITE_INCLUDE) \
-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_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 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)
$(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) -I$(RAYLIB_DIR) $(SQLITE_INCLUDE) \
-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) \
-Wl,--gc-sections $(NATIVE_SYSTEM_LDLIBS)
@@ -523,17 +528,17 @@ $(FONT_LOCALE_TEST): tests/font_locale_test.c $(FONT_OUTPUTS) | $(TEST_BIN_DIR)
$(GUIDE_OVERLAY_TEST): tests/guide_overlay_test.c vendor/flint/src/ui/guide.c vendor/flint/include/ui.h | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE \
$(FLINT_INCLUDE) -I$(RAYLIB_DIR) \
$(FLINT_INCLUDE) \
-o $@ \
tests/guide_overlay_test.c
$(APP_BOTTOM_NAV_TEST): tests/app_bottom_nav_test.c src/app/app_nav.c src/app/app_nav.h src/app/app.h vendor/flint/include/ui.h | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE \
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings $(FLINT_INCLUDE) -I$(RAYLIB_DIR) \
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/storage $(FLINT_INCLUDE) \
-o $@ \
tests/app_bottom_nav_test.c
$(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):
$(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)):
mkdir -p $@
$(WINDOWS_BIN_DIR)/$(WIN64_ARCH) $(WINDOWS_BIN_DIR)/$(WIN32_ARCH):
@@ -555,64 +560,15 @@ $(EMBEDDED_ASSETS_C): $(EMBEDDED_ASSET_FILES) $(FLINT_DIR)/scripts/embed-assets.
$(FLINT_ICON_STAMP): FORCE $(FLINT_ICON_FILES) | $(BUILD_OBJ_DIR)
@tmp="$@.tmp"; \
find $(FLINT_DIR)/icons -maxdepth 1 -type f -name '*.png' | LC_ALL=C sort | while IFS= read -r file; do sha256sum "$$file"; done > "$$tmp"; \
for dir in $(FLINT_DIR)/icons $(FLINT_DIR)/pfp; do find "$$dir" -maxdepth 1 -type f -name '*.png'; done | LC_ALL=C sort | while IFS= read -r file; do sha256sum "$$file"; done > "$$tmp"; \
if ! cmp -s "$$tmp" "$@"; then mv "$$tmp" "$@"; else rm "$$tmp"; fi
$(FLINT_ICON_ASSETS_C): $(FLINT_ICON_STAMP) $(FLINT_DIR)/scripts/embed-icons.sh
cd $(FLINT_DIR) && sh scripts/embed-icons.sh icons src/ui_icon_assets.c
$(RAYLIB_A): $(RAYLIB_SOURCES) Makefile
rm -rf $(NATIVE_VENDOR_BUILD_DIR)/raylib-src
mkdir -p $(NATIVE_VENDOR_BUILD_DIR)/raylib-src $(RAYLIB_BUILD_DIR)
cp -R $(RAYLIB_DIR)/. $(NATIVE_VENDOR_BUILD_DIR)/raylib-src/
$(MAKE) -j1 -C $(NATIVE_VENDOR_BUILD_DIR)/raylib-src \
CC="$(CC)" \
AR="ar" \
PLATFORM=PLATFORM_DESKTOP_SDL \
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
RAYLIB_LIBTYPE=STATIC \
RAYLIB_RELEASE_PATH=../raylib \
RAYLIB_MODULE_AUDIO=TRUE \
RAYLIB_MODULE_MODELS=FALSE \
SDL_INCLUDE_PATH="$(RAY_SDL_INCLUDE_DIR)" \
SDL_LIBRARIES="$(RAY_SDL_LDLIBS)" \
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(RAY_CFLAGS) $(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
$(WEB_RAYLIB_A): $(RAYLIB_SOURCES) | $(WEB_OBJ_DIR)
rm -rf $(VENDOR_BUILD_DIR)/web/raylib-src
mkdir -p $(VENDOR_BUILD_DIR)/web/raylib-src $(WEB_RAYLIB_BUILD_DIR)
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/web/raylib-src/
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/web/raylib-src \
PLATFORM=PLATFORM_WEB \
RAYLIB_LIBTYPE=STATIC \
RAYLIB_RELEASE_PATH=../raylib \
RAYLIB_MODULE_AUDIO=TRUE \
RAYLIB_MODULE_MODELS=FALSE \
CC="$(WEB_CC)" \
AR="$(WEB_AR)" \
CUSTOM_CFLAGS="$(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
cd $(FLINT_DIR) && sh scripts/embed-icons.sh "icons pfp" src/ui/ui_icon_assets.c
$(WEB_RAYLIB_A): web-tools-check
$(WEB_LIBOQS_A): web-tools-check
$(CLICK_RAYLIB_A): $(RAYLIB_SOURCES)
rm -rf $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src
mkdir -p $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src $(CLICK_RAYLIB_BUILD_DIR)
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src/
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib-src \
PLATFORM=PLATFORM_DESKTOP_SDL \
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
RAYLIB_LIBTYPE=STATIC \
RAYLIB_RELEASE_PATH=../raylib \
RAYLIB_MODULE_AUDIO=TRUE \
RAYLIB_MODULE_MODELS=FALSE \
CC="$(AARCH64_CC)" \
AR="$(AARCH64_AR)" \
RANLIB="$(AARCH64_RANLIB)" \
SDL_INCLUDE_PATH="$(AARCH64_RAY_SDL_INCLUDE_DIR)" \
SDL_LIBRARIES="$(AARCH64_RAY_SDL_LDLIBS)" \
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(AARCH64_RAY_CFLAGS) $(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
$(CLICK_LIBOQS_A): $(LIBOQS_DIR)/CMakeLists.txt
rm -rf $(CLICK_LIBOQS_BUILD_DIR)
$(CMAKE) -S $(LIBOQS_DIR) -B $(CLICK_LIBOQS_BUILD_DIR) \
@@ -631,40 +587,6 @@ $(CLICK_LIBOQS_A): $(LIBOQS_DIR)/CMakeLists.txt
-DOQS_MINIMAL_BUILD=$(FLINT_LIBOQS_MINIMAL_BUILD)
$(CMAKE) --build $(CLICK_LIBOQS_BUILD_DIR) --target oqs
$(WIN64_RAYLIB_A): $(RAYLIB_SOURCES)
rm -rf $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src
mkdir -p $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src $(WIN64_RAYLIB_BUILD_DIR)
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src/
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib-src \
OS=Windows_NT \
PLATFORM=PLATFORM_DESKTOP_RGFW \
GRAPHICS=GRAPHICS_API_OPENGL_11 \
RAYLIB_LIBTYPE=STATIC \
RAYLIB_RELEASE_PATH=../raylib \
RAYLIB_MODULE_AUDIO=TRUE \
RAYLIB_MODULE_MODELS=FALSE \
CC="$(WIN64_CC)" \
AR="$(WIN64_AR)" \
RANLIB="$(WIN64_RANLIB)" \
CUSTOM_CFLAGS="$(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
$(WIN32_RAYLIB_A): $(RAYLIB_SOURCES)
rm -rf $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src
mkdir -p $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src $(WIN32_RAYLIB_BUILD_DIR)
cp -R $(RAYLIB_DIR)/. $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src/
$(MAKE) -j1 -C $(VENDOR_BUILD_DIR)/windows/$(WIN32_ARCH)/raylib-src \
OS=Windows_NT \
PLATFORM=PLATFORM_DESKTOP_RGFW \
GRAPHICS=GRAPHICS_API_OPENGL_11 \
RAYLIB_LIBTYPE=STATIC \
RAYLIB_RELEASE_PATH=../raylib \
RAYLIB_MODULE_AUDIO=TRUE \
RAYLIB_MODULE_MODELS=FALSE \
CC="$(WIN32_CC)" \
AR="$(WIN32_AR)" \
RANLIB="$(WIN32_RANLIB)" \
CUSTOM_CFLAGS="$(APP_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
$(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H): $(SQLITE_DIR)/configure $(SQLITE_DIR)/manifest | $(BUILD_OBJ_DIR)
mkdir -p $(SQLITE_BUILD_DIR)
cd $(SQLITE_BUILD_DIR) && $(abspath $(SQLITE_DIR))/configure
@@ -776,7 +698,6 @@ $(TARGET): Makefile $(SRC) $(FLINT_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_SRC) $(SQL
$(FLINT_INCLUDE) \
$(SQLITE_INCLUDE) \
$(LIBOQS_INCLUDE) \
-I$(RAYLIB_DIR) \
$(RAY_CFLAGS) \
-DHAS_LIBOQS=1 \
-DSUPPORT_MODULE_RAUDIO=1 \
@@ -800,7 +721,6 @@ $(CLICK_BIN): Makefile $(SRC) $(FLINT_CLICK_SRCS) $(FLINT_ICON_STAMP) $(SQLITE_S
$(FLINT_INCLUDE) \
$(SQLITE_INCLUDE) \
$(CLICK_LIBOQS_INCLUDE) \
-I$(RAYLIB_DIR) \
$(AARCH64_RAY_CFLAGS) \
-DHAS_LIBOQS=1 \
-DPLATFORM_DESKTOP \
@@ -884,7 +804,6 @@ $(WIN64_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(FLINT_ICON_STAMP) $(SQL
$(SQLITE_INCLUDE) \
$(WIN64_LIBOQS_INCLUDE) \
-I$(WIN64_CURL_INCLUDE_DIR) \
-I$(RAYLIB_DIR) \
-DHAS_LIBOQS=1 \
-DPLATFORM_DESKTOP \
-DCURL_STATICLIB \
@@ -907,7 +826,6 @@ $(WIN32_TARGET): Makefile $(SRC) $(FLINT_WINDOWS_SRCS) $(FLINT_ICON_STAMP) $(SQL
$(SQLITE_INCLUDE) \
$(WIN32_LIBOQS_INCLUDE) \
-I$(WIN32_CURL_INCLUDE_DIR) \
-I$(RAYLIB_DIR) \
-DHAS_LIBOQS=1 \
-DPLATFORM_DESKTOP \
-DCURL_STATICLIB \
@@ -998,7 +916,6 @@ $(WEB_JS_TARGET): Makefile $(WEB_SRC) $(FLINT_WEB_SRCS) $(FLINT_ICON_STAMP) $(SQ
$(FLINT_INCLUDE) \
$(SQLITE_INCLUDE) \
$(WEB_LIBOQS_INCLUDE) \
-I$(RAYLIB_DIR) \
-DHAS_LIBOQS=1 \
-DPLATFORM_WEB \
-DSUPPORT_MODULE_RAUDIO=1 \
@@ -1016,8 +933,9 @@ $(WEB_JS_TARGET): Makefile $(WEB_SRC) $(FLINT_WEB_SRCS) $(FLINT_ICON_STAMP) $(SQ
-sFETCH=1 \
-sALLOW_MEMORY_GROWTH=0 \
-sINITIAL_MEMORY=268435456 \
-sSTACK_SIZE=8388608 \
-sGLOBAL_BASE=16777216 \
-sSTACK_SIZE=33554432 \
-sGLOBAL_BASE=67108864 \
-sASYNCIFY_STACK_SIZE=1048576 \
-sEXPORTED_FUNCTIONS=_main,_malloc,_free,_app_web_get_play_in_background,_app_web_set_backgrounded,_app_web_background_tick \
-lidbfs.js \
-lm
@@ -1073,10 +991,6 @@ android-debug: android-copy-assets android-local-properties
unset ANDROID_HOME; $(GRADLE) -p droid assembleDebug $(ANDROID_GRADLE_ARGS)
$(MAKE) android-copy-debug-apks
android-debug-fast: android-copy-assets android-local-properties
unset ANDROID_HOME; $(GRADLE) -p droid assembleDebug -Pinbe.abis="$(ANDROID_DEBUG_ABIS)" $(ANDROID_GRADLE_ARGS)
$(MAKE) android-copy-debug-apks
android-release:
$(MAKE) android-check-keystore PASSWORD="$(PASSWORD)"
$(MAKE) android-copy-assets
@@ -1159,13 +1073,6 @@ android-install: android-debug
$(ADB) install -r "$$APK"; \
$(ADB) shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
android-install-fast: android-debug-fast
@ABI=$$($(ADB) shell getprop ro.product.cpu.abi | tr -d '\r'); \
APK=droid/app/build/outputs/apk/debug/app-$${ABI}-debug.apk; \
if [ ! -f "$$APK" ]; then APK=droid/app/build/outputs/apk/debug/app-debug.apk; fi; \
$(ADB) install -r "$$APK"; \
$(ADB) shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
android-install-release: android-release
@ABI=$$($(ADB) shell getprop ro.product.cpu.abi | tr -d '\r'); \
APK=droid/app/build/outputs/apk/release/app-$${ABI}-release.apk; \
@@ -1178,12 +1085,7 @@ android-avd:
@adb_cmd="$$HOME/.android-sdk-writable/platform-tools/adb"; \
if [ ! -x "$$adb_cmd" ]; then adb_cmd="$${ANDROID_SDK_ROOT:-$${ANDROID_HOME}}/platform-tools/adb"; fi; \
if [ ! -x "$$adb_cmd" ]; then adb_cmd=adb; fi; \
abi=$$("$$adb_cmd" -e shell getprop ro.product.cpu.abi | tr -d '\r'); \
if [ -z "$$abi" ]; then \
echo "No emulator ABI detected. Is the AVD running?"; \
exit 1; \
fi; \
$(MAKE) android-install-fast ADB="$$adb_cmd -e" ANDROID_DEBUG_ABIS="$$abi"
$(MAKE) android-install ADB="$$adb_cmd -e"
android-clean:
$(GRADLE) -p droid clean $(ANDROID_GRADLE_ARGS)
@@ -1215,9 +1117,13 @@ windows:
web:
$(MAKE) $(WEB_TARGET)
$(MAKE) web-smoke-test
rm -f $(WEB_DIST_ZIP)
cd $(WEB_DIST_DIR) && zip -9 -r $(abspath $(WEB_DIST_ZIP)) .
web-smoke-test: $(WEB_SMOKE_TEST)
WEB_SMOKE_BROWSER="$(WEB_SMOKE_BROWSER)" node $(WEB_SMOKE_TEST) $(WEB_DIST_DIR)
site: web
tclsh site/build.tcl
@@ -1246,7 +1152,7 @@ clean-native:
clean-vendor-builds:
rm -rf $(VENDOR_BUILD_DIR)
NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native run run-fresh dist appimage vendor-prebuilds vendor-prebuilds-native,$(MAKECMDGOALS)),native)
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)
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)
+102 -4
View File
@@ -11,34 +11,132 @@ make native
make run
```
On FreeBSD, use GNU Make:
```bash
gmake native
gmake run
```
Native binaries are written to `build/bin/<platform>/`, for example
`build/bin/freebsd/inbe-freebsd-x86_64` on FreeBSD.
Install locally:
Install into the system prefix:
```bash
make install
```
This installs the app to `~/.local/lib/inbe` and links `~/.local/bin/inbe`.
If `~/bin` exists, it links `~/bin/inbe` too.
By default this installs the binary, desktop entry, icon, and AppStream
metadata under `/usr/local`. Use `DESTDIR` for staged/package installs, or
`PREFIX` to choose another install root.
Install for only the current user:
```bash
make install-user
```
This installs under `~/.local`, including the desktop entry and icon.
## FreeBSD Package
Build a native FreeBSD package from inside the repo:
```bash
gmake package-freebsd
```
The package is written to `build/dist/freebsd/`, for example:
```bash
build/dist/freebsd/inbe-1.8.3-freebsd-x86_64.pkg
```
Install it with FreeBSD `pkg`:
```bash
sudo pkg install -y ./build/dist/freebsd/inbe-1.8.3-freebsd-x86_64.pkg
```
The package installs the `inbe` command plus desktop integration for menus such
as Xfce: `Inner Breeze` appears from the `.desktop` file, uses the bundled icon,
and includes AppStream metadata.
## Other Targets
General:
```bash
make test
make dist
make clean
```
Native desktop:
```bash
make native
make run
make install-user
make uninstall
```
FreeBSD:
```bash
gmake package-freebsd
```
Android:
```bash
make android-debug
make android-release
make android-bundle
```
Web:
```bash
make web
make site
make chrome-web-store
```
Linux:
```bash
make appimage
```
Ubuntu Touch:
```bash
make click
```
Windows:
```bash
make windows
```
Common outputs:
- `make native` builds `build/bin/<platform>/inbe-<platform>-<arch>`.
- `make appimage` builds a Linux AppImage under `build/dist/linux/`.
- `make web` builds and smoke-tests the web app, then writes `build/dist/inbe-web.zip`.
- `make windows` builds 64-bit and 32-bit Windows binaries and writes a zip under `build/dist/windows/`.
- `make click` builds the Ubuntu Touch Click package under `build/dist/click/`.
- `make dist` builds release artifacts; Android release targets require `PASSWORD`.
## Android
Build a debug APK:
```bash
make android-debug-fast
make android-debug
```
Create and launch an Android 17/API 37.1 AVD for Pixel storage testing:
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 99 KiB

+2 -6
View File
@@ -61,12 +61,8 @@ android {
abi {
enable true
reset()
def selectedAbis = (project.findProperty('inbe.abis') ?: 'arm64-v8a,armeabi-v7a,x86,x86_64')
.split(',')
.collect { it.trim() }
.findAll { it.length() > 0 }
include(*selectedAbis)
universalApk !project.hasProperty('inbe.abis')
include 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
universalApk true
}
}
+4 -3
View File
@@ -32,8 +32,8 @@ add_subdirectory("${FLINT_DIR}/vendor/liboqs" "${CMAKE_BINARY_DIR}/liboqs")
if(NOT TARGET oqs)
message(FATAL_ERROR "Inbe Android builds require liboqs for sync account crypto")
endif()
file(GLOB FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c" "${FLINT_DIR}/src/ui/*.c")
list(REMOVE_ITEM FLINT_SOURCES "${FLINT_DIR}/src/file_dialog.c")
file(GLOB_RECURSE FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c")
list(REMOVE_ITEM FLINT_SOURCES "${FLINT_DIR}/src/file_dialog/file_dialog.c")
file(GLOB INBE_LOCALE_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/locales/*.txt")
file(GLOB INBE_SOUND_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/assets/sounds/*.ogg")
file(GLOB INBE_PRACTICE_BANNER_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/assets/practices/*/banner.png")
@@ -177,6 +177,8 @@ add_library(main SHARED
)
target_include_directories(main PRIVATE
"${FLINT_DIR}/include"
"${FLINT_DIR}/src"
"${SRC_DIR}"
"${SRC_DIR}/app"
"${SRC_DIR}/core"
@@ -190,7 +192,6 @@ target_include_directories(main PRIVATE
"${SRC_DIR}/platform/android"
"${SRC_DIR}/third_party"
"${NATIVE_APP_GLUE_DIR}"
"${FLINT_DIR}/include"
"${SQLITE_BUILD_DIR}"
)
+37 -45
View File
@@ -10,14 +10,11 @@ Návyky
[tab_practice]
Cvičení
---
[tab_pet]
Pet
---
[profile_data_title]
[profile_data]
Data
---
[profile_data_button]
Nastavit data
[profile_sync_tab]
Sync
---
[profile_habits_label]
Navyky
@@ -64,23 +61,11 @@ Aktualizace
[profile_no_account]
Zadny ucet
---
[profile_account_section]
Ucet
---
[profile_configure_button]
Nastavit
---
[profile_data_section]
Data
---
[profile_friends_count_format]
[profile_friends_summary]
%d pratel
---
[profile_pending_count_format]
%d cekajici
---
[profile_social_section]
Socialni
[profile_friends_pending_summary]
%d pratel +%d
---
[profile_add_friend_button]
Pridat pritele
@@ -97,14 +82,9 @@ Zadna data zebricku
[profile_practice_label]
Cviceni
---
[profile_my_practices_button]
Moje cvičení
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Moje cvičení
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Nastavení
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
SPUSTIT
@@ -308,10 +298,10 @@ Klidny pruvodce pro dychani, navyky a synchronizaci.
Motiv
---
[theme_mode_label]
Režim barev
Theme mode
---
[theme_follow_device]
Podle zařízení
System
---
[speed_label]
Rychlost
@@ -373,9 +363,6 @@ Kruh
[volume_label]
Hlasitost
---
[show_session_volume_control_label]
Zobrazit ovládání hlasitosti
---
[show_session_return_button_label]
Zobrazit tlačítko návratu
---
@@ -771,17 +758,7 @@ Celková zádrž
[habit_stats_best_streak]
Nejlepší série
---
[profile_guide_account]
Zde nastavite synchronizacni ucet.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Odtud otevete pratele a zebricek.
---
[profile_guide_social_no_account]
Vytvorte synchronizacni ucet pro odemceni pratel a zebricku.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Jógová cvičení.
---
[pet_gamification_title]
Gamifikace se připravuje...
Gamification in progress...
---
[pet_gamification_subtitle]
Pouze náhled. Tato karta ještě není implementována.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Dnešní počet návyků.
@@ -1066,3 +1043,18 @@ Smazáno %lld sezení
[habit_stats_day_plural]
%d dní
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@ Gewohnheiten
[tab_practice]
Praxis
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
Daten
---
[profile_data_button]
Daten konfigurieren
[profile_sync_tab]
Sync
---
[profile_habits_label]
Gewohnheiten
@@ -64,23 +61,11 @@ Aktualisieren
[profile_no_account]
Kein Konto
---
[profile_account_section]
Konto
---
[profile_configure_button]
Konfigurieren
---
[profile_data_section]
Daten
---
[profile_friends_count_format]
[profile_friends_summary]
%d Freunde
---
[profile_pending_count_format]
%d ausstehend
---
[profile_social_section]
Sozial
[profile_friends_pending_summary]
%d Freunde +%d
---
[profile_add_friend_button]
Freund hinzufuegen
@@ -97,14 +82,9 @@ Keine Bestenlistendaten
[profile_practice_label]
Praxis
---
[profile_my_practices_button]
Meine Praktiken
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Meine Praktiken
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Einstellungen
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
START
@@ -308,10 +298,10 @@ Ein ruhiger Begleiter fuer Atemuebungen, Gewohnheiten und Synchronisierung.
Thema
---
[theme_mode_label]
Farbmodus
Theme mode
---
[theme_follow_device]
Gerät folgen
System
---
[speed_label]
Geschwindigkeit
@@ -373,9 +363,6 @@ Kreis
[volume_label]
Lautstärke
---
[show_session_volume_control_label]
Lautstärkeregler anzeigen
---
[show_session_return_button_label]
Zurück-Taste anzeigen
---
@@ -771,17 +758,7 @@ Gesamte Atemhaltezeit
[habit_stats_best_streak]
Beste Serie
---
[profile_guide_account]
Richte hier dein Sync-Konto ein.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Oeffne Freunde und Bestenliste von hier.
---
[profile_guide_social_no_account]
Erstelle ein Sync-Konto, um Freunde und Bestenliste freizuschalten.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Yoga-Übungssitzungen.
---
[pet_gamification_title]
Gamification in Arbeit...
Gamification in progress...
---
[pet_gamification_subtitle]
Nur Vorschau. Dieser Tab ist noch nicht implementiert.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Heutige Gewohnheiten gesamt.
@@ -1066,3 +1043,18 @@ Results
[habit_stats_day_plural]
%d Tage
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+36 -44
View File
@@ -10,14 +10,11 @@ Habits
[tab_practice]
Practice
---
[tab_pet]
Pet
---
[profile_data_title]
[profile_data]
Data
---
[profile_data_button]
Configure Data
[profile_sync_tab]
Sync
---
[profile_habits_label]
Habits
@@ -64,23 +61,11 @@ Updating
[profile_no_account]
No account
---
[profile_account_section]
Account
---
[profile_configure_button]
Configure
---
[profile_data_section]
Data
---
[profile_friends_count_format]
[profile_friends_summary]
%d friends
---
[profile_pending_count_format]
%d pending
---
[profile_social_section]
Social
[profile_friends_pending_summary]
%d friends +%d
---
[profile_add_friend_button]
Add friend
@@ -97,14 +82,9 @@ No leaderboard data
[profile_practice_label]
Practice
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Settings
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
PLAY
@@ -314,10 +304,10 @@ A quiet breathing companion for practice, habits, and sync.
Theme
---
[theme_mode_label]
Color mode
Theme mode
---
[theme_follow_device]
Follow device
System
---
[theme_system]
System
@@ -403,9 +393,6 @@ Circle
[volume_label]
Volume
---
[show_session_volume_control_label]
Show volume control
---
[show_session_return_button_label]
Show return button
---
@@ -556,7 +543,7 @@ Quit
Account
---
[sync_configure_account_button]
Configure Account
Configure profile
---
[sync_create_account_button]
Create Account
@@ -810,17 +797,7 @@ Total hold
[habit_stats_best_streak]
Best streak
---
[profile_guide_account]
Configure your sync account here.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Open friends and leaderboard from here.
---
[profile_guide_social_no_account]
Create a sync account to unlock friends and leaderboard.
---
[transition_label]
Animations
@@ -1065,3 +1042,18 @@ Deleted %lld sessions
[habit_stats_day_plural]
%d days
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@ Hábitos
[tab_practice]
Práctica
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
Datos
---
[profile_data_button]
Configurar datos
[profile_sync_tab]
Sync
---
[profile_habits_label]
Habitos
@@ -64,23 +61,11 @@ Actualizando
[profile_no_account]
Sin cuenta
---
[profile_account_section]
Cuenta
---
[profile_configure_button]
Configurar
---
[profile_data_section]
Datos
---
[profile_friends_count_format]
[profile_friends_summary]
%d amigos
---
[profile_pending_count_format]
%d pendientes
---
[profile_social_section]
Social
[profile_friends_pending_summary]
%d amigos +%d
---
[profile_add_friend_button]
Anadir amigo
@@ -97,14 +82,9 @@ Sin datos de clasificacion
[profile_practice_label]
Practica
---
[profile_my_practices_button]
Mis prácticas
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Mis prácticas
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Configuración
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
REPRODUCIR
@@ -308,10 +298,10 @@ Un companero tranquilo para respiracion, habitos y sincronizacion.
Tema
---
[theme_mode_label]
Modo de color
Theme mode
---
[theme_follow_device]
Seguir dispositivo
System
---
[speed_label]
Velocidad
@@ -373,9 +363,6 @@ Circulo
[volume_label]
Volumen
---
[show_session_volume_control_label]
Mostrar control de volumen
---
[show_session_return_button_label]
Mostrar botón de volver
---
@@ -771,17 +758,7 @@ Retención total
[habit_stats_best_streak]
Mejor racha
---
[profile_guide_account]
Configura tu cuenta de sincronizacion aqui.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Abre amigos y clasificacion desde aqui.
---
[profile_guide_social_no_account]
Crea una cuenta de sincronizacion para desbloquear amigos y clasificacion.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Sesiones de práctica de yoga.
---
[pet_gamification_title]
Gamificación en curso...
Gamification in progress...
---
[pet_gamification_subtitle]
Solo vista previa. Esta pestaña aún no está implementada.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Total de hábitos de hoy.
@@ -1066,3 +1043,18 @@ Results
[habit_stats_day_plural]
%d días
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@ Habitudes
[tab_practice]
Pratique
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
Donnees
---
[profile_data_button]
Configurer les donnees
[profile_sync_tab]
Sync
---
[profile_habits_label]
Habitudes
@@ -64,23 +61,11 @@ Mise a jour
[profile_no_account]
Aucun compte
---
[profile_account_section]
Compte
---
[profile_configure_button]
Configurer
---
[profile_data_section]
Donnees
---
[profile_friends_count_format]
[profile_friends_summary]
%d amis
---
[profile_pending_count_format]
%d en attente
---
[profile_social_section]
Social
[profile_friends_pending_summary]
%d amis +%d
---
[profile_add_friend_button]
Ajouter un ami
@@ -97,14 +82,9 @@ Aucune donnee de classement
[profile_practice_label]
Pratique
---
[profile_my_practices_button]
Mes pratiques
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Mes pratiques
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Réglages
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
DÉMARRER
@@ -311,10 +301,10 @@ Un compagnon discret pour la respiration, les habitudes et la synchronisation.
Thème
---
[theme_mode_label]
Mode couleur
Theme mode
---
[theme_follow_device]
Suivre l'appareil
System
---
[speed_label]
Vitesse
@@ -376,9 +366,6 @@ Cercle
[volume_label]
Volume
---
[show_session_volume_control_label]
Afficher le contrôle du volume
---
[show_session_return_button_label]
Afficher le bouton retour
---
@@ -810,17 +797,7 @@ Rétention totale
[habit_stats_best_streak]
Meilleure série
---
[profile_guide_account]
Configurez votre compte de synchronisation ici.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Ouvrez les amis et le classement ici.
---
[profile_guide_social_no_account]
Creez un compte de synchronisation pour debloquer les amis et le classement.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Séances de yoga.
---
[pet_gamification_title]
Gamification en cours...
Gamification in progress...
---
[pet_gamification_subtitle]
Aperçu uniquement. Cet onglet n'est pas encore implémenté.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Total des habitudes du jour.
@@ -1066,3 +1043,18 @@ Results
[habit_stats_day_plural]
%d jours
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+37 -45
View File
@@ -10,14 +10,11 @@ Kebiasaan
[tab_practice]
Latihan
---
[tab_pet]
Pet
---
[profile_data_title]
[profile_data]
Data
---
[profile_data_button]
Atur data
[profile_sync_tab]
Sync
---
[profile_habits_label]
Kebiasaan
@@ -64,23 +61,11 @@ Memperbarui
[profile_no_account]
Tidak ada akun
---
[profile_account_section]
Akun
---
[profile_configure_button]
Atur
---
[profile_data_section]
Data
---
[profile_friends_count_format]
[profile_friends_summary]
%d teman
---
[profile_pending_count_format]
%d tertunda
---
[profile_social_section]
Sosial
[profile_friends_pending_summary]
%d teman +%d
---
[profile_add_friend_button]
Tambah teman
@@ -97,14 +82,9 @@ Tidak ada data papan peringkat
[profile_practice_label]
Latihan
---
[profile_my_practices_button]
Praktik saya
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Praktik saya
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Pengaturan
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
MULAI
@@ -308,10 +298,10 @@ Pendamping tenang untuk pernapasan, kebiasaan, dan sinkronisasi.
Tema
---
[theme_mode_label]
Mode warna
Theme mode
---
[theme_follow_device]
Ikuti perangkat
System
---
[speed_label]
Kecepatan
@@ -373,9 +363,6 @@ Lingkaran
[volume_label]
Volume
---
[show_session_volume_control_label]
Tampilkan kontrol volume
---
[show_session_return_button_label]
Tampilkan tombol kembali
---
@@ -771,17 +758,7 @@ Total tahan
[habit_stats_best_streak]
Rangkaian terbaik
---
[profile_guide_account]
Atur akun sinkronisasi Anda di sini.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Buka teman dan papan peringkat dari sini.
---
[profile_guide_social_no_account]
Buat akun sinkronisasi untuk membuka teman dan papan peringkat.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Sesi latihan yoga.
---
[pet_gamification_title]
Gamifikasi sedang dibuat...
Gamification in progress...
---
[pet_gamification_subtitle]
Pratinjau saja. Tab ini belum diterapkan.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Total kebiasaan hari ini.
@@ -1066,3 +1043,18 @@ Results
[habit_stats_day_plural]
%d hari
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@ Abitudini
[tab_practice]
Pratica
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
Dati
---
[profile_data_button]
Configura dati
[profile_sync_tab]
Sync
---
[profile_habits_label]
Abitudini
@@ -64,23 +61,11 @@ Aggiornamento
[profile_no_account]
Nessun account
---
[profile_account_section]
Account
---
[profile_configure_button]
Configura
---
[profile_data_section]
Dati
---
[profile_friends_count_format]
[profile_friends_summary]
%d amici
---
[profile_pending_count_format]
%d in attesa
---
[profile_social_section]
Social
[profile_friends_pending_summary]
%d amici +%d
---
[profile_add_friend_button]
Aggiungi amico
@@ -97,14 +82,9 @@ Nessun dato classifica
[profile_practice_label]
Pratica
---
[profile_my_practices_button]
Le mie pratiche
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Le mie pratiche
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Impostazioni
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
AVVIA
@@ -308,10 +298,10 @@ Un compagno discreto per respirazione, abitudini e sincronizzazione.
Tema
---
[theme_mode_label]
Modalità colore
Theme mode
---
[theme_follow_device]
Segui dispositivo
System
---
[theme_system]
Sistema
@@ -397,9 +387,6 @@ Cerchio
[volume_label]
Volume
---
[show_session_volume_control_label]
Mostra controllo volume
---
[show_session_return_button_label]
Mostra pulsante indietro
---
@@ -771,17 +758,7 @@ Apnea totale
[habit_stats_best_streak]
Migliore serie
---
[profile_guide_account]
Configura qui il tuo account di sincronizzazione.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Apri amici e classifica da qui.
---
[profile_guide_social_no_account]
Crea un account di sincronizzazione per sbloccare amici e classifica.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Sessioni di yoga.
---
[pet_gamification_title]
Gamification in corso...
Gamification in progress...
---
[pet_gamification_subtitle]
Solo anteprima. Questa scheda non è ancora implementata.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Totale abitudini di oggi.
@@ -1066,3 +1043,18 @@ Eliminate %lld sessioni
[habit_stats_day_plural]
%d giorni
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@
[tab_practice]
練習
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
データ
---
[profile_data_button]
データを設定
[profile_sync_tab]
Sync
---
[profile_habits_label]
習慣
@@ -64,23 +61,11 @@ Pet
[profile_no_account]
アカウントなし
---
[profile_account_section]
アカウント
---
[profile_configure_button]
設定
---
[profile_data_section]
データ
---
[profile_friends_count_format]
[profile_friends_summary]
%d人のフレンド
---
[profile_pending_count_format]
%d件保留中
---
[profile_social_section]
ソーシャル
[profile_friends_pending_summary]
%d人のフレンド +%d
---
[profile_add_friend_button]
フレンドを追加
@@ -97,14 +82,9 @@ Pet
[profile_practice_label]
プラクティス
---
[profile_my_practices_button]
自分のプラクティス
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
自分のプラクティス
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
設定
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
開始
@@ -308,10 +298,10 @@ OK
テーマ
---
[theme_mode_label]
カラーモード
Theme mode
---
[theme_follow_device]
デバイスに合わせる
System
---
[speed_label]
速度
@@ -373,9 +363,6 @@ OK
[volume_label]
音量
---
[show_session_volume_control_label]
音量コントロールを表示
---
[show_session_return_button_label]
戻るボタンを表示
---
@@ -773,17 +760,7 @@ Description
[habit_stats_best_streak]
最長連続記録
---
[profile_guide_account]
ここで同期アカウントを設定します。
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
ここからフレンドとランキングを開きます。
---
[profile_guide_social_no_account]
フレンドとランキングを使うには同期アカウントを作成してください。
---
[transition_label]
@@ -883,10 +860,10 @@ Yoga
ヨガの練習セッション。
---
[pet_gamification_title]
ゲーミフィケーションを準備中...
Gamification in progress...
---
[pet_gamification_subtitle]
プレビューのみです。このタブはまだ実装されていません。
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
今日の習慣合計です。
@@ -1068,3 +1045,18 @@ Results
[habit_stats_day_plural]
%d日
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@ Inner Breeze
[tab_practice]
연습
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
데이터
---
[profile_data_button]
데이터 설정
[profile_sync_tab]
Sync
---
[profile_habits_label]
습관
@@ -64,23 +61,11 @@ Pet
[profile_no_account]
계정 없음
---
[profile_account_section]
계정
---
[profile_configure_button]
설정
---
[profile_data_section]
데이터
---
[profile_friends_count_format]
[profile_friends_summary]
친구 %d명
---
[profile_pending_count_format]
대기 %d개
---
[profile_social_section]
소셜
[profile_friends_pending_summary]
친구 %d명 +%d
---
[profile_add_friend_button]
친구 추가
@@ -97,14 +82,9 @@ Pet
[profile_practice_label]
연습
---
[profile_my_practices_button]
내 연습
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
내 연습
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
설정
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
시작
@@ -308,10 +298,10 @@ Finish
테마
---
[theme_mode_label]
색상 모드
Theme mode
---
[theme_follow_device]
기기 설정 따르기
System
---
[theme_system]
시스템
@@ -397,9 +387,6 @@ Inner Breeze
[volume_label]
음량
---
[show_session_volume_control_label]
볼륨 조절 표시
---
[show_session_return_button_label]
돌아가기 버튼 표시
---
@@ -770,17 +757,7 @@ Description
[habit_stats_best_streak]
최고 연속 기록
---
[profile_guide_account]
여기에서 동기화 계정을 설정하세요.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
여기에서 친구와 순위표를 엽니다.
---
[profile_guide_social_no_account]
친구와 순위표를 사용하려면 동기화 계정을 만드세요.
---
[transition_label]
@@ -880,10 +857,10 @@ Yoga
요가 연습 세션.
---
[pet_gamification_title]
게임화 준비 중...
Gamification in progress...
---
[pet_gamification_subtitle]
미리보기 전용입니다. 이 탭은 아직 구현되지 않았습니다.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
오늘의 습관 합계입니다.
@@ -1065,3 +1042,18 @@ Results
[habit_stats_day_plural]
%d일
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@ Hábitos
[tab_practice]
Prática
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
Dados
---
[profile_data_button]
Configurar dados
[profile_sync_tab]
Sync
---
[profile_habits_label]
Habitos
@@ -64,23 +61,11 @@ Atualizando
[profile_no_account]
Sem conta
---
[profile_account_section]
Conta
---
[profile_configure_button]
Configurar
---
[profile_data_section]
Dados
---
[profile_friends_count_format]
[profile_friends_summary]
%d amigos
---
[profile_pending_count_format]
%d pendentes
---
[profile_social_section]
Social
[profile_friends_pending_summary]
%d amigos +%d
---
[profile_add_friend_button]
Adicionar amigo
@@ -97,14 +82,9 @@ Sem dados de classificacao
[profile_practice_label]
Pratica
---
[profile_my_practices_button]
Minhas práticas
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Minhas práticas
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Configurações
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
INICIAR
@@ -308,10 +298,10 @@ Um companheiro tranquilo para respiracao, habitos e sincronizacao.
Tema
---
[theme_mode_label]
Modo de cor
Theme mode
---
[theme_follow_device]
Seguir dispositivo
System
---
[speed_label]
Velocidade
@@ -373,9 +363,6 @@ Circulo
[volume_label]
Volume
---
[show_session_volume_control_label]
Mostrar controle de volume
---
[show_session_return_button_label]
Mostrar botão de voltar
---
@@ -771,17 +758,7 @@ Retenção total
[habit_stats_best_streak]
Melhor sequência
---
[profile_guide_account]
Configure sua conta de sincronizacao aqui.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Abra amigos e classificacao aqui.
---
[profile_guide_social_no_account]
Crie uma conta de sincronizacao para liberar amigos e classificacao.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Sessões de yoga.
---
[pet_gamification_title]
Gamificação em andamento...
Gamification in progress...
---
[pet_gamification_subtitle]
Apenas prévia. Esta aba ainda não foi implementada.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Total de hábitos de hoje.
@@ -1066,3 +1043,18 @@ Results
[habit_stats_day_plural]
%d dias
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@ Inner Breeze
[tab_practice]
Практика
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
Данные
---
[profile_data_button]
Настроить данные
[profile_sync_tab]
Sync
---
[profile_habits_label]
Привычки
@@ -64,23 +61,11 @@ Pet
[profile_no_account]
Нет аккаунта
---
[profile_account_section]
Аккаунт
---
[profile_configure_button]
Настроить
---
[profile_data_section]
Данные
---
[profile_friends_count_format]
[profile_friends_summary]
%d друзей
---
[profile_pending_count_format]
%d ожидают
---
[profile_social_section]
Социальное
[profile_friends_pending_summary]
%d друзей +%d
---
[profile_add_friend_button]
Добавить друга
@@ -97,14 +82,9 @@ Pet
[profile_practice_label]
Практика
---
[profile_my_practices_button]
Мои практики
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
Мои практики
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
Настройки
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
СТАРТ
@@ -311,10 +301,10 @@ OK
Тема
---
[theme_mode_label]
Режим цвета
Theme mode
---
[theme_follow_device]
Как на устройстве
System
---
[theme_system]
Системная
@@ -400,9 +390,6 @@ Inner Breeze
[volume_label]
Громкость
---
[show_session_volume_control_label]
Показывать регулятор громкости
---
[show_session_return_button_label]
Показывать кнопку возврата
---
@@ -771,17 +758,7 @@ Description
[habit_stats_best_streak]
Лучшая серия
---
[profile_guide_account]
Настройте аккаунт синхронизации здесь.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Откройте друзей и рейтинг здесь.
---
[profile_guide_social_no_account]
Создайте аккаунт синхронизации, чтобы открыть друзей и рейтинг.
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
Сеансы практики йоги.
---
[pet_gamification_title]
Геймификация в разработке...
Gamification in progress...
---
[pet_gamification_subtitle]
Только предпросмотр. Эта вкладка еще не реализована.
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
Итог привычек за сегодня.
@@ -1066,3 +1043,18 @@ Results
[habit_stats_day_plural]
%d дней
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+38 -46
View File
@@ -10,14 +10,11 @@
[tab_practice]
练习
---
[tab_pet]
Pet
[profile_data]
Data
---
[profile_data_title]
数据
---
[profile_data_button]
配置数据
[profile_sync_tab]
Sync
---
[profile_habits_label]
习惯
@@ -64,23 +61,11 @@ Pet
[profile_no_account]
没有账户
---
[profile_account_section]
账户
---
[profile_configure_button]
配置
---
[profile_data_section]
数据
---
[profile_friends_count_format]
[profile_friends_summary]
%d 位好友
---
[profile_pending_count_format]
%d 个待处理
---
[profile_social_section]
社交
[profile_friends_pending_summary]
%d 位好友 +%d
---
[profile_add_friend_button]
添加好友
@@ -97,14 +82,9 @@ Pet
[profile_practice_label]
练习
---
[profile_my_practices_button]
我的练习
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
我的练习
---
[move_up_button]
Up
@@ -112,8 +92,18 @@ Up
[move_down_button]
Down
---
[tab_settings]
设置
---
[tab_stack]
Stack
---
[customize_nav_title]
Customize Nav
---
[customize_nav_button]
Customize Nav
---
[customize_nav_add]
Add item
---
[play_button]
开始
@@ -308,10 +298,10 @@ Finish
主题
---
[theme_mode_label]
颜色模式
Theme mode
---
[theme_follow_device]
跟随设备
System
---
[speed_label]
速度
@@ -373,9 +363,6 @@ Finish
[volume_label]
音量
---
[show_session_volume_control_label]
显示音量控制
---
[show_session_return_button_label]
显示返回按钮
---
@@ -771,17 +758,7 @@ Wim Hof 屏息轮次
[habit_stats_best_streak]
最佳连续记录
---
[profile_guide_account]
在这里配置同步账户。
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
从这里打开好友和排行榜。
---
[profile_guide_social_no_account]
创建同步账户以解锁好友和排行榜。
---
[transition_label]
@@ -881,10 +858,10 @@ Yoga
瑜伽练习课程。
---
[pet_gamification_title]
游戏化开发中...
Gamification in progress...
---
[pet_gamification_subtitle]
仅为预览。此标签页尚未实现。
Preview only. This tab is not implemented yet.
---
[habits_guide_overview_progress]
今天的习惯总数。
@@ -1066,3 +1043,18 @@ Results
[habit_stats_day_plural]
%d天
---
[tray_show_inner_breeze]
Show Inner Breeze
---
[tray_hide_inner_breeze]
Hide Inner Breeze
---
[tray_start_practice]
Start Practice
---
[tray_quit_inner_breeze]
Quit Inner Breeze
---
[tray_mark_complete]
Mark Complete
---
+2
View File
@@ -1,7 +1,9 @@
[Desktop Entry]
Type=Application
Name=Inner Breeze
Comment=Syncable breathing, meditation, and habit practice app
Exec=inbe
Icon=inbe
Categories=Utility;
Terminal=false
StartupNotify=true
+4 -4
View File
@@ -25,10 +25,10 @@ SCENES=(
"wim_hof_session:05-wim-hof-session:11:1"
"calendar_meditation:06-calendar-meditation:1:0"
"habits_stats:07-habits-statistics:2:1"
"profile_data:08-profile-data:0:0"
"profile_practices:09-profile-practices:4:0"
"profile_sync_account:10-configure-account:7:1"
"settings_overview:11-settings-overview:0:0"
"data:08-data:0:0"
"my_practices:09-my-practices:4:0"
"configure_account:10-configure-account:7:1"
"settings_session:11-settings-session:0:0"
"theme_selection:12-theme-selection:0:0"
)
+446
View File
@@ -0,0 +1,446 @@
#!/usr/bin/env node
import { createServer } from 'node:http';
import { createReadStream, mkdtempSync, rmSync, existsSync, accessSync, constants } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, normalize, resolve, sep } from 'node:path';
import { spawn } from 'node:child_process';
const root = resolve(process.argv[2] || 'build/dist/web');
const browserSetting = process.env.WEB_SMOKE_BROWSER || 'auto';
const browserArgs = (process.env.WEB_SMOKE_BROWSER_ARGS || '').split(/\s+/).filter(Boolean);
const timeoutMs = Number(process.env.WEB_SMOKE_TIMEOUT_MS || 30000);
const useNoSandbox = process.env.WEB_SMOKE_NO_SANDBOX
? !/^(0|false|no)$/i.test(process.env.WEB_SMOKE_NO_SANDBOX)
: !!process.env.CI || (typeof process.getuid === 'function' && process.getuid() === 0);
const userDataDir = mkdtempSync(join(tmpdir(), 'inbe-web-smoke-'));
const mime = new Map([
['.html', 'text/html; charset=utf-8'],
['.js', 'text/javascript; charset=utf-8'],
['.wasm', 'application/wasm'],
['.json', 'application/json; charset=utf-8'],
['.png', 'image/png'],
['.jpg', 'image/jpeg'],
['.jpeg', 'image/jpeg'],
['.css', 'text/css; charset=utf-8'],
['.zip', 'application/zip'],
['.ogg', 'audio/ogg']
]);
if (!existsSync(join(root, 'index.html')) || !existsSync(join(root, 'index.js')) || !existsSync(join(root, 'index.wasm'))) {
console.error(`web smoke: missing web build outputs in ${root}`);
process.exit(1);
}
function canExecute(path) {
try {
accessSync(path, constants.X_OK);
return true;
} catch {
return false;
}
}
function findOnPath(command) {
if (command.includes('/') || command.includes('\\'))
return canExecute(command) ? command : '';
for (const dir of (process.env.PATH || '').split(':')) {
if (!dir) continue;
const path = join(dir, command);
if (canExecute(path))
return path;
}
return '';
}
function browserCandidates() {
const candidates = [];
if (process.env.CHROME) candidates.push(process.env.CHROME);
candidates.push(
'/usr/bin/chromium',
'/usr/bin/chromium-browser',
'/usr/bin/google-chrome',
'/usr/bin/google-chrome-stable',
'/snap/bin/chromium',
'/opt/google/chrome/chrome',
'/opt/chromium/chrome',
'google-chrome',
'google-chrome-stable',
'chromium',
'chromium-browser',
'chrome'
);
return [...new Set(candidates.filter(Boolean))];
}
function resolveBrowser() {
if (browserSetting && browserSetting !== 'auto') {
const resolved = findOnPath(browserSetting);
if (resolved) return resolved;
throw new Error(`browser not found: ${browserSetting}`);
}
const tried = browserCandidates();
for (const candidate of tried) {
const resolved = findOnPath(candidate);
if (resolved) return resolved;
}
throw new Error(`no Chrome/Chromium browser found; tried ${tried.join(', ')}`);
}
function contentType(path) {
const dot = path.lastIndexOf('.');
return dot >= 0 ? mime.get(path.slice(dot).toLowerCase()) || 'application/octet-stream' : 'application/octet-stream';
}
function isInside(base, path) {
const rel = normalize(path).startsWith(base.endsWith(sep) ? base : base + sep);
return path === base || rel;
}
const server = createServer((req, res) => {
const url = new URL(req.url || '/', 'http://127.0.0.1');
const leaf = url.pathname === '/' ? '/index.html' : decodeURIComponent(url.pathname);
const path = resolve(root, '.' + leaf);
if (!isInside(root, path) || !existsSync(path)) {
res.writeHead(404, { 'content-type': 'text/plain; charset=utf-8' });
res.end('not found');
return;
}
res.writeHead(200, {
'content-type': contentType(path),
'cache-control': 'no-store'
});
createReadStream(path).pipe(res);
});
function listen() {
return new Promise((resolveListen, reject) => {
server.once('error', reject);
server.listen(0, '127.0.0.1', () => resolveListen(server.address().port));
});
}
function delay(ms) {
return new Promise(resolveDelay => setTimeout(resolveDelay, ms));
}
function reserveLocalPort() {
const portServer = createServer();
return new Promise((resolveReserve, reject) => {
portServer.once('error', reject);
portServer.listen(0, '127.0.0.1', () => {
const { port } = portServer.address();
portServer.close(error => {
if (error)
reject(error);
else
resolveReserve(port);
});
});
});
}
function formatChromeLaunchError(stderrLines) {
const stderr = stderrLines.join('').trim();
const suffix = stderr ? `; chrome stderr: ${stderr.slice(-4000)}` : '';
return new Error(`Chrome exited before DevTools was ready${suffix}`);
}
async function waitForDevtools(port, chrome, stderrLines) {
const start = Date.now();
let exited = false;
const onExit = () => {
exited = true;
};
chrome.once('exit', onExit);
try {
while (Date.now() - start < timeoutMs) {
if (exited)
throw formatChromeLaunchError(stderrLines);
try {
const response = await fetch(`http://127.0.0.1:${port}/json/version`);
if (response.ok)
return;
} catch {}
await delay(50);
}
} finally {
chrome.off('exit', onExit);
}
const stderr = stderrLines.join('').trim();
const suffix = stderr ? `; chrome stderr: ${stderr.slice(-4000)}` : '';
throw new Error(`timed out waiting for Chrome DevTools on port ${port}${suffix}`);
}
async function jsonRequest(url, options = {}) {
const response = await fetch(url, options);
if (!response.ok)
throw new Error(`${options.method || 'GET'} ${url} failed: ${response.status}`);
return response.json();
}
function connect(wsUrl) {
return new Promise((resolveConnect, reject) => {
const ws = new WebSocket(wsUrl);
const pending = new Map();
const events = [];
let nextId = 1;
ws.addEventListener('open', () => {
resolveConnect({
events,
send(method, params = {}) {
const id = nextId++;
ws.send(JSON.stringify({ id, method, params }));
return new Promise((resolveSend, rejectSend) => {
pending.set(id, { resolve: resolveSend, reject: rejectSend, method });
});
},
close() {
ws.close();
}
});
});
ws.addEventListener('message', event => {
const message = JSON.parse(event.data);
if (message.id && pending.has(message.id)) {
const item = pending.get(message.id);
pending.delete(message.id);
if (message.error)
item.reject(new Error(`${item.method}: ${message.error.message}`));
else
item.resolve(message.result || {});
} else if (message.method) {
events.push(message);
}
});
ws.addEventListener('error', reject);
});
}
function eventText(event) {
if (event.method === 'Runtime.consoleAPICalled') {
return (event.params.args || []).map(arg => arg.value ?? arg.description ?? '').join(' ');
}
if (event.method === 'Log.entryAdded')
return event.params.entry?.text || '';
if (event.method === 'Runtime.exceptionThrown')
return [
event.params.exceptionDetails?.text || event.params.exceptionDetails?.exception?.description || 'exception thrown',
...((event.params.exceptionDetails?.stackTrace?.callFrames || []).map(frame => {
const name = frame.functionName || '(anonymous)';
return `${name}@${frame.url}:${frame.lineNumber + 1}:${frame.columnNumber + 1}`;
}))
].join(' ');
if (event.method === 'Page.javascriptDialogOpening')
return event.params.message || 'javascript dialog opened';
return '';
}
function fatalEvent(event) {
const text = eventText(event);
if (event.method === 'Runtime.exceptionThrown' || event.method === 'Page.javascriptDialogOpening')
return text;
if (event.method === 'Runtime.consoleAPICalled' && event.params.type === 'error' &&
/Aborted|RuntimeError|unreachable|exception thrown/i.test(text))
return text;
if (event.method === 'Log.entryAdded' && event.params.entry?.level === 'error' &&
/Aborted|RuntimeError|unreachable/i.test(text))
return text;
return '';
}
async function waitForHealthyPage(client) {
const start = Date.now();
let sawRaylib = false;
let lastState = null;
let healthySince = 0;
while (Date.now() - start < timeoutMs) {
for (const event of client.events) {
const fatal = fatalEvent(event);
if (fatal) {
const recent = client.events.slice(-16).map(eventText).filter(Boolean).join(' | ');
throw new Error(`${fatal}; recent=${recent}`);
}
if (/PLATFORM: WEB: Initialized successfully|INBE: Global app pointer set/.test(eventText(event)))
sawRaylib = true;
}
const result = await client.send('Runtime.evaluate', {
expression: `(() => {
const canvas = document.querySelector('canvas');
if (!canvas) return { ok: false, reason: 'missing canvas' };
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
if (!gl) return { ok: false, reason: 'missing webgl' };
const width = gl.drawingBufferWidth;
const height = gl.drawingBufferHeight;
return {
ok: width > 0 && height > 0,
width,
height,
loadingClass: document.querySelector('#loading-screen')?.className || ''
};
})()`,
returnByValue: true
});
const value = result.result?.value;
lastState = value;
if (sawRaylib && value?.ok) {
if (!healthySince)
healthySince = Date.now();
if (Date.now() - healthySince >= 1500)
return value;
} else {
healthySince = 0;
}
await new Promise(resolveDelay => setTimeout(resolveDelay, 250));
}
const recent = client.events.slice(-12).map(eventText).filter(Boolean).join(' | ');
throw new Error(`web app did not become healthy within ${timeoutMs}ms; state=${JSON.stringify(lastState)}; recent=${recent}`);
}
async function waitForStorageIdle(client) {
const start = Date.now();
let lastState = null;
while (Date.now() - start < timeoutMs) {
const result = await client.send('Runtime.evaluate', {
expression: `(() => ({
syncing: !!Module.__inbeStorageSyncing,
pending: !!Module.__inbeStorageSyncPending,
timer: !!Module.__inbeStorageSyncTimer
}))()`,
returnByValue: true
});
lastState = result.result?.value;
if (lastState && !lastState.syncing && !lastState.pending && !lastState.timer)
return;
await new Promise(resolveDelay => setTimeout(resolveDelay, 50));
}
throw new Error(`IDBFS sync did not finish within ${timeoutMs}ms; state=${JSON.stringify(lastState)}`);
}
async function verifyReloadPersistence(client) {
const marker = `web-smoke-${Date.now()}`;
await client.send('Runtime.evaluate', {
expression: `(() => {
try { FS.mkdir('/home/inbe'); } catch (e) {}
FS.writeFile('/home/inbe/web-smoke-persist.txt', ${JSON.stringify(marker)});
if (typeof Module.__inbeFlushStorageSync !== 'function')
throw new Error('missing immediate storage flush helper');
Module.__inbeFlushStorageSync(true);
return true;
})()`,
returnByValue: true
});
await waitForStorageIdle(client);
await client.send('Page.reload', { ignoreCache: true });
await waitForHealthyPage(client);
const result = await client.send('Runtime.evaluate', {
expression: `(() => {
try {
return FS.readFile('/home/inbe/web-smoke-persist.txt', { encoding: 'utf8' });
} catch (e) {
return '';
}
})()`,
returnByValue: true
});
if (result.result?.value !== marker)
throw new Error(`IDBFS reload persistence failed; got=${JSON.stringify(result.result?.value)}`);
}
let chrome;
let client;
let failure;
try {
const port = await listen();
const devtoolsPort = await reserveLocalPort();
const browser = resolveBrowser();
const args = [
'--headless=new',
`--remote-debugging-port=${devtoolsPort}`,
'--remote-debugging-address=127.0.0.1',
`--user-data-dir=${userDataDir}`,
'--no-first-run',
'--no-default-browser-check',
'--disable-background-networking',
'--disable-dev-shm-usage',
'--enable-unsafe-swiftshader',
'--ignore-gpu-blocklist',
'--enable-webgl',
'--use-gl=angle',
'--use-angle=swiftshader',
...browserArgs,
'about:blank'
];
if (useNoSandbox)
args.splice(1, 0, '--no-sandbox');
const chromeStderr = [];
chrome = spawn(browser, args, { stdio: ['ignore', 'ignore', 'pipe'], detached: true });
chrome.stderr.setEncoding('utf8');
chrome.stderr.on('data', chunk => {
chromeStderr.push(chunk);
while (chromeStderr.join('').length > 8000)
chromeStderr.shift();
});
chrome.once('error', error => {
if (!failure)
failure = error;
});
await waitForDevtools(devtoolsPort, chrome, chromeStderr);
const pages = await jsonRequest(`http://127.0.0.1:${devtoolsPort}/json/new?about:blank`, {
method: 'PUT'
});
client = await connect(pages.webSocketDebuggerUrl);
await client.send('Runtime.enable');
await client.send('Log.enable');
await client.send('Page.enable');
await client.send('Page.navigate', { url: `http://127.0.0.1:${port}/index.html` });
await waitForHealthyPage(client);
await verifyReloadPersistence(client);
console.log('web smoke: PASS');
} catch (error) {
failure = error;
} finally {
if (client)
client.close();
if (chrome) {
const exited = new Promise(resolveExit => chrome.once('exit', resolveExit));
try {
process.kill(-chrome.pid, 'SIGTERM');
} catch {}
const stopped = await Promise.race([
exited.then(() => true),
new Promise(resolveDelay => setTimeout(() => resolveDelay(false), 2000))
]);
if (!stopped) {
try {
process.kill(-chrome.pid, 'SIGKILL');
} catch {}
await Promise.race([exited, new Promise(resolveDelay => setTimeout(resolveDelay, 1000))]);
}
}
server.close();
rmSync(userDataDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
}
if (failure) {
console.error(`web smoke: FAIL: ${failure.message}`);
process.exit(1);
}
+124 -68
View File
@@ -37,6 +37,10 @@
#include <sys/stat.h>
#include <time.h>
#if defined(PLATFORM_WEB)
#include <emscripten.h>
#endif
#if ANDROID_BUILD
#include "android_wakelock.h"
#include "android_device.h"
@@ -70,6 +74,60 @@ int view_height = INBE_DEFAULT_HEIGHT;
static int app_full_view_width = INBE_DEFAULT_WIDTH;
/* Theme colors are now accessed via theme accessor functions */
int
app_draw_close_title_bar(InbeApp *app, const char *title, int height)
{
int hover = 0;
int button_size = ScaleUIPx(18);
int padding = ScaleUIPx(6);
int button_total = button_size + padding * 2;
int x = view_width - button_total - ScaleUIPx(12);
int y = (height - button_total) / 2;
if(y < 0)
y = 0;
DrawUITitleBar(title, height);
if(app != NULL && !app->modal.active &&
DrawUIPaddedIconBtn(x, y, button_size, padding,
app->icons[UI_ICON_TYPE_X], &hover))
return 1;
return 0;
}
int
app_draw_close_dropdown_title_bar(InbeApp *app, UITitleBarDropdown dropdown,
int height)
{
int hover = 0;
int button_size = ScaleUIPx(18);
int padding = ScaleUIPx(6);
int button_total = button_size + padding * 2;
int close_x = view_width - button_total - ScaleUIPx(12);
int close_y = (height - button_total) / 2;
int dropdown_x = ScaleUIPx(8);
int dropdown_h = dropdown.height > 0 ? dropdown.height : ScaleUIPx(32);
int dropdown_y = (height - dropdown_h) / 2;
int dropdown_w = close_x - dropdown_x - ScaleUIPx(8);
if(close_y < 0)
close_y = 0;
if(dropdown_y < 0)
dropdown_y = 0;
if(dropdown_w < 1)
dropdown_w = 1;
DrawRectangle(0, 0, view_width, height, GetThemeBackground());
DrawLine(0, height - 1, view_width, height - 1,
DarkenUIColor(GetThemeButton(), 18));
DrawUIDropdownButton(dropdown.id, dropdown_x, dropdown_y, dropdown_w,
dropdown_h, dropdown.options, dropdown.option_count,
dropdown.selected_index);
if(app != NULL && !app->modal.active &&
DrawUIPaddedIconBtn(close_x, close_y, button_size, padding,
app->icons[UI_ICON_TYPE_X], &hover))
return 1;
return 0;
}
void
app_leave_practice_config(InbeApp *app)
{
@@ -686,44 +744,6 @@ apply_language_selection(InbeApp *app, int language_index, int save_now)
save_settings(app);
}
#if defined(PLATFORM_WEB)
#include <emscripten.h>
static int web_storage_ready = 0;
static void
init_web_storage(void)
{
int ok;
if(web_storage_ready)
return;
ok = EM_ASM_INT({
if(typeof FS === 'undefined' || typeof IDBFS === 'undefined')
return 0;
try {
FS.mkdir('/home');
} catch(e) {}
try {
if(!FS.analyzePath('/home').object.isFolder) return 0;
FS.mount(IDBFS, {root: '/'}, '/home');
} catch(e) {
if(e.errno !== 10 && String(e).indexOf('already mounted') === -1) {
console.error('IDBFS mount failed:', e);
return 0;
}
}
return 1;
});
web_storage_ready = ok != 0;
}
#endif
static void
load_config(void)
{
@@ -1095,9 +1115,6 @@ app_init(void *vapp) {
practice_active_background_stop(app);
#endif
#if defined(PLATFORM_WEB)
init_web_storage();
#endif
InitLocale();
if(!load_locale_font(app)) {
TraceLog(LOG_WARNING, "FONT: Failed to load chopped locale font -> using built-in default");
@@ -1145,7 +1162,7 @@ app_init(void *vapp) {
app->cursor_disabled = 0;
app->play_circle_hover = 0;
app->play_circle_scale = 1.0f;
app->settings_tab = SETTINGS_TAB_OVERVIEW;
app->settings_tab = SETTINGS_TAB_SESSION;
app->habit_edit = (HabitEditState){
.index = -1,
.color = {99, 196, 165, 255},
@@ -1234,6 +1251,8 @@ handle_back_button(InbeApp *app)
if(app->settings_dirty)
save_settings(app);
settings_screen_clear_status();
if(app_return_to_nav_sidebar_if_needed(app))
break;
app_switch_screen(app, app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart);
@@ -1241,23 +1260,11 @@ handle_back_button(InbeApp *app)
break;
case InbeScreenProfile:
if(app->profile_view != PROFILE_VIEW_MAIN) {
AppRoute route = app_current_route(app);
route.profile_view = PROFILE_VIEW_MAIN;
app->profile_scroll = 0;
app->sync_server_url_focused = 0;
settings_screen_clear_status();
app_switch_route(app, route);
app->profile_scroll = 0;
app->sync_server_url_focused = 0;
settings_screen_clear_status();
if(app_return_to_nav_sidebar_if_needed(app))
break;
}
if(app->profile_tab != PROFILE_TAB_OVERVIEW) {
AppRoute route = app_current_route(app);
route.profile_tab = PROFILE_TAB_OVERVIEW;
app->profile_scroll = 0;
settings_screen_clear_status();
app_switch_route(app, route);
break;
}
app_switch_screen(app, app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart);
@@ -1269,6 +1276,18 @@ handle_back_button(InbeApp *app)
: InbeScreenStart);
break;
case InbeScreenCustomizeNav:
if(app_return_to_nav_sidebar_if_needed(app))
break;
app_switch_screen(app, app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart);
break;
case InbeScreenNavSidebar:
app_close_nav_sidebar(app);
break;
case InbeScreenPracticeConfig:
app_leave_practice_config(app);
app_switch_screen(app, InbeScreenStart);
@@ -1332,6 +1351,28 @@ handle_back_button(InbeApp *app)
}
}
static void
draw_profile_picture_picker_modal(InbeApp *app)
{
UIProfilePicturePickerResult result;
if(app == NULL)
return;
result = DrawUIProfilePicturePickerModal((UIProfilePicturePickerModal){
.title = "Profile picture",
.icons = app->icons,
.selected_icon_type = &app->profile_picture_icon,
.close_icon = app->icons[UI_ICON_TYPE_X],
.max_width = 360,
.scroll_offset = &app->profile_picture_picker_scroll
});
if(result.changed)
save_settings(app);
if(result.closed)
app_close_modal(app);
}
static void
draw_global_modal(InbeApp *app)
{
@@ -1358,6 +1399,10 @@ draw_global_modal(InbeApp *app)
}
if(app->modal.type == UIModalThemePicker)
settings_screen_draw_theme_picker_modal(app);
if(app->modal.type == UIModalProfilePicturePicker) {
draw_profile_picture_picker_modal(app);
return;
}
if(app->modal.type == UIModalConfirmRemoveFriend) {
profile_screen_draw_remove_friend_modal(app);
return;
@@ -1434,7 +1479,6 @@ updateapp(InbeApp *app)
AppRoute frame_route = app_current_route(app);
int first_run_guide_active = 0;
int habits_guide_active = 0;
int profile_guide_active = 0;
int practice_fullscreen_modal = 0;
int global_modal_drawn = 0;
int content_input_clip_active = 0;
@@ -1444,6 +1488,7 @@ updateapp(InbeApp *app)
#if !ANDROID_BUILD && !defined(PLATFORM_WEB)
app_update_desktop_background_state(app);
#endif
app_update_nav_sidebar_mode(app);
for(int i = 0; i < practice_count(); i++) {
const PracticeDefinition *practice = practice_get(i);
if(practice->update != NULL)
@@ -1453,15 +1498,16 @@ updateapp(InbeApp *app)
app->practice_coming_soon_ticks--;
practice_screen_prepare_first_run_guide(app);
habits_screen_prepare_first_run_guide(app);
profile_screen_prepare_first_run_guide(app);
first_run_guide_active = practice_screen_first_run_guide_active(app);
habits_guide_active = habits_screen_first_run_guide_active(app);
profile_guide_active = profile_screen_first_run_guide_active(app);
practice_fullscreen_modal =
app->modal.active &&
app->modal.type == UIModalEditProgressiveStartSpeed;
if(app->nav_sidebar_open)
PushUIInputCapture((Rectangle){0, 0, (float)view_width,
(float)view_height}, 0);
if(app->modal.active || app->close_prompt_open || first_run_guide_active ||
habits_guide_active || profile_guide_active) {
habits_guide_active) {
PushUIInputCapture((Rectangle){0, 0, (float)view_width, (float)view_height}, 0);
}
@@ -1490,15 +1536,15 @@ updateapp(InbeApp *app)
app->inbe.screen == InbeScreenSunSalutation))))
#endif
) {
if(app->close_prompt_open) {
if(app->nav_sidebar_open || app->inbe.screen == InbeScreenNavSidebar) {
app_close_nav_sidebar(app);
} else if(app->close_prompt_open) {
app->close_prompt_open = 0;
} else if(first_run_guide_active || habits_guide_active || profile_guide_active) {
} else if(first_run_guide_active || habits_guide_active) {
app->tutorial_step = 0;
practice_screen_prepare_first_run_guide(app);
app->habits_guide_step = 0;
habits_screen_prepare_first_run_guide(app);
app->profile_guide_step = 0;
profile_screen_prepare_first_run_guide(app);
} else if(app->modal.active) {
app_close_modal(app);
} else {
@@ -1523,6 +1569,16 @@ updateapp(InbeApp *app)
goto finish_frame;
}
if(app->inbe.screen == InbeScreenCustomizeNav) {
if(app_draw_customize_nav_page(app))
goto finish_frame;
goto finish_frame;
}
if(app->inbe.screen == InbeScreenNavSidebar) {
goto finish_frame;
}
if(app->inbe.screen == InbeScreenLanguage) {
language_screen_draw(app);
goto finish_frame;
@@ -1557,7 +1613,8 @@ updateapp(InbeApp *app)
switch (app->inbe.screen) {
case InbeScreenStart:
{
if(!practice_fullscreen_modal) {
if(!practice_fullscreen_modal &&
app->main_tab != APP_MAIN_TAB_NONE) {
if(app->practice_tab == PRACTICE_TAB_MANUAL) {
manual_screen_draw(app);
} else if(app->practice_tab == PRACTICE_TAB_CONFIG) {
@@ -1620,7 +1677,6 @@ finish_frame:
app_draw_bottom_nav(app);
practice_screen_draw_first_run_guide(app);
habits_screen_draw_first_run_guide(app);
profile_screen_draw_first_run_guide(app);
if(!global_modal_drawn)
draw_global_modal(app);
app_draw_close_prompt(app);
+32 -16
View File
@@ -1,7 +1,7 @@
#ifndef INBE_APP_H
#define INBE_APP_H
#include "raylib.h"
#include "flint.h"
#include "platform.h"
#include "breath_engine.h"
#include "app_fwd.h"
@@ -42,7 +42,6 @@ enum {
};
enum {
SETTINGS_TAB_OVERVIEW = -1,
SETTINGS_TAB_SESSION = 0,
SETTINGS_TAB_DEVICE,
SETTINGS_TAB_THEME,
@@ -59,10 +58,11 @@ enum {
};
enum {
PROFILE_TAB_OVERVIEW = 0,
PROFILE_TAB_SYNC = 0,
PROFILE_TAB_OVERVIEW = PROFILE_TAB_SYNC,
PROFILE_TAB_DATA,
PROFILE_TAB_FRIENDS,
PROFILE_TAB_LEADERBOARD,
PROFILE_TAB_DATA,
PROFILE_TAB_COUNT
};
@@ -101,6 +101,8 @@ typedef enum {
UIModalSyncPublicId,
UIModalConfirmRemoveFriend,
UIModalConfirmSyncAccountSwitch,
UIModalBottomNavConfig,
UIModalProfilePicturePicker,
} UIModalType;
typedef enum InbePendingSyncAccountAction {
@@ -184,6 +186,7 @@ typedef enum AppDeviceOrientation {
} AppDeviceOrientation;
typedef enum AppMainTab {
APP_MAIN_TAB_NONE = -1,
APP_MAIN_TAB_HABITS = 0,
APP_MAIN_TAB_PRACTICE = 1,
} AppMainTab;
@@ -195,9 +198,19 @@ typedef enum AppNavRoute {
APP_NAV_ROUTE_PRACTICE = 2,
APP_NAV_ROUTE_PET = 3,
APP_NAV_ROUTE_SETTINGS = 4,
APP_NAV_ROUTE_COUNT = 5,
APP_NAV_ROUTE_STACK = 5,
APP_NAV_ROUTE_ACCOUNT = 6,
APP_NAV_ROUTE_DATA = 7,
APP_NAV_ROUTE_FRIENDS = 8,
APP_NAV_ROUTE_LEADERBOARD = 9,
APP_NAV_ROUTE_PRACTICES = 10,
APP_NAV_ROUTE_COUNT = 11,
} AppNavRoute;
enum {
APP_BOTTOM_NAV_CONTENT_MAX = 4,
};
typedef struct AppRoute {
int screen;
int exercise_type;
@@ -217,6 +230,10 @@ typedef struct AppContentTransition {
float duration_seconds;
} AppContentTransition;
int app_draw_close_title_bar(InbeApp *app, const char *title, int height);
int app_draw_close_dropdown_title_bar(InbeApp *app, UITitleBarDropdown dropdown,
int height);
typedef struct WhmPracticeState {
Texture2D image_1;
Texture2D image_2;
@@ -288,13 +305,6 @@ typedef struct HabitEditState {
int counter_enabled;
} HabitEditState;
typedef struct ProfileGuideAnchors {
Rectangle account;
Rectangle data;
Rectangle social;
int valid;
} ProfileGuideAnchors;
struct InbeApp {
Inbe inbe;
Inbe settings_preview;
@@ -372,9 +382,6 @@ struct InbeApp {
int tutorial_seen;
int habits_guide_step;
int habits_guide_seen;
int profile_guide_step;
int profile_guide_seen;
ProfileGuideAnchors profile_guide_anchors;
int exercise_manual_seen_mask;
int practice_visible_mask;
int practice_home_scroll;
@@ -385,6 +392,16 @@ struct InbeApp {
int theme_mode;
int orientation_mode;
int navigation_mode;
int bottom_nav_routes[APP_BOTTOM_NAV_CONTENT_MAX];
int bottom_nav_route_count;
int bottom_nav_config_routes[APP_BOTTOM_NAV_CONTENT_MAX];
int bottom_nav_config_route_count;
int nav_sidebar_open;
int nav_sidebar_open_frame;
int nav_sidebar_scroll;
int nav_sidebar_return_on_back;
UIIconType profile_picture_icon;
int profile_picture_picker_scroll;
int transition_mode;
int android_orientation;
int main_tab;
@@ -401,7 +418,6 @@ struct InbeApp {
int habit_counter_press_start_x;
int habit_counter_press_start_y;
int advanced_session_controls;
int show_session_volume_control;
int double_tap_to_breathe;
double breath_tap_last_time;
int hold_display_mode;
+933 -71
View File
File diff suppressed because it is too large. Load diff
+6
View File
@@ -10,6 +10,12 @@ int app_fullscreen_bottom_reserved(const InbeApp *app);
void app_set_android_bottom_nav_height(int height);
int app_android_bottom_nav_height(void);
void app_draw_bottom_nav(InbeApp *app);
int app_draw_customize_nav_page(InbeApp *app);
void app_apply_nav_route(InbeApp *app, int route);
void app_update_nav_sidebar_mode(InbeApp *app);
void app_close_nav_sidebar(InbeApp *app);
int app_return_to_nav_sidebar_if_needed(InbeApp *app);
void app_reset_bottom_nav_routes(InbeApp *app);
void app_sanitize_bottom_nav_routes(InbeApp *app);
#endif
+66 -7
View File
@@ -1,6 +1,7 @@
#include "app_settings.h"
#include "app.h"
#include "app_nav.h"
#include "device_preferences.h"
#include "locale.h"
#include "practices/meditation/meditation_music.h"
@@ -56,8 +57,10 @@ static void
sync_web_storage(void)
{
EM_ASM({
if(typeof Module.__inbeScheduleStorageSync === 'function')
Module.__inbeScheduleStorageSync(250, true);
if(typeof Module.__inbeFlushStorageSync === 'function')
Module.__inbeFlushStorageSync(true);
else if(typeof Module.__inbeScheduleStorageSync === 'function')
Module.__inbeScheduleStorageSync(0, true);
});
}
#endif
@@ -108,6 +111,51 @@ load_navigation_mode(void)
return NAV_MODE_TABBAR;
}
static UIIconType
default_profile_picture_icon(void)
{
UIIconType fallback = GetUIProfilePictureIconType(0);
return fallback != UI_ICON_TYPE_NONE ? fallback : UI_ICON_TYPE_PROFILE;
}
static int
is_profile_picture_icon(UIIconType type)
{
for(int i = 0; i < GetUIProfilePictureIconCount(); i++) {
if(GetUIProfilePictureIconType(i) == type)
return 1;
}
return 0;
}
static UIIconType
load_profile_picture_icon(void)
{
UIIconType fallback = default_profile_picture_icon();
UIIconType type =
(UIIconType)storage_get_setting_int("profile_picture_icon", fallback);
return is_profile_picture_icon(type) ? type : fallback;
}
static void
load_bottom_nav_routes(InbeApp *app)
{
if(app == NULL)
return;
app->bottom_nav_route_count =
storage_get_setting_int("bottom_nav_route_count", 2);
app->bottom_nav_routes[0] =
storage_get_setting_int("bottom_nav_route_0", APP_NAV_ROUTE_HABITS);
app->bottom_nav_routes[1] =
storage_get_setting_int("bottom_nav_route_1", APP_NAV_ROUTE_PRACTICE);
app->bottom_nav_routes[2] =
storage_get_setting_int("bottom_nav_route_2", APP_NAV_ROUTE_NONE);
app->bottom_nav_routes[3] =
storage_get_setting_int("bottom_nav_route_3", APP_NAV_ROUTE_NONE);
app_sanitize_bottom_nav_routes(app);
}
static int
default_theme_source(void)
{
@@ -170,7 +218,6 @@ save_settings(InbeApp *app)
{"sound_volume", app->sound_volume},
{"tutorial_seen", app->tutorial_seen ? 1 : 0},
{"habits_guide_seen", app->habits_guide_seen ? 1 : 0},
{"profile_guide_seen", app->profile_guide_seen ? 1 : 0},
{"exercise_manual_seen_mask", app->exercise_manual_seen_mask},
{"practice_visible_mask", app->practice_visible_mask},
{"theme", app->theme_id},
@@ -179,6 +226,12 @@ save_settings(InbeApp *app)
{"theme_mode", app->theme_mode},
{"orientation_mode", app->orientation_mode},
{"navigation_mode", app->navigation_mode},
{"profile_picture_icon", app->profile_picture_icon},
{"bottom_nav_route_count", app->bottom_nav_route_count},
{"bottom_nav_route_0", app->bottom_nav_routes[0]},
{"bottom_nav_route_1", app->bottom_nav_routes[1]},
{"bottom_nav_route_2", app->bottom_nav_routes[2]},
{"bottom_nav_route_3", app->bottom_nav_routes[3]},
{"transition_mode", app->transition_mode},
{"main_tab", app->main_tab},
{"habits_screen_mode", app->habits.screen_mode == HABITS_SCREEN_REORDER
@@ -194,7 +247,6 @@ save_settings(InbeApp *app)
{"advanced_session_controls", app->advanced_session_controls ? 1 : 0},
{"double_tap_to_breathe", app->double_tap_to_breathe ? 1 : 0},
{"show_session_return_button", app->show_session_return_button ? 1 : 0},
{"show_session_volume_control", app->show_session_volume_control ? 1 : 0},
{"hold_display_mode", app->hold_display_mode},
{"exercise_type", app->exercise_type},
{"sun_salutation_repetitions", app->sun_salutation.repetitions},
@@ -284,7 +336,6 @@ app_load_settings(InbeApp *app)
LoadedBoolSetting settings[] = {
{&app->tutorial_seen, "tutorial_seen", 0},
{&app->habits_guide_seen, "habits_guide_seen", 0},
{&app->profile_guide_seen, "profile_guide_seen", 0},
{&app->dark_mode, "dark_mode", 0},
{&app->fullscreen_enabled, "fullscreen", 0},
#if ANDROID_BUILD || defined(PLATFORM_WEB)
@@ -296,7 +347,6 @@ app_load_settings(InbeApp *app)
{&app->advanced_session_controls, "advanced_session_controls", 0},
{&app->double_tap_to_breathe, "double_tap_to_breathe", 0},
{&app->show_session_return_button, "show_session_return_button", 1},
{&app->show_session_volume_control, "show_session_volume_control", 0},
{&app->meditation.show_extend_controls, "meditation_show_extend_controls", 1},
};
load_bool_settings(settings, sizeof(settings) / sizeof(settings[0]));
@@ -317,7 +367,7 @@ app_load_settings(InbeApp *app)
{&app->orientation_mode, "orientation_mode", APP_ORIENTATION_SYSTEM,
APP_ORIENTATION_SYSTEM, APP_ORIENTATION_SENSOR},
{&app->main_tab, "main_tab", APP_MAIN_TAB_PRACTICE,
APP_MAIN_TAB_HABITS, APP_MAIN_TAB_PRACTICE},
APP_MAIN_TAB_NONE, APP_MAIN_TAB_PRACTICE},
{&app->habits.screen_mode, "habits_screen_mode", HABITS_SCREEN_OVERVIEW,
HABITS_SCREEN_OVERVIEW, HABITS_SCREEN_DETAIL},
{&app->habits.tab, "habits_tab", HABIT_TAB_WEEKLY,
@@ -361,6 +411,15 @@ app_load_settings(InbeApp *app)
}
app->navigation_mode = load_navigation_mode();
app->profile_picture_icon = load_profile_picture_icon();
load_bottom_nav_routes(app);
if(app->bottom_nav_route_count <= 0) {
app->main_tab = APP_MAIN_TAB_NONE;
} else if(app->main_tab == APP_MAIN_TAB_NONE) {
app->main_tab = app->bottom_nav_routes[0] == APP_NAV_ROUTE_HABITS
? APP_MAIN_TAB_HABITS
: APP_MAIN_TAB_PRACTICE;
}
manual_seen_mask = storage_get_setting_int("exercise_manual_seen_mask", -1);
if(manual_seen_mask < 0)
+2
View File
@@ -396,6 +396,8 @@ app_modal_type_name(UIModalType type)
case UIModalSyncPublicId: return "sync_public_id";
case UIModalConfirmRemoveFriend: return "confirm_remove_friend";
case UIModalConfirmSyncAccountSwitch: return "confirm_sync_account_switch";
case UIModalBottomNavConfig: return "bottom_nav_config";
case UIModalProfilePicturePicker: return "profile_picture_picker";
default: break;
}
return "unknown";
+2
View File
@@ -43,6 +43,8 @@ enum {
InbeScreenProfile,
InbeScreenHabits,
InbeScreenPet,
InbeScreenCustomizeNav,
InbeScreenNavSidebar,
InbeScreenHabitEdit,
InbeScreenHabitSessionEdit,
};
+14 -12
View File
@@ -1,4 +1,4 @@
#include "raylib.h"
#include "flint.h"
#include "app.h"
#include "storage.h"
#include "practices/practice_registry.h"
@@ -18,7 +18,7 @@
#include <time.h>
#if defined(INBE_DESKTOP_TRAY_ENABLED)
#include "desktop_tray.h"
#include "platform/inbe_desktop_tray.h"
#endif
#if defined(_WIN32) && !ANDROID_BUILD
@@ -511,7 +511,6 @@ setup_screenshot_scene(InbeApp *app, const ScreenshotRequest *request)
app->settings_scroll = 0;
app->manual_scroll = 0;
app->tutorial_step = 0;
app->profile_guide_seen = 1;
app->habits_guide_seen = 1;
app->tutorial_seen = 1;
screenshot_seed_habits(app);
@@ -552,21 +551,24 @@ setup_screenshot_scene(InbeApp *app, const ScreenshotRequest *request)
app->main_tab = APP_MAIN_TAB_PRACTICE;
app->settings_tab = SETTINGS_TAB_THEME;
app->inbe.screen = InbeScreenSettings;
} else if(strcmp(request->scene, "settings_overview") == 0) {
} else if(strcmp(request->scene, "settings_session") == 0) {
app->main_tab = APP_MAIN_TAB_PRACTICE;
app->settings_tab = SETTINGS_TAB_OVERVIEW;
app->settings_tab = SETTINGS_TAB_SESSION;
app->inbe.screen = InbeScreenSettings;
} else if(strcmp(request->scene, "profile_data") == 0) {
app->profile_view = PROFILE_VIEW_DATA;
app->profile_tab = PROFILE_TAB_OVERVIEW;
} else if(strcmp(request->scene, "data") == 0 ||
strcmp(request->scene, "profile_data") == 0) {
app->profile_view = PROFILE_VIEW_MAIN;
app->profile_tab = PROFILE_TAB_DATA;
app->inbe.screen = InbeScreenProfile;
} else if(strcmp(request->scene, "profile_practices") == 0) {
} else if(strcmp(request->scene, "my_practices") == 0 ||
strcmp(request->scene, "profile_practices") == 0) {
app->profile_view = PROFILE_VIEW_PRACTICES;
app->profile_tab = PROFILE_TAB_OVERVIEW;
app->inbe.screen = InbeScreenProfile;
} else if(strcmp(request->scene, "profile_sync_account") == 0) {
app->profile_view = PROFILE_VIEW_SYNC_ACCOUNT;
app->profile_tab = PROFILE_TAB_OVERVIEW;
} else if(strcmp(request->scene, "configure_account") == 0 ||
strcmp(request->scene, "profile_sync_account") == 0) {
app->profile_view = PROFILE_VIEW_MAIN;
app->profile_tab = PROFILE_TAB_SYNC;
app->inbe.screen = InbeScreenProfile;
} else if(strcmp(request->scene, "cobalt_dark") == 0) {
screenshot_apply_theme(app, THEME_COBALT, 1);
+1 -1
View File
@@ -1,7 +1,7 @@
#include "android_import.h"
#include "platform.h"
#include "raylib.h"
#include "flint.h"
#include <string.h>
#if ANDROID_BUILD
+1 -1
View File
@@ -9,7 +9,7 @@
#include <string.h>
#include <stdio.h>
#include <raylib.h>
#include "flint.h"
#include <pthread.h>
#include <jni.h>
#include <android/log.h>
@@ -1,7 +1,7 @@
#include "android_runtime_assets.h"
#include "runtime_assets.h"
#include "raylib.h"
#include "flint.h"
#include <android/native_activity.h>
#include <android_native_app_glue.h>
+1 -1
View File
@@ -4,7 +4,7 @@
#include "locale.h"
#include "storage.h"
#include "version.h"
#include "raylib.h"
#include "flint.h"
#include "miniz.h"
#include <time.h>
#include <stdlib.h>
+1 -1
View File
@@ -3,7 +3,7 @@
#include "practices/practice_registry.h"
#include <time.h>
#include <raylib.h>
#include "flint.h"
#include <pthread.h>
#include <android/log.h>
#include <unistd.h>
+1 -1
View File
@@ -1,6 +1,6 @@
#include "android_wakelock.h"
#include <raylib.h>
#include "flint.h"
#include <pthread.h>
#include <android/log.h>
#include <jni.h>
-526
View File
@@ -1,526 +0,0 @@
#include "desktop_tray.h"
#if defined(INBE_DESKTOP_TRAY_ENABLED)
#include "app.h"
#include "locale.h"
#include "practices/practice_registry.h"
#include "raylib.h"
#if defined(INBE_DESKTOP_TRAY_AYATANA)
#include <libayatana-appindicator/app-indicator.h>
#elif defined(INBE_DESKTOP_TRAY_APPINDICATOR)
#include <libappindicator/app-indicator.h>
#endif
#include <SDL.h>
#include <gtk/gtk.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static pthread_t tray_thread;
static pthread_mutex_t tray_action_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t tray_state_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t tray_status_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t tray_state_cond = PTHREAD_COND_INITIALIZER;
static InbeDesktopTrayAction pending_action = INBE_DESKTOP_TRAY_ACTION_NONE;
static int tray_started;
static int tray_state;
static char tray_status_text[128] = "Inner Breeze";
static int tray_status_update_pending;
#if defined(INBE_DESKTOP_TRAY_GTK_STATUS_ICON)
static GtkStatusIcon *tray_status_icon;
#endif
enum {
DESKTOP_TRAY_STATE_STARTING = 0,
DESKTOP_TRAY_STATE_READY,
DESKTOP_TRAY_STATE_FAILED,
DESKTOP_TRAY_STATE_STOPPED
};
static void
desktop_tray_set_action(InbeDesktopTrayAction action)
{
pthread_mutex_lock(&tray_action_lock);
pending_action = action;
pthread_mutex_unlock(&tray_action_lock);
}
InbeDesktopTrayAction
inbe_desktop_tray_poll_action(void)
{
InbeDesktopTrayAction action;
pthread_mutex_lock(&tray_action_lock);
action = pending_action;
pending_action = INBE_DESKTOP_TRAY_ACTION_NONE;
pthread_mutex_unlock(&tray_action_lock);
return action;
}
static int
desktop_tray_sdl_event_filter(void *userdata, SDL_Event *event)
{
(void)userdata;
if(event != NULL && event->type == SDL_QUIT) {
desktop_tray_set_action(INBE_DESKTOP_TRAY_ACTION_CLOSE_REQUEST);
return 0;
}
return 1;
}
static void
desktop_tray_menu_action(GtkMenuItem *item, gpointer user_data)
{
(void)item;
desktop_tray_set_action((InbeDesktopTrayAction)(intptr_t)user_data);
}
static GtkWidget *
desktop_tray_menu_item(const char *label, InbeDesktopTrayAction action)
{
GtkWidget *item = gtk_menu_item_new_with_label(label);
g_signal_connect(item, "activate", G_CALLBACK(desktop_tray_menu_action),
(gpointer)(intptr_t)action);
return item;
}
static void
desktop_tray_set_state(int state)
{
pthread_mutex_lock(&tray_state_lock);
tray_state = state;
pthread_cond_signal(&tray_state_cond);
pthread_mutex_unlock(&tray_state_lock);
}
static gboolean
desktop_tray_apply_status(gpointer user_data)
{
char text[sizeof(tray_status_text)];
(void)user_data;
pthread_mutex_lock(&tray_status_lock);
snprintf(text, sizeof(text), "%s", tray_status_text);
tray_status_update_pending = 0;
pthread_mutex_unlock(&tray_status_lock);
#if defined(INBE_DESKTOP_TRAY_GTK_STATUS_ICON)
if(tray_status_icon != NULL) {
gtk_status_icon_set_title(tray_status_icon, text);
gtk_status_icon_set_tooltip_text(tray_status_icon, text);
}
#endif
return G_SOURCE_REMOVE;
}
static gboolean
desktop_tray_quit_main(gpointer user_data)
{
(void)user_data;
gtk_main_quit();
return G_SOURCE_REMOVE;
}
static const char *
desktop_tray_icon_path(void)
{
static char path[512];
static const char *const fallback_paths[] = {
"inbe.png",
"packaging/linux/appimage/inbe.png",
"packaging/snap/snap/gui/inbe.png",
"web-assets/icons/inbe.png",
NULL
};
static const char *const exe_links[] = {
#if defined(__FreeBSD__)
"/proc/curproc/file",
#endif
#if defined(__linux__)
"/proc/self/exe",
#endif
NULL
};
for(int i = 0; exe_links[i] != NULL; i++) {
ssize_t len = readlink(exe_links[i], path, sizeof(path) - 16);
if(len > 0 && (size_t)len < sizeof(path) - 16) {
char *slash;
path[len] = '\0';
slash = strrchr(path, '/');
if(slash != NULL) {
slash[1] = '\0';
strncat(path, "inbe.png", sizeof(path) - strlen(path) - 1);
if(g_file_test(path, G_FILE_TEST_IS_REGULAR))
return path;
}
}
}
for(int i = 0; fallback_paths[i] != NULL; i++) {
if(g_file_test(fallback_paths[i], G_FILE_TEST_IS_REGULAR))
return fallback_paths[i];
}
return NULL;
}
static GtkWidget *
desktop_tray_create_menu(void)
{
GtkWidget *menu = gtk_menu_new();
GtkWidget *start_item;
GtkWidget *start_menu;
gtk_menu_shell_append(GTK_MENU_SHELL(menu),
desktop_tray_menu_item("Show Inner Breeze",
INBE_DESKTOP_TRAY_ACTION_SHOW));
start_item = gtk_menu_item_new_with_label("Start Practice");
start_menu = gtk_menu_new();
gtk_menu_shell_append(GTK_MENU_SHELL(start_menu),
desktop_tray_menu_item("Wim Hof",
INBE_DESKTOP_TRAY_ACTION_START_WHM));
gtk_menu_shell_append(GTK_MENU_SHELL(start_menu),
desktop_tray_menu_item("Meditation",
INBE_DESKTOP_TRAY_ACTION_START_MEDITATION));
gtk_menu_shell_append(GTK_MENU_SHELL(start_menu),
desktop_tray_menu_item("Sun Salutation",
INBE_DESKTOP_TRAY_ACTION_START_SUN_SALUTATION));
gtk_menu_item_set_submenu(GTK_MENU_ITEM(start_item), start_menu);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), start_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
gtk_menu_shell_append(GTK_MENU_SHELL(menu),
desktop_tray_menu_item("Quit Inner Breeze",
INBE_DESKTOP_TRAY_ACTION_QUIT));
gtk_widget_show_all(menu);
return menu;
}
#if defined(INBE_DESKTOP_TRAY_GTK_STATUS_ICON)
static void
desktop_tray_status_icon_activate(GtkStatusIcon *status_icon, gpointer user_data)
{
(void)status_icon;
(void)user_data;
desktop_tray_set_action(INBE_DESKTOP_TRAY_ACTION_SHOW);
}
static void
desktop_tray_status_icon_popup(GtkStatusIcon *status_icon, guint button,
guint activate_time, gpointer user_data)
{
GtkWidget *menu = user_data;
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, gtk_status_icon_position_menu,
status_icon, button, activate_time);
}
#endif
static void *
desktop_tray_thread_main(void *arg)
{
#if defined(INBE_DESKTOP_TRAY_AYATANA) || defined(INBE_DESKTOP_TRAY_APPINDICATOR)
AppIndicator *indicator;
#endif
GtkWidget *menu;
(void)arg;
if(!gtk_init_check(NULL, NULL)) {
desktop_tray_set_state(DESKTOP_TRAY_STATE_FAILED);
return NULL;
}
#if defined(INBE_DESKTOP_TRAY_AYATANA) || defined(INBE_DESKTOP_TRAY_APPINDICATOR)
indicator = app_indicator_new("inbe", "inbe",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
if(indicator == NULL) {
desktop_tray_set_state(DESKTOP_TRAY_STATE_FAILED);
return NULL;
}
app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE);
{
const char *icon_path = desktop_tray_icon_path();
if(icon_path != NULL)
app_indicator_set_icon_full(indicator, icon_path, "Inner Breeze");
else
app_indicator_set_icon_full(indicator, "inbe", "Inner Breeze");
}
menu = desktop_tray_create_menu();
app_indicator_set_menu(indicator, GTK_MENU(menu));
#elif defined(INBE_DESKTOP_TRAY_GTK_STATUS_ICON)
menu = desktop_tray_create_menu();
{
const char *icon_path = desktop_tray_icon_path();
tray_status_icon = icon_path != NULL
? gtk_status_icon_new_from_file(icon_path)
: gtk_status_icon_new_from_icon_name("inbe");
}
if(tray_status_icon == NULL) {
desktop_tray_set_state(DESKTOP_TRAY_STATE_FAILED);
return NULL;
}
gtk_status_icon_set_title(tray_status_icon, "Inner Breeze");
gtk_status_icon_set_tooltip_text(tray_status_icon, "Inner Breeze");
gtk_status_icon_set_visible(tray_status_icon, TRUE);
g_signal_connect(tray_status_icon, "activate",
G_CALLBACK(desktop_tray_status_icon_activate), NULL);
g_signal_connect(tray_status_icon, "popup-menu",
G_CALLBACK(desktop_tray_status_icon_popup), menu);
#else
desktop_tray_set_state(DESKTOP_TRAY_STATE_FAILED);
return NULL;
#endif
desktop_tray_set_state(DESKTOP_TRAY_STATE_READY);
gtk_main();
desktop_tray_set_state(DESKTOP_TRAY_STATE_STOPPED);
return NULL;
}
int
inbe_desktop_tray_init(void)
{
int ready;
pthread_mutex_lock(&tray_state_lock);
tray_state = DESKTOP_TRAY_STATE_STARTING;
pthread_mutex_unlock(&tray_state_lock);
if(pthread_create(&tray_thread, NULL, desktop_tray_thread_main, NULL) != 0)
return 0;
tray_started = 1;
pthread_mutex_lock(&tray_state_lock);
while(tray_state == DESKTOP_TRAY_STATE_STARTING)
pthread_cond_wait(&tray_state_cond, &tray_state_lock);
ready = tray_state == DESKTOP_TRAY_STATE_READY;
pthread_mutex_unlock(&tray_state_lock);
if(!ready) {
pthread_join(tray_thread, NULL);
tray_started = 0;
return 0;
}
SDL_SetEventFilter(desktop_tray_sdl_event_filter, NULL);
return ready;
}
void
inbe_desktop_tray_shutdown(void)
{
int ready;
pthread_mutex_lock(&tray_state_lock);
ready = tray_state == DESKTOP_TRAY_STATE_READY;
pthread_mutex_unlock(&tray_state_lock);
if(tray_started && ready)
g_idle_add(desktop_tray_quit_main, NULL);
if(tray_started)
pthread_join(tray_thread, NULL);
tray_started = 0;
}
static void
desktop_tray_restore_window(void)
{
ClearWindowState(FLAG_WINDOW_HIDDEN);
RestoreWindow();
}
void
inbe_desktop_tray_keep_running(void)
{
int ready;
pthread_mutex_lock(&tray_state_lock);
ready = tray_state == DESKTOP_TRAY_STATE_READY;
pthread_mutex_unlock(&tray_state_lock);
if(ready)
SetWindowState(FLAG_WINDOW_HIDDEN);
else
MinimizeWindow();
}
static void
desktop_tray_start_practice(InbeApp *app, int practice_id)
{
const PracticeDefinition *practice;
if(app == NULL)
return;
app->exercise_type = practice_clamp_id(practice_id);
app->main_tab = APP_MAIN_TAB_PRACTICE;
app->practice_tab = PRACTICE_TAB_PLAY;
if(app->modal.active)
app_close_modal(app);
desktop_tray_restore_window();
practice = practice_get(app->exercise_type);
if(practice->start != NULL)
practice->start(app);
}
void
inbe_desktop_tray_apply_action(InbeApp *app, InbeDesktopTrayAction action, int *quit)
{
switch(action) {
case INBE_DESKTOP_TRAY_ACTION_SHOW:
desktop_tray_restore_window();
break;
case INBE_DESKTOP_TRAY_ACTION_MINIMIZE:
MinimizeWindow();
break;
case INBE_DESKTOP_TRAY_ACTION_CLOSE_REQUEST:
app_request_desktop_close(app);
break;
case INBE_DESKTOP_TRAY_ACTION_START_WHM:
desktop_tray_start_practice(app, PRACTICE_WHM);
break;
case INBE_DESKTOP_TRAY_ACTION_START_MEDITATION:
desktop_tray_start_practice(app, PRACTICE_MEDITATION);
break;
case INBE_DESKTOP_TRAY_ACTION_START_SUN_SALUTATION:
desktop_tray_start_practice(app, PRACTICE_SUN_SALUTATION);
break;
case INBE_DESKTOP_TRAY_ACTION_QUIT:
if(quit != NULL)
*quit = 1;
break;
case INBE_DESKTOP_TRAY_ACTION_NONE:
default:
break;
}
}
void
inbe_desktop_tray_update_status(InbeApp *app)
{
char text[sizeof(tray_status_text)];
int ready;
if(app == NULL)
return;
pthread_mutex_lock(&tray_state_lock);
ready = tray_state == DESKTOP_TRAY_STATE_READY;
pthread_mutex_unlock(&tray_state_lock);
if(!ready)
return;
snprintf(text, sizeof(text), "Inner Breeze");
if(app->inbe.screen == InbeScreenSession) {
int count = int_from_count(app->inbe.count);
int max_breaths = int_from_count(app->inbe.maxbreaths);
if(app->session_paused) {
snprintf(text, sizeof(text), "%s", GetLocaleText("tray_wim_hof_paused"));
} else {
switch(app->inbe.phase) {
case InbePhaseBreathe:
FormatLocaleText(text, sizeof(text), "tray_wim_hof_breath",
count, max_breaths);
break;
case InbePhaseHold:
FormatLocaleText(text, sizeof(text), "tray_wim_hof_hold", count);
break;
case InbePhaseRecover:
FormatLocaleText(text, sizeof(text), "tray_wim_hof_breathe_in",
count);
break;
case InbePhaseNext:
snprintf(text, sizeof(text), "%s", GetLocaleText("tray_wim_hof_next_round"));
break;
case InbePhaseStarting:
default:
snprintf(text, sizeof(text), "%s", GetLocaleText("tray_wim_hof_starting"));
break;
}
}
} else if(app->inbe.screen == InbeScreenMeditation) {
int remaining = app->meditation.remaining_seconds;
if(remaining < 0)
remaining = 0;
FormatLocaleText(text, sizeof(text),
app->session_paused ? "tray_meditation_paused"
: "tray_meditation_left",
remaining / 60, remaining % 60);
} else if(app->inbe.screen == InbeScreenSunSalutation) {
FormatLocaleText(text, sizeof(text),
app->session_paused ? "tray_sun_salutation_paused"
: "tray_sun_salutation",
app->sun_salutation.step + 1,
app->sun_salutation.repetition + 1,
app->sun_salutation.repetitions);
}
pthread_mutex_lock(&tray_status_lock);
if(strcmp(tray_status_text, text) != 0) {
snprintf(tray_status_text, sizeof(tray_status_text), "%s", text);
if(!tray_status_update_pending) {
tray_status_update_pending = 1;
g_idle_add(desktop_tray_apply_status, NULL);
}
}
pthread_mutex_unlock(&tray_status_lock);
}
#else
int
inbe_desktop_tray_init(void)
{
return 0;
}
void
inbe_desktop_tray_shutdown(void)
{
}
InbeDesktopTrayAction
inbe_desktop_tray_poll_action(void)
{
return INBE_DESKTOP_TRAY_ACTION_NONE;
}
void
inbe_desktop_tray_apply_action(InbeApp *app, InbeDesktopTrayAction action, int *quit)
{
(void)app;
(void)action;
(void)quit;
}
void
inbe_desktop_tray_update_status(InbeApp *app)
{
(void)app;
}
void
inbe_desktop_tray_keep_running(void)
{
}
#endif
+479
View File
@@ -0,0 +1,479 @@
#include "inbe_desktop_tray.h"
#if defined(INBE_DESKTOP_TRAY_ENABLED)
#include "app.h"
#include "desktop_tray.h"
#include "habits_screen.h"
#include "locale.h"
#include "practices/practice_registry.h"
#include "practices/sun_salutation/sun_salutation_practice.h"
#include "flint.h"
#include <stdio.h>
#include <string.h>
typedef struct InbeTraySnapshot {
int window_visible;
int count;
char show_hide_label[96];
char start_practice_label[96];
char habits_label[96];
char quit_label[96];
char whm_label[96];
char meditation_label[96];
char sun_salutation_label[96];
char habit_labels[INBE_HABIT_MAX][128];
int habit_indices[INBE_HABIT_MAX];
int habit_enabled[INBE_HABIT_MAX];
} InbeTraySnapshot;
static InbeTraySnapshot TraySnapshot;
static int TrayReady;
static const char *const TrayIconPaths[] = {
"inbe.png",
"packaging/linux/appimage/inbe.png",
"packaging/snap/snap/gui/inbe.png",
"web-assets/icons/inbe.png",
NULL
};
static InbeDesktopTrayAction
GetTrayHabitAction(int index)
{
if(index < 0 || index >= INBE_HABIT_MAX)
return INBE_DESKTOP_TRAY_ACTION_NONE;
return (InbeDesktopTrayAction)(INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_0 + index);
}
static int
GetTrayHabitIndex(InbeDesktopTrayAction action)
{
if(action < INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_0 ||
action > INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_9)
return -1;
return (int)(action - INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_0);
}
static const char *
GetTrayWindowLabelKey(int visible)
{
return visible ? "tray_hide_inner_breeze" : "tray_show_inner_breeze";
}
static InbeDesktopTrayAction
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)
{
if(snapshot == NULL)
return;
snprintf(snapshot->show_hide_label, sizeof(snapshot->show_hide_label), "%s",
GetLocaleText(GetTrayWindowLabelKey(snapshot->window_visible)));
snprintf(snapshot->start_practice_label, sizeof(snapshot->start_practice_label), "%s",
GetLocaleText("tray_start_practice"));
snprintf(snapshot->habits_label, sizeof(snapshot->habits_label), "%s",
GetLocaleText("tray_mark_complete"));
snprintf(snapshot->quit_label, sizeof(snapshot->quit_label), "%s",
GetLocaleText("tray_quit_inner_breeze"));
snprintf(snapshot->whm_label, sizeof(snapshot->whm_label), "%s",
GetLocaleText("exercise_wim_hof"));
snprintf(snapshot->meditation_label, sizeof(snapshot->meditation_label), "%s",
GetLocaleText("exercise_meditation"));
snprintf(snapshot->sun_salutation_label, sizeof(snapshot->sun_salutation_label), "%s",
GetLocaleText("exercise_sun_salutation"));
}
static void
SeedTraySnapshot(void)
{
InbeTraySnapshot next;
memset(&next, 0, sizeof(next));
next.window_visible = !IsWindowHidden();
FillTraySnapshotLabels(&next);
TraySnapshot = next;
}
static int
BuildTrayMenu(const InbeTraySnapshot *snapshot,
DesktopTrayMenuItem *items, int item_count,
DesktopTrayMenuItem *start_items, int start_item_count,
DesktopTrayMenuItem *habit_items, int habit_item_count)
{
InbeTraySnapshot local_snapshot;
int item_index = 0;
if(items == NULL || item_count < 5 ||
start_items == NULL || start_item_count < 3 ||
habit_items == NULL || habit_item_count < INBE_HABIT_MAX)
return 0;
memset(&local_snapshot, 0, sizeof(local_snapshot));
InitTraySnapshotLabels(&local_snapshot);
if(snapshot != NULL)
local_snapshot = *snapshot;
start_items[0] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_ACTION,
.label = local_snapshot.whm_label,
.action = INBE_DESKTOP_TRAY_ACTION_START_WHM,
.enabled = 1
};
start_items[1] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_ACTION,
.label = local_snapshot.meditation_label,
.action = INBE_DESKTOP_TRAY_ACTION_START_MEDITATION,
.enabled = 1
};
start_items[2] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_ACTION,
.label = local_snapshot.sun_salutation_label,
.action = INBE_DESKTOP_TRAY_ACTION_START_SUN_SALUTATION,
.enabled = 1
};
for(int i = 0; i < local_snapshot.count && i < INBE_HABIT_MAX; i++) {
habit_items[i] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_ACTION,
.label = local_snapshot.habit_labels[i],
.action = GetTrayHabitAction(i),
.enabled = local_snapshot.habit_enabled[i]
};
}
items[item_index++] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_ACTION,
.label = local_snapshot.show_hide_label,
.action = GetTrayWindowAction(local_snapshot.window_visible),
.enabled = 1
};
items[item_index++] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_SUBMENU,
.label = local_snapshot.start_practice_label,
.enabled = 1,
.children = start_items,
.child_count = 3
};
items[item_index++] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_SUBMENU,
.label = local_snapshot.habits_label,
.enabled = local_snapshot.count > 0,
.children = habit_items,
.child_count = local_snapshot.count
};
items[item_index++] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_SEPARATOR
};
items[item_index++] = (DesktopTrayMenuItem){
.kind = DESKTOP_TRAY_MENU_ITEM_ACTION,
.label = local_snapshot.quit_label,
.action = INBE_DESKTOP_TRAY_ACTION_QUIT,
.enabled = 1
};
return item_index;
}
static void
ApplyTrayMenuSnapshot(const InbeTraySnapshot *snapshot)
{
DesktopTrayMenuItem items[5];
DesktopTrayMenuItem start_items[3];
DesktopTrayMenuItem habit_items[INBE_HABIT_MAX];
int count;
memset(items, 0, sizeof(items));
memset(start_items, 0, sizeof(start_items));
memset(habit_items, 0, sizeof(habit_items));
count = BuildTrayMenu(snapshot, items, 5, start_items, 3,
habit_items, INBE_HABIT_MAX);
SetDesktopTrayMenu(items, count);
SetDesktopTrayActivateAction(GetTrayWindowAction(snapshot != NULL
? snapshot->window_visible
: !IsWindowHidden()));
}
int
inbe_desktop_tray_init(void)
{
DesktopTraySpec spec;
DesktopTrayMenuItem items[5];
DesktopTrayMenuItem start_items[3];
DesktopTrayMenuItem habit_items[INBE_HABIT_MAX];
int item_count;
SeedTraySnapshot();
memset(items, 0, sizeof(items));
memset(start_items, 0, sizeof(start_items));
memset(habit_items, 0, sizeof(habit_items));
item_count = BuildTrayMenu(&TraySnapshot, items, 5, start_items, 3,
habit_items, INBE_HABIT_MAX);
memset(&spec, 0, sizeof(spec));
spec.id = "inbe";
spec.title = "Inner Breeze";
spec.icon_name = "inbe";
spec.icon_paths = TrayIconPaths;
spec.close_action = INBE_DESKTOP_TRAY_ACTION_CLOSE_REQUEST;
spec.activate_action = GetTrayWindowAction(TraySnapshot.window_visible);
spec.menu_items = items;
spec.menu_item_count = item_count;
TrayReady = InitDesktopTray(&spec);
return TrayReady;
}
void
inbe_desktop_tray_shutdown(void)
{
ShutdownDesktopTray();
TrayReady = 0;
}
InbeDesktopTrayAction
inbe_desktop_tray_poll_action(void)
{
return (InbeDesktopTrayAction)PollDesktopTrayAction();
}
static void
RestoreTrayWindow(void)
{
ClearWindowState(FLAG_WINDOW_HIDDEN);
RestoreWindow();
}
static void
HideTrayWindow(void)
{
SetWindowState(FLAG_WINDOW_HIDDEN);
}
void
inbe_desktop_tray_keep_running(void)
{
if(TrayReady)
SetWindowState(FLAG_WINDOW_HIDDEN);
else
MinimizeWindow();
}
static void
StartTrayPractice(InbeApp *app, int practice_id)
{
const PracticeDefinition *practice;
if(app == NULL)
return;
app->exercise_type = practice_clamp_id(practice_id);
app->main_tab = APP_MAIN_TAB_PRACTICE;
app->practice_tab = PRACTICE_TAB_PLAY;
if(app->modal.active)
app_close_modal(app);
RestoreTrayWindow();
practice = practice_get(app->exercise_type);
if(practice->start != NULL)
practice->start(app);
}
static void
MarkTrayHabit(InbeApp *app, int index)
{
int today;
InbeHabit *habit;
if(app == NULL || index < 0 || index >= app->habits.count ||
index >= INBE_HABIT_MAX)
return;
today = habits_today_index();
habit = &app->habits.items[index];
if(habit->counter_enabled)
habit_set_day_count(&app->habits, index, today,
habit_day_count(habit, today) + 1);
else
habit_set_day(&app->habits, index, today, 1);
}
static void
UpdateTrayMenuSnapshot(InbeApp *app)
{
InbeTraySnapshot next;
int today;
if(app == NULL)
return;
memset(&next, 0, sizeof(next));
next.window_visible = !IsWindowHidden();
FillTraySnapshotLabels(&next);
today = habits_today_index();
for(int i = 0; i < app->habits.count && i < INBE_HABIT_MAX &&
next.count < INBE_HABIT_MAX; i++) {
InbeHabit *habit = &app->habits.items[i];
int count = habit_day_count(habit, today);
int completed = habit_completed_day(habit, today) || count > 0;
if(completed)
continue;
snprintf(next.habit_labels[next.count], sizeof(next.habit_labels[next.count]),
"%s", habit->name);
next.habit_indices[next.count] = i;
next.habit_enabled[next.count] = 1;
next.count++;
}
if(memcmp(&TraySnapshot, &next, sizeof(next)) != 0) {
TraySnapshot = next;
ApplyTrayMenuSnapshot(&TraySnapshot);
}
}
void
inbe_desktop_tray_apply_action(InbeApp *app, InbeDesktopTrayAction action, int *quit)
{
int habit_index = GetTrayHabitIndex(action);
if(habit_index >= 0) {
if(habit_index < TraySnapshot.count)
MarkTrayHabit(app, TraySnapshot.habit_indices[habit_index]);
return;
}
switch(action) {
case INBE_DESKTOP_TRAY_ACTION_SHOW:
RestoreTrayWindow();
break;
case INBE_DESKTOP_TRAY_ACTION_HIDE:
HideTrayWindow();
break;
case INBE_DESKTOP_TRAY_ACTION_MINIMIZE:
MinimizeWindow();
break;
case INBE_DESKTOP_TRAY_ACTION_CLOSE_REQUEST:
app_request_desktop_close(app);
break;
case INBE_DESKTOP_TRAY_ACTION_START_WHM:
StartTrayPractice(app, PRACTICE_WHM);
break;
case INBE_DESKTOP_TRAY_ACTION_START_MEDITATION:
StartTrayPractice(app, PRACTICE_MEDITATION);
break;
case INBE_DESKTOP_TRAY_ACTION_START_SUN_SALUTATION:
StartTrayPractice(app, PRACTICE_SUN_SALUTATION);
break;
case INBE_DESKTOP_TRAY_ACTION_QUIT:
if(quit != NULL)
*quit = 1;
break;
case INBE_DESKTOP_TRAY_ACTION_NONE:
default:
break;
}
}
void
inbe_desktop_tray_update_status(InbeApp *app)
{
char text[128];
if(app == NULL)
return;
UpdateTrayMenuSnapshot(app);
snprintf(text, sizeof(text), "Inner Breeze");
if(app->inbe.screen == InbeScreenSession) {
int count = int_from_count(app->inbe.count);
int max_breaths = int_from_count(app->inbe.maxbreaths);
if(app->session_paused) {
snprintf(text, sizeof(text), "%s", GetLocaleText("tray_wim_hof_paused"));
} else {
switch(app->inbe.phase) {
case InbePhaseBreathe:
FormatLocaleText(text, sizeof(text), "tray_wim_hof_breath",
count, max_breaths);
break;
case InbePhaseHold:
FormatLocaleText(text, sizeof(text), "tray_wim_hof_hold", count);
break;
case InbePhaseRecover:
FormatLocaleText(text, sizeof(text), "tray_wim_hof_breathe_in",
count);
break;
case InbePhaseNext:
snprintf(text, sizeof(text), "%s", GetLocaleText("tray_wim_hof_next_round"));
break;
case InbePhaseStarting:
default:
snprintf(text, sizeof(text), "%s", GetLocaleText("tray_wim_hof_starting"));
break;
}
}
} else if(app->inbe.screen == InbeScreenMeditation) {
int remaining = app->meditation.remaining_seconds;
if(remaining < 0)
remaining = 0;
FormatLocaleText(text, sizeof(text),
app->session_paused ? "tray_meditation_paused"
: "tray_meditation_left",
remaining / 60, remaining % 60);
} else if(app->inbe.screen == InbeScreenSunSalutation) {
FormatLocaleText(text, sizeof(text),
app->session_paused ? "tray_sun_salutation_paused"
: "tray_sun_salutation",
app->sun_salutation.step + 1,
app->sun_salutation.repetition + 1,
app->sun_salutation.repetitions);
}
SetDesktopTrayStatus(text);
}
#else
int inbe_desktop_tray_init(void) { return 0; }
void inbe_desktop_tray_shutdown(void) {}
InbeDesktopTrayAction inbe_desktop_tray_poll_action(void)
{
return INBE_DESKTOP_TRAY_ACTION_NONE;
}
void inbe_desktop_tray_apply_action(InbeApp *app, InbeDesktopTrayAction action, int *quit)
{
(void)app;
(void)action;
(void)quit;
}
void inbe_desktop_tray_update_status(InbeApp *app) { (void)app; }
void inbe_desktop_tray_keep_running(void) { MinimizeWindow(); }
#endif
@@ -6,12 +6,23 @@
typedef enum InbeDesktopTrayAction {
INBE_DESKTOP_TRAY_ACTION_NONE = 0,
INBE_DESKTOP_TRAY_ACTION_SHOW,
INBE_DESKTOP_TRAY_ACTION_HIDE,
INBE_DESKTOP_TRAY_ACTION_MINIMIZE,
INBE_DESKTOP_TRAY_ACTION_CLOSE_REQUEST,
INBE_DESKTOP_TRAY_ACTION_START_WHM,
INBE_DESKTOP_TRAY_ACTION_START_MEDITATION,
INBE_DESKTOP_TRAY_ACTION_START_SUN_SALUTATION,
INBE_DESKTOP_TRAY_ACTION_QUIT
INBE_DESKTOP_TRAY_ACTION_QUIT,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_0,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_1,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_2,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_3,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_4,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_5,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_6,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_7,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_8,
INBE_DESKTOP_TRAY_ACTION_MARK_HABIT_9
} InbeDesktopTrayAction;
int inbe_desktop_tray_init(void);
+1 -1
View File
@@ -4,7 +4,7 @@
#include "locale.h"
#include "theme.h"
#include "ui.h"
#include "raylib.h"
#include "flint.h"
#include "screens/practice_screen.h"
#include "meditation_music.h"
+2 -2
View File
@@ -6,7 +6,7 @@
#include "screens/practice_screen.h"
#include "theme.h"
#include "ui.h"
#include "raylib.h"
#include "flint.h"
extern int view_width;
extern int view_height;
@@ -92,7 +92,7 @@ meditation_manual_draw(InbeApp *app)
practice_screen_manual_layout(app, UIModalPracticeManual, MEDITATION_MANUAL_PAGES,
manual_screen_tutorial_top_gap(),
ScaleUIPx(8), ScaleUIPx(120), &layout);
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN],
if(app_draw_close_title_bar(app,
GetLocaleText("meditation_manual_title"),
layout.title_h))
meditation_manual_close(app, 0);
+18 -22
View File
@@ -7,7 +7,7 @@
#include "theme.h"
#include "ui.h"
#include "practices/practice_registry.h"
#include "raylib.h"
#include "flint.h"
#include <stdio.h>
@@ -343,26 +343,22 @@ draw_meditation_sound_controls(InbeApp *app)
{
int title_h = GetUITitleBarHeight();
if(app->show_session_volume_control) {
if(DrawUIIconSliderPopup((UIIconSliderPopup){
.id = 501,
.x = view_width - ScaleUIPx(56),
.y = (title_h - (ScaleUIPx(24) + ScaleUIPx(10) * 2)) / 2,
.icon_size = ScaleUIPx(24),
.icon_padding = ScaleUIPx(10),
.icon = meditation_sound_icon_for_volume(app),
.open = &app->volume_popup_active,
.value = &app->sound_volume,
.min = SETTINGS_VOLUME_MIN,
.max = SETTINGS_VOLUME_MAX,
.popup_width = ScaleUIPx(44),
.popup_height = ScaleUIPx(200)
})) {
app->settings_dirty = 1;
save_settings(app);
}
} else {
app->volume_popup_active = 0;
if(DrawUIIconSliderPopup((UIIconSliderPopup){
.id = 501,
.x = view_width - ScaleUIPx(76),
.y = (title_h - (ScaleUIPx(18) + ScaleUIPx(5) * 2)) / 2,
.icon_size = ScaleUIPx(18),
.icon_padding = ScaleUIPx(5),
.icon = meditation_sound_icon_for_volume(app),
.open = &app->volume_popup_active,
.value = &app->sound_volume,
.min = SETTINGS_VOLUME_MIN,
.max = SETTINGS_VOLUME_MAX,
.popup_width = ScaleUIPx(40),
.popup_height = ScaleUIPx(176)
})) {
app->settings_dirty = 1;
save_settings(app);
}
}
@@ -419,7 +415,7 @@ meditation_draw_screen(InbeApp *app, int center_x, int center_y)
int title_h = GetUITitleBarHeight();
if(app->show_session_return_button &&
DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], GetLocaleText("meditation_title"), title_h)) {
app_draw_close_title_bar(app, GetLocaleText("meditation_title"), title_h)) {
meditation_request_exit(app);
return;
} else if(!app->show_session_return_button) {
@@ -255,11 +255,11 @@ sun_salutation_config_screen_draw(InbeApp *app)
app->practice_config_tab = 0;
if(app->modal.active && app->modal.type == UIModalPracticeConfig) {
title_h = GetUITitleBarHeight();
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], GetLocaleText("practice_config_title"), title_h)) {
if(app_draw_close_title_bar(app, GetLocaleText("practice_config_title"), title_h)) {
app_close_modal(app);
return;
}
} else if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN],
} else if(app_draw_close_title_bar(app,
GetLocaleText("practice_config_title"),
title_h)) {
if(app->settings_dirty)
@@ -252,7 +252,7 @@ sun_salutation_draw_screen(InbeApp *app, int center_x, int center_y)
FormatLocaleText(step_title, sizeof(step_title), "sun_salutation_session_step_title",
step + 1, SUN_SALUTATION_STEP_COUNT);
if(app->show_session_return_button &&
DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], step_title, title_h)) {
app_draw_close_title_bar(app, step_title, title_h)) {
sun_salutation_request_exit(app);
return;
} else if(!app->show_session_return_button) {
+1 -1
View File
@@ -5,7 +5,7 @@
#include "whm_session.h"
#include "theme.h"
#include "ui.h"
#include "raylib.h"
#include "flint.h"
#include "screens/practice_screen.h"
#include "practices/meditation/meditation_music.h"
+2 -2
View File
@@ -8,7 +8,7 @@
#include "ui_clip.h"
#include "ui.h"
#include "theme_meta.h"
#include "raylib.h"
#include "flint.h"
#include <stdio.h>
extern int view_width;
@@ -176,7 +176,7 @@ whm_manual_draw(InbeApp *app)
practice_screen_manual_layout(app, UIModalPracticeManual, (int)TUTORIAL_STEPS_COUNT,
manual_screen_tutorial_top_gap(), footer_content_pad,
0, &layout);
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN],
if(app_draw_close_title_bar(app,
GetLocaleText("practice_manual_button"),
layout.title_h))
whm_manual_close(app, 0);
+249 -64
View File
@@ -9,6 +9,7 @@
#include "practices/meditation/meditation_music.h"
#include "practices/practice_registry.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
@@ -497,11 +498,24 @@ draw_session_counter(InbeApp *app, int center_x, int center_y)
{
char text[CountSize];
int count;
int font = UI_TEXT_16;
Color text_color = app->inbe.phase == InbePhaseHold &&
app->hold_display_mode == HOLD_DISPLAY_CIRCLE
? text_color_for_background(GetThemeBackground())
: text_color_for_background(GetThemeCircle());
int font = UI_TEXT_24;
Color text_color = text_color_for_background(GetThemeCircle());
if(app->inbe.phase == InbePhaseStarting) {
int total_seconds = app->inbe.round == 0 ? 3 : app->inbe.pause_seconds;
int remaining;
if(total_seconds <= 0)
remaining = 0;
else {
remaining = total_seconds - app->inbe.sectick / 60;
if(remaining < 1)
remaining = 1;
}
snprintf(text, sizeof(text), "%d", remaining);
DrawCenteredUIControlText(text, center_x, center_y, font, text_color);
return;
}
if(app->inbe.phase == InbePhaseRecover) {
if(app->inbe.r < app->inbe.rmax) {
@@ -580,37 +594,173 @@ draw_hold_display_mode_selector(InbeApp *app, int x, int y, int w)
return clicked;
}
static void
draw_hold_progress_outline(InbeApp *app, int center_x, int center_y)
static Color
color_with_alpha(Color color, unsigned char alpha)
{
int seconds = int_from_count(app->inbe.count);
int total_frames = seconds * 60 + app->inbe.sectick;
int minute_frames = 60 * 60;
int completed_minutes = total_frames / minute_frames;
int frame_in_minute = total_frames % minute_frames;
float sweep = 360.0f * (float)frame_in_minute / (float)minute_frames;
int thickness = ScaleUIPx(5);
int gap = ScaleUIPx(18);
int radius = app->inbe.r + ScaleUIPx(12);
int min_radius = app->inbe.r / 2;
color.a = alpha;
return color;
}
if(thickness < 3)
thickness = 3;
if(min_radius < ScaleUIPx(16))
min_radius = ScaleUIPx(16);
static void
session_circle_progress(InbeApp *app, int *total_ticks, int *completed_ticks,
float *progress, int *countdown)
{
int total = int_from_count(app->inbe.maxbreaths);
int completed = 0;
float amount = 0.0f;
int is_countdown = 0;
for(int i = 0; i <= completed_minutes; i++) {
int ring_radius = radius - i * gap;
if(ring_radius <= min_radius)
break;
if(total < 1)
total = 1;
if(i < completed_minutes) {
DrawRing((Vector2){center_x, center_y}, (float)(ring_radius - thickness / 2),
(float)(ring_radius + thickness / 2), -90.0f, 270.0f, 96, GetThemeText());
} else if(sweep > 0.0f) {
DrawRing((Vector2){center_x, center_y}, (float)(ring_radius - thickness / 2),
(float)(ring_radius + thickness / 2), -90.0f, -90.0f + sweep, 96, GetThemeText());
if(total_ticks == NULL || completed_ticks == NULL || progress == NULL ||
countdown == NULL)
return;
switch(app->inbe.phase) {
case InbePhaseStarting: {
int total_seconds = app->inbe.round == 0 ? 3 : app->inbe.pause_seconds;
int total_frames = total_seconds * 60;
total = total_seconds > 0 ? total_seconds : 1;
if(total_frames > 0)
amount = (float)app->inbe.sectick / (float)total_frames;
completed = (int)(amount * (float)total);
is_countdown = 1;
break;
}
case InbePhaseBreathe:
completed = clampi(int_from_count(app->inbe.count), 0, total);
amount = (float)completed / (float)total;
break;
case InbePhaseHold: {
int total_frames = 60 * 60;
int frame_in_minute = (int_from_count(app->inbe.count) * 60 + app->inbe.sectick) %
total_frames;
total = 60;
amount = (float)frame_in_minute / (float)total_frames;
completed = clampi(frame_in_minute / 60, 0, total);
break;
}
case InbePhaseRecover: {
int count = int_from_count(app->inbe.count);
total = 15;
completed = clampi(count, 0, total);
amount = (float)completed / (float)total;
is_countdown = 1;
break;
}
case InbePhaseNext:
default:
completed = 0;
amount = 0.0f;
break;
}
if(amount < 0.0f)
amount = 0.0f;
if(amount > 1.0f)
amount = 1.0f;
*total_ticks = total;
*completed_ticks = clampi(completed, 0, total);
*progress = amount;
*countdown = is_countdown;
}
static void
draw_session_progress_circle(InbeApp *app, int center_x, int center_y, float radius)
{
int total_ticks = 1;
int completed_ticks = 0;
int countdown = 0;
float progress = 0.0f;
int gap = ScaleUIPx(5);
int band_width;
int thickness;
float inner_radius;
float outer_radius;
Color circle = GetThemeCircle();
Color contrast = text_color_for_background(circle);
Color band_bg;
Color band_fill;
Color tick_done;
Color tick_pending;
Color ring;
if(app == NULL)
return;
session_circle_progress(app, &total_ticks, &completed_ticks, &progress,
&countdown);
if(total_ticks <= 20)
band_width = ScaleUIPx(14);
else if(total_ticks <= 40)
band_width = ScaleUIPx(11);
else
band_width = ScaleUIPx(8);
if(band_width < 5)
band_width = 5;
thickness = total_ticks <= 40 ? ScaleUIPx(3) : ScaleUIPx(2);
if(thickness < 1)
thickness = 1;
outer_radius = radius - (float)gap;
inner_radius = outer_radius - (float)band_width;
if(inner_radius < radius * 0.66f)
inner_radius = radius * 0.66f;
if(outer_radius <= inner_radius)
return;
band_bg = color_with_alpha(contrast, 30);
band_fill = color_with_alpha(contrast, 72);
tick_pending = color_with_alpha(contrast, 96);
tick_done = color_with_alpha(contrast, 235);
ring = color_with_alpha(contrast, 175);
DrawCircleV((Vector2){(float)center_x, (float)center_y}, radius, circle);
DrawRing((Vector2){(float)center_x, (float)center_y}, inner_radius, outer_radius,
0.0f, 360.0f, 128, band_bg);
if(countdown) {
DrawRing((Vector2){(float)center_x, (float)center_y}, inner_radius,
outer_radius, 0.0f, 360.0f, 128, band_fill);
if(progress > 0.0f) {
DrawRing((Vector2){(float)center_x, (float)center_y}, inner_radius,
outer_radius, -90.0f - 360.0f * progress, -90.0f,
128, band_bg);
}
} else if(progress > 0.0f) {
DrawRing((Vector2){(float)center_x, (float)center_y}, inner_radius, outer_radius,
-90.0f, -90.0f + 360.0f * progress, 128, band_fill);
}
DrawRing((Vector2){(float)center_x, (float)center_y}, inner_radius - 0.75f,
inner_radius + 0.75f, 0.0f, 360.0f, 128, ring);
DrawRing((Vector2){(float)center_x, (float)center_y}, outer_radius - 0.75f,
outer_radius + 0.75f, 0.0f, 360.0f, 128, ring);
for(int i = 0; i < total_ticks; i++) {
float direction = countdown ? -1.0f : 1.0f;
float angle = -PI * 0.5f +
direction * ((float)i * 2.0f * PI) / (float)total_ticks;
float s = sinf(angle);
float c = cosf(angle);
int tick_colored = countdown ? i >= completed_ticks
: i < completed_ticks;
Vector2 start = {
(float)center_x + c * inner_radius,
(float)center_y + s * inner_radius
};
Vector2 end = {
(float)center_x + c * outer_radius,
(float)center_y + s * outer_radius
};
DrawLineEx(start, end, (float)thickness,
tick_colored ? tick_done : tick_pending);
}
}
@@ -619,13 +769,7 @@ session_draw_inbe(InbeApp *app, int center_x, int center_y)
{
float radius = draw_radius(&app->inbe);
if(app->inbe.phase == InbePhaseHold && app->hold_display_mode == HOLD_DISPLAY_CIRCLE) {
draw_hold_progress_outline(app, center_x, center_y);
} else {
DrawCircleV((Vector2){(float)center_x, (float)center_y}, radius, GetThemeCircle());
DrawRing((Vector2){(float)center_x, (float)center_y}, radius - 0.75f,
radius + 0.75f, 0.0f, 360.0f, 96, GetThemeText());
}
draw_session_progress_circle(app, center_x, center_y, radius);
draw_session_counter(app, center_x, center_y);
}
@@ -717,9 +861,10 @@ draw_session_status(InbeApp *app, int center_x, int center_y)
char max_text[32];
int total_seconds;
int remaining;
int max_w;
int max_text_w;
int text_y;
int font = UI_TEXT_16;
int font = UI_TEXT_24;
if(app->inbe.phase != InbePhaseStarting)
return;
@@ -733,6 +878,15 @@ draw_session_status(InbeApp *app, int center_x, int center_y)
remaining = 1;
FormatLocaleText(max_text, sizeof(max_text), "starting_in", 30);
max_w = (int)(app->inbe.rmax * 2.0f);
if(max_w > view_width - ScaleUIPx(32))
max_w = view_width - ScaleUIPx(32);
if(max_w < ScaleUIPx(120))
max_w = ScaleUIPx(120);
if(MeasureUIText(max_text, font) > max_w)
font = UI_TEXT_16;
if(MeasureUIText(max_text, font) > max_w)
font = UI_TEXT_12;
max_text_w = MeasureUIText(max_text, font);
FormatLocaleText(text, sizeof(text), "starting_in", remaining);
text_y = center_y - (int)(app->inbe.rmax * 0.72f) - ScaleUIPx(40);
@@ -749,6 +903,43 @@ session_round_label(InbeApp *app, char *text, size_t text_size)
FormatLocaleText(text, text_size, "session_round_label", app->inbe.round + 1);
}
static int
session_draw_round_title_bar(InbeApp *app, const char *title, int height,
int show_close)
{
int hover = 0;
int close_icon = ScaleUIPx(18);
int close_padding = ScaleUIPx(6);
int close_total = close_icon + close_padding * 2;
int close_x = view_width - close_total - ScaleUIPx(12);
int close_y = (height - close_total) / 2;
int side_reserved = view_width - close_x + ScaleUIPx(8);
int font = UI_TEXT_24;
int max_w = view_width - side_reserved * 2;
int title_w;
if(title == NULL)
title = "";
if(close_y < 0)
close_y = 0;
if(max_w < ScaleUIPx(48))
max_w = view_width - ScaleUIPx(16);
title_w = MeasureUIText(title, font);
while(font > GetUIFontSize() && title_w > max_w) {
font--;
title_w = MeasureUIText(title, font);
}
DrawUITitleBar("", height);
DrawUIText(title, (view_width - title_w) / 2,
GetUIControlTextY(title, 0, height, font), font, GetThemeText());
if(show_close && app != NULL && !app->modal.active &&
DrawUIPaddedIconBtn(close_x, close_y, close_icon, close_padding,
app->icons[UI_ICON_TYPE_X], &hover))
return 1;
return 0;
}
void
draw_preview_inbe(Inbe *inbe, int center_x, int center_y)
{
@@ -783,39 +974,33 @@ session_update_screen(InbeApp *app, int center_x, int center_y, int *hover)
char title[32];
session_round_label(app, title, sizeof(title));
if(app->show_session_return_button &&
DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], title, title_h)) {
if(session_draw_round_title_bar(app, title, title_h,
app->show_session_return_button)) {
if(app->session_paused) {
stop_android_background_session(app);
app_init(app);
} else {
app_open_modal(app, UIModalConfirmExitSession);
}
} else if(!app->show_session_return_button) {
DrawUITitleBar(title, title_h);
}
if(app->show_session_volume_control) {
if(DrawUIIconSliderPopup((UIIconSliderPopup){
.id = 500,
.x = view_width - ScaleUIPx(56),
.y = (title_h - (ScaleUIPx(24) + ScaleUIPx(10) * 2)) / 2,
.icon_size = ScaleUIPx(24),
.icon_padding = ScaleUIPx(10),
.icon = sound_icon_for_volume(app),
.open = &app->volume_popup_active,
.value = &app->sound_volume,
.min = SETTINGS_VOLUME_MIN,
.max = SETTINGS_VOLUME_MAX,
.popup_width = ScaleUIPx(44),
.popup_height = ScaleUIPx(200)
})) {
app->settings_dirty = 1;
update_session_sounds(app);
save_settings(app);
}
} else {
app->volume_popup_active = 0;
if(DrawUIIconSliderPopup((UIIconSliderPopup){
.id = 500,
.x = view_width - ScaleUIPx(76),
.y = (title_h - (ScaleUIPx(18) + ScaleUIPx(5) * 2)) / 2,
.icon_size = ScaleUIPx(18),
.icon_padding = ScaleUIPx(5),
.icon = sound_icon_for_volume(app),
.open = &app->volume_popup_active,
.value = &app->sound_volume,
.min = SETTINGS_VOLUME_MIN,
.max = SETTINGS_VOLUME_MAX,
.popup_width = ScaleUIPx(40),
.popup_height = ScaleUIPx(176)
})) {
app->settings_dirty = 1;
update_session_sounds(app);
save_settings(app);
}
if(app->modal.active && app->modal.type == UIModalConfirmExitSession) {
+4 -3
View File
@@ -373,8 +373,9 @@ draw_habit_edit_screen(InbeApp *app)
DrawRectangle(0, 0, view_width, top_h, GetThemeBackground());
DrawLine(0, top_h - 1, view_width, top_h - 1, DarkenUIColor(GetThemeButton(), 18));
if(!app->modal.active &&
DrawUIPaddedIconBtn(ScaleUIPx(12), ScaleUIPx(12), ScaleUIPx(24),
ScaleUIPx(8), app->icons[UI_ICON_TYPE_RETURN], &hover)) {
DrawUIPaddedIconBtn(view_width - ScaleUIPx(52), ScaleUIPx(12),
ScaleUIPx(24), ScaleUIPx(8),
app->icons[UI_ICON_TYPE_X], &hover)) {
habit_edit_cancel(app);
app_switch_screen(app, InbeScreenHabits);
return;
@@ -385,7 +386,7 @@ draw_habit_edit_screen(InbeApp *app)
GetUIControlTextY(title, 0, top_h, title_font),
title_font, GetThemeText());
if(!app->modal.active &&
DrawUIPaddedIconBtn(view_width - ScaleUIPx(52), ScaleUIPx(12),
DrawUIPaddedIconBtn(view_width - ScaleUIPx(100), ScaleUIPx(12),
ScaleUIPx(24), ScaleUIPx(8), app->icons[UI_ICON_TYPE_CHECK], &hover)) {
habit_edit_commit(app);
return;
+1 -1
View File
@@ -185,7 +185,7 @@ draw_habit_session_edit_screen(InbeApp *app)
if(viewport_h < ScaleUIPx(80))
viewport_h = ScaleUIPx(80);
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], date_text, top_h)) {
if(app_draw_close_title_bar(app, date_text, top_h)) {
habit_session_cancel_edit(app);
app_switch_screen(app, InbeScreenHabits);
return;
+85 -83
View File
@@ -30,6 +30,7 @@ static void habits_add_seed(InbeHabits *habits, const char *id, const char *name
const char *description, Color color,
int activity_mask);
static void draw_habit_link_dot(int x, int y, int w, Color color);
static void draw_habit_day_count_label(int x, int y, int w, int h, int count);
static Color habit_text_color_for_background(Color background);
enum {
@@ -1026,7 +1027,7 @@ draw_habits_top_bar(InbeApp *app, int draw_menu)
if(app->habits.screen_mode == HABITS_SCREEN_REORDER) {
if(draw_menu)
return;
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], GetLocaleText("habit_reorder_title"), top_h))
if(app_draw_close_title_bar(app, GetLocaleText("habit_reorder_title"), top_h))
habits_return_to_overview(app);
return;
}
@@ -1042,7 +1043,7 @@ draw_habits_top_bar(InbeApp *app, int draw_menu)
int dropdown_h = ScaleUIPx(32);
dropdown_selected = selected;
if(DrawUIReturnDropdownTitleBar(app->icons[UI_ICON_TYPE_RETURN], (UITitleBarDropdown){
if(app_draw_close_dropdown_title_bar(app, (UITitleBarDropdown){
.id = 301,
.options = options,
.option_count = option_count,
@@ -1152,18 +1153,6 @@ habits_overview_actions_stack(int content_w)
!habits_button_label_fits(GetLocaleText("habit_reorder_title"), half_w);
}
static int
habits_reorder_move_buttons_stack(int content_w)
{
int btn_w = ScaleUIPx(74);
int gap = ScaleUIPx(8);
return content_w < ScaleUIPx(260) ||
content_w < btn_w * 2 + gap ||
!habits_button_label_fits(GetLocaleText("move_up_button"), btn_w) ||
!habits_button_label_fits(GetLocaleText("move_down_button"), btn_w);
}
static int
habits_overview_day_index(int days_ago)
{
@@ -1216,14 +1205,10 @@ static int
habits_reorder_content_height(int content_w, void *user_data)
{
InbeApp *app = user_data;
int row_h;
int count = app != NULL ? app->habits.count : 0;
if(habits_reorder_move_buttons_stack(content_w))
row_h = ScaleUIPx(36) + ScaleUIPx(32) * 2 + ScaleUIPx(8) * 2;
else
row_h = ScaleUIPx(48);
return ScaleUIPx(70) + row_h * (count > 0 ? count : 1);
(void)content_w;
return ScaleUIPx(70) + ScaleUIPx(48) * (count > 0 ? count : 1);
}
static void
@@ -1267,10 +1252,12 @@ draw_habits_reorder(InbeApp *app, int content_top)
int w = page.content_w;
int font = GetUIFontSize();
int small = GetUISmallFontSize();
int btn_h = ScaleUIPx(32);
int fixed_btn_w = ScaleUIPx(74);
int gap = ScaleUIPx(8);
int stack_rows = habits_reorder_move_buttons_stack(w);
int row_h = ScaleUIPx(48);
int handle_w = ScaleUIPx(34);
UIReorderItem reorder_items[INBE_HABIT_MAX];
UIReorderListResult reorder;
int row_y[INBE_HABIT_MAX];
int count = app->habits.count;
y = page.content_y + ScaleUIPx(16);
@@ -1281,45 +1268,60 @@ draw_habits_reorder(InbeApp *app, int content_top)
return;
}
for(int i = 0; i < app->habits.count; i++) {
int row_y = y;
int up_hover = 0;
int down_hover = 0;
int controls_w = fixed_btn_w * 2 + gap;
int name_w = stack_rows ? w : w - controls_w - gap;
if(count > INBE_HABIT_MAX)
count = INBE_HABIT_MAX;
for(int i = 0; i < count; i++) {
row_y[i] = y + i * row_h;
reorder_items[i] = (UIReorderItem){
.id = i + 1,
.bounds = {(float)x, (float)row_y[i],
(float)w, (float)row_h},
.disabled = 0
};
}
reorder = UpdateUIReorderList((UIReorderList){
.id = 801,
.bounds = {(float)x, (float)y, (float)w, (float)(row_h * count)},
.items = reorder_items,
.item_count = count,
.handle_width = handle_w,
.scroll_offset = &app->habits.scroll,
.max_scroll = page.view.max_scroll,
.viewport_top = (int)page.area.bounds.y,
.viewport_bottom = (int)(page.area.bounds.y + page.area.bounds.height)
});
if(reorder.committed &&
habits_move(&app->habits, reorder.from_index, reorder.to_index)) {
habits_persist_view_state(app);
app_auto_sync(app);
EndUIScrollPage(page);
return;
}
habits_draw_fitted_text(app->habits.items[i].name, x, row_y + ScaleUIPx(7),
name_w, font, GetThemeText());
if(stack_rows) {
row_y += ScaleUIPx(36);
}
if(DrawUIGenericButton(stack_rows ? x : x + w - fixed_btn_w * 2 - gap,
row_y, stack_rows ? w : fixed_btn_w, btn_h,
GetLocaleText("move_up_button"),
UI_BUTTON_STYLE_SECONDARY, i == 0, &up_hover)) {
if(habits_move(&app->habits, i, i - 1)) {
habits_persist_view_state(app);
app_auto_sync(app);
}
EndUIScrollPage(page);
return;
}
if(stack_rows)
row_y += btn_h + gap;
if(DrawUIGenericButton(stack_rows ? x : x + w - fixed_btn_w,
row_y, stack_rows ? w : fixed_btn_w, btn_h,
GetLocaleText("move_down_button"),
UI_BUTTON_STYLE_SECONDARY,
i == app->habits.count - 1, &down_hover)) {
if(habits_move(&app->habits, i, i + 1)) {
habits_persist_view_state(app);
app_auto_sync(app);
}
EndUIScrollPage(page);
return;
}
y += stack_rows ? ScaleUIPx(108) : ScaleUIPx(46);
habits_draw_divider(x, w, y - ScaleUIPx(6));
for(int i = 0; i < count; i++) {
if(reorder.dragging && i == reorder.active_index)
continue;
DrawUIReorderHandle(x, row_y[i], handle_w, row_h,
reorder.active && i == reorder.active_index);
habits_draw_fitted_text(app->habits.items[i].name,
x + handle_w, row_y[i] + ScaleUIPx(13),
w - handle_w, font, GetThemeText());
habits_draw_divider(x, w, row_y[i] + row_h - ScaleUIPx(4));
}
if(reorder.dragging && reorder.target_index >= 0 &&
reorder.target_index < count)
DrawUIReorderPlaceholder(reorder_items[reorder.target_index].bounds);
if(reorder.dragging && reorder.active_index >= 0 &&
reorder.active_index < count) {
int i = reorder.active_index;
int overlay_y = row_y[i] + reorder.drag_delta_y;
DrawRectangle(x, overlay_y, w, row_h,
LightenUIColor(GetThemeBackground(), 8));
DrawUIReorderHandle(x, overlay_y, handle_w, row_h, 1);
habits_draw_fitted_text(app->habits.items[i].name,
x + handle_w, overlay_y + ScaleUIPx(13),
w - handle_w, font, GetThemeText());
}
EndUIScrollPage(page);
@@ -1565,16 +1567,8 @@ draw_habits_overview(InbeApp *app, int content_top)
habit_apply_count_action(app, i, day_index, action, minimum_count);
app_auto_sync(app);
}
if(!future_day && (has_linked_day || (counting_enabled && count > 0))) {
char count_label[16];
int count_w;
snprintf(count_label, sizeof(count_label), "%d",
has_linked_day ? session_count : count);
count_w = MeasureUIText(count_label, UI_TEXT_12);
DrawUIText(count_label, day_x + cell - count_w - ScaleUIPx(3),
row_y + ScaleUIPx(3), UI_TEXT_12,
GetThemeText());
}
if(counting_enabled && count > 0 && !future_day)
draw_habit_day_count_label(day_x, row_y, cell, cell, count);
if(!future_day && has_linked_day)
draw_habit_link_dot(day_x, row_y, cell, habit->color);
}
@@ -1921,6 +1915,23 @@ draw_habit_link_dot(int x, int y, int w, Color color)
ScaleUIPx(3), GetThemeText());
}
static void
draw_habit_day_count_label(int x, int y, int w, int h, int count)
{
char count_label[16];
int count_font = UI_TEXT_12;
int count_w;
int padding = ScaleUIPx(3);
if(count <= 0)
return;
snprintf(count_label, sizeof(count_label), "%d", count);
count_w = MeasureUIText(count_label, count_font);
DrawUIText(count_label, x + (w - count_w) / 2,
y + h - count_font - padding,
count_font, GetThemeText());
}
static int
habit_calendar_day_cell(InbeApp *app, int x, int y, int w, int h,
const char *label, int completed, int disabled, int current_day)
@@ -2604,17 +2615,8 @@ draw_habits_screen(InbeApp *app)
if(completed && !future_day) {
draw_habit_completion_underline(cell_x, cell_y, cell_w, cell_h, active->color);
}
if(counting_enabled && count > 0 && !future_day && !has_linked_day) {
char count_label[16];
int count_font = UI_TEXT_12;
int count_w;
snprintf(count_label, sizeof(count_label), "%d", count);
count_w = MeasureUIText(count_label, count_font);
DrawUIText(count_label,
cell_x + cell_w - count_w - ScaleUIPx(4),
cell_y + ScaleUIPx(4),
count_font, GetThemeText());
}
if(counting_enabled && count > 0 && !future_day)
draw_habit_day_count_label(cell_x, cell_y, cell_w, cell_h, count);
if(!future_day && has_linked_day) {
draw_habit_link_dot(cell_x, cell_y, cell_w, active->color);
}
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef HABITS_SCREEN_H
#define HABITS_SCREEN_H
#include "raylib.h"
#include "flint.h"
#include "breath_engine.h"
#include "app_fwd.h"
#include <stddef.h>
+1 -1
View File
@@ -4,7 +4,7 @@
#include "locale.h"
#include "theme.h"
#include "ui.h"
#include "raylib.h"
#include "flint.h"
extern int view_width;
extern int view_height;
+1 -1
View File
@@ -7,7 +7,7 @@
#include "ui_text.h"
#include "theme.h"
#include "ui.h"
#include "raylib.h"
#include "flint.h"
#include <math.h>
+1 -1
View File
@@ -154,7 +154,7 @@ practice_screen_handle_config_title(InbeApp *app, const char *title, int modal_t
title_h = practice_screen_subscreen_integrated(app, modal_type)
? app_content_top_reserved(app)
: GetUITitleBarHeight();
if(!DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], title, title_h))
if(!app_draw_close_title_bar(app, title, title_h))
return 0;
if(app->modal.active && (int)app->modal.type == modal_type) {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef PRACTICE_SCREEN_H
#define PRACTICE_SCREEN_H
#include "raylib.h"
#include "flint.h"
#include "app_fwd.h"
#define PRACTICE_CATEGORY_TAB_H 40
+78 -376
View File
@@ -1,6 +1,7 @@
#include "profile_screen.h"
#include "app.h"
#include "app_nav.h"
#include "text_utils.h"
#include "locale.h"
#include "theme.h"
@@ -8,7 +9,6 @@
#include "profile_social.h"
#include "practice_screen.h"
#include "settings/settings_data.h"
#include "settings/settings_screen.h"
#include "settings/settings_sync_account.h"
#include "storage.h"
#include "sync_account.h"
@@ -20,29 +20,6 @@
extern int view_height;
extern int view_width;
#define INBE_SYNC_SERVER_URL_KEY "sync_server_url"
enum {
PROFILE_GUIDE_STEPS = 3
};
static Rectangle
profile_expanded_anchor(int x, int y, int w, int h)
{
int pad = ScaleUIPx(6);
return (Rectangle){(float)(x - pad), (float)(y - pad),
(float)(w + pad * 2), (float)(h + pad * 2)};
}
static void
profile_set_guide_anchor(Rectangle *anchor, int x, int y, int w, int h)
{
if(anchor == NULL)
return;
*anchor = profile_expanded_anchor(x, y, w, h);
}
static void
profile_format_size(char *out, size_t out_size, long long bytes)
{
@@ -55,24 +32,6 @@ profile_format_size(char *out, size_t out_size, long long bytes)
snprintf(out, out_size, "%lld B", bytes);
}
static int
profile_main_content_height(int content_w)
{
int h = ScaleUIPx(14);
int btn_h = ScaleUIPx(34);
if(content_w < ScaleUIPx(320))
h += ScaleUIPx(18) + ScaleUIPx(30) + btn_h + ScaleUIPx(10);
else
h += ScaleUIPx(18) + ScaleUIPx(38);
h += ScaleUIPx(18);
h += ScaleUIPx(24) + ScaleUIPx(54) + btn_h + ScaleUIPx(8) +
btn_h + ScaleUIPx(20);
h += ScaleUIPx(18);
h += ScaleUIPx(20) + ScaleUIPx(34) + btn_h + ScaleUIPx(20);
return h;
}
static int
profile_data_content_height(int content_w)
{
@@ -98,49 +57,25 @@ profile_habits_content_height(InbeApp *app, int content_w)
return ScaleUIPx(16) + (count > 0 ? count * row_h : ScaleUIPx(24));
}
static int
profile_practices_content_height(int content_w)
{
(void)content_w;
return ScaleUIPx(16) +
GetUICheckboxRowHeight((UICheckboxRow){0}) * EXERCISE_COUNT +
ScaleUIPx(16);
}
static int
profile_content_height(int content_w, void *user_data)
{
InbeApp *app = user_data;
if(app != NULL && app->profile_view == PROFILE_VIEW_DATA)
return profile_data_content_height(content_w);
if(app != NULL && app->profile_view == PROFILE_VIEW_SYNC_ACCOUNT)
return profile_sync_content_height(content_w);
if(app != NULL && app->profile_view == PROFILE_VIEW_HABITS)
return profile_habits_content_height(app, content_w);
if(app != NULL && app->profile_view == PROFILE_VIEW_PRACTICES)
return profile_practices_content_height(content_w);
if(app != NULL && app->profile_tab == PROFILE_TAB_FRIENDS)
return profile_social_friends_content_height(app, content_w);
if(app != NULL && app->profile_tab == PROFILE_TAB_LEADERBOARD)
return profile_social_leaderboard_content_height(app, content_w);
return ScaleUIPx(12) + profile_habits_content_height(app, content_w);
if(app != NULL && app->profile_view == PROFILE_VIEW_DATA)
return ScaleUIPx(12) + profile_data_content_height(content_w);
if(app != NULL && app->profile_view == PROFILE_VIEW_SYNC_ACCOUNT)
return ScaleUIPx(12) + profile_sync_content_height(content_w);
if(app != NULL && app->profile_tab == PROFILE_TAB_DATA)
return profile_data_content_height(content_w);
return profile_main_content_height(content_w);
}
static const char *
profile_practice_label(int index)
{
switch(index) {
case EXERCISE_MEDITATION:
return GetLocaleText("exercise_meditation");
case EXERCISE_SUN_SALUTATION:
return GetLocaleText("exercise_sun_salutation");
case EXERCISE_WIM_HOF:
default:
return GetLocaleText("exercise_wim_hof");
}
return ScaleUIPx(12) + profile_data_content_height(content_w);
if(app != NULL && app->profile_tab == PROFILE_TAB_FRIENDS)
return ScaleUIPx(12) + profile_social_friends_content_height(app, content_w);
if(app != NULL && app->profile_tab == PROFILE_TAB_LEADERBOARD)
return ScaleUIPx(12) +
profile_social_leaderboard_content_height(app, content_w);
return ScaleUIPx(12) + profile_sync_content_height(content_w);
}
static void
@@ -179,124 +114,48 @@ static const char *
profile_tab_title(int tab)
{
switch(tab) {
case PROFILE_TAB_SYNC:
return GetLocaleText("profile_sync_tab");
case PROFILE_TAB_DATA:
return GetLocaleText("profile_data");
case PROFILE_TAB_FRIENDS:
return GetLocaleText("profile_friends_title");
case PROFILE_TAB_LEADERBOARD:
return GetLocaleText("profile_leaderboard_title");
case PROFILE_TAB_DATA:
return GetLocaleText("profile_data_title");
case PROFILE_TAB_OVERVIEW:
default:
return GetLocaleText("tab_profile");
}
}
static void
profile_screen_finish_first_run_guide(InbeApp *app)
static int
profile_draw_tab_dropdown(InbeApp *app, int y, int w)
{
const char *options[PROFILE_TAB_COUNT];
int selected;
int dropdown_w;
int dropdown_x;
int dropdown_h = ScaleUIPx(36);
int dropdown_y = y + (GetUITabBarHeight() - dropdown_h) / 2;
if(app == NULL)
return;
app->profile_guide_seen = 1;
app->profile_guide_step = 0;
save_settings(app);
}
return -1;
int
profile_screen_first_run_guide_active(const InbeApp *app)
{
InbeSyncAccount account;
options[PROFILE_TAB_SYNC] = profile_tab_title(PROFILE_TAB_SYNC);
options[PROFILE_TAB_DATA] = profile_tab_title(PROFILE_TAB_DATA);
options[PROFILE_TAB_FRIENDS] = profile_tab_title(PROFILE_TAB_FRIENDS);
options[PROFILE_TAB_LEADERBOARD] = profile_tab_title(PROFILE_TAB_LEADERBOARD);
return app != NULL && !app->profile_guide_seen && !app->modal.active &&
app->inbe.screen == InbeScreenProfile &&
!sync_account_load(&account);
}
selected = app->profile_tab;
dropdown_w = w - ScaleUIPx(32);
if(dropdown_w > ScaleUIPx(360))
dropdown_w = ScaleUIPx(360);
if(dropdown_w < ScaleUIPx(180))
dropdown_w = w - ScaleUIPx(16);
dropdown_x = (w - dropdown_w) / 2;
void
profile_screen_prepare_first_run_guide(InbeApp *app)
{
if(!profile_screen_first_run_guide_active(app))
return;
app->profile_guide_step = clampi(app->profile_guide_step, 0, PROFILE_GUIDE_STEPS - 1);
app->profile_view = PROFILE_VIEW_MAIN;
app->profile_tab = PROFILE_TAB_OVERVIEW;
app->profile_scroll = 0;
}
void
profile_screen_draw_first_run_guide(InbeApp *app)
{
UIGuideStep steps[PROFILE_GUIDE_STEPS];
UIGuideResult result;
if(!profile_screen_first_run_guide_active(app))
return;
if(!app->profile_guide_anchors.valid)
return;
steps[0] = (UIGuideStep){
.anchor = app->profile_guide_anchors.account,
.text = GetLocaleText("profile_guide_account")
};
steps[1] = (UIGuideStep){
.anchor = app->profile_guide_anchors.data,
.text = GetLocaleText("profile_guide_data")
};
steps[2] = (UIGuideStep){
.anchor = app->profile_guide_anchors.social,
.text = GetLocaleText("profile_guide_social_no_account")
};
result = DrawUIGuideOverlay((UIGuideOverlay){
.steps = steps,
.count = PROFILE_GUIDE_STEPS,
.step = &app->profile_guide_step,
.view_width = view_width,
.view_height = view_height,
.reserved_top = 0,
.reserved_bottom = GetUIBottomNavHeight(),
.max_width = ScaleUIPx(300),
.paragraph_font = GetUISmallFontSize(),
.close_icon = app->icons[UI_ICON_TYPE_X],
.back_icon = app->icons[UI_ICON_TYPE_BACKWARD],
.next_icon = app->icons[UI_ICON_TYPE_FORWARD],
.done_icon = app->icons[UI_ICON_TYPE_CHECK]
});
if(result.closed || result.finished)
profile_screen_finish_first_run_guide(app);
}
static void
profile_draw_summary_columns(int x, int w, int *y)
{
char habits[32];
char sessions[32];
char storage[64];
const char *labels[3] = {
GetLocaleText("profile_habits_label"),
GetLocaleText("profile_sessions_label"),
GetLocaleText("profile_storage_label")
};
const char *values[3] = {habits, sessions, storage};
int col_w = w / 3;
int value_font = UI_TEXT_16;
int label_font = GetUISmallFontSize();
snprintf(habits, sizeof(habits), "%d", storage_habit_count());
snprintf(sessions, sizeof(sessions), "%d", storage_session_count());
profile_format_size(storage, sizeof(storage), storage_total_size());
for(int i = 0; i < 3; i++) {
int cx = x + i * col_w;
int cw = i == 2 ? x + w - cx : col_w;
DrawUIText(values[i], cx, *y, value_font, GetThemeText());
DrawUIText(labels[i], cx, *y + ScaleUIPx(24), label_font,
DarkenUIColor(GetThemeText(), 32));
if(i < 2)
DrawLine(cx + cw - ScaleUIPx(10), *y - ScaleUIPx(2),
cx + cw - ScaleUIPx(10), *y + ScaleUIPx(42),
DarkenUIColor(GetThemeBackground(), 24));
}
*y += ScaleUIPx(58);
DrawUIDropdownButton(812, dropdown_x, dropdown_y, dropdown_w, dropdown_h,
options, PROFILE_TAB_COUNT, &app->profile_tab);
return selected;
}
static void
@@ -310,147 +169,6 @@ profile_draw_fitted_text(const char *text, int x, int y, int max_w, int font, Co
DrawUIText(fitted, x, y, font, color);
}
static void
profile_switch_view(InbeApp *app, int view)
{
AppRoute route;
if(app == NULL)
return;
route = app_current_route(app);
route.profile_view = view;
if(view != PROFILE_VIEW_MAIN)
route.profile_tab = PROFILE_TAB_OVERVIEW;
app->profile_scroll = 0;
app->sync_server_url_focused = 0;
settings_screen_clear_status();
app_switch_route(app, route);
}
static void
profile_switch_tab(InbeApp *app, int tab)
{
AppRoute route;
if(app == NULL)
return;
route = app_current_route(app);
route.profile_view = PROFILE_VIEW_MAIN;
route.profile_tab = tab;
app->profile_scroll = 0;
settings_screen_clear_status();
app_switch_route(app, route);
}
static void
profile_draw_overview(InbeApp *app, int x, int w, int *y)
{
int font = GetUIFontSize();
int small = GetUISmallFontSize();
int btn_h = ScaleUIPx(34);
int account_y;
int data_y;
int social_y;
int hover_account = 0;
int hover_data = 0;
int hover_practices = 0;
int hover_friends = 0;
int hover_leaderboard = 0;
int half_w = (w - ScaleUIPx(8)) / 2;
InbeSyncAccount account;
int has_account;
const char *alias;
char account_text[96];
char pending_text[64];
char friend_text[64];
*y += ScaleUIPx(14);
account_y = *y;
has_account = sync_account_load(&account);
alias = storage_get_setting_text("sync_account_alias");
account_text[0] = '\0';
if(has_account) {
if(alias != NULL && alias[0] != '\0') {
snprintf(account_text, sizeof(account_text), "@%s", alias);
} else {
snprintf(account_text, sizeof(account_text), "%.12s...", account.public_id);
}
} else {
snprintf(account_text, sizeof(account_text), "%s", GetLocaleText("profile_no_account"));
}
DrawUIText(GetLocaleText("profile_account_section"), x, *y, small,
DarkenUIColor(GetThemeText(), 35));
*y += ScaleUIPx(18);
if(w < ScaleUIPx(320)) {
profile_draw_fitted_text(account_text, x, *y, w, font, GetThemeText());
*y += ScaleUIPx(30);
if(DrawUIGenericButton(x, *y, w, btn_h, GetLocaleText("profile_configure_button"),
UI_BUTTON_STYLE_SECONDARY, 0,
&hover_account))
settings_data_open_sync_account_config(app);
*y += btn_h + ScaleUIPx(10);
} else {
int button_w = ScaleUIPx(132);
int text_w = w - button_w - ScaleUIPx(10);
profile_draw_fitted_text(account_text, x, *y, text_w, font,
GetThemeText());
if(DrawUIGenericButton(x + w - button_w, *y - ScaleUIPx(8), button_w,
btn_h, GetLocaleText("profile_configure_button"),
UI_BUTTON_STYLE_SECONDARY, 0,
&hover_account))
settings_data_open_sync_account_config(app);
*y += ScaleUIPx(38);
}
profile_draw_divider(x, w, *y);
profile_set_guide_anchor(&app->profile_guide_anchors.account, x, account_y, w,
*y - account_y);
*y += ScaleUIPx(18);
data_y = *y;
DrawUIText(GetLocaleText("profile_data_section"), x, *y, small,
DarkenUIColor(GetThemeText(), 35));
*y += ScaleUIPx(24);
profile_draw_summary_columns(x, w, y);
if(DrawUIGenericButton(x, *y, w, btn_h, GetLocaleText("profile_data_button"),
UI_BUTTON_STYLE_SECONDARY, 0, &hover_data))
profile_switch_tab(app, PROFILE_TAB_DATA);
*y += btn_h + ScaleUIPx(8);
if(DrawUIGenericButton(x, *y, w, btn_h,
GetLocaleText("profile_my_practices_button"),
UI_BUTTON_STYLE_SECONDARY, 0, &hover_practices))
profile_switch_view(app, PROFILE_VIEW_PRACTICES);
*y += btn_h + ScaleUIPx(20);
profile_draw_divider(x, w, *y);
profile_set_guide_anchor(&app->profile_guide_anchors.data, x, data_y, w,
*y - data_y);
*y += ScaleUIPx(18);
social_y = *y;
snprintf(friend_text, sizeof(friend_text), GetLocaleText("profile_friends_count_format"),
profile_social_friends_count(app));
snprintf(pending_text, sizeof(pending_text), GetLocaleText("profile_pending_count_format"),
profile_social_pending_count(app));
DrawUIText(GetLocaleText("profile_social_section"), x, *y, small,
DarkenUIColor(GetThemeText(), 35));
*y += ScaleUIPx(20);
DrawUIText(friend_text, x, *y, font, GetThemeText());
DrawUIText(pending_text, x + w - MeasureUIText(pending_text, font), *y,
font, GetThemeText());
*y += ScaleUIPx(34);
if(DrawUIGenericButton(x, *y, half_w, btn_h, GetLocaleText("profile_friends_title"),
UI_BUTTON_STYLE_PRIMARY, !has_account, &hover_friends))
profile_switch_tab(app, PROFILE_TAB_FRIENDS);
if(DrawUIGenericButton(x + half_w + ScaleUIPx(8), *y, half_w, btn_h,
GetLocaleText("profile_leaderboard_title"), UI_BUTTON_STYLE_PRIMARY,
!has_account, &hover_leaderboard))
profile_switch_tab(app, PROFILE_TAB_LEADERBOARD);
*y += btn_h + ScaleUIPx(16);
profile_set_guide_anchor(&app->profile_guide_anchors.social, x, social_y, w,
*y - social_y);
app->profile_guide_anchors.valid = 1;
}
static void
profile_draw_data(InbeApp *app, int x, int w, int *y)
{
@@ -509,38 +227,16 @@ profile_draw_habits(InbeApp *app, int x, int w, int *y)
DarkenUIColor(GetThemeText(), 35));
}
static void
profile_draw_practices(InbeApp *app, int x, int w, int *y)
{
(void)w;
*y += ScaleUIPx(16);
for(int i = 0; i < EXERCISE_COUNT; i++) {
int enabled = practice_is_visible(app, i);
if(DrawUICheckboxRow((UICheckboxRow){
.label = profile_practice_label(i),
.value = &enabled
}, x, *y)) {
practice_set_visible(app, i, enabled);
}
*y += GetUICheckboxRowHeight((UICheckboxRow){0});
}
}
int
profile_screen_draw(InbeApp *app)
{
int is_profile_subpage = app->profile_view == PROFILE_VIEW_MAIN &&
app->profile_tab != PROFILE_TAB_OVERVIEW;
int header_h = (app->profile_view != PROFILE_VIEW_MAIN || is_profile_subpage)
? GetUITitleBarHeight()
: 0;
int content_y = header_h;
int header_h = GetUITitleBarHeight();
int selector_y = header_h;
int content_y = header_h + GetUITabBarHeight();
int content_h = view_height - content_y - app_content_bottom_reserved(app);
UIScrollPage page;
int y;
app->profile_guide_anchors.valid = 0;
const char *title = GetLocaleText("sync_configure_account_button");
#if ANDROID_BUILD
settings_data_handle_android_import(app);
@@ -549,28 +245,25 @@ profile_screen_draw(InbeApp *app)
#endif
if(app->profile_tab < 0 || app->profile_tab >= PROFILE_TAB_COUNT)
app->profile_tab = PROFILE_TAB_OVERVIEW;
if((app->profile_tab == PROFILE_TAB_FRIENDS ||
app->profile_tab == PROFILE_TAB_LEADERBOARD) &&
!sync_account_load(&(InbeSyncAccount){0})) {
app->profile_tab = PROFILE_TAB_OVERVIEW;
app->profile_tab = PROFILE_TAB_SYNC;
if(app->profile_view == PROFILE_VIEW_MAIN &&
app->profile_tab == PROFILE_TAB_OVERVIEW)
app->profile_tab = PROFILE_TAB_SYNC;
if(app->profile_view == PROFILE_VIEW_DATA)
title = GetLocaleText("profile_data");
else if(app->profile_view == PROFILE_VIEW_HABITS)
title = GetLocaleText("profile_my_habits_title");
if(app_draw_close_title_bar(app, title, header_h)) {
app->profile_scroll = 0;
app->sync_server_url_focused = 0;
if(app_return_to_nav_sidebar_if_needed(app))
return 1;
app_switch_screen(app, app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart);
return 1;
}
if(app->profile_view != PROFILE_VIEW_MAIN) {
const char *title = GetLocaleText("profile_data_title");
if(app->profile_view == PROFILE_VIEW_SYNC_ACCOUNT)
title = GetLocaleText("sync_configure_account_button");
else if(app->profile_view == PROFILE_VIEW_HABITS)
title = GetLocaleText("profile_my_habits_title");
else if(app->profile_view == PROFILE_VIEW_PRACTICES)
title = GetLocaleText("profile_my_practices_title");
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], title, header_h))
profile_switch_view(app, PROFILE_VIEW_MAIN);
} else if(is_profile_subpage) {
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], profile_tab_title(app->profile_tab), header_h))
profile_switch_tab(app, PROFILE_TAB_OVERVIEW);
}
profile_draw_tab_dropdown(app, selector_y, view_width);
if(content_h < 0)
content_h = 0;
@@ -584,7 +277,7 @@ profile_screen_draw(InbeApp *app)
.content_height = profile_content_height,
.user_data = app
});
y = page.content_y;
y = page.content_y + ScaleUIPx(12);
if(app->profile_view == PROFILE_VIEW_SYNC_ACCOUNT)
settings_sync_account_draw_config(app, page.content_x, page.content_w, &y);
@@ -592,20 +285,29 @@ profile_screen_draw(InbeApp *app)
profile_draw_data(app, page.content_x, page.content_w, &y);
else if(app->profile_view == PROFILE_VIEW_HABITS)
profile_draw_habits(app, page.content_x, page.content_w, &y);
else if(app->profile_view == PROFILE_VIEW_PRACTICES)
profile_draw_practices(app, page.content_x, page.content_w, &y);
else if(app->profile_tab == PROFILE_TAB_DATA)
profile_draw_data(app, page.content_x, page.content_w, &y);
else if(app->profile_tab == PROFILE_TAB_FRIENDS)
profile_social_draw_friends(app, page.content_x, page.content_w, &y);
else if(app->profile_tab == PROFILE_TAB_LEADERBOARD)
profile_social_draw_leaderboard(app, page.content_x, page.content_w, &y);
else if(app->profile_tab == PROFILE_TAB_DATA)
profile_draw_data(app, page.content_x, page.content_w, &y);
else
profile_draw_overview(app, page.content_x, page.content_w, &y);
settings_sync_account_draw_config(app, page.content_x, page.content_w, &y);
EndUIScrollPage(page);
SetUIDropdownClipTop(content_y);
SetUIDropdownClipBottom(view_height - app_content_bottom_reserved(app));
if(DrawUIDropdownMenu(812)) {
app->profile_view = PROFILE_VIEW_MAIN;
app->profile_scroll = 0;
}
SetUIDropdownClipTop(0);
SetUIDropdownClipBottom(0);
if(app->profile_view == PROFILE_VIEW_MAIN &&
app->profile_tab == PROFILE_TAB_LEADERBOARD) {
(app->profile_tab == PROFILE_TAB_LEADERBOARD ||
app->profile_tab == PROFILE_TAB_FRIENDS)) {
SetUIDropdownClipTop(content_y);
SetUIDropdownClipBottom(view_height - app_content_bottom_reserved(app));
if(DrawUIDropdownMenu(811)) {
-3
View File
@@ -5,8 +5,5 @@
int profile_screen_draw(InbeApp *app);
void profile_screen_draw_remove_friend_modal(InbeApp *app);
int profile_screen_first_run_guide_active(const InbeApp *app);
void profile_screen_prepare_first_run_guide(InbeApp *app);
void profile_screen_draw_first_run_guide(InbeApp *app);
#endif
+1 -1
View File
@@ -5,7 +5,7 @@
#include "theme.h"
#include "ui.h"
#include "version.h"
#include "raylib.h"
#include "flint.h"
#include <stdio.h>
+3 -3
View File
@@ -19,7 +19,7 @@
#if defined(PLATFORM_WEB)
#include <emscripten.h>
#endif
#include "raylib.h"
#include "flint.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -404,8 +404,8 @@ settings_data_open_sync_account_config(InbeApp *app)
settings_sync_server_load(app);
{
AppRoute route = app_current_route(app);
route.profile_view = PROFILE_VIEW_SYNC_ACCOUNT;
route.profile_tab = PROFILE_TAB_OVERVIEW;
route.profile_view = PROFILE_VIEW_MAIN;
route.profile_tab = PROFILE_TAB_SYNC;
app_switch_route(app, route);
}
app->profile_scroll = 0;
+12 -52
View File
@@ -10,7 +10,7 @@
#include "settings_theme.h"
#include "theme.h"
#include "ui.h"
#include "raylib.h"
#include "flint.h"
#include <stdio.h>
#include <string.h>
@@ -106,13 +106,6 @@ settings_tab_content_height(InbeApp *app, int tab, int content_w)
return settings_about_content_height(content_w);
}
static int
settings_overview_content_height(int content_w)
{
(void)content_w;
return ScaleUIPx(250);
}
typedef struct SettingsScrollPageContext {
InbeApp *app;
int tab;
@@ -126,13 +119,11 @@ settings_scroll_page_content_height(int content_w, void *user_data)
if(planned_content_w < ScaleUIPx(160))
planned_content_w = content_w;
if(ctx->tab == SETTINGS_TAB_OVERVIEW)
return settings_overview_content_height(planned_content_w);
return settings_tab_content_height(ctx->app, ctx->tab, planned_content_w);
}
static const char *
settings_tab_label(int tab)
const char *
settings_screen_tab_label(int tab)
{
switch(tab) {
case SETTINGS_TAB_SESSION:
@@ -152,42 +143,16 @@ static void
settings_draw_section_header(InbeApp *app, int tab)
{
int header_h = GetUITabBarHeight();
const char *title = settings_tab_label(tab);
const char *title = settings_screen_tab_label(tab);
if(DrawUIReturnTitleBar(app->icons[UI_ICON_TYPE_RETURN], title, header_h)) {
AppRoute route = app_current_route(app);
route.settings_tab = SETTINGS_TAB_OVERVIEW;
if(app_draw_close_title_bar(app, title, header_h)) {
app->settings_scroll = 0;
if(app->modal.type == UIModalThemePicker)
app_close_modal(app);
settings_screen_clear_status();
app_switch_route(app, route);
}
}
static void
settings_draw_overview(InbeApp *app, int x, int w, int *y)
{
const int tabs[] = {
SETTINGS_TAB_SESSION,
SETTINGS_TAB_DEVICE,
SETTINGS_TAB_THEME,
SETTINGS_TAB_ABOUT
};
int btn_h = ScaleUIPx(40);
int gap = ScaleUIPx(10);
int hover = 0;
for(int i = 0; i < 4; i++) {
if(DrawUIGenericButton(x, *y, w, btn_h, settings_tab_label(tabs[i]),
UI_BUTTON_STYLE_SECONDARY, app->modal.active,
&hover)) {
AppRoute route = app_current_route(app);
route.settings_tab = tabs[i];
app->settings_scroll = 0;
settings_screen_clear_status();
app_switch_route(app, route);
}
*y += btn_h + gap;
app_switch_screen(app, app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart);
}
}
@@ -202,8 +167,8 @@ settings_screen_draw(InbeApp *app)
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
app->settings_drag_slider = 0;
if(app->settings_tab < SETTINGS_TAB_OVERVIEW || app->settings_tab >= SETTINGS_TAB_COUNT)
app->settings_tab = SETTINGS_TAB_OVERVIEW;
if(app->settings_tab < 0 || app->settings_tab >= SETTINGS_TAB_COUNT)
app->settings_tab = SETTINGS_TAB_SESSION;
detail_header_h = GetUITabBarHeight();
tab_content_start_y = detail_header_h;
@@ -219,10 +184,7 @@ settings_screen_draw(InbeApp *app)
if(content_viewport_h < 0)
content_viewport_h = 0;
if(app->settings_tab == SETTINGS_TAB_OVERVIEW)
DrawUITitleBar(GetLocaleText("settings_title"), detail_header_h);
else
settings_draw_section_header(app, app->settings_tab);
settings_draw_section_header(app, app->settings_tab);
{
SettingsScrollPageContext page_ctx = {app, app->settings_tab};
@@ -237,9 +199,7 @@ settings_screen_draw(InbeApp *app)
});
int y = page.content_y;
if(app->settings_tab == SETTINGS_TAB_OVERVIEW)
settings_draw_overview(app, page.content_x, page.content_w, &y);
else if(app->settings_tab == SETTINGS_TAB_THEME)
if(app->settings_tab == SETTINGS_TAB_THEME)
settings_theme_draw(app, page.content_x, page.content_w, &y, &app->theme_state);
else if(app->settings_tab == SETTINGS_TAB_SESSION)
settings_session_draw(app, page.content_x, page.content_w, &y);
+1
View File
@@ -6,6 +6,7 @@
/* Draw the settings screen. Returns non-zero when it consumed the whole frame. */
int settings_screen_draw(InbeApp *app);
const char *settings_screen_tab_label(int tab);
void settings_screen_clear_status(void);
void settings_screen_set_status_success(const char *message, const char *detail);
void settings_screen_set_status_error(const char *message);
-11
View File
@@ -14,8 +14,6 @@ settings_session_content_height(int content_w)
int label_w = content_w > 0 ? content_w : ScaleUIPx(240);
int height = ScaleUIPx(SETTINGS_SESSION_SLIDER_ROW_H) + ScaleUIPx(40);
height += settings_ui_toggle_row_height(GetLocaleText("show_session_volume_control_label"),
label_w);
height += settings_ui_toggle_row_height(GetLocaleText("show_session_return_button_label"),
label_w);
height += settings_ui_toggle_row_height(GetLocaleText("play_in_background_label"),
@@ -27,7 +25,6 @@ void
settings_session_draw(InbeApp *app, int x, int w, int *y)
{
int sound_volume;
int show_session_volume;
int show_session_return;
int play_in_background;
@@ -44,14 +41,6 @@ settings_session_draw(InbeApp *app, int x, int w, int *y)
save_settings(app);
}
show_session_volume = app->show_session_volume_control;
if(settings_ui_commit_toggle_row(app, x, w, y,
GetLocaleText("show_session_volume_control_label"),
&show_session_volume, 0)) {
app->show_session_volume_control = show_session_volume;
save_settings(app);
}
show_session_return = app->show_session_return_button;
if(settings_ui_commit_toggle_row(app, x, w, y,
GetLocaleText("show_session_return_button_label"),
+39 -7
View File
@@ -8,7 +8,7 @@
#include "sync_client.h"
#include "theme.h"
#include "ui.h"
#include "raylib.h"
#include "flint.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -41,24 +41,43 @@ settings_sync_account_set_import_dialog(SettingsSyncKeyImportDialog callback)
}
static int
settings_draw_public_id_field(const char *text, int x, int w, int *y, int font,
UITextInputStyle style)
settings_draw_public_id_link(const char *text, int x, int w, int *y, int font)
{
int field_h;
int link_h;
int clicked = 0;
if(text == NULL || y == NULL)
return 0;
link_h = GetUITextHeight(text, font) + ScaleUIPx(8);
if(link_h < ScaleUIPx(28))
link_h = ScaleUIPx(28);
clicked = DrawUIHref((UIHref){
.bounds = {(float)x, (float)*y, (float)w, (float)link_h},
.text = text,
.font = font
});
*y += link_h;
return clicked;
}
static void
settings_draw_public_id_field(const char *text, int x, int w, int *y, int font,
UITextInputStyle style)
{
int field_h;
if(text == NULL || y == NULL)
return;
field_h = GetUIReadonlyTextBoxHeight(text, font, w, style, 0);
clicked = DrawUIReadonlyTextBox((UIReadonlyTextBox){
DrawUIReadonlyTextBox((UIReadonlyTextBox){
.bounds = {(float)x, (float)*y, (float)w, (float)field_h},
.text = text,
.font = font,
.style = style
});
*y += field_h;
return clicked;
}
static void
@@ -261,7 +280,8 @@ settings_sync_draw_account_id(InbeApp *app, const InbeSyncAccount *account,
snprintf(display, sizeof(display), "@%s", alias);
else
settings_compact_public_id(account->public_id, display, sizeof(display));
if(settings_draw_public_id_field(display, x, w, y, small_font, style) && app != NULL)
(void)style;
if(settings_draw_public_id_link(display, x, w, y, small_font) && app != NULL)
app_open_modal(app, UIModalSyncPublicId);
}
@@ -634,6 +654,18 @@ settings_sync_account_draw_config(InbeApp *app, int x, int w, int *y)
int commit = 0;
UITextInputStyle input_style = settings_sync_text_style();
if(app != NULL && app->sync_server_url[0] == '\0') {
const char *saved;
settings_sync_ensure_default_server();
saved = storage_get_setting_text(INBE_SYNC_SERVER_URL_KEY);
snprintf(app->sync_server_url, sizeof(app->sync_server_url), "%s",
saved != NULL && saved[0] != '\0'
? saved
: INBE_SYNC_SERVER_URL_DEFAULT);
app->sync_server_url_cursor = (int)strlen(app->sync_server_url);
}
if(!has_account) {
UIButtonRowItem buttons[2] = {
{GetLocaleText("sync_create_account_button"), UI_BUTTON_STYLE_PRIMARY, 0},
+1 -1
View File
@@ -8,7 +8,7 @@
#include <android_native_app_glue.h>
#endif
#include "raylib.h"
#include "flint.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+30 -10
View File
@@ -2,7 +2,7 @@
#include "import.h"
#include "raylib.h"
#include "flint.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -164,35 +164,50 @@ bind_text(sqlite3_stmt *stmt, int index, const char *text)
return sqlite3_bind_text(stmt, index, text != NULL ? text : "", -1, SQLITE_TRANSIENT) == SQLITE_OK;
}
static int
schema_exec(const char *sql)
{
return exec_sql(sql);
}
int
schema_create(void)
{
return exec_sql(
return
#if defined(__EMSCRIPTEN__)
schema_exec("PRAGMA synchronous=OFF;") &&
#endif
schema_exec(
"PRAGMA journal_mode=DELETE;"
"PRAGMA foreign_keys=ON;"
"PRAGMA foreign_keys=ON;") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS meta("
" key TEXT PRIMARY KEY,"
" value TEXT NOT NULL"
");"
");") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS users("
" id TEXT PRIMARY KEY,"
" created_at INTEGER NOT NULL,"
" kind TEXT NOT NULL"
");"
");") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS settings("
" user_id TEXT NOT NULL,"
" key TEXT NOT NULL,"
" value TEXT NOT NULL,"
" updated_at INTEGER NOT NULL,"
" PRIMARY KEY(user_id,key)"
");"
");") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS social_snapshots("
" user_id TEXT NOT NULL,"
" kind TEXT NOT NULL,"
" json TEXT NOT NULL,"
" updated_at INTEGER NOT NULL,"
" PRIMARY KEY(user_id,kind)"
");"
");") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS sessions("
" id TEXT PRIMARY KEY,"
" user_id TEXT NOT NULL,"
@@ -212,7 +227,8 @@ schema_create(void)
" round_index INTEGER NOT NULL,"
" seconds INTEGER NOT NULL,"
" PRIMARY KEY(session_id,round_index)"
");"
");") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS habits("
" id TEXT PRIMARY KEY,"
" user_id TEXT NOT NULL,"
@@ -236,7 +252,8 @@ schema_create(void)
" session_count INTEGER NOT NULL DEFAULT 0,"
" updated_at INTEGER NOT NULL,"
" PRIMARY KEY(habit_id,local_date)"
");"
");") &&
schema_exec(
"CREATE TABLE IF NOT EXISTS imports("
" id TEXT PRIMARY KEY,"
" imported_at INTEGER NOT NULL,"
@@ -506,8 +523,11 @@ storage_init(const char *root)
return 0;
}
sqlite3_busy_timeout(g_storage.db, 1000);
if(!schema_create() || !migrate_schema() || !load_or_create_user())
if(!schema_create() || !migrate_schema() || !load_or_create_user()) {
sqlite3_close(g_storage.db);
g_storage.db = NULL;
return 0;
}
storage_migrate_default_habit_ids();
storage_migrate_habit_ids_to_uuid();
storage_materialize_session_habit_days();
+1 -1
View File
@@ -6,7 +6,7 @@
#include "miniz.h"
#include "version.h"
#include "raylib.h"
#include "flint.h"
#include <sqlite3.h>
#include <dirent.h>
#include <stdio.h>
+1 -1
View File
@@ -3,7 +3,7 @@
#include "db.h"
#include "screens/habits_screen.h"
#include "raylib.h"
#include "flint.h"
#include <sqlite3.h>
#include <stdarg.h>
#include <stdio.h>
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef INBE_STORAGE_H
#define INBE_STORAGE_H
#include "raylib.h"
#include "flint.h"
#include <stddef.h>
enum {
+1 -1
View File
@@ -4,7 +4,7 @@
#include "data.h"
#include "storage.h"
#include "sync_client.h"
#include "raylib.h"
#include "flint.h"
#if ANDROID_BUILD
#include "android_share.h"
+55 -28
View File
@@ -9,45 +9,68 @@ function hideLoadingScreen() {
});
}
function runStorageSync(retryDelay) {
if (Module.__inbeStorageSyncing) return;
Module.__inbeStorageSyncing = true;
Module.__inbeStorageSyncPending = false;
var shouldLog = !!Module.__inbeStorageSyncLogSuccess;
Module.__inbeStorageSyncLogSuccess = false;
try {
FS.syncfs(false, function(err) {
Module.__inbeStorageSyncing = false;
if (err) console.error('IDBFS save failed:', err);
else if (shouldLog) console.log('IDBFS synced');
if (Module.__inbeStorageSyncPending) {
if (Module.__inbeStorageSyncTimer) clearTimeout(Module.__inbeStorageSyncTimer);
Module.__inbeStorageSyncTimer = setTimeout(function() {
Module.__inbeStorageSyncTimer = 0;
runStorageSync(retryDelay);
}, retryDelay);
}
});
} catch (e) {
Module.__inbeStorageSyncing = false;
console.error('IDBFS sync error:', e);
if (Module.__inbeStorageSyncPending) {
if (Module.__inbeStorageSyncTimer) clearTimeout(Module.__inbeStorageSyncTimer);
Module.__inbeStorageSyncTimer = setTimeout(function() {
Module.__inbeStorageSyncTimer = 0;
runStorageSync(retryDelay);
}, retryDelay);
}
}
}
function scheduleStorageSync(delay, logSuccess) {
if (typeof FS === 'undefined' || typeof FS.syncfs !== 'function') return;
Module.__inbeStorageSyncPending = true;
Module.__inbeStorageSyncLogSuccess = Module.__inbeStorageSyncLogSuccess || !!logSuccess;
if (Module.__inbeStorageSyncTimer) clearTimeout(Module.__inbeStorageSyncTimer);
Module.__inbeStorageSyncTimer = setTimeout(function runStorageSync() {
Module.__inbeStorageSyncTimer = setTimeout(function() {
Module.__inbeStorageSyncTimer = 0;
if (Module.__inbeStorageSyncing) return;
Module.__inbeStorageSyncing = true;
Module.__inbeStorageSyncPending = false;
var shouldLog = !!Module.__inbeStorageSyncLogSuccess;
Module.__inbeStorageSyncLogSuccess = false;
try {
FS.syncfs(false, function(err) {
Module.__inbeStorageSyncing = false;
if (err) console.error('IDBFS save failed:', err);
else if (shouldLog) console.log('IDBFS synced');
if (Module.__inbeStorageSyncPending) {
if (Module.__inbeStorageSyncTimer) clearTimeout(Module.__inbeStorageSyncTimer);
Module.__inbeStorageSyncTimer = setTimeout(runStorageSync, delay);
}
});
} catch (e) {
Module.__inbeStorageSyncing = false;
console.error('IDBFS sync error:', e);
if (Module.__inbeStorageSyncPending) {
if (Module.__inbeStorageSyncTimer) clearTimeout(Module.__inbeStorageSyncTimer);
Module.__inbeStorageSyncTimer = setTimeout(runStorageSync, delay);
}
}
runStorageSync(delay);
}, delay);
}
function flushStorageSync(logSuccess) {
if (typeof FS === 'undefined' || typeof FS.syncfs !== 'function') return;
Module.__inbeStorageSyncPending = true;
Module.__inbeStorageSyncLogSuccess = Module.__inbeStorageSyncLogSuccess || !!logSuccess;
if (Module.__inbeStorageSyncTimer) {
clearTimeout(Module.__inbeStorageSyncTimer);
Module.__inbeStorageSyncTimer = 0;
}
runStorageSync(0);
}
var Module = {
__inbeRuntimeReady: false,
__inbeScheduleStorageSync: scheduleStorageSync,
__inbeFlushStorageSync: flushStorageSync,
preRun: [function() {
if (typeof FS === 'undefined' || typeof IDBFS === 'undefined') {
console.error('IDBFS unavailable');
@@ -74,7 +97,10 @@ var Module = {
removeRunDependency('inbe-idbfs');
});
}],
postRun: [hideLoadingScreen],
postRun: [function() {
Module.__inbeRuntimeReady = true;
hideLoadingScreen();
}],
locateFile: function(path, prefix) {
if (path === 'index.wasm' || path === 'index.data') {
return prefix + path + '?v=WEB_CACHE_BUSTER';
@@ -162,6 +188,7 @@ window.onerror = function() {
var lastBackgroundTick = 0;
function callExport(name, args) {
if (!Module || !Module.__inbeRuntimeReady) return 0;
var fn = Module && Module['_' + name];
if (typeof fn !== 'function') return 0;
try {
+729 -20
View File
@@ -16,9 +16,11 @@ static int mouse_released = 0;
static int bottom_nav_draw_count = 0;
static int bottom_nav_clicked_route = APP_NAV_ROUTE_NONE;
static UIBottomNav bottom_nav_last;
static UIBottomNavItem bottom_nav_items_last[APP_BOTTOM_NAV_CONTENT_MAX + 1];
static int save_settings_count = 0;
static int reset_settings_preview_count = 0;
static int settings_status_clear_count = 0;
static const char *generic_button_clicked_label = NULL;
static void
expect(int condition, const char *message)
@@ -36,9 +38,11 @@ reset_state(void)
bottom_nav_draw_count = 0;
bottom_nav_clicked_route = APP_NAV_ROUTE_NONE;
memset(&bottom_nav_last, 0, sizeof(bottom_nav_last));
memset(bottom_nav_items_last, 0, sizeof(bottom_nav_items_last));
save_settings_count = 0;
reset_settings_preview_count = 0;
settings_status_clear_count = 0;
generic_button_clicked_label = NULL;
view_width = 320;
view_height = 560;
app_set_android_bottom_nav_height(0);
@@ -60,6 +64,179 @@ DrawRectangle(int posX, int posY, int width, int height, Color color)
(void)color;
}
void
DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color)
{
(void)startPosX;
(void)startPosY;
(void)endPosX;
(void)endPosY;
(void)color;
}
void
DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color)
{
(void)rec;
(void)roundness;
(void)segments;
(void)color;
}
void
DrawCircle(int centerX, int centerY, float radius, Color color)
{
(void)centerX;
(void)centerY;
(void)radius;
(void)color;
}
void
DrawCircleLines(int centerX, int centerY, float radius, Color color)
{
(void)centerX;
(void)centerY;
(void)radius;
(void)color;
}
Color
GetThemeSurface(void)
{
return (Color){0};
}
Color
GetThemeBackground(void)
{
return (Color){0};
}
Color
GetThemeButton(void)
{
return (Color){0};
}
Color
GetThemeIcon(void)
{
return (Color){0};
}
Color
GetThemeText(void)
{
return (Color){0};
}
Color
DarkenUIColor(Color color, int amount)
{
(void)amount;
return color;
}
Color
LightenUIColor(Color color, int amount)
{
(void)amount;
return color;
}
int
ScaleUIPx(int px)
{
return px;
}
int
GetUITabBarHeight(void)
{
return 44;
}
int
GetUIFontSize(void)
{
return 16;
}
int
GetUIControlTextY(const char *text, int y, int h, int font)
{
(void)text;
(void)font;
return y + h / 2;
}
void
DrawUIText(const char *text, int x, int y, int fontSize, Color color)
{
(void)text;
(void)x;
(void)y;
(void)fontSize;
(void)color;
}
int
MeasureUIText(const char *text, int font_size)
{
(void)font_size;
return text != NULL ? (int)strlen(text) * 8 : 0;
}
int
GetUITextHeight(const char *text, int font_size)
{
(void)text;
return font_size > 0 ? font_size : 16;
}
void
FormatLocaleText(char *out, size_t out_size, const char *key, ...)
{
if(out == NULL || out_size == 0)
return;
snprintf(out, out_size, "%s", key != NULL ? key : "");
}
int
DrawUIHref(UIHref link)
{
(void)link;
return 0;
}
bool
CheckCollisionPointRec(Vector2 point, Rectangle rec)
{
return point.x >= rec.x && point.x <= rec.x + rec.width &&
point.y >= rec.y && point.y <= rec.y + rec.height;
}
Vector2
GetMousePosition(void)
{
return (Vector2){0};
}
Vector2
GetScreenToWorld2D(Vector2 position, Camera2D camera)
{
(void)camera;
return position;
}
bool
IsMouseButtonPressed(int button)
{
(void)button;
return false;
}
int
GetUIBottomNavHeight(void)
{
@@ -70,6 +247,11 @@ UIBottomNavResult
DrawUIBottomNav(UIBottomNav nav)
{
bottom_nav_last = nav;
if(nav.count > APP_BOTTOM_NAV_CONTENT_MAX + 1)
nav.count = APP_BOTTOM_NAV_CONTENT_MAX + 1;
for(int i = 0; i < nav.count; i++)
bottom_nav_items_last[i] = nav.items[i];
bottom_nav_last.items = bottom_nav_items_last;
bottom_nav_draw_count++;
return (UIBottomNavResult){
.clicked_route = bottom_nav_clicked_route,
@@ -79,6 +261,226 @@ DrawUIBottomNav(UIBottomNav nav)
};
}
UISidebarAccountHeaderResult
DrawUISidebarAccountHeader(UISidebarAccountHeader header)
{
(void)header;
return (UISidebarAccountHeaderResult){
.height = 138
};
}
UIProfilePicturePickerResult
DrawUIProfilePicturePickerModal(UIProfilePicturePickerModal modal)
{
(void)modal;
return (UIProfilePicturePickerResult){0};
}
UIScrollView
BeginUIScrollContainer(UIScrollArea area)
{
return (UIScrollView){
.content_x = area.content_x,
.content_y = (int)area.bounds.y,
.content_w = area.content_width,
.viewport_h = (int)area.bounds.height,
.content_h = area.content_height
};
}
void
EndUIScrollContainer(UIScrollArea area, UIScrollView view)
{
(void)area;
(void)view;
}
int
DrawUISectionLabel(UISectionLabel label, int x, int y)
{
(void)label;
(void)x;
(void)y;
return 0;
}
int
DrawUIGenericButton(int x, int y, int w, int h, const char *label,
UIButtonStyle style, int disabled, int *hover)
{
(void)x;
(void)y;
(void)w;
(void)h;
(void)style;
if(hover != NULL)
*hover = 0;
if(!disabled && generic_button_clicked_label != NULL &&
label != NULL && strcmp(label, generic_button_clicked_label) == 0) {
generic_button_clicked_label = NULL;
return 1;
}
return 0;
}
UIBottomNavConfigResult
DrawUIBottomNavConfigModal(UIBottomNavConfigModal modal)
{
(void)modal;
return (UIBottomNavConfigResult){0};
}
UIReorderListResult
UpdateUIReorderList(UIReorderList list)
{
(void)list;
return (UIReorderListResult){
.from_index = -1,
.to_index = -1,
.active_index = -1,
.target_index = -1
};
}
void
DrawUIReorderHandle(int x, int y, int w, int h, int active)
{
(void)x;
(void)y;
(void)w;
(void)h;
(void)active;
}
void
DrawUIReorderPlaceholder(Rectangle bounds)
{
(void)bounds;
}
UIScrollPage
BeginUIScrollPage(UIScrollPageSpec spec)
{
return (UIScrollPage){
.content_x = 16,
.content_y = spec.y,
.content_w = 288,
.content_h = spec.height
};
}
void
EndUIScrollPage(UIScrollPage page)
{
(void)page;
}
int
DrawUIReturnTitleBar(Texture2D return_icon, const char *title, int height)
{
(void)return_icon;
(void)title;
(void)height;
return 0;
}
int
app_draw_close_title_bar(InbeApp *app, const char *title, int height)
{
(void)app;
(void)title;
(void)height;
return 0;
}
const char *
settings_screen_tab_label(int tab)
{
switch(tab) {
case SETTINGS_TAB_SESSION:
return "Session";
case SETTINGS_TAB_DEVICE:
return "Device";
case SETTINGS_TAB_THEME:
return "Appearance";
case SETTINGS_TAB_ABOUT:
return "About";
default:
return "Settings";
}
}
int
GetUISmallFontSize(void)
{
return 12;
}
int
DrawUIDropdownButton(int id, int x, int y, int w, int h,
const char **options, int option_count,
int *selected_index)
{
(void)id;
(void)x;
(void)y;
(void)w;
(void)h;
(void)options;
(void)option_count;
(void)selected_index;
return 0;
}
int
DrawUIDropdownMenu(int id)
{
(void)id;
return 0;
}
void
SetUIDropdownClipTop(int y)
{
(void)y;
}
void
SetUIDropdownClipBottom(int y)
{
(void)y;
}
int
DrawUIPaddedIconBtn(int x, int y, int size, int padding,
Texture2D icon, int *hover)
{
(void)x;
(void)y;
(void)size;
(void)padding;
(void)icon;
if(hover != NULL)
*hover = 0;
return 0;
}
void
DrawUIIconTexture(int x, int y, int size, Texture2D icon, Color tint)
{
(void)x;
(void)y;
(void)size;
(void)icon;
(void)tint;
}
void
ClearUIInputCaptures(void)
{
}
const char *
GetLocaleText(const char *key)
{
@@ -102,6 +504,42 @@ app_switch_screen(InbeApp *app, int screen)
app->inbe.screen = screen;
}
AppRoute
app_current_route(const InbeApp *app)
{
AppRoute route;
memset(&route, 0, sizeof(route));
if(app == NULL)
return route;
route.screen = app->inbe.screen;
route.exercise_type = app->exercise_type;
route.practice_tab = app->practice_tab;
route.practice_config_tab = app->practice_config_tab;
route.settings_tab = app->settings_tab;
route.profile_view = app->profile_view;
route.profile_tab = app->profile_tab;
route.habits_screen_mode = app->habits.screen_mode;
route.habits_tab = app->habits.tab;
return route;
}
void
app_switch_route(InbeApp *app, AppRoute route)
{
if(app == NULL)
return;
app->inbe.screen = route.screen;
app->exercise_type = route.exercise_type;
app->practice_tab = route.practice_tab;
app->practice_config_tab = route.practice_config_tab;
app->settings_tab = route.settings_tab;
app->profile_view = route.profile_view;
app->profile_tab = route.profile_tab;
app->habits.screen_mode = route.habits_screen_mode;
app->habits.tab = route.habits_tab;
}
void
app_leave_practice_config(InbeApp *app)
{
@@ -129,6 +567,54 @@ settings_screen_clear_status(void)
settings_status_clear_count++;
}
int
sync_account_load(InbeSyncAccount *account)
{
(void)account;
return 0;
}
const char *
storage_get_setting_text(const char *key)
{
(void)key;
return "";
}
void
app_open_modal(InbeApp *app, UIModalType type)
{
if(app == NULL)
return;
app->modal.active = 1;
app->modal.type = type;
app->modal_input_block_frame = app->inbe.frame;
}
void
app_close_modal(InbeApp *app)
{
if(app == NULL)
return;
app->modal.active = 0;
app->modal.type = UIModalNone;
app->modal_input_block_frame = app->inbe.frame;
}
int
profile_social_friends_count(InbeApp *app)
{
(void)app;
return 0;
}
int
profile_social_pending_count(InbeApp *app)
{
(void)app;
return 0;
}
#include "../src/app/app_nav.c"
static InbeApp
@@ -141,9 +627,68 @@ test_app(void)
app.inbe.frame = 42;
app.practice_tab = PRACTICE_TAB_PLAY;
app.main_tab = APP_MAIN_TAB_PRACTICE;
app_reset_bottom_nav_routes(&app);
return app;
}
static void
test_default_bottom_nav_routes_are_habits_practice_stack(void)
{
InbeApp app = test_app();
reset_state();
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 1,
"default bottom nav should draw");
expect(bottom_nav_last.count == 3,
"default bottom nav should have three items");
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_HABITS,
"default first bottom nav item should be habits");
expect(bottom_nav_last.items[1].route == APP_NAV_ROUTE_PRACTICE,
"default second bottom nav item should be practice");
expect(bottom_nav_last.items[2].route == APP_NAV_ROUTE_STACK,
"default third bottom nav item should be stack");
}
static void
test_stack_opens_sidebar_without_routing(void)
{
InbeApp app = test_app();
reset_state();
view_width = 720;
bottom_nav_clicked_route = APP_NAV_ROUTE_STACK;
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 1,
"stack route should draw bottom nav");
expect(app.nav_sidebar_open == 1,
"stack route should open sidebar");
expect(app.inbe.screen == InbeScreenStart,
"stack route should not change screens");
expect(reset_settings_preview_count == 0,
"stack route should not run settings route side effects");
}
static void
test_compact_stack_opens_sidebar_screen(void)
{
InbeApp app = test_app();
reset_state();
view_width = 320;
bottom_nav_clicked_route = APP_NAV_ROUTE_STACK;
app_draw_bottom_nav(&app);
expect(app.nav_sidebar_open == 1,
"compact stack route should open sidebar");
expect(app.inbe.screen == InbeScreenNavSidebar,
"compact stack route should switch to sidebar screen");
}
static void
test_same_frame_modal_close_consumes_bottom_nav_click(void)
{
@@ -152,14 +697,14 @@ test_same_frame_modal_close_consumes_bottom_nav_click(void)
reset_state();
app.modal_input_block_frame = app.inbe.frame;
mouse_released = 1;
bottom_nav_clicked_route = APP_NAV_ROUTE_SETTINGS;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 0,
"same-frame modal close must skip bottom nav draw");
expect(app.inbe.screen == InbeScreenStart,
"same-frame modal close must not route to settings");
"same-frame modal close must not route");
expect(reset_settings_preview_count == 0,
"same-frame modal close must not run settings route side effects");
}
@@ -172,16 +717,16 @@ test_unblocked_bottom_nav_click_still_routes(void)
reset_state();
app.modal_input_block_frame = app.inbe.frame - 1;
mouse_released = 1;
bottom_nav_clicked_route = APP_NAV_ROUTE_SETTINGS;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 1,
"unblocked frame should draw bottom nav");
expect(app.inbe.screen == InbeScreenSettings,
"unblocked bottom nav click should route to settings");
expect(reset_settings_preview_count == 1,
"settings route should reset preview");
expect(app.inbe.screen == InbeScreenHabits,
"unblocked bottom nav click should route to habits");
expect(reset_settings_preview_count == 0,
"habits route should not reset settings preview");
expect(app_content_bottom_reserved(&app) == 52,
"bottom nav should reserve larger touch height");
expect(bottom_nav_last.bottom_margin == 0,
@@ -194,30 +739,49 @@ test_edge_bottom_nav_routes_are_applied(void)
InbeApp app = test_app();
reset_state();
bottom_nav_clicked_route = APP_NAV_ROUTE_PROFILE;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 1,
"profile edge route should draw bottom nav");
expect(app.inbe.screen == InbeScreenProfile,
"profile edge route should switch to profile");
expect(settings_status_clear_count == 1,
"profile route should clear settings status");
"habits edge route should draw bottom nav");
expect(app.inbe.screen == InbeScreenHabits,
"habits edge route should switch to habits");
app = test_app();
reset_state();
bottom_nav_clicked_route = APP_NAV_ROUTE_SETTINGS;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_set_android_bottom_nav_height(24);
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 1,
"settings edge route should draw bottom nav");
expect(app.inbe.screen == InbeScreenSettings,
"settings edge route should switch to settings");
"habits edge route should draw bottom nav with system margin");
expect(app.inbe.screen == InbeScreenHabits,
"habits edge route should switch to habits with system margin");
expect(bottom_nav_last.bottom_margin == 24,
"bottom nav should preserve Android system nav margin");
}
static void
test_profile_hides_bottom_nav(void)
{
InbeApp app = test_app();
reset_state();
app.inbe.screen = InbeScreenProfile;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 0,
"profile should not draw bottom nav");
expect(app_current_nav_route(&app) == APP_NAV_ROUTE_NONE,
"profile should not expose a bottom nav route");
expect(app_content_bottom_reserved(&app) == 0,
"profile should not reserve bottom nav height");
expect(app.inbe.screen == InbeScreenProfile,
"profile hidden nav should not route clicks");
}
static void
test_practice_manual_hides_bottom_nav(void)
{
@@ -225,7 +789,7 @@ test_practice_manual_hides_bottom_nav(void)
reset_state();
app.practice_tab = PRACTICE_TAB_MANUAL;
bottom_nav_clicked_route = APP_NAV_ROUTE_SETTINGS;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_draw_bottom_nav(&app);
@@ -246,7 +810,7 @@ test_practice_config_hides_bottom_nav(void)
reset_state();
app.practice_tab = PRACTICE_TAB_CONFIG;
bottom_nav_clicked_route = APP_NAV_ROUTE_SETTINGS;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_draw_bottom_nav(&app);
@@ -267,7 +831,7 @@ test_file_dialog_hides_bottom_nav(void)
reset_state();
app.file_dialog_active = 1;
bottom_nav_clicked_route = APP_NAV_ROUTE_SETTINGS;
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
app_draw_bottom_nav(&app);
@@ -277,15 +841,160 @@ test_file_dialog_hides_bottom_nav(void)
"active file dialog should not route bottom nav clicks");
}
static void
test_empty_bottom_nav_draws_stack_only_bar(void)
{
InbeApp app = test_app();
reset_state();
view_width = 720;
app.main_tab = APP_MAIN_TAB_NONE;
app.bottom_nav_route_count = 0;
for(int i = 0; i < APP_BOTTOM_NAV_CONTENT_MAX; i++)
app.bottom_nav_routes[i] = APP_NAV_ROUTE_NONE;
bottom_nav_clicked_route = APP_NAV_ROUTE_STACK;
app_draw_bottom_nav(&app);
expect(bottom_nav_draw_count == 1,
"empty bottom nav should draw stack-only nav bar");
expect(bottom_nav_last.count == 1,
"empty bottom nav should contain only stack");
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_STACK,
"empty bottom nav only item should be stack");
expect(app.nav_sidebar_open == 1,
"empty bottom nav stack should open sidebar");
expect(app.inbe.screen == InbeScreenStart &&
app.main_tab == APP_MAIN_TAB_NONE,
"empty bottom nav should stay on blank start screen");
expect(app_content_bottom_reserved(&app) == 52,
"empty bottom nav should reserve stack bar space");
}
static void
test_bottom_nav_config_save_stays_on_customize_screen(void)
{
InbeApp app = test_app();
reset_state();
app.inbe.screen = InbeScreenCustomizeNav;
app.main_tab = APP_MAIN_TAB_NONE;
app.bottom_nav_route_count = 0;
for(int i = 0; i < APP_BOTTOM_NAV_CONTENT_MAX; i++)
app.bottom_nav_routes[i] = APP_NAV_ROUTE_NONE;
app.bottom_nav_config_route_count = 1;
app.bottom_nav_config_routes[0] = APP_NAV_ROUTE_HABITS;
app_save_bottom_nav_config(&app);
expect(app.inbe.screen == InbeScreenCustomizeNav,
"adding first nav item should stay on customize nav screen");
expect(app.main_tab == APP_MAIN_TAB_HABITS,
"adding first nav item should select a valid main tab");
expect(app.bottom_nav_route_count == 1 &&
app.bottom_nav_routes[0] == APP_NAV_ROUTE_HABITS,
"adding first nav item should save configured route");
expect(save_settings_count == 1,
"adding first nav item should save settings once");
}
static void
test_open_main_tab_none_returns_blank_start(void)
{
InbeApp app = test_app();
reset_state();
app.inbe.screen = InbeScreenCustomizeNav;
app.main_tab = APP_MAIN_TAB_NONE;
app_open_main_tab(&app, app.main_tab, 0);
expect(app.inbe.screen == InbeScreenStart &&
app.main_tab == APP_MAIN_TAB_NONE,
"closing customize nav with no routes should return to blank start");
}
static void
test_compact_sidebar_close_footer_closes_to_home(void)
{
InbeApp app = test_app();
reset_state();
view_width = 320;
app.inbe.screen = InbeScreenNavSidebar;
app.nav_sidebar_open = 1;
app.nav_sidebar_open_frame = app.inbe.frame - 1;
generic_button_clicked_label = "close_button";
app_draw_bottom_nav(&app);
expect(app.nav_sidebar_open == 0,
"sidebar footer close should close sidebar");
expect(app.inbe.screen == InbeScreenStart,
"sidebar footer close should return to current home screen");
}
static void
test_sidebar_child_back_returns_to_compact_sidebar(void)
{
InbeApp app = test_app();
reset_state();
view_width = 320;
app.inbe.screen = InbeScreenNavSidebar;
app.nav_sidebar_open = 1;
app_apply_nav_route(&app, APP_NAV_ROUTE_ACCOUNT);
expect(app.inbe.screen == InbeScreenProfile,
"sidebar account route should open profile");
expect(app.nav_sidebar_return_on_back == 1,
"sidebar child route should remember compact sidebar return");
expect(app_return_to_nav_sidebar_if_needed(&app) == 1,
"profile back should return to compact sidebar");
expect(app.inbe.screen == InbeScreenNavSidebar &&
app.nav_sidebar_open == 1,
"profile back should reopen sidebar screen");
}
static void
test_sidebar_screen_becomes_overlay_when_width_expands(void)
{
InbeApp app = test_app();
reset_state();
view_width = 320;
app.inbe.screen = InbeScreenNavSidebar;
app.nav_sidebar_open = 1;
view_width = 720;
app_update_nav_sidebar_mode(&app);
expect(app.nav_sidebar_open == 1,
"expanded sidebar should remain open as overlay");
expect(app.inbe.screen == InbeScreenStart,
"expanded sidebar should return to home screen behind overlay");
}
int
main(void)
{
test_default_bottom_nav_routes_are_habits_practice_stack();
test_stack_opens_sidebar_without_routing();
test_compact_stack_opens_sidebar_screen();
test_same_frame_modal_close_consumes_bottom_nav_click();
test_unblocked_bottom_nav_click_still_routes();
test_edge_bottom_nav_routes_are_applied();
test_profile_hides_bottom_nav();
test_practice_manual_hides_bottom_nav();
test_practice_config_hides_bottom_nav();
test_file_dialog_hides_bottom_nav();
test_empty_bottom_nav_draws_stack_only_bar();
test_bottom_nav_config_save_stays_on_customize_screen();
test_open_main_tab_none_returns_blank_start();
test_compact_sidebar_close_footer_closes_to_home();
test_sidebar_child_back_returns_to_compact_sidebar();
test_sidebar_screen_becomes_overlay_when_width_expands();
if(failures > 0) {
fprintf(stderr, "%d app bottom nav test failure(s)\n", failures);
BIN
View File
Binary file not shown.
+3 -2
View File
@@ -289,8 +289,6 @@ add_dynamic_locale_keys(LocaleKeys *used)
"exercise_wim_hof",
"exercise_meditation",
"exercise_sun_salutation",
"profile_guide_social",
"profile_guide_social_no_account",
"meditation_music_download_button",
"meditation_music_redownload_button",
"sync_alias_title",
@@ -325,6 +323,9 @@ add_dynamic_locale_keys(LocaleKeys *used)
"sync_server_error",
"sync_status_connected",
"sync_status_not_set",
"tray_show_inner_breeze",
"tray_hide_inner_breeze",
"tray_mark_complete",
"tray_meditation_paused",
"tray_meditation_left",
"tray_sun_salutation",
+1 -1
View File
@@ -1,6 +1,6 @@
#include "breath_engine.h"
#include "miniz.h"
#include "raylib.h"
#include "flint.h"
#include "screens/habits_screen.h"
#include "storage.h"
#include <sqlite3.h>
+1 -1