Compare commits

...
6 Commits
Author SHA1 Message Date
waozi c679b11b73 improve github action caching 2026-06-21 01:28:57 -03:00
waozi 82ccb092c2 improve edit icon 2026-06-21 01:16:41 -03:00
waozi 8bbbfe0be0 add new first time user guid 2026-06-21 01:08:35 -03:00
waozi ee89a9623a add basic transit]ion between screens 2026-06-21 00:22:03 -03:00
waozi df91739754 fix new hhabit creation 2026-06-21 00:01:55 -03:00
waozi 5fadbcacea improve workflow 2026-06-20 23:49:08 -03:00
60 changed files with 1420 additions and 399 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
build-essential
zlib1g-dev
+3
View File
@@ -0,0 +1,3 @@
build-essential
zlib1g-dev
zip
+5
View File
@@ -0,0 +1,5 @@
build-essential
gcc-mingw-w64-i686-win32
gcc-mingw-w64-x86-64-win32
zlib1g-dev
zip
+34 -2
View File
@@ -20,6 +20,8 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
@@ -28,10 +30,24 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Cache Test apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
restore-keys: |
test-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Test Dependencies
run: |
set -euo pipefail
mapfile -t packages < .github/apt/test-packages.txt
mkdir -p "$APT_CACHE_DIR/partial"
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev
sudo apt-get \
-o Dir::Cache::archives="$APT_CACHE_DIR" \
install -y "${packages[@]}"
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
- name: Run Tests
run: make test
@@ -40,6 +56,8 @@ jobs:
name: Build Chrome Extension
runs-on: ubuntu-latest
needs: test
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
@@ -48,10 +66,24 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Cache Web apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
restore-keys: |
web-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Web Dependencies
run: |
set -euo pipefail
mapfile -t packages < .github/apt/web-packages.txt
mkdir -p "$APT_CACHE_DIR/partial"
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev zip
sudo apt-get \
-o Dir::Cache::archives="$APT_CACHE_DIR" \
install -y "${packages[@]}"
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
- name: Set up Emscripten
run: |
+145 -11
View File
@@ -17,6 +17,8 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
@@ -25,18 +27,34 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Cache Test apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
restore-keys: |
test-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Test Dependencies
run: |
set -euo pipefail
mapfile -t packages < .github/apt/test-packages.txt
mkdir -p "$APT_CACHE_DIR/partial"
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev
sudo apt-get \
-o Dir::Cache::archives="$APT_CACHE_DIR" \
install -y "${packages[@]}"
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
- name: Run Tests
run: make test
build-web:
name: Build Web and Chrome Extension
name: Build Web
runs-on: ubuntu-latest
needs: test
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
@@ -45,10 +63,24 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Cache Web apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
restore-keys: |
web-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Web Dependencies
run: |
set -euo pipefail
mapfile -t packages < .github/apt/web-packages.txt
mkdir -p "$APT_CACHE_DIR/partial"
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev zip
sudo apt-get \
-o Dir::Cache::archives="$APT_CACHE_DIR" \
install -y "${packages[@]}"
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
- name: Set up Emscripten
run: |
@@ -66,10 +98,8 @@ jobs:
set -euo pipefail
make package-unpackaged-assets
make web
make chrome-web-store
mkdir -p build/release/web
cp build/dist/inbe-web.zip build/release/web/
cp build/dist/inbe-chrome-web-store.zip build/release/web/
- name: Upload Web Artifact
uses: actions/upload-artifact@v4
@@ -78,6 +108,65 @@ jobs:
path: build/release/web/*
if-no-files-found: error
build-chrome-extension:
name: Build Chrome Extension
runs-on: ubuntu-latest
needs: test
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Cache Web apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
restore-keys: |
web-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Install Web Dependencies
run: |
set -euo pipefail
mapfile -t packages < .github/apt/web-packages.txt
mkdir -p "$APT_CACHE_DIR/partial"
sudo apt-get update
sudo apt-get \
-o Dir::Cache::archives="$APT_CACHE_DIR" \
install -y "${packages[@]}"
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
- name: Set up Emscripten
run: |
set -euo pipefail
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
"$HOME/emsdk/emsdk" install latest
"$HOME/emsdk/emsdk" activate latest
echo "EMSDK=$HOME/emsdk" >> "$GITHUB_ENV"
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
echo "$HOME/emsdk" >> "$GITHUB_PATH"
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
- name: Build Chrome Extension ZIP
run: |
set -euo pipefail
make package-unpackaged-assets
make chrome-web-store
mkdir -p build/release/chrome-web-store
cp build/dist/inbe-chrome-web-store.zip build/release/chrome-web-store/
- name: Upload Chrome Extension Artifact
uses: actions/upload-artifact@v4
with:
name: release-chrome-web-store
path: build/release/chrome-web-store/*
if-no-files-found: error
build-linux:
name: Build Linux
runs-on: ubuntu-latest
@@ -151,6 +240,8 @@ jobs:
name: Build Windows
runs-on: ubuntu-latest
needs: test
env:
APT_CACHE_DIR: /tmp/apt-cache
steps:
- name: Checkout Repository
@@ -159,15 +250,34 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Cache Windows apt packages
uses: actions/cache@v4
with:
path: ${{ env.APT_CACHE_DIR }}
key: windows-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/windows-packages.txt') }}
restore-keys: |
windows-apt-${{ runner.os }}-${{ runner.arch }}-
- name: Cache Windows vendor builds
uses: actions/cache@v4
with:
path: |
vendor-builds/windows
vendor-builds/sqlite
key: windows-vendor-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile', 'vendor/raylib/src/**', 'vendor/curl/**', 'vendor/sqlite/**') }}
restore-keys: |
windows-vendor-${{ runner.os }}-${{ runner.arch }}-
- name: Install Windows Dependencies
run: |
set -euo pipefail
mapfile -t packages < .github/apt/windows-packages.txt
mkdir -p "$APT_CACHE_DIR/partial"
sudo apt-get update
sudo apt-get install -y \
build-essential \
gcc-mingw-w64-i686-win32 \
gcc-mingw-w64-x86-64-win32 \
zlib1g-dev \
zip
sudo apt-get \
-o Dir::Cache::archives="$APT_CACHE_DIR" \
install -y "${packages[@]}"
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
if [ -x /usr/bin/x86_64-w64-mingw32-gcc-win32 ]; then
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-win32
fi
@@ -211,6 +321,29 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Cache Android SDK packages
uses: actions/cache@v4
with:
path: |
${{ env.ANDROID_HOME }}/platforms/android-35
${{ env.ANDROID_HOME }}/build-tools/34.0.0
${{ env.ANDROID_HOME }}/ndk/25.1.8937393
${{ env.ANDROID_HOME }}/ndk/28.2.13676358
${{ env.ANDROID_HOME }}/cmake/3.22.1
key: android-sdk-${{ runner.os }}-${{ runner.arch }}-api35-bt34-ndk25-ndk28-cmake322
restore-keys: |
android-sdk-${{ runner.os }}-${{ runner.arch }}-
- name: Cache Android native build
uses: actions/cache@v4
with:
path: |
droid/app/.cxx
droid/app/build/intermediates/cxx
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'src/**/*.c', 'src/**/*.h', 'flint/src/**/*.c', 'flint/include/**/*.h', 'vendor/raylib/src/**') }}
restore-keys: |
android-native-${{ runner.os }}-${{ runner.arch }}-
- name: Install Android SDK Components
run: |
set -euo pipefail
@@ -266,6 +399,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- build-web
- build-chrome-extension
- build-linux
- build-windows
- build-android
+5
View File
@@ -1,4 +1,9 @@
# Changelog
## [1.4.7] - 2026-06-21
### Changed
- Rework Practice into Manual, start, and configuration tabs with a new localized first-run guide.
- Simplify Meditation's manual to one page and make bottom navigation more compact.
## [1.4.6] - 2026-06-20
### Changed
- Move habit weekly, monthly, statistics, and edit views into icon tabs under the habit selector.
+7 -2
View File
@@ -241,7 +241,7 @@ UNPACKAGED_AUDIO_DIR := unpackaged_assets/audio
UNPACKAGED_AUDIO_FILES := $(shell find $(UNPACKAGED_AUDIO_DIR) -type f 2>/dev/null)
MEDITATION_AUDIO_ZIP := web-assets/dl/inbe-meditation-audio-v1.zip
.PHONY: all native run screenshot test dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows clean clean-linux clean-vendor-builds android-check-keystore android-copy-assets android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web chrome-web-store
.PHONY: all native run run-fresh screenshot test dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows clean clean-linux clean-vendor-builds android-check-keystore android-copy-assets android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web chrome-web-store
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click
all: native
@@ -293,6 +293,11 @@ vendor-prebuilds-windows: $(WIN64_RAYLIB_A) $(WIN32_RAYLIB_A) $(WIN64_CURL_A) $(
run: $(TARGET)
./$(TARGET)
run-fresh: $(TARGET)
@root=$$(mktemp -d /tmp/inbe-fresh.XXXXXX); \
echo "INBE_DATA_ROOT=$$root"; \
INBE_DATA_ROOT="$$root" ./$(TARGET)
screenshot: $(TARGET)
./scripts/generate-screenshots.sh "$(TARGET)"
@@ -987,7 +992,7 @@ clean-linux:
clean-vendor-builds:
rm -rf $(VENDOR_BUILD_DIR)
NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native run dist appimage vendor-prebuilds vendor-prebuilds-native,$(MAKECMDGOALS)),native)
NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native 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. Enter the ray flake shell with 'nix develop')
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

+2 -2
View File
@@ -35,8 +35,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 35
versionCode 41
versionName "1.4.6"
versionCode 42
versionName "1.4.7"
}
@@ -0,0 +1,3 @@
### Changed
- Rework Practice into Manual, start, and configuration tabs with a new localized first-run guide.
- Simplify Meditation's manual to one page and make bottom navigation more compact.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 197 B

+1
View File
@@ -10,6 +10,7 @@
#include "flint_text.h"
#include "flint_ui.h"
#include "flint_text_layout.h"
#include "flint_transition.h"
#include "flint_locale.h"
#include "flint_theme.h"
#include "flint_theme_meta.h"
+27
View File
@@ -0,0 +1,27 @@
#ifndef FLINT_TRANSITION_H
#define FLINT_TRANSITION_H
#include "raylib.h"
typedef enum FlintTransitionPhase {
FLINT_TRANSITION_NONE = 0,
FLINT_TRANSITION_OUT = 1,
FLINT_TRANSITION_IN = 2
} FlintTransitionPhase;
typedef struct FlintTransition {
int active;
int phase;
int ticks;
int duration;
} FlintTransition;
void flint_transition_reset(FlintTransition *transition);
void flint_transition_begin(FlintTransition *transition, int duration);
void flint_transition_reverse_to_out(FlintTransition *transition);
float flint_transition_alpha(const FlintTransition *transition);
int flint_transition_step(FlintTransition *transition);
void flint_transition_draw_fade(const FlintTransition *transition,
int width, int height, Color color);
#endif
+24 -18
View File
@@ -105,15 +105,19 @@ static const unsigned char flint_icon_droid[] = {
static const unsigned char flint_icon_edit[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
0x00, 0x66, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x52, 0x5b, 0x0e, 0xc0, 0x20, 0x08, 0x13,
0xef, 0x7f, 0xe7, 0xed, 0x47, 0x13, 0x84, 0xae, 0x6d, 0x4c, 0xc6, 0xa7, 0xf4, 0x41, 0x91, 0x31,
0x8c, 0x7a, 0x56, 0xa1, 0x5e, 0x38, 0xe4, 0x83, 0x10, 0x21, 0x39, 0x9f, 0xce, 0x68, 0x92, 0xe9,
0x3a, 0x67, 0xf7, 0xdc, 0x83, 0x02, 0x1b, 0x80, 0x08, 0xf5, 0xad, 0x09, 0x54, 0x32, 0x12, 0x39,
0xa6, 0x62, 0x64, 0x16, 0xa9, 0x61, 0xd8, 0x57, 0x59, 0x98, 0x5b, 0xf2, 0xac, 0x20, 0x26, 0x8e,
0xa2, 0xc1, 0x05, 0x65, 0x20, 0x23, 0x43, 0xe7, 0x3c, 0xaa, 0xb3, 0x17, 0x79, 0x48, 0xea, 0x74,
0x65, 0x84, 0xdf, 0x2b, 0x54, 0x46, 0x55, 0x2f, 0xf8, 0xdc, 0x8b, 0xb8, 0x5d, 0x5e, 0xd7, 0x7f,
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x08, 0x06, 0x00, 0x00, 0x00, 0x8d, 0x89, 0x1d,
0x0d, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
0x00, 0xa6, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0xd3, 0x51, 0x0e, 0xc3, 0x20, 0x0c, 0x03,
0x50, 0x67, 0xea, 0x41, 0xe1, 0x64, 0x70, 0xd3, 0xf4, 0xa3, 0x43, 0x4b, 0x43, 0xdc, 0x80, 0xb6,
0xf9, 0xaf, 0x2a, 0x7d, 0x32, 0x89, 0x0a, 0xfc, 0x38, 0xb2, 0x7a, 0xb0, 0xb5, 0xa6, 0xf6, 0xb9,
0xd6, 0x1a, 0x7e, 0xbb, 0x04, 0x0e, 0xac, 0x94, 0x02, 0x00, 0xe8, 0xbd, 0x53, 0x34, 0x05, 0x3d,
0x36, 0xc2, 0xd0, 0x47, 0xd0, 0x63, 0x22, 0x22, 0x00, 0xa0, 0xaa, 0xca, 0xd0, 0xd7, 0x6e, 0x33,
0x0b, 0x8f, 0x77, 0x76, 0xbe, 0x21, 0x98, 0x35, 0x8b, 0x50, 0x0a, 0x32, 0x2c, 0x42, 0xa3, 0xdc,
0x40, 0x86, 0xf9, 0x56, 0xfa, 0x0e, 0xf0, 0x99, 0x23, 0x6d, 0xc8, 0x30, 0x8f, 0x5a, 0x2c, 0x5d,
0x0a, 0xc3, 0x46, 0x3b, 0x86, 0xdd, 0x40, 0xbb, 0x29, 0x36, 0xa7, 0x0c, 0x9b, 0x1a, 0xda, 0x8d,
0x79, 0x74, 0x05, 0x9b, 0x40, 0xe0, 0xba, 0xae, 0xdf, 0xe8, 0x2a, 0x16, 0x82, 0x3e, 0x3b, 0x18,
0x00, 0x1c, 0x0c, 0xb0, 0xc8, 0x48, 0x86, 0x4d, 0xa0, 0x07, 0x56, 0x91, 0xbf, 0x46, 0xb2, 0x5f,
0x69, 0x37, 0x47, 0x74, 0xcd, 0x6f, 0x72, 0x02, 0x63, 0x94, 0x8b, 0x26, 0xd7, 0xd9, 0x8c, 0x86,
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
@@ -874,13 +878,15 @@ static const unsigned char flint_icon_sun[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
0x00, 0x5f, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x53, 0x41, 0x12, 0x00, 0x21, 0x08, 0x8a,
0xfe, 0xff, 0x67, 0xf7, 0xb4, 0x3b, 0xd5, 0x42, 0x61, 0x7a, 0x32, 0x54, 0x68, 0x28, 0xd1, 0x48,
0x44, 0x44, 0x30, 0x1c, 0x00, 0x18, 0xfe, 0x1b, 0x66, 0x04, 0x0a, 0x4f, 0x35, 0x6d, 0xeb, 0x96,
0x82, 0xea, 0x73, 0x87, 0x59, 0x3f, 0xbe, 0xc4, 0x31, 0x68, 0x21, 0x99, 0x13, 0xf7, 0xba, 0x4b,
0xbd, 0x1f, 0x15, 0x0e, 0x22, 0x92, 0xc0, 0x0d, 0x49, 0x30, 0x7a, 0xb2, 0xf3, 0xa7, 0x6e, 0xe2,
0x7b, 0xb8, 0x7d, 0xc6, 0x34, 0x49, 0xe9, 0x37, 0x96, 0xf6, 0x41, 0xe1, 0xd4, 0xb8, 0xcc, 0x3a,
0x3f, 0xfb, 0x0f, 0xaf, 0x73, 0x1a, 0x91, 0x95, 0xf6, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
0x00, 0x7f, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x53, 0x41, 0x0e, 0xc0, 0x20, 0x08, 0xa3,
0xbe, 0x54, 0x5f, 0xa6, 0x3f, 0x65, 0xa7, 0x1a, 0xd7, 0xe1, 0x30, 0xb1, 0x27, 0xad, 0xb4, 0x82,
0x02, 0x2c, 0x40, 0xef, 0xdd, 0x23, 0xbe, 0xb5, 0x06, 0xe5, 0x3e, 0x04, 0xc5, 0xb5, 0xd6, 0x17,
0x3f, 0xc6, 0x08, 0x4d, 0x5e, 0x1b, 0x15, 0x03, 0x80, 0x99, 0x99, 0xbb, 0xfb, 0xce, 0x04, 0x99,
0x98, 0xd8, 0x99, 0xe0, 0x44, 0xfc, 0x67, 0x82, 0x2c, 0xed, 0x99, 0xea, 0xa6, 0x9c, 0x92, 0xd5,
0xcc, 0x40, 0x72, 0x8c, 0xa1, 0xa6, 0xe8, 0x0d, 0x04, 0x85, 0xba, 0xd6, 0xd8, 0x62, 0x97, 0x98,
0x06, 0x5a, 0xf3, 0xda, 0x07, 0xda, 0x13, 0x6b, 0xec, 0xf5, 0x23, 0xde, 0x7f, 0x23, 0x0f, 0xaf,
0x1a, 0x29, 0x33, 0x39, 0x6a, 0xe5, 0x9d, 0x09, 0x71, 0x34, 0x4c, 0x6a, 0xa2, 0x88, 0xc6, 0xf9,
0x01, 0xde, 0xe5, 0x8f, 0xcd, 0xb7, 0xb6, 0xd5, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
0x44, 0xae, 0x42, 0x60, 0x82,
};
@@ -1218,7 +1224,7 @@ const FlintIconAsset flint_icon_assets[] = {
{UI_ICON_TYPE_CHECK, "check", flint_icon_check, 131u},
{UI_ICON_TYPE_DISCORD, "discord", flint_icon_discord, 180u},
{UI_ICON_TYPE_DROID, "droid", flint_icon_droid, 170u},
{UI_ICON_TYPE_EDIT, "edit", flint_icon_edit, 172u},
{UI_ICON_TYPE_EDIT, "edit", flint_icon_edit, 236u},
{UI_ICON_TYPE_EYE_CLOSED, "eye-closed", flint_icon_eye_closed, 157u},
{UI_ICON_TYPE_FDROID, "fdroid", flint_icon_fdroid, 268u},
{UI_ICON_TYPE_FORWARD, "forward", flint_icon_forward, 153u},
@@ -1261,7 +1267,7 @@ const FlintIconAsset flint_icon_assets[] = {
{UI_ICON_TYPE_STACK, "stack", flint_icon_stack, 112u},
{UI_ICON_TYPE_STAT, "stat", flint_icon_stat, 150u},
{UI_ICON_TYPE_STRIPE, "stripe", flint_icon_stripe, 180u},
{UI_ICON_TYPE_SUN, "sun", flint_icon_sun, 165u},
{UI_ICON_TYPE_SUN, "sun", flint_icon_sun, 197u},
{UI_ICON_TYPE_TCL, "tcl", flint_icon_tcl, 325u},
{UI_ICON_TYPE_TELEGRAM, "telegram", flint_icon_telegram, 182u},
{UI_ICON_TYPE_TEXT, "text", flint_icon_text, 216u},
+98
View File
@@ -0,0 +1,98 @@
#include "flint_transition.h"
#include <stddef.h>
void
flint_transition_reset(FlintTransition *transition)
{
if(transition == NULL)
return;
transition->active = 0;
transition->phase = FLINT_TRANSITION_NONE;
transition->ticks = 0;
transition->duration = 0;
}
void
flint_transition_begin(FlintTransition *transition, int duration)
{
if(transition == NULL)
return;
if(duration <= 0)
duration = 1;
transition->active = 1;
transition->phase = FLINT_TRANSITION_OUT;
transition->ticks = 0;
transition->duration = duration;
}
void
flint_transition_reverse_to_out(FlintTransition *transition)
{
if(transition == NULL || !transition->active)
return;
if(transition->phase == FLINT_TRANSITION_IN) {
transition->phase = FLINT_TRANSITION_OUT;
transition->ticks = transition->duration - transition->ticks;
if(transition->ticks < 0)
transition->ticks = 0;
}
}
float
flint_transition_alpha(const FlintTransition *transition)
{
float progress;
if(transition == NULL || !transition->active || transition->duration <= 0)
return 0.0f;
progress = (float)transition->ticks / (float)transition->duration;
if(progress < 0.0f)
progress = 0.0f;
if(progress > 1.0f)
progress = 1.0f;
if(transition->phase == FLINT_TRANSITION_OUT)
return progress;
if(transition->phase == FLINT_TRANSITION_IN)
return 1.0f - progress;
return 0.0f;
}
int
flint_transition_step(FlintTransition *transition)
{
if(transition == NULL || !transition->active)
return FLINT_TRANSITION_NONE;
transition->ticks++;
if(transition->ticks < transition->duration)
return FLINT_TRANSITION_NONE;
if(transition->phase == FLINT_TRANSITION_OUT) {
transition->phase = FLINT_TRANSITION_IN;
transition->ticks = 0;
return FLINT_TRANSITION_OUT;
}
flint_transition_reset(transition);
return FLINT_TRANSITION_IN;
}
void
flint_transition_draw_fade(const FlintTransition *transition,
int width, int height, Color color)
{
int alpha;
if(transition == NULL || !transition->active)
return;
alpha = (int)(flint_transition_alpha(transition) * 255.0f);
if(alpha <= 0)
return;
if(alpha > 255)
alpha = 255;
color.a = (unsigned char)(((int)color.a * alpha) / 255);
if(color.a == 0)
return;
DrawRectangle(0, 0, width, height, color);
}
+2 -2
View File
@@ -3,7 +3,7 @@
int
ui_bottom_nav_height(void)
{
return flint_px(46);
return flint_px(40);
}
FlintUIBottomNavResult
@@ -14,7 +14,7 @@ ui_draw_bottom_nav(FlintUIBottomNav nav)
int height = nav.height > 0 ? nav.height : ui_bottom_nav_height();
int bottom_margin = nav.bottom_margin > 0 ? nav.bottom_margin : 0;
int side_margin = nav.side_margin > 0 ? nav.side_margin : 0;
int icon_size = nav.icon_size > 0 ? nav.icon_size : flint_px(24);
int icon_size = nav.icon_size > 0 ? nav.icon_size : flint_px(22);
int y = nav.view_height - bottom_margin - height;
int available_w = nav.view_width - side_margin * 2;
int tab_w;
+12
View File
@@ -763,3 +763,15 @@ Položka 8
[reset_button]
Obnovit
---
[practice_guide_dropdown]
Zde si vyberte praxi.
---
[practice_guide_manual]
Pred zahajenim praxe si prectete navod, abyste porozumeli celemu cviceni.
---
[practice_guide_sun]
Az budete pripraveni zacit cviceni, pouzijte kartu se sluncem.
---
[practice_guide_config]
Upravte konfiguraci praxe podle svych potreb.
---
+12
View File
@@ -763,3 +763,15 @@ Eintrag 8
[reset_button]
Zurücksetzen
---
[practice_guide_dropdown]
Wahle hier deine Praxis aus.
---
[practice_guide_manual]
Lies das Tutorial, bevor du eine Praxis startest, damit du die ganze Uebung verstehst.
---
[practice_guide_sun]
Nutze den Sonnen-Tab, wenn du bereit bist, die Uebung zu starten.
---
[practice_guide_config]
Passe die Konfiguration der Praxis an deine Anforderungen an.
---
+12
View File
@@ -764,3 +764,15 @@ Item 8
[reset_button]
Reset
---
[practice_guide_dropdown]
Choose your practice here.
---
[practice_guide_manual]
Read the tutorial before starting a practice so you understand the full exercise.
---
[practice_guide_sun]
Use the sun tab when you are ready to start the exercise.
---
[practice_guide_config]
Change the practice configuration to meet your standards.
---
+12
View File
@@ -763,3 +763,15 @@ Elemento 8
[reset_button]
Restablecer
---
[practice_guide_dropdown]
Elige tu practica aqui.
---
[practice_guide_manual]
Lee el tutorial antes de iniciar una practica para entender todo el ejercicio.
---
[practice_guide_sun]
Usa la pestana del sol cuando estes listo para iniciar el ejercicio.
---
[practice_guide_config]
Cambia la configuracion de la practica segun tus necesidades.
---
+12
View File
@@ -763,3 +763,15 @@ Ajouter un élément
[reset_button]
Réinitialiser
---
[practice_guide_dropdown]
Choisissez votre pratique ici.
---
[practice_guide_manual]
Lisez le tutoriel avant de commencer une pratique afin de comprendre tout l'exercice.
---
[practice_guide_sun]
Utilisez l'onglet soleil lorsque vous etes pret a commencer l'exercice.
---
[practice_guide_config]
Modifiez la configuration de la pratique selon vos besoins.
---
+12
View File
@@ -763,3 +763,15 @@ Item 8
[reset_button]
Reset
---
[practice_guide_dropdown]
Pilih praktik Anda di sini.
---
[practice_guide_manual]
Baca tutorial sebelum memulai praktik agar Anda memahami seluruh latihan.
---
[practice_guide_sun]
Gunakan tab matahari saat Anda siap memulai latihan.
---
[practice_guide_config]
Ubah konfigurasi praktik agar sesuai dengan kebutuhan Anda.
---
+12
View File
@@ -761,3 +761,15 @@ Elemento 8
[reset_button]
Ripristina
---
[practice_guide_dropdown]
Scegli qui la tua pratica.
---
[practice_guide_manual]
Leggi il tutorial prima di iniziare una pratica per capire l'esercizio completo.
---
[practice_guide_sun]
Usa la scheda con il sole quando sei pronto per iniziare l'esercizio.
---
[practice_guide_config]
Modifica la configurazione della pratica in base alle tue esigenze.
---
+12
View File
@@ -763,3 +763,15 @@ https:// または localhost:8080 のようなループバックを使用して
[reset_button]
リセット
---
[practice_guide_dropdown]
ここで練習を選びます。
---
[practice_guide_manual]
練習を始める前にチュートリアルを読んで、エクササイズ全体を理解してください。
---
[practice_guide_sun]
エクササイズを始める準備ができたら、太陽タブを使います。
---
[practice_guide_config]
自分に合うように練習の設定を変更できます。
---
+12
View File
@@ -760,3 +760,15 @@ https:// 또는 localhost:8080 같은 루프백을 사용하세요
[reset_button]
초기화
---
[practice_guide_dropdown]
여기에서 연습을 선택하세요.
---
[practice_guide_manual]
연습을 시작하기 전에 튜토리얼을 읽고 전체 운동을 이해하세요.
---
[practice_guide_sun]
운동을 시작할 준비가 되면 태양 탭을 사용하세요.
---
[practice_guide_config]
필요에 맞게 연습 설정을 변경하세요.
---
+12
View File
@@ -763,3 +763,15 @@ Item 8
[reset_button]
Redefinir
---
[practice_guide_dropdown]
Escolha a sua pratica aqui.
---
[practice_guide_manual]
Leia o tutorial antes de iniciar uma pratica para entender o exercicio completo.
---
[practice_guide_sun]
Use a aba do sol quando estiver pronto para iniciar o exercicio.
---
[practice_guide_config]
Altere a configuracao da pratica de acordo com as suas necessidades.
---
+12
View File
@@ -764,3 +764,15 @@ liboqs не собран для этой платформы.
[reset_button]
Сбросить
---
[practice_guide_dropdown]
Выберите практику здесь.
---
[practice_guide_manual]
Прочитайте руководство перед началом практики, чтобы понять упражнение полностью.
---
[practice_guide_sun]
Используйте вкладку с солнцем, когда будете готовы начать упражнение.
---
[practice_guide_config]
Измените настройки практики под свои требования.
---
+12
View File
@@ -761,3 +761,15 @@ Wim Hof 屏息轮次
[reset_button]
重置
---
[practice_guide_dropdown]
在这里选择你的练习。
---
[practice_guide_manual]
开始练习前请先阅读教程,了解完整的练习流程。
---
[practice_guide_sun]
准备开始练习时,请使用太阳标签。
---
[practice_guide_config]
根据你的需要调整练习配置。
---
+112 -114
View File
@@ -63,6 +63,10 @@ InbeApp *get_global_inbe_app(void);
#define INBE_SYNC_SERVER_URL_KEY "sync_server_url"
#define INBE_SYNC_INPUT_QUIET_SECONDS 0.45
enum {
APP_SCREEN_TRANSITION_TICKS = 8
};
InbeConfig config = {
.title = "Inner Breeze",
.width = INBE_DEFAULT_WIDTH,
@@ -488,7 +492,7 @@ int view_height = INBE_DEFAULT_HEIGHT;
static int app_full_view_width = INBE_DEFAULT_WIDTH;
/* Theme colors are now accessed via theme accessor functions */
static void
void
app_leave_practice_config(InbeApp *app)
{
if(app == NULL)
@@ -503,19 +507,71 @@ app_leave_practice_config(InbeApp *app)
app->settings_scroll = 0;
}
void
app_switch_screen(InbeApp *app, int screen)
{
if(app == NULL)
return;
if(app->inbe.screen == screen &&
(!app->screen_transition.active ||
app->screen_transition_target == screen))
return;
app->screen_transition_target = screen;
if(app->screen_transition.active) {
if(app->inbe.screen != screen)
flint_transition_reverse_to_out(&app->screen_transition);
return;
}
flint_transition_begin(&app->screen_transition, APP_SCREEN_TRANSITION_TICKS);
}
static void
app_advance_screen_transition(InbeApp *app)
{
int completed_phase;
if(app == NULL)
return;
completed_phase = flint_transition_step(&app->screen_transition);
if(completed_phase == FLINT_TRANSITION_OUT)
app->inbe.screen = app->screen_transition_target;
else if(completed_phase == FLINT_TRANSITION_IN)
app->screen_transition_target = app->inbe.screen;
}
static void
app_observe_direct_screen_change(InbeApp *app, int before_screen)
{
if(app == NULL || app->screen_transition.active ||
before_screen == app->inbe.screen)
return;
app->screen_transition = (FlintTransition){
.active = 1,
.phase = FLINT_TRANSITION_IN,
.ticks = 0,
.duration = APP_SCREEN_TRANSITION_TICKS
};
app->screen_transition_target = app->inbe.screen;
}
static void
app_open_main_tab(InbeApp *app, int main_tab, int persist)
{
if(app == NULL)
return;
if(app->inbe.screen == InbeScreenPracticeConfig)
if(app->practice_tab == PRACTICE_TAB_CONFIG)
app_leave_practice_config(app);
app->main_tab = clampi(main_tab, APP_MAIN_TAB_HABITS, APP_MAIN_TAB_PRACTICE);
app->inbe.screen = app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart;
if(app->main_tab == APP_MAIN_TAB_PRACTICE)
app->practice_tab = PRACTICE_TAB_PLAY;
app_switch_screen(app, app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart);
if(persist)
save_settings(app);
}
@@ -581,12 +637,12 @@ app_apply_sidebar_route(InbeApp *app, int route)
: HABIT_TAB_MONTHLY;
break;
case APP_NAV_ROUTE_SETTINGS:
if(app->inbe.screen == InbeScreenPracticeConfig)
if(app->practice_tab == PRACTICE_TAB_CONFIG)
app_leave_practice_config(app);
reset_settings_preview(app);
app->settings_tab = SETTINGS_TAB_DEVICE;
app->settings_scroll = 0;
app->inbe.screen = InbeScreenSettings;
app_switch_screen(app, InbeScreenSettings);
app_schedule_settings_save(app);
break;
default:
@@ -632,7 +688,8 @@ app_toolbar_height(void)
int
app_content_top_reserved(const InbeApp *app)
{
(void)app;
if(app != NULL && app->inbe.screen == InbeScreenStart)
return app_toolbar_height() + flint_px(PRACTICE_CATEGORY_TAB_H);
return app_toolbar_height();
}
@@ -774,8 +831,7 @@ app_nav_route_active(const InbeApp *app, int route)
if(app == NULL)
return 0;
if(route == APP_NAV_ROUTE_PRACTICE)
return app->inbe.screen == InbeScreenStart ||
app->inbe.screen == InbeScreenPracticeConfig;
return app->inbe.screen == InbeScreenStart;
if(route == APP_NAV_ROUTE_HABITS)
return app->inbe.screen == InbeScreenHabits ||
app->inbe.screen == InbeScreenHabitEdit ||
@@ -1367,7 +1423,11 @@ app_init(void *vapp) {
app->sidebar_open = 0;
app->pending_sidebar_route = APP_NAV_ROUTE_NONE;
app_bottom_nav_normalize(app);
app_open_main_tab(app, app->main_tab, 0);
flint_transition_reset(&app->screen_transition);
app->inbe.screen = app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart;
app->screen_transition_target = app->inbe.screen;
init_audio(app);
for(int i = 0; i < practice_count(); i++) {
const PracticeDefinition *practice = practice_get(i);
@@ -1398,6 +1458,7 @@ app_init(void *vapp) {
app->inbe.screen = InbeScreenLanguage;
else
app->inbe.screen = InbeScreenStart;
app->screen_transition_target = app->inbe.screen;
app->modal = (UIModal){0};
app->meditation.duration_seconds = 0;
@@ -1488,19 +1549,31 @@ handle_back_button(InbeApp *app)
}
switch(app->inbe.screen) {
case InbeScreenStart:
if(app->practice_tab == PRACTICE_TAB_CONFIG)
app_leave_practice_config(app);
if(app->practice_tab != PRACTICE_TAB_PLAY) {
app->practice_tab = PRACTICE_TAB_PLAY;
app->manual_scroll = 0;
app->settings_scroll = 0;
app->tutorial_step = 0;
break;
}
break;
case InbeScreenSettings:
if(app->settings_dirty)
save_settings(app);
settings_screen_clear_status();
app->inbe.screen = app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart;
app_switch_screen(app, app->main_tab == APP_MAIN_TAB_HABITS
? InbeScreenHabits
: InbeScreenStart);
app->settings_scroll = 0;
break;
case InbeScreenPracticeConfig:
app_leave_practice_config(app);
app->inbe.screen = InbeScreenStart;
app_switch_screen(app, InbeScreenStart);
break;
case InbeScreenHabits:
@@ -1508,17 +1581,17 @@ handle_back_button(InbeApp *app)
habit_edit_commit(app);
break;
}
app->inbe.screen = InbeScreenStart;
app_switch_screen(app, InbeScreenStart);
break;
case InbeScreenHabitEdit:
habit_edit_cancel(app);
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
break;
case InbeScreenHabitSessionEdit:
habit_session_cancel_edit(app);
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
break;
case InbeScreenLanguage:
@@ -1559,7 +1632,6 @@ handle_back_button(InbeApp *app)
}
break;
case InbeScreenStart:
default:
break;
}
@@ -1663,6 +1735,7 @@ updateapp(InbeApp *app)
int center_x = view_width / 2;
int center_y = view_height / 2;
int hover = 0;
int frame_screen = app->inbe.screen;
app_apply_pending_sidebar_route(app);
for(int i = 0; i < practice_count(); i++) {
@@ -1672,6 +1745,7 @@ updateapp(InbeApp *app)
}
if(app->practice_coming_soon_ticks > 0)
app->practice_coming_soon_ticks--;
practice_screen_prepare_first_run_guide(app);
if(IsKeyPressed(KEY_BACK)) {
if(app->modal.active) {
@@ -1688,23 +1762,11 @@ updateapp(InbeApp *app)
goto finish_frame;
}
if(app->inbe.screen == InbeScreenPracticeConfig) {
const PracticeDefinition *practice = practice_get(app->exercise_type);
if(practice->draw_config != NULL)
practice->draw_config(app);
goto finish_frame;
}
if(app->inbe.screen == InbeScreenLanguage) {
language_screen_draw(app);
goto finish_frame;
}
if(app->inbe.screen == InbeScreenManual) {
manual_screen_draw(app);
goto finish_frame;
}
if(app->inbe.screen == InbeScreenHabits) {
draw_habits_screen(app);
goto finish_frame;
@@ -1720,7 +1782,7 @@ updateapp(InbeApp *app)
goto finish_frame;
}
if(app->inbe.screen == InbeScreenStart) {
if(app->inbe.screen == InbeScreenStart && app->practice_tab == PRACTICE_TAB_PLAY) {
practice_update_circle_bounds(app, app_content_top_reserved(app),
app_content_bottom_reserved(app));
} else if(app->inbe.screen == InbeScreenSession) {
@@ -1728,7 +1790,7 @@ updateapp(InbeApp *app)
}
int play_circle_clicked = 0;
if(app->inbe.screen == InbeScreenStart)
if(app->inbe.screen == InbeScreenStart && app->practice_tab == PRACTICE_TAB_PLAY)
play_circle_clicked = practice_draw_start_preview(app, center_x, center_y);
else if(app->inbe.screen == InbeScreenSession)
practice_draw_active_breathing(app, center_x, center_y);
@@ -1737,90 +1799,21 @@ updateapp(InbeApp *app)
switch (app->inbe.screen) {
case InbeScreenStart:
{
const char *exercise_options[EXERCISE_COUNT];
int exercise_values[EXERCISE_COUNT];
FlintUIToolbarAction toolbar_actions[2];
FlintUIToolbarHeaderResult header_result;
FlintUIToolbarResult menu_result;
int activity_count;
int activity_index;
int exercise_changed = 0;
practice_screen_draw_top_bar(app, 0);
activity_count = EXERCISE_COUNT;
for(int i = 0; i < activity_count; i++) {
exercise_values[i] = i;
exercise_options[i] = practice_activity_label(exercise_values[i]);
}
activity_index = clampi(app->exercise_type, 0, EXERCISE_COUNT - 1);
toolbar_actions[0] = (FlintUIToolbarAction){
app->icons[UI_ICON_TYPE_MANUAL],
app->modal.active
};
toolbar_actions[1] = (FlintUIToolbarAction){
app->icons[UI_ICON_TYPE_WRENCH],
app->modal.active
};
header_result = ui_draw_toolbar_header((FlintUIToolbarHeader){
.leading_icon = (Texture2D){0},
.toolbar = (FlintUIToolbar){
.id = 300,
.height = flint_px(58),
.options = app->modal.active ? NULL : exercise_options,
.option_count = app->modal.active ? 0 : activity_count,
.selected_index = &activity_index,
.dropdown_min_width = flint_px(160),
.dropdown_max_width = flint_px(230),
.dropdown_height = flint_px(36),
.actions = toolbar_actions,
.action_count = 2,
.action_icon_size = flint_px(20),
.action_icon_padding = flint_px(8),
.action_gap = flint_px(8),
.side_padding = flint_px(12)
}
});
if(APP_SIDEBAR_ENABLED && header_result.leading_clicked)
app->sidebar_open = 1;
if(header_result.toolbar.clicked_action == 0) {
app->tutorial_step = 0;
app->manual_scroll = 0;
app->inbe.screen = InbeScreenManual;
}
if(header_result.toolbar.clicked_action == 1) {
reset_settings_preview(app);
app->settings_scroll = 0;
app->practice_config_tab = 0;
app->inbe.screen = InbeScreenPracticeConfig;
if(app->practice_tab == PRACTICE_TAB_MANUAL) {
manual_screen_draw(app);
} else if(app->practice_tab == PRACTICE_TAB_CONFIG) {
const PracticeDefinition *practice = practice_get(app->exercise_type);
if(practice->draw_config != NULL)
practice->draw_config(app);
} else if(!app->modal.active && app->tutorial_seen && play_circle_clicked) {
const PracticeDefinition *practice = practice_get(app->exercise_type);
if(practice->start != NULL)
practice->start(app);
}
if(!app->modal.active && play_circle_clicked) {
if(!exercise_manual_seen(app, app->exercise_type)) {
app->tutorial_step = 0;
app->manual_scroll = 0;
app->inbe.screen = InbeScreenManual;
} else {
const PracticeDefinition *practice = practice_get(app->exercise_type);
if(practice->start != NULL)
practice->start(app);
}
}
menu_result = ui_draw_toolbar_header((FlintUIToolbarHeader){
.toolbar = (FlintUIToolbar){
.id = 300,
.draw_menu = 1,
.options = exercise_options,
.option_count = activity_count,
.selected_index = &activity_index
}
}).toolbar;
if(!app->modal.active && menu_result.selected_menu_item >= 0) {
app->exercise_type = exercise_values[activity_index];
exercise_changed = 1;
}
if(exercise_changed)
save_settings(app);
practice_screen_draw_top_bar(app, 1);
}
if(app->modal.active && app->modal.type == UIModalMeditationSetup) {
const PracticeDefinition *practice = practice_get(PRACTICE_MEDITATION);
@@ -1849,8 +1842,13 @@ updateapp(InbeApp *app)
finish_frame:
app_draw_bottom_nav(app);
practice_screen_draw_first_run_guide(app);
draw_global_modal(app);
app_flush_deferred_settings(app);
app_observe_direct_screen_change(app, frame_screen);
flint_transition_draw_fade(&app->screen_transition, view_width, view_height,
(Color){0, 0, 0, 255});
app_advance_screen_transition(app);
app->inbe.frame++;
}
+13
View File
@@ -5,6 +5,7 @@
#include "breath_engine.h"
#include "app_fwd.h"
#include "flint_runtime_assets.h"
#include "flint_transition.h"
#include "ui_icon_types.h"
#include "screens/habits_screen.h"
@@ -51,6 +52,13 @@ enum {
PRACTICE_CATEGORY_COUNT
};
enum {
PRACTICE_TAB_MANUAL = 0,
PRACTICE_TAB_PLAY,
PRACTICE_TAB_CONFIG,
PRACTICE_TAB_COUNT
};
typedef enum {
UIModalNone,
UIModalConfirmExitSession,
@@ -255,10 +263,13 @@ struct InbeApp {
int show_session_volume_control;
int hold_display_mode;
int exercise_type;
int practice_tab;
int practice_config_tab;
int practice_category_tab;
int practice_coming_soon_ticks;
int previous_screen;
FlintTransition screen_transition;
int screen_transition_target;
int session_paused;
int backgrounded;
int results_saved;
@@ -274,6 +285,8 @@ struct InbeApp {
void app_init(void *app);
void app_update_draw(void *app, Rectangle viewport);
void app_destroy(void *app);
void app_switch_screen(InbeApp *app, int screen);
void app_leave_practice_config(InbeApp *app);
int app_draw_sidebar_toggle(InbeApp *app, int x, int y);
int app_content_top_reserved(const InbeApp *app);
int app_content_bottom_reserved(const InbeApp *app);
+2 -2
View File
@@ -3,7 +3,7 @@
#define INBE_VERSION_MAJOR 1
#define INBE_VERSION_MINOR 4
#define INBE_VERSION_PATCH 6
#define INBE_VERSION_STRING "1.4.6"
#define INBE_VERSION_PATCH 7
#define INBE_VERSION_STRING "1.4.7"
#endif
+13 -10
View File
@@ -31,19 +31,22 @@ meditation_config_scroll_page_content_height(int content_w, void *user_data)
void
meditation_config_screen_draw(InbeApp *app)
{
int title_h = ui_screen_header_height();
int integrated = app->inbe.screen == InbeScreenStart;
int title_h = integrated ? app_content_top_reserved(app) : ui_screen_header_height();
int scroll_y;
int scroll_h;
FlintUIHeader header;
header = ui_draw_title_header(title_h, locale_get("practice_config_title"),
(Texture2D){0}, app->icons[UI_ICON_TYPE_X]);
if(header.right_clicked) {
if(app->settings_dirty)
save_settings(app);
meditation_practice_leave_config(app);
app->settings_scroll = 0;
app->inbe.screen = InbeScreenStart;
if(!integrated) {
FlintUIHeader header = ui_draw_title_header(title_h, locale_get("practice_config_title"),
(Texture2D){0}, app->icons[UI_ICON_TYPE_X]);
if(header.right_clicked) {
if(app->settings_dirty)
save_settings(app);
meditation_practice_leave_config(app);
app->settings_scroll = 0;
app->practice_tab = PRACTICE_TAB_PLAY;
app_switch_screen(app, InbeScreenStart);
}
}
scroll_y = title_h + flint_px(16);
+26 -103
View File
@@ -2,7 +2,7 @@
#include "app.h"
#include "flint_locale.h"
#include "meditation_music.h"
#include "screens/manual_screen.h"
#include "theme.h"
#include "flint_ui.h"
#include "raylib.h"
@@ -11,7 +11,7 @@ extern int view_width;
extern int view_height;
enum {
MEDITATION_MANUAL_PAGES = 2
MEDITATION_MANUAL_PAGES = 1
};
static void
@@ -32,7 +32,8 @@ meditation_manual_close(InbeApp *app, int mark_seen)
mark_exercise_manual_seen(app, EXERCISE_MEDITATION);
app->tutorial_step = 0;
app->manual_scroll = 0;
app->inbe.screen = InbeScreenStart;
app->practice_tab = PRACTICE_TAB_PLAY;
app_switch_screen(app, InbeScreenStart);
}
static void
@@ -76,66 +77,41 @@ intro_page_height(int content_w)
flint_px(20);
}
static int
settings_page_height(InbeApp *app, int content_w)
{
FlintUIParagraph paragraph = {
.text = locale_get("meditation_manual_text"),
.icon = (Texture2D){0},
.icon_type = UI_ICON_TYPE_NONE,
.icon_size = 0,
.width = content_w,
.font = flint_ui_font(),
.line_gap = flint_px(8),
.color = theme_get_text(),
};
return meditation_music_measure_settings(app, content_w, 0, 1) +
flint_px(34) + flint_ui_paragraph_height(paragraph) + flint_px(20);
}
typedef struct MeditationManualScrollPageContext {
InbeApp *app;
int page;
} MeditationManualScrollPageContext;
static int
meditation_manual_scroll_page_content_height(int content_w, void *user_data)
{
MeditationManualScrollPageContext *ctx = user_data;
return ctx->page == 0 ? intro_page_height(content_w)
: settings_page_height(ctx->app, content_w);
(void)user_data;
return intro_page_height(content_w);
}
void
meditation_manual_draw(InbeApp *app)
{
int title_h = ui_screen_header_height();
int button_h = flint_px(36);
int footer_y = view_height - flint_px(42);
int integrated = app->inbe.screen == InbeScreenStart;
int title_h = integrated ? app_content_top_reserved(app) : ui_screen_header_height();
int nav_h = MEDITATION_MANUAL_PAGES > 1 ? manual_screen_guide_nav_height() : 0;
int nav_y = view_height - app_content_bottom_reserved(app) - nav_h;
int content_y = title_h + flint_px(16);
int content_h = footer_y - content_y - flint_px(28);
int content_h = nav_y - content_y - flint_px(16);
int responsive_max_w = (int)(view_width * 0.90f);
int max_content_w = flint_px(520);
int page = clampi(app->tutorial_step, 0, MEDITATION_MANUAL_PAGES - 1);
int content_x = 0;
int content_w = 0;
if(responsive_max_w > max_content_w)
responsive_max_w = max_content_w;
if(responsive_max_w < flint_px(280))
responsive_max_w = flint_px(280);
app->tutorial_step = page;
if(ui_draw_screen_header(locale_get("meditation_manual_title"), 1))
page = manual_screen_guide_update_page(app, MEDITATION_MANUAL_PAGES,
meditation_manual_start,
meditation_manual_close);
if(!integrated && ui_draw_screen_header(locale_get("meditation_manual_title"), 1))
meditation_manual_close(app, 0);
if(content_h < flint_px(120))
content_h = flint_px(120);
{
MeditationManualScrollPageContext page_ctx = {app, page};
FlintUIScrollPage scroll_page = ui_scroll_page_begin((FlintUIScrollPageSpec){
.y = content_y,
.height = content_h,
@@ -143,76 +119,23 @@ meditation_manual_draw(InbeApp *app)
.min_content_width = flint_px(280),
.scroll_offset = &app->manual_scroll,
.content_height = meditation_manual_scroll_page_content_height,
.user_data = &page_ctx
.user_data = NULL
});
int y = scroll_page.content_y;
content_x = scroll_page.content_x;
content_w = scroll_page.content_w;
if(page == 0) {
draw_intro_page(app, content_x, content_w, &y);
} else {
FlintUIParagraph paragraph;
meditation_music_draw_settings(app, content_x, content_w,
&y, 0, 1);
y += flint_px(34);
paragraph = (FlintUIParagraph){
.text = locale_get("meditation_manual_text"),
.icon = (Texture2D){0},
.icon_type = UI_ICON_TYPE_NONE,
.icon_size = 0,
.width = content_w,
.font = flint_ui_font(),
.line_gap = flint_px(8),
.color = theme_get_text(),
};
flint_ui_paragraph_draw(paragraph, content_x, &y);
}
draw_intro_page(app, scroll_page.content_x, scroll_page.content_w, &y);
ui_scroll_page_end(scroll_page);
}
if(page == 1)
meditation_music_draw_dropdown_menu(app);
{
int gap = flint_px(10);
int manual_seen = exercise_manual_seen(app, EXERCISE_MEDITATION);
int show_left = page > 0 || manual_seen;
const char *left = page == 0 ? locale_get("tutorial_skip_button")
: locale_get("tutorial_back_button");
const char *right = page == 0 ? locale_get("tutorial_next_button")
: locale_get("tutorial_start_button");
FlintUIButtonRowItem buttons[2] = {
{left, UI_BUTTON_STYLE_PRIMARY, 0},
{right, UI_BUTTON_STYLE_PRIMARY, 0}
};
int clicked;
clicked = ui_draw_button_row((FlintUIButtonRow){
.x = content_x,
.y = footer_y,
.width = content_w,
.height = button_h,
.gap = gap,
.items = show_left ? buttons : &buttons[1],
.count = show_left ? 2 : 1
});
if(clicked == 0 && show_left) {
if(page == 0)
meditation_manual_start(app);
else {
app->tutorial_step = 0;
app->manual_scroll = 0;
}
} else if(clicked == (show_left ? 1 : 0)) {
if(page == 0) {
app->tutorial_step = 1;
app->manual_scroll = 0;
} else {
meditation_manual_start(app);
}
}
}
manual_screen_guide_draw_nav(app, (ManualGuideNav){
.page = page,
.page_count = MEDITATION_MANUAL_PAGES,
.y = nav_y,
.h = nav_h,
.show_left_on_first = exercise_manual_seen(app, EXERCISE_MEDITATION),
.start = meditation_manual_start,
.close = meditation_manual_close
});
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT) && app->settings_dirty)
save_settings(app);
@@ -28,7 +28,7 @@ meditation_practice_start(InbeApp *app)
app->modal.active = 1;
app->modal.type = UIModalMeditationSetup;
app->modal.selected_button = 0;
app->inbe.screen = InbeScreenStart;
app_switch_screen(app, InbeScreenStart);
}
void
@@ -39,7 +39,7 @@ meditation_start(InbeApp *app, int seconds)
app->volume_popup_active = 0;
app->modal.active = 0;
app->modal.type = UIModalNone;
app->inbe.screen = InbeScreenMeditation;
app_switch_screen(app, InbeScreenMeditation);
app_play_sound(app, app->bell_sound, 1.0f);
meditation_music_start_session(app);
}
@@ -68,7 +68,7 @@ meditation_finish(InbeApp *app)
app->session_paused = 0;
app->volume_popup_active = 0;
meditation_music_stop(app);
app->inbe.screen = InbeScreenStart;
app_switch_screen(app, InbeScreenStart);
}
void
@@ -141,7 +141,7 @@ meditation_exit_to_start(InbeApp *app)
app->volume_popup_active = 0;
app->modal.active = 0;
app->modal.type = UIModalNone;
app->inbe.screen = InbeScreenStart;
app_switch_screen(app, InbeScreenStart);
}
void
+12 -9
View File
@@ -325,7 +325,8 @@ whm_config_scroll_page_content_height(int content_w, void *user_data)
void
whm_config_screen_draw(InbeApp *app)
{
int title_h = ui_screen_header_height();
int integrated = app->inbe.screen == InbeScreenStart;
int title_h = integrated ? app_content_top_reserved(app) : ui_screen_header_height();
int config_tab_h = flint_px(40);
int config_tab_gap = flint_px(14);
int scroll_y;
@@ -336,20 +337,22 @@ whm_config_screen_draw(InbeApp *app)
locale_get("settings_section_breathing"),
locale_get("settings_section_session"),
};
FlintUIHeader header;
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
app->settings_drag_slider = 0;
if(app->practice_config_tab < 0 || app->practice_config_tab > 1)
app->practice_config_tab = 0;
header = ui_draw_title_header(title_h, locale_get("practice_config_title"),
(Texture2D){0}, app->icons[UI_ICON_TYPE_X]);
if(header.right_clicked) {
if(app->settings_dirty)
save_settings(app);
app->settings_scroll = 0;
app->inbe.screen = InbeScreenStart;
if(!integrated) {
FlintUIHeader header = ui_draw_title_header(title_h, locale_get("practice_config_title"),
(Texture2D){0}, app->icons[UI_ICON_TYPE_X]);
if(header.right_clicked) {
if(app->settings_dirty)
save_settings(app);
app->settings_scroll = 0;
app->practice_tab = PRACTICE_TAB_PLAY;
app_switch_screen(app, InbeScreenStart);
}
}
clicked_config_tab = whm_draw_subtab_bar(title_h, config_tab_h, config_tabs, 2,
+35 -78
View File
@@ -1,5 +1,6 @@
#include "whm_practice.h"
#include "app.h"
#include "screens/manual_screen.h"
#include "whm_session.h"
#include "flint_locale.h"
#include "theme.h"
@@ -153,7 +154,8 @@ whm_manual_close(InbeApp *app, int mark_seen)
mark_exercise_manual_seen(app, EXERCISE_WIM_HOF);
app->tutorial_step = 0;
app->manual_scroll = 0;
app->inbe.screen = InbeScreenStart;
app->practice_tab = PRACTICE_TAB_PLAY;
app_switch_screen(app, InbeScreenStart);
}
static void
@@ -168,39 +170,21 @@ manual_screen_start_exercise(InbeApp *app)
void
whm_manual_draw(InbeApp *app)
{
int title_h = ui_screen_header_height();
int tab_h = flint_px(56);
int viewport_h = view_height - title_h - tab_h;
int integrated = app->inbe.screen == InbeScreenStart;
int title_h = integrated ? app_content_top_reserved(app) : ui_screen_header_height();
int nav_h = manual_screen_guide_nav_height();
int nav_y = view_height - app_content_bottom_reserved(app) - nav_h;
int content_y = title_h;
int viewport_h = nav_y - content_y;
int body_font = flint_ui_font();
int footer_content_pad = flint_ui_font() / 2;
int content_area_h = viewport_h - footer_content_pad; /* For scissor mode and scroll calculations */
int previous_step;
int content_x = 0;
int content_w = 0;
const char *title = locale_get("tutorial_title");
int close_clicked = 0;
int step = app->tutorial_step;
step = clampi(step, 0, (int)TUTORIAL_STEPS_COUNT - 1);
app->tutorial_step = step;
previous_step = step;
if(IsKeyPressed(KEY_RIGHT) || IsKeyPressed(KEY_ENTER)) {
if(step < (int)TUTORIAL_STEPS_COUNT - 1)
app->tutorial_step++;
else
manual_screen_start_exercise(app);
}
if(IsKeyPressed(KEY_LEFT) && step > 0)
app->tutorial_step--;
if(IsKeyPressed(KEY_ESCAPE))
whm_manual_close(app, 0);
step = app->tutorial_step;
if(previous_step != step) {
app->manual_scroll = 0;
previous_step = step;
}
step = manual_screen_guide_update_page(app, (int)TUTORIAL_STEPS_COUNT,
manual_screen_start_exercise,
whm_manual_close);
switch(step) {
case 1: title = locale_get("tutorial_method_title"); break;
@@ -210,8 +194,7 @@ whm_manual_draw(InbeApp *app)
default: break;
}
close_clicked = ui_draw_screen_header(title, 1);
if(close_clicked)
if(!integrated && ui_draw_screen_header(title, 1))
whm_manual_close(app, 0);
{
@@ -228,7 +211,7 @@ whm_manual_draw(InbeApp *app)
page_ctx = (WhmManualScrollPageContext){app, step, body_font, top_padding};
page = ui_scroll_page_begin((FlintUIScrollPageSpec){
.y = title_h,
.y = content_y,
.height = content_area_h,
.max_content_width = responsive_max_w,
.min_content_width = flint_px(280),
@@ -237,38 +220,38 @@ whm_manual_draw(InbeApp *app)
.user_data = &page_ctx
});
content_x = page.content_x;
content_w = page.content_w;
int y = page.content_y + top_padding;
if(step == 0) {
int img_h = flint_px(170);
ui_draw_tutorial_image(app->whm.image_1, "practices/whm/1.jpg", content_x, y, content_w, img_h);
ui_draw_tutorial_image(app->whm.image_1, "practices/whm/1.jpg",
page.content_x, y, page.content_w, img_h);
y += img_h + flint_px(22);
draw_tutorial_paragraph(app, 0, content_x, &y, content_w, body_font);
draw_tutorial_paragraph(app, 0, page.content_x, &y, page.content_w, body_font);
} else if(step == 1) {
draw_tutorial_paragraph(app, 1, content_x, &y, content_w, body_font);
draw_tutorial_paragraph(app, 1, page.content_x, &y, page.content_w, body_font);
} else if(step == 2) {
int speed = app->inbe.speed_level;
draw_tutorial_paragraph(app, 2, content_x, &y, content_w, body_font);
draw_tutorial_paragraph(app, 2, page.content_x, &y, page.content_w, body_font);
y += flint_px(20); /* Increased spacing between text and circle */
update_preview_bounds(&app->settings_preview, content_w, flint_px(132));
update_preview_bounds(&app->settings_preview, page.content_w, flint_px(132));
apply_settings(&app->settings_preview, speed, app->inbe.max_rounds,
int_from_count(app->inbe.maxbreaths), app->inbe.pause_seconds);
app->settings_preview.progressive_speed = 0;
inbestep(&app->settings_preview);
if(app->settings_preview.phase != InbePhaseBreathe) {
reset_settings_preview(app);
update_preview_bounds(&app->settings_preview, content_w, flint_px(132));
update_preview_bounds(&app->settings_preview, page.content_w, flint_px(132));
apply_settings(&app->settings_preview, speed, app->inbe.max_rounds,
int_from_count(app->inbe.maxbreaths), app->inbe.pause_seconds);
app->settings_preview.progressive_speed = 0;
}
draw_preview_inbe(&app->settings_preview, content_x + content_w / 2, y + flint_px(40));
draw_preview_inbe(&app->settings_preview,
page.content_x + page.content_w / 2, y + flint_px(40));
y += (int)(app->settings_preview.rmax * 0.72f) + flint_px(54);
if(ui_draw_slider(10, content_x, y, content_w, locale_get("speed_label"), SETTINGS_SPEED_MIN,
if(ui_draw_slider(10, page.content_x, y, page.content_w, locale_get("speed_label"), SETTINGS_SPEED_MIN,
SETTINGS_SPEED_MAX, &speed, "")) {
apply_settings(&app->inbe, speed, app->inbe.max_rounds,
int_from_count(app->inbe.maxbreaths), app->inbe.pause_seconds);
@@ -281,54 +264,28 @@ whm_manual_draw(InbeApp *app)
int hold_preview_radius = flint_px(54);
int hold_preview_extent = hold_preview_radius + flint_px(8) + flint_px(5);
int breath_button_hover = 0;
int center_x = content_x + content_w / 2;
int center_x = page.content_x + page.content_w / 2;
y += hold_preview_extent;
draw_tutorial_hold_preview(app, center_x, y, hold_preview_radius);
y += hold_preview_extent + flint_px(24);
ui_draw_text_btn(center_x, y, locale_get("breath_button"), &breath_button_hover);
y += flint_px(42) + flint_px(18);
draw_tutorial_paragraph(app, 3, content_x, &y, content_w, body_font);
draw_tutorial_paragraph(app, 3, page.content_x, &y, page.content_w, body_font);
} else {
draw_tutorial_paragraph(app, 4, content_x, &y, content_w, body_font);
draw_tutorial_paragraph(app, 4, page.content_x, &y, page.content_w, body_font);
}
ui_scroll_page_end(page);
}
const char *left_label = step == 0 ? locale_get("tutorial_skip_button") : locale_get("tutorial_back_button");
const char *right_label = step == (int)TUTORIAL_STEPS_COUNT - 1 ? locale_get("tutorial_start_button") : locale_get("tutorial_next_button");
int footer_gap = flint_px(10);
int button_h = flint_px(34);
int footer_y = view_height - flint_px(38);
FlintUIButtonRowItem footer_buttons[2] = {
{left_label, UI_BUTTON_STYLE_PRIMARY, 0},
{right_label, UI_BUTTON_STYLE_PRIMARY, 0}
};
int footer_clicked;
footer_clicked = ui_draw_button_row((FlintUIButtonRow){
.x = content_x,
.y = footer_y,
.width = content_w,
.height = button_h,
.gap = footer_gap,
.items = footer_buttons,
.count = 2
manual_screen_guide_draw_nav(app, (ManualGuideNav){
.page = step,
.page_count = (int)TUTORIAL_STEPS_COUNT,
.y = nav_y,
.h = nav_h,
.show_left_on_first = 1,
.start = manual_screen_start_exercise,
.close = whm_manual_close
});
if(footer_clicked == 0) {
if(step == 0)
manual_screen_start_exercise(app);
else {
app->tutorial_step--;
app->manual_scroll = 0;
}
} else if(footer_clicked == 1) {
if(step == (int)TUTORIAL_STEPS_COUNT - 1)
manual_screen_start_exercise(app);
else {
app->tutorial_step++;
app->manual_scroll = 0;
}
}
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
app->settings_drag_slider = 0;
+2 -2
View File
@@ -207,7 +207,7 @@ session_start(InbeApp *app)
app->saved_pause_seconds = app->inbe.pause_seconds;
app->inbe.pause_seconds = 3;
session_update_circle_bounds_for_view(&app->inbe, 0, flint_px(56) + 80);
app->inbe.screen = InbeScreenSession;
app_switch_screen(app, InbeScreenSession);
app->session_paused = 0;
app->results_saved = 0;
app->results_path[0] = '\0';
@@ -334,7 +334,7 @@ finish_round(InbeApp *app)
#ifdef __ANDROID__
android_allow_screen_off();
#endif
app->inbe.screen = InbeScreenResults;
app_switch_screen(app, InbeScreenResults);
} else {
app_init(app);
}
+17 -16
View File
@@ -4,20 +4,21 @@
void
habit_edit_begin_new(InbeApp *app)
{
const char *default_name;
Color default_color = {99, 196, 165, 255};
int created;
if(app == NULL)
return;
app->habit_edit = (HabitEditState){
.active = 1,
.is_new = 1,
.index = -1,
.color = {99, 196, 165, 255},
.sync_mode = INBE_HABIT_SYNC_NONE
};
snprintf(app->habit_edit.text, sizeof(app->habit_edit.text), "%s", locale_get("habit_new_default_name"));
app->habit_edit.cursor = (int)strlen(app->habit_edit.text);
app->habits.tab = HABIT_TAB_EDIT;
app->inbe.screen = InbeScreenHabits;
default_name = locale_get("habit_new_default_name");
created = habits_add_custom(&app->habits, default_name, default_color,
INBE_HABIT_SYNC_NONE, 0);
if(created < 0)
return;
app_auto_sync(app);
habit_edit_begin(app, created);
}
void
@@ -38,7 +39,7 @@ habit_edit_begin(InbeApp *app, int index)
app->habits.items[index].name);
app->habit_edit.cursor = (int)strlen(app->habit_edit.text);
app->habits.tab = HABIT_TAB_EDIT;
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
}
void
@@ -193,7 +194,7 @@ habit_edit_commit(InbeApp *app)
app->habits.tab = app->habits.view_mode == HABIT_VIEW_WEEKLY
? HABIT_TAB_WEEKLY
: HABIT_TAB_MONTHLY;
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
}
static void
@@ -332,7 +333,7 @@ draw_habit_edit_screen(InbeApp *app)
app->habits.tab = app->habits.view_mode == HABIT_VIEW_WEEKLY
? HABIT_TAB_WEEKLY
: HABIT_TAB_MONTHLY;
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
return;
}
@@ -345,7 +346,7 @@ draw_habit_edit_screen(InbeApp *app)
ui_draw_icon_btn_padded(flint_px(12), flint_px(12), flint_px(24),
flint_px(8), app->icons[UI_ICON_TYPE_RETURN], &hover)) {
habit_edit_cancel(app);
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
return;
}
title_font = flint_ui_title_font(title, view_width - flint_px(120));
@@ -399,7 +400,7 @@ draw_habit_edit_screen(InbeApp *app)
habits_delete(&app->habits, index);
app_auto_sync(app);
}
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
}
return;
}
+3 -3
View File
@@ -167,7 +167,7 @@ draw_habit_session_edit_screen(InbeApp *app)
return;
bottom_reserved = app_content_bottom_reserved(app);
if(app->habit_detail_index < 0 || app->habit_detail_index >= app->habits.count) {
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
return;
}
@@ -175,7 +175,7 @@ draw_habit_session_edit_screen(InbeApp *app)
habit_collect_linked_entries(habit, app->habit_detail_day, &ctx);
if(ctx.count <= 0) {
habit_session_cancel_edit(app);
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
return;
}
habit_format_date(app->habit_detail_day, date_text, sizeof(date_text));
@@ -189,7 +189,7 @@ draw_habit_session_edit_screen(InbeApp *app)
app->icons[UI_ICON_TYPE_RETURN], (Texture2D){0});
if(header.left_clicked) {
habit_session_cancel_edit(app);
app->inbe.screen = InbeScreenHabits;
app_switch_screen(app, InbeScreenHabits);
return;
}
+1 -1
View File
@@ -730,7 +730,7 @@ habit_open_linked_edit_page(InbeApp *app, int habit_index, int day_index)
app->habit_session_edit = (HabitSessionEditState){.round = -1};
app->modal.active = 0;
app->modal.type = 0;
app->inbe.screen = InbeScreenHabitSessionEdit;
app_switch_screen(app, InbeScreenHabitSessionEdit);
}
static void
+1 -1
View File
@@ -96,7 +96,7 @@ language_screen_draw(InbeApp *app)
flint_text_draw(locale_get("language_label"), dropdown_x, dropdown_y - flint_px(24), label_font, theme_get_text());
if(ui_draw_text_btn(button_x, button_y, locale_get("next_button"), &next_hover)) {
app->inbe.screen = InbeScreenStart;
app_switch_screen(app, InbeScreenStart);
}
if(language_dropdown_menu(app, 200))
+136
View File
@@ -1,7 +1,13 @@
#include "manual_screen.h"
#include "app.h"
#include "flint_locale.h"
#include "flint_ui.h"
#include "practices/practice_registry.h"
#include "theme.h"
#include <stdio.h>
extern int view_width;
void
manual_screen_reset_layouts(InbeApp *app)
@@ -11,6 +17,136 @@ manual_screen_reset_layouts(InbeApp *app)
app->manual_scroll = 0;
}
int
manual_screen_guide_update_page(InbeApp *app, int page_count,
ManualGuideStartFn start,
ManualGuideCloseFn close)
{
int page;
int previous_page;
if(app == NULL || page_count <= 0)
return 0;
page = clampi(app->tutorial_step, 0, page_count - 1);
previous_page = page;
if(IsKeyPressed(KEY_RIGHT) || IsKeyPressed(KEY_ENTER)) {
if(page < page_count - 1)
page++;
else if(close != NULL)
close(app, 1);
else if(start != NULL)
start(app);
}
if(IsKeyPressed(KEY_LEFT) && page > 0)
page--;
if(IsKeyPressed(KEY_ESCAPE) && close != NULL)
close(app, 0);
page = clampi(page, 0, page_count - 1);
if(page != previous_page)
app->manual_scroll = 0;
app->tutorial_step = page;
return page;
}
int
manual_screen_guide_nav_height(void)
{
return flint_px(42);
}
void
manual_screen_guide_draw_nav(InbeApp *app, ManualGuideNav nav)
{
int page;
int h;
int button_size;
int button_pad;
int max_inner_w;
int inner_w;
int inner_x;
int button_y;
char page_text[32];
int font = flint_ui_font();
int text_w;
if(app == NULL || nav.page_count <= 1 || nav.start == NULL)
return;
page = clampi(nav.page, 0, nav.page_count - 1);
h = nav.h > 0 ? nav.h : manual_screen_guide_nav_height();
button_size = view_width < flint_px(360) ? flint_px(32) : flint_px(36);
button_pad = flint_px(8);
max_inner_w = flint_px(260);
inner_w = view_width - flint_px(24);
if(inner_w > max_inner_w)
inner_w = max_inner_w;
if(inner_w < button_size * 2 + flint_px(72))
inner_w = button_size * 2 + flint_px(72);
if(inner_w > view_width)
inner_w = view_width;
inner_x = (view_width - inner_w) / 2;
button_y = nav.y + (h - button_size) / 2;
DrawRectangle(0, nav.y, view_width, h, flint_darken(theme_get_bg(), 5));
DrawLine(0, nav.y + h - 1, view_width, nav.y + h - 1,
flint_darken(theme_get_bg(), 28));
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {(float)inner_x, (float)button_y,
(float)button_size, (float)button_size},
.icon = app->icons[UI_ICON_TYPE_BACKWARD],
.icon_size = flint_px(20),
.icon_padding = button_pad,
.disabled = page <= 0 && !nav.show_left_on_first,
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
if(page > 0) {
app->tutorial_step = page - 1;
app->manual_scroll = 0;
} else if(nav.show_left_on_first) {
if(nav.close != NULL)
nav.close(app, 1);
else
nav.start(app);
}
}
snprintf(page_text, sizeof(page_text), "%d/%d", page + 1, nav.page_count);
text_w = flint_text_measure(page_text, font);
flint_text_draw(page_text, inner_x + (inner_w - text_w) / 2,
flint_text_y(page_text, nav.y, h, font), font,
theme_get_text());
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {(float)(inner_x + inner_w - button_size), (float)button_y,
(float)button_size, (float)button_size},
.icon = app->icons[page >= nav.page_count - 1 ? UI_ICON_TYPE_CHECK
: UI_ICON_TYPE_FORWARD],
.icon_size = flint_px(20),
.icon_padding = button_pad,
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
if(page == nav.page_count - 1) {
if(nav.close != NULL)
nav.close(app, 1);
else
nav.start(app);
} else {
app->tutorial_step = page + 1;
app->manual_scroll = 0;
}
}
}
void
manual_screen_close_tutorial(InbeApp *app, int mark_seen)
{
+18
View File
@@ -4,8 +4,26 @@
#include "breath_engine.h"
#include "app_fwd.h"
typedef void (*ManualGuideStartFn)(InbeApp *app);
typedef void (*ManualGuideCloseFn)(InbeApp *app, int mark_seen);
typedef struct ManualGuideNav {
int page;
int page_count;
int y;
int h;
int show_left_on_first;
ManualGuideStartFn start;
ManualGuideCloseFn close;
} ManualGuideNav;
void manual_screen_draw(InbeApp *app);
void manual_screen_close_tutorial(InbeApp *app, int mark_seen);
void manual_screen_reset_layouts(InbeApp *app);
int manual_screen_guide_update_page(InbeApp *app, int page_count,
ManualGuideStartFn start,
ManualGuideCloseFn close);
void manual_screen_guide_draw_nav(InbeApp *app, ManualGuideNav nav);
int manual_screen_guide_nav_height(void);
#endif
+421
View File
@@ -1,6 +1,22 @@
#include "practice_screen.h"
#include "app.h"
#include "practices/practice_registry.h"
#include "flint_locale.h"
#include "flint_ui.h"
#include "theme.h"
#include <stdio.h>
extern int view_width;
extern int view_height;
enum {
PRACTICE_GUIDE_STEPS = 4
};
typedef struct PracticeGuideStep {
Rectangle anchor;
const char *text;
} PracticeGuideStep;
int
practice_activity_count_for_tab(int tab)
@@ -40,3 +56,408 @@ practice_clamp_activity_to_tab(InbeApp *app)
return;
app->exercise_type = practice_clamp_id(app->exercise_type);
}
static int
practice_screen_draw_tab_bar(InbeApp *app, int y)
{
FlintUISubtab tabs[PRACTICE_TAB_COUNT];
int tab_h = flint_px(PRACTICE_CATEGORY_TAB_H);
if(app == NULL)
return -1;
tabs[PRACTICE_TAB_PLAY] = (FlintUISubtab){
.icon = app->icons[UI_ICON_TYPE_SUN],
.icon_size = flint_px(20),
.disabled = app->modal.active
};
tabs[PRACTICE_TAB_MANUAL] = (FlintUISubtab){
.icon = app->icons[UI_ICON_TYPE_MANUAL],
.icon_size = flint_px(20),
.disabled = app->modal.active
};
tabs[PRACTICE_TAB_CONFIG] = (FlintUISubtab){
.icon = app->icons[UI_ICON_TYPE_WRENCH],
.icon_size = flint_px(20),
.disabled = app->modal.active
};
if(app->practice_tab < 0 || app->practice_tab >= PRACTICE_TAB_COUNT)
app->practice_tab = PRACTICE_TAB_PLAY;
return ui_draw_subtab_bar((FlintUISubtabBar){
.bounds = {0, (float)y, (float)view_width, (float)tab_h},
.tabs = tabs,
.count = PRACTICE_TAB_COUNT,
.selected_index = app->practice_tab,
.font = flint_ui_font()
});
}
void
practice_screen_open_tab(InbeApp *app, int tab)
{
if(app == NULL || app->modal.active)
return;
if(tab == PRACTICE_TAB_PLAY) {
if(app->practice_tab == PRACTICE_TAB_CONFIG)
app_leave_practice_config(app);
app->practice_tab = PRACTICE_TAB_PLAY;
app_switch_screen(app, InbeScreenStart);
} else if(tab == PRACTICE_TAB_MANUAL) {
if(app->practice_tab == PRACTICE_TAB_CONFIG)
app_leave_practice_config(app);
app->practice_tab = PRACTICE_TAB_MANUAL;
app->tutorial_step = 0;
app->manual_scroll = 0;
app_switch_screen(app, InbeScreenStart);
} else if(tab == PRACTICE_TAB_CONFIG) {
if(app->practice_tab != PRACTICE_TAB_CONFIG) {
reset_settings_preview(app);
app->settings_scroll = 0;
app->practice_config_tab = 0;
}
app->practice_tab = PRACTICE_TAB_CONFIG;
app_switch_screen(app, InbeScreenStart);
}
}
void
practice_screen_draw_top_bar(InbeApp *app, int draw_menu)
{
const char *exercise_options[EXERCISE_COUNT];
int exercise_values[EXERCISE_COUNT];
int activity_count;
int activity_index;
if(app == NULL)
return;
activity_count = EXERCISE_COUNT;
for(int i = 0; i < activity_count; i++) {
exercise_values[i] = i;
exercise_options[i] = practice_activity_label(exercise_values[i]);
}
activity_index = clampi(app->exercise_type, 0, EXERCISE_COUNT - 1);
if(draw_menu) {
FlintUIToolbarResult menu_result = ui_draw_toolbar_header((FlintUIToolbarHeader){
.toolbar = (FlintUIToolbar){
.id = 300,
.draw_menu = 1,
.options = exercise_options,
.option_count = activity_count,
.selected_index = &activity_index
}
}).toolbar;
if(!app->modal.active && menu_result.selected_menu_item >= 0) {
if(app->practice_tab == PRACTICE_TAB_CONFIG)
app_leave_practice_config(app);
app->exercise_type = exercise_values[activity_index];
app->manual_scroll = 0;
app->settings_scroll = 0;
app->tutorial_step = 0;
app->practice_config_tab = 0;
save_settings(app);
}
return;
}
(void)ui_draw_toolbar_header((FlintUIToolbarHeader){
.leading_icon = (Texture2D){0},
.toolbar = (FlintUIToolbar){
.id = 300,
.height = app_toolbar_height(),
.options = app->modal.active ? NULL : exercise_options,
.option_count = app->modal.active ? 0 : activity_count,
.selected_index = &activity_index,
.dropdown_min_width = flint_px(160),
.dropdown_max_width = flint_px(230),
.dropdown_height = flint_px(36),
.side_padding = flint_px(12)
}
});
{
int clicked = practice_screen_draw_tab_bar(app, app_toolbar_height());
if(clicked >= 0 && clicked != app->practice_tab)
practice_screen_open_tab(app, clicked);
}
}
static Rectangle
practice_screen_dropdown_anchor(void)
{
int side_padding = flint_px(12);
int dropdown_h = flint_px(36);
int dropdown_w = view_width - side_padding * 2;
if(dropdown_w > flint_px(230))
dropdown_w = flint_px(230);
if(dropdown_w < flint_px(160))
dropdown_w = view_width - side_padding * 2;
if(dropdown_w < 1)
dropdown_w = 1;
return (Rectangle){
(float)side_padding,
(float)((app_toolbar_height() - dropdown_h) / 2),
(float)dropdown_w,
(float)dropdown_h
};
}
static Rectangle
practice_screen_tab_anchor(int tab)
{
int tab_h = flint_px(PRACTICE_CATEGORY_TAB_H);
int tab_w = view_width / PRACTICE_TAB_COUNT;
int x = tab * tab_w;
int w = tab == PRACTICE_TAB_COUNT - 1 ? view_width - x : tab_w;
return (Rectangle){
(float)x,
(float)app_toolbar_height(),
(float)w,
(float)tab_h
};
}
static void
practice_screen_finish_first_run_guide(InbeApp *app)
{
if(app == NULL)
return;
app->tutorial_seen = 1;
app->tutorial_step = 0;
save_settings(app);
}
void
practice_screen_prepare_first_run_guide(InbeApp *app)
{
int step;
if(app == NULL || app->tutorial_seen || app->inbe.screen != InbeScreenStart)
return;
if(app->modal.active)
return;
step = clampi(app->tutorial_step, 0, PRACTICE_GUIDE_STEPS - 1);
if(step <= 1)
app->practice_tab = PRACTICE_TAB_MANUAL;
else
app->practice_tab = PRACTICE_TAB_PLAY;
}
static void
practice_screen_draw_guide_arrow(Rectangle tip, Rectangle anchor)
{
int anchor_cx = (int)(anchor.x + anchor.width / 2);
int anchor_cy = (int)(anchor.y + anchor.height / 2);
int tip_left = (int)tip.x;
int tip_right = (int)(tip.x + tip.width);
int tip_top = (int)tip.y;
int tip_bottom = (int)(tip.y + tip.height);
int point_x = anchor_cx;
int point_y = anchor_cy;
int base_x = clampi(anchor_cx, tip_left + flint_px(18), tip_right - flint_px(18));
Color color = theme_get_button();
if(anchor_cy < tip_top) {
DrawTriangle((Vector2){(float)base_x, (float)tip_top},
(Vector2){(float)(base_x - flint_px(8)), (float)(tip_top - flint_px(12))},
(Vector2){(float)(base_x + flint_px(8)), (float)(tip_top - flint_px(12))},
color);
point_y = tip_top - flint_px(12);
} else if(anchor_cy > tip_bottom) {
DrawTriangle((Vector2){(float)base_x, (float)tip_bottom},
(Vector2){(float)(base_x + flint_px(8)), (float)(tip_bottom + flint_px(12))},
(Vector2){(float)(base_x - flint_px(8)), (float)(tip_bottom + flint_px(12))},
color);
point_y = tip_bottom + flint_px(12);
} else if(anchor_cx < tip_left) {
DrawTriangle((Vector2){(float)tip_left, (float)anchor_cy},
(Vector2){(float)(tip_left - flint_px(12)), (float)(anchor_cy + flint_px(8))},
(Vector2){(float)(tip_left - flint_px(12)), (float)(anchor_cy - flint_px(8))},
color);
point_x = tip_left - flint_px(12);
} else {
DrawTriangle((Vector2){(float)tip_right, (float)anchor_cy},
(Vector2){(float)(tip_right + flint_px(12)), (float)(anchor_cy - flint_px(8))},
(Vector2){(float)(tip_right + flint_px(12)), (float)(anchor_cy + flint_px(8))},
color);
point_x = tip_right + flint_px(12);
}
DrawLineEx((Vector2){(float)point_x, (float)point_y},
(Vector2){(float)anchor_cx, (float)anchor_cy},
(float)flint_px(2), theme_get_text());
}
static Rectangle
practice_screen_guide_tip_bounds(Rectangle anchor, int w, int h)
{
int margin = flint_px(12);
int gap = flint_px(20);
int x = (int)(anchor.x + anchor.width / 2) - w / 2;
int y;
if(x < margin)
x = margin;
if(x + w > view_width - margin)
x = view_width - margin - w;
if(x < margin)
x = margin;
if(anchor.y + anchor.height + gap + h < view_height - ui_bottom_nav_height())
y = (int)(anchor.y + anchor.height + gap);
else
y = (int)(anchor.y - gap - h);
if(y < app_toolbar_height() + flint_px(PRACTICE_CATEGORY_TAB_H))
y = app_toolbar_height() + flint_px(PRACTICE_CATEGORY_TAB_H) + margin;
if(y + h > view_height - ui_bottom_nav_height() - margin)
y = view_height - ui_bottom_nav_height() - margin - h;
if(y < margin)
y = margin;
return (Rectangle){(float)x, (float)y, (float)w, (float)h};
}
void
practice_screen_draw_first_run_guide(InbeApp *app)
{
PracticeGuideStep steps[PRACTICE_GUIDE_STEPS];
int step;
int margin = flint_px(12);
int tip_w = view_width - margin * 2;
int pad = flint_px(12);
int button_size = flint_px(34);
int font = flint_ui_font();
int page_font = FLINT_TEXT_12;
char page_text[16];
FlintUIParagraph paragraph;
int paragraph_h;
int tip_h;
Rectangle tip;
int y;
int back_disabled;
int finish;
if(app == NULL || app->tutorial_seen || app->modal.active)
return;
if(app->inbe.screen != InbeScreenStart)
return;
steps[0] = (PracticeGuideStep){
practice_screen_dropdown_anchor(),
locale_get("practice_guide_dropdown")
};
steps[1] = (PracticeGuideStep){
practice_screen_tab_anchor(PRACTICE_TAB_MANUAL),
locale_get("practice_guide_manual")
};
steps[2] = (PracticeGuideStep){
practice_screen_tab_anchor(PRACTICE_TAB_PLAY),
locale_get("practice_guide_sun")
};
steps[3] = (PracticeGuideStep){
practice_screen_tab_anchor(PRACTICE_TAB_CONFIG),
locale_get("practice_guide_config")
};
step = clampi(app->tutorial_step, 0, PRACTICE_GUIDE_STEPS - 1);
app->tutorial_step = step;
if(IsKeyPressed(KEY_RIGHT) || IsKeyPressed(KEY_ENTER)) {
if(step >= PRACTICE_GUIDE_STEPS - 1)
practice_screen_finish_first_run_guide(app);
else
app->tutorial_step = step + 1;
return;
}
if(IsKeyPressed(KEY_LEFT) && step > 0) {
app->tutorial_step = step - 1;
return;
}
if(IsKeyPressed(KEY_ESCAPE)) {
practice_screen_finish_first_run_guide(app);
return;
}
if(tip_w > flint_px(300))
tip_w = flint_px(300);
paragraph = (FlintUIParagraph){
.text = steps[step].text,
.icon = (Texture2D){0},
.icon_type = UI_ICON_TYPE_NONE,
.icon_size = 0,
.width = tip_w - pad * 2,
.font = font,
.line_gap = flint_px(6),
.color = theme_get_text(),
};
paragraph_h = flint_ui_paragraph_height(paragraph);
tip_h = pad + paragraph_h + flint_px(12) + button_size + pad;
if(tip_h < flint_px(112))
tip_h = flint_px(112);
tip = practice_screen_guide_tip_bounds(steps[step].anchor, tip_w, tip_h);
DrawRectangle(0, 0, view_width, view_height, (Color){0, 0, 0, 86});
DrawRectangleLinesEx(steps[step].anchor, (float)flint_px(2), theme_get_text());
DrawRectangleRounded(tip, 0.08f, 8, theme_get_button());
DrawRectangleRoundedLines(tip, 0.08f, 8,
flint_darken(theme_get_button(), 35));
practice_screen_draw_guide_arrow(tip, steps[step].anchor);
y = (int)tip.y + pad;
flint_ui_paragraph_draw(paragraph, (int)tip.x + pad, &y);
snprintf(page_text, sizeof(page_text), "%d/%d", step + 1, PRACTICE_GUIDE_STEPS);
flint_text_draw(page_text, (int)tip.x + pad,
(int)tip.y + (int)tip.height - pad - button_size +
(button_size - page_font) / 2,
page_font, theme_get_text());
back_disabled = step <= 0;
finish = step >= PRACTICE_GUIDE_STEPS - 1;
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {
tip.x + tip.width - pad - button_size * 2 - flint_px(8),
tip.y + tip.height - pad - button_size,
(float)button_size,
(float)button_size
},
.icon = app->icons[UI_ICON_TYPE_BACKWARD],
.icon_size = flint_px(19),
.icon_padding = flint_px(7),
.disabled = back_disabled,
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
app->tutorial_step = step - 1;
}
if(flint_ui_icon_button((FlintUIIconButton){
.bounds = {
tip.x + tip.width - pad - button_size,
tip.y + tip.height - pad - button_size,
(float)button_size,
(float)button_size
},
.icon = app->icons[finish ? UI_ICON_TYPE_CHECK : UI_ICON_TYPE_FORWARD],
.icon_size = flint_px(19),
.icon_padding = flint_px(7),
.background = theme_get_button(),
.hover_background = theme_get_button_hover(),
.icon_color = theme_get_text(),
.border = flint_darken(theme_get_button(), 35)
})) {
if(finish)
practice_screen_finish_first_run_guide(app);
else
app->tutorial_step = step + 1;
}
}
+4
View File
@@ -13,5 +13,9 @@ int practice_activity_for_tab(int tab, int index);
const char *practice_activity_label(int exercise);
int practice_activity_index_for_tab(int tab, int exercise);
void practice_clamp_activity_to_tab(InbeApp *app);
void practice_screen_open_tab(InbeApp *app, int tab);
void practice_screen_draw_top_bar(InbeApp *app, int draw_menu);
void practice_screen_prepare_first_run_guide(InbeApp *app);
void practice_screen_draw_first_run_guide(InbeApp *app);
#endif
+72 -10
View File
@@ -32,23 +32,84 @@ settings_sync_account_set_import_dialog(SettingsSyncKeyImportDialog callback)
}
static void
settings_draw_hex_groups(const char *text, int x, int *y, int font, Color color,
int groups, int group_chars)
settings_draw_public_id_field(const char *text, int x, int w, int *y, int font,
FlintUITextInputStyle style)
{
char line[128];
int text_len;
int pad_x;
int pad_y = flint_px(8);
int line_h = flint_text_line_height(font);
int content_w;
int line_count = 0;
int offset = 0;
int field_h;
int draw_y;
if(text == NULL || y == NULL)
return;
for(int i = 0; i < groups && text[offset] != '\0'; i++) {
int len = group_chars;
if((int)strlen(text + offset) < len)
len = (int)strlen(text + offset);
text_len = (int)strlen(text);
pad_x = style.padding_x > 0 ? style.padding_x : flint_px(10);
content_w = w - pad_x * 2;
if(content_w < flint_px(24))
content_w = flint_px(24);
while(offset < text_len) {
int len;
if(flint_text_measure(text + offset, font) <= content_w) {
offset = text_len;
line_count++;
break;
}
len = 1;
while(offset + len < text_len && len + 1 < (int)sizeof(line)) {
snprintf(line, sizeof(line), "%.*s", len + 1, text + offset);
if(flint_text_measure(line, font) > content_w)
break;
len++;
}
offset += len;
line_count++;
}
if(line_count < 1)
line_count = 1;
field_h = line_count * line_h + pad_y * 2;
DrawRectangleRounded((Rectangle){(float)x, (float)*y, (float)w, (float)field_h},
style.radius > 0.0f ? style.radius : 0.08f, 8,
style.background);
DrawRectangleRoundedLines((Rectangle){(float)x, (float)*y, (float)w, (float)field_h},
style.radius > 0.0f ? style.radius : 0.08f, 8,
style.border);
offset = 0;
draw_y = *y + pad_y;
while(offset < text_len) {
int len;
if(flint_text_measure(text + offset, font) <= content_w) {
snprintf(line, sizeof(line), "%s", text + offset);
flint_text_draw(line, x + pad_x, draw_y, font, style.text);
break;
}
len = 1;
while(offset + len < text_len && len + 1 < (int)sizeof(line)) {
snprintf(line, sizeof(line), "%.*s", len + 1, text + offset);
if(flint_text_measure(line, font) > content_w)
break;
len++;
}
snprintf(line, sizeof(line), "%.*s", len, text + offset);
flint_text_draw(line, x, *y, font, color);
*y += flint_px(17);
flint_text_draw(line, x + pad_x, draw_y, font, style.text);
draw_y += line_h;
offset += len;
}
*y += field_h;
}
static void
@@ -258,7 +319,8 @@ settings_sync_account_draw(InbeApp *app, int x, int w, int *y)
flint_text_draw(locale_get("sync_public_id_label"), x, *y, small_font,
flint_darken(theme_get_text(), 30));
*y += flint_px(18);
settings_draw_hex_groups(account.public_id, x, y, small_font, theme_get_text(), 2, 32);
settings_draw_public_id_field(account.public_id, x, w, y, small_font,
settings_sync_text_style());
*y += flint_px(4);
{
@@ -351,7 +413,7 @@ settings_sync_account_draw_config(InbeApp *app, int x, int w, int *y)
flint_text_draw(locale_get("sync_public_id_label"), x, *y, small_font,
flint_darken(theme_get_text(), 30));
*y += flint_px(18);
settings_draw_hex_groups(account.public_id, x, y, small_font, theme_get_text(), 2, 32);
settings_draw_public_id_field(account.public_id, x, w, y, small_font, input_style);
*y += flint_px(8);
flint_text_draw(locale_get("sync_remote_label"), x, *y, small_font,
+22 -5
View File
@@ -715,6 +715,19 @@ EM_JS(int, sync_web_fetch_poll_js,
EM_JS(int, sync_websocket_start_js, (const char *url_ptr), {
const url = UTF8ToString(url_ptr);
const now = Date.now();
function scheduleRetry() {
const failures = Math.min((Module.__inbeSyncWebSocketFailures || 0) + 1, 8);
Module.__inbeSyncWebSocketFailures = failures;
Module.__inbeSyncWebSocketRetryAt = Date.now() +
Math.min(300000, 2000 * Math.pow(2, failures - 1));
}
function logSocketError(event) {
const logAt = Module.__inbeSyncWebSocketLogAt || 0;
if(Date.now() < logAt)
return;
Module.__inbeSyncWebSocketLogAt = Date.now() + 60000;
console.warn("Inbe sync WebSocket unavailable; remote sync events will retry in the background.", event);
}
if(Module.__inbeSyncWebSocket &&
Module.__inbeSyncWebSocketUrl === url &&
(Module.__inbeSyncWebSocket.readyState === WebSocket.OPEN ||
@@ -732,6 +745,8 @@ EM_JS(int, sync_websocket_start_js, (const char *url_ptr), {
Module.__inbeSyncWebSocket = ws;
ws.onopen = function() {
Module.__inbeSyncWebSocketRetryAt = 0;
Module.__inbeSyncWebSocketFailures = 0;
Module.__inbeSyncWebSocketLogAt = 0;
console.info("Inbe sync WebSocket connected");
};
ws.onmessage = function(event) {
@@ -744,18 +759,20 @@ EM_JS(int, sync_websocket_start_js, (const char *url_ptr), {
Module.__inbeSyncWebSocketEvent = 1;
}
};
ws.onclose = function() {
ws.onclose = function(event) {
if(Module.__inbeSyncWebSocket === ws)
Module.__inbeSyncWebSocket = null;
Module.__inbeSyncWebSocketRetryAt = Date.now() + 2000;
scheduleRetry();
if(ws.__inbeHadError)
logSocketError(event);
};
ws.onerror = function(event) {
console.warn("Inbe sync WebSocket error:", event);
ws.__inbeHadError = true;
};
return 1;
} catch(e) {
console.warn("Inbe sync WebSocket failed:", e);
Module.__inbeSyncWebSocketRetryAt = Date.now() + 2000;
scheduleRetry();
logSocketError(e);
return 0;
}
});
+4 -4
View File
@@ -3,8 +3,8 @@
IDI_APP_ICON ICON "inbe.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,6,0
PRODUCTVERSION 1,4,6,0
FILEVERSION 1,4,7,0
PRODUCTVERSION 1,4,7,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -21,11 +21,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "waozi"
VALUE "FileDescription", "Inner Breeze"
VALUE "FileVersion", "1.4.6"
VALUE "FileVersion", "1.4.7"
VALUE "InternalName", "inbe"
VALUE "OriginalFilename", "inbe-windows-x86_64.exe"
VALUE "ProductName", "Inner Breeze"
VALUE "ProductVersion", "1.4.6"
VALUE "ProductVersion", "1.4.7"
END
END
BLOCK "VarFileInfo"