Compare commits

...
6 Commits
Author SHA1 Message Date
waozi a3743c9b37 improve profile screen 2026-06-29 03:16:43 -03:00
waozi fe96b6c61e bug fixes 2026-06-29 03:06:17 -03:00
waozi eabbff2972 fix critical inset issue 2026-06-29 00:15:28 -03:00
waozi 157788fa5c improve habit management 2026-06-28 23:58:01 -03:00
waozi e89f63e382 improve my profile screen 2026-06-28 23:45:36 -03:00
waozi 1105b51c24 fix translations 2026-06-28 22:08:00 -03:00
54 changed files with 2720 additions and 1055 deletions

No files matched your search

+3 -3
View File
@@ -571,7 +571,7 @@ jobs:
butler push "$linux_appimage" waozi/inbe:linux --userversion "$VERSION"
publish-google-play:
name: Publish Google Play Alpha
name: Publish Google Play Open Testing
runs-on: ubuntu-latest
needs:
- build-android
@@ -595,13 +595,13 @@ jobs:
name: release-android
path: build/release/android
- name: Publish AAB to Closed Testing Alpha
- name: Publish AAB to Play Games on PC Open Testing
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_JSON_KEY }}
packageName: xyz.waozi.inbe
releaseFiles: build/release/android/*.aab
tracks: alpha
tracks: google_play_games_pc:beta
status: completed
publish-chrome-web-store:
+24
View File
@@ -1,4 +1,28 @@
# Changelog
## [1.7.4] - 2026-06-29
### Fixed
- Clean up practice stats, friend removal, sync review, and Android inset handling.
## [1.7.3] - 2026-06-29
### Fixed
- bottom inset in practice
### Changed
- Improve habit management
## [1.7.2] - 2026-06-29
### Added
- Add local `make install` target.
- Add Profile controls for habit ordering and practice visibility.
### Changed
- Move sync status into the Data view and simplify the habits add option.
- Clean up the README.
## [1.7.1] - 2026-06-28
### Changed
- Move shared Lyra sync protocol code into Flint and simplify Inbe sync client wiring.
## [1.7.0] - 2026-06-28
### Changed
- Rework Android safe-area handling to use one native inset path with stable bottom navigation spacing.
+17 -3
View File
@@ -277,13 +277,27 @@ UNPACKAGED_AUDIO_DIR := unpackaged_assets/audio
UNPACKAGED_AUDIO_FILES := $(shell find $(UNPACKAGED_AUDIO_DIR) -type f 2>/dev/null)
MEDITATION_AUDIO_ZIP := web-assets/dl/inbe-meditation-audio-v1.zip
.PHONY: all native run run-fresh screenshot test dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows clean clean-linux clean-vendor-builds android-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 site chrome-web-store
.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-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 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)"; \
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 \
@@ -377,10 +391,10 @@ $(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 $(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/flint_lyra_sync.c $(FLINT_DIR)/src/flint_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 \
tests/sync_url_test.c src/storage/sync_client.c $(FLINT_DIR)/src/flint_lyra_sync.c $(FLINT_DIR)/src/flint_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/flint_lyra_account.c $(FLINT_DIR)/include/flint_lyra_account.h src/storage/storage.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)
+28 -93
View File
@@ -1,115 +1,50 @@
# Inner Breeze
Inner Breeze is a free, open-source practice app for breathing, meditation, and habit tracking.
Inner Breeze is a free, open-source app for breathing, meditation, and habit tracking.
## Features
## Build
- Guided practice sessions with visual and audio cues
- Mind, Yoga, and Fitness organization for habits and practice views
- Configurable breathing sessions and meditation timers
- Habit tracking with session history
- Local SQLite storage with import/export support
- Theme customization with light and dark variants
- Touch-optimized UI for desktop and mobile
## Building
inbe uses [raylib](https://github.com/raysan5/raylib) and requires a Nix development environment.
### Prerequisites
- [Nix](https://nixos.org/download.html) with flakes enabled
- For Android builds: Java 17+ JDK
### Native Build
Use the Nix development shell:
```bash
# Enter the development shell
nix develop
# Build for your current platform
make native
# Run
make run
```
### Cross-Platform Builds
Install locally:
```bash
# Android debug APK
make install
```
This installs the app to `~/.local/lib/inbe` and links `~/.local/bin/inbe`.
If `~/bin` exists, it links `~/bin/inbe` too.
## Other Targets
```bash
make test
make android-debug
# Android release APK
make android-release PASSWORD=your-keystore-password
make web
make appimage
make windows
```
## Release Automation
## Project Layout
GitHub Actions builds release artifacts for web, Linux, Windows, Android, and
the Chrome extension. When a new version tag is created by the release workflow,
the web, Android, Windows, and Linux builds are also published to itch.io.
- `src/` - app code
- `assets/` - images, fonts, and sounds
- `locales/` - translations
- `droid/` - Android project
- `site/` - website
- `vendor/flint/` - Flint UI/runtime submodule
Required repository secrets:
## Notes
- `ITCH_API_KEY` - itch.io Butler API key for publishing `waozi/inbe:html5`,
`waozi/inbe:android`, `waozi/inbe:windows`, and `waozi/inbe:linux`
### Android Emulator Testing
For automated testing with camera notch (cutout) support:
```bash
# Enter the development shell and run everything automatically
nix develop
./scripts/emulator.sh # Creates and launches the test AVD
make android-install # Builds, installs, and launches the app
```
This single script handles:
- AVD creation (if missing)
- Emulator launch
- APK build
- App installation and launch
The AVD is configured with:
- **Device**: Pixel 6 (punch-hole camera style)
- **Display**: 1080×2400 @ 420dpi
- **RAM**: 4GB with hardware acceleration
- **Cutout**: Punch-hole camera for testing window insets
### Platform-Specific Notes
- **Linux**: Requires SDL2 runtime libraries
- **Windows**: Standalone executable, no dependencies
- **Android**: Requires Android NDK in the development shell
- **Web**: Requires Emscripten toolchain
## Project Structure
- `src/` - Inbe application code
- `vendor/` - external third-party dependencies
- `vendor/flint/` - **git submodule** for first-party UI/runtime support code used directly by Inbe
- `wasm4/` - Standalone WASM-4 version
- `assets/` - Images and sounds
- `droid/` - Android build configuration
## Flint submodule workflow
`vendor/flint` is a source submodule (not a one-off copied sync). To update Inbe after a Flint change:
1. Push changes in the Flint repo.
2. In Inbe, update the submodule pointer:
- `git submodule update --init --recursive vendor/flint`
- `git -C vendor/flint pull`
3. Commit Inbe with the updated `vendor/flint` submodule reference.
When updating other projects that vendor Flint as a submodule, this keeps UI behavior and API docs aligned.
## Sync model
Inbe is offline-first. User-owned app data moves through the storage sync chain; social data is server-authorized. Friends, requests, and leaderboard snapshots are cached locally for fast/offline UI, but Lyra owns the authoritative social state and refreshes those caches through authenticated sync.
Inbe stores app data locally in SQLite. Optional sync can mirror user-owned
data through a Lyra-compatible sync server.
## License
MIT - see [LICENSE](LICENSE)
MIT. See [LICENSE](LICENSE).
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 104 KiB

+2 -2
View File
@@ -35,8 +35,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 35
versionCode 63
versionName "1.7.0"
versionCode 67
versionName "1.7.4"
}
+1
View File
@@ -207,6 +207,7 @@ target_link_options(main PRIVATE
-Wl,--gc-sections
-Wl,--strip-all
-Wl,-z,max-page-size=16384
-Wl,-z,common-page-size=16384
-Wl,--wrap=fopen
)
@@ -447,7 +447,6 @@ public class MainActivity extends NativeActivity {
// Notify native code that activity is ready for wake lock
nativeWakeLockReady();
requestNotificationPermissionIfNeeded();
}
@Override
+1 -1
View File
@@ -1,3 +1,3 @@
plugins {
id 'com.android.application' version '8.4.2' apply false
id 'com.android.application' version '8.5.1' apply false
}
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
@@ -0,0 +1,3 @@
Changed
---
- Move shared Lyra sync protocol code into Flint and simplify Inbe sync client wiring.
@@ -0,0 +1,8 @@
Added
---
- Add local `make install` target.
- Add Profile controls for habit ordering and practice visibility.
Changed
---
- Move sync status into the Data view and simplify the habits add option.
- Clean up the README.
@@ -0,0 +1,3 @@
Changed
---
- Improve habit management
@@ -0,0 +1,3 @@
Fixed
---
- bottom inset in practice
+115 -7
View File
@@ -5,7 +5,7 @@ Inner Breeze
Historie
---
[tab_profile]
Profile
Profil
---
[tab_habits]
Návyky
@@ -32,16 +32,109 @@ Pet
Data
---
[profile_data_button]
Configure Data
Nastavit data
---
[profile_habits_label]
Habits
Navyky
---
[profile_sessions_label]
Sessions
Sezeni
---
[profile_storage_label]
Storage
Uloziste
---
[profile_friends_title]
Pratele
---
[profile_leaderboard_title]
Zebricek
---
[profile_metric_streak]
Serie
---
[profile_metric_avg_time]
Prumerny cas
---
[profile_metric_avg_hold]
Prumerna vydrz
---
[profile_none_label]
Zadne
---
[profile_friend_accept_button]
Prijmout
---
[profile_friend_decline_button]
Odmitnout
---
[profile_friend_remove_title]
Odebrat pritele?
---
[profile_friend_remove_message]
%s bude odebran. Pro obnoveni poslete novou zadost.
---
[profile_updating_status]
Aktualizace
---
[profile_no_account]
Zadny ucet
---
[profile_account_section]
Ucet
---
[profile_configure_button]
Nastavit
---
[profile_data_section]
Data
---
[profile_sync_section]
Synchronizace
---
[profile_friends_count_format]
%d pratel
---
[profile_pending_count_format]
%d cekajici
---
[profile_social_section]
Socialni
---
[profile_add_friend_button]
Pridat pritele
---
[profile_refresh_button]
Obnovit
---
[profile_incoming_title]
Prichozi
---
[profile_outgoing_title]
Odchozi
---
[profile_no_leaderboard_data]
Zadna data zebricku
---
[profile_practice_label]
Cviceni
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Nastavení
@@ -287,10 +380,10 @@ Vzhled
Jazyk
---
[settings_tab_about]
About
O aplikaci
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Klidny pruvodce pro dychani, navyky a synchronizaci.
---
[theme_label]
Motiv
@@ -776,6 +869,9 @@ Upravit návyk
[habit_name_label]
Název
---
[habit_description_label]
Description
---
[habit_underline_label]
Podtržení
---
@@ -874,6 +970,18 @@ Zvolte Tyden nebo Kalendar pro kontrolu navyku.
[habits_guide_statistics]
Zde zobrazite statistiky navyku.
---
[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.
---
[nav_mode_label]
Navigace
---
+116 -8
View File
@@ -5,7 +5,7 @@ Inner Breeze
Verlauf
---
[tab_profile]
Profile
Profil
---
[tab_habits]
Gewohnheiten
@@ -29,19 +29,112 @@ Anleitung
Pet
---
[profile_data_title]
Data
Daten
---
[profile_data_button]
Configure Data
Daten konfigurieren
---
[profile_habits_label]
Habits
Gewohnheiten
---
[profile_sessions_label]
Sessions
Sitzungen
---
[profile_storage_label]
Storage
Speicher
---
[profile_friends_title]
Freunde
---
[profile_leaderboard_title]
Bestenliste
---
[profile_metric_streak]
Serie
---
[profile_metric_avg_time]
Durchschnittszeit
---
[profile_metric_avg_hold]
Durchschn. Halten
---
[profile_none_label]
Keine
---
[profile_friend_accept_button]
Annehmen
---
[profile_friend_decline_button]
Ablehnen
---
[profile_friend_remove_title]
Freund entfernen?
---
[profile_friend_remove_message]
%s wird entfernt. Sende eine neue Anfrage zum Wiederverbinden.
---
[profile_updating_status]
Aktualisieren
---
[profile_no_account]
Kein Konto
---
[profile_account_section]
Konto
---
[profile_configure_button]
Konfigurieren
---
[profile_data_section]
Daten
---
[profile_sync_section]
Sync
---
[profile_friends_count_format]
%d Freunde
---
[profile_pending_count_format]
%d ausstehend
---
[profile_social_section]
Sozial
---
[profile_add_friend_button]
Freund hinzufuegen
---
[profile_refresh_button]
Aktualisieren
---
[profile_incoming_title]
Eingehend
---
[profile_outgoing_title]
Ausgehend
---
[profile_no_leaderboard_data]
Keine Bestenlistendaten
---
[profile_practice_label]
Praxis
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Einstellungen
@@ -287,10 +380,10 @@ Darstellung
Sprache
---
[settings_tab_about]
About
Info
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Ein ruhiger Begleiter fuer Atemuebungen, Gewohnheiten und Synchronisierung.
---
[theme_label]
Thema
@@ -776,6 +869,9 @@ Gewohnheit bearbeiten
[habit_name_label]
Bezeichnung
---
[habit_description_label]
Description
---
[habit_underline_label]
Unterstreichung
---
@@ -874,6 +970,18 @@ Wahle Woche oder Kalender, um deine Gewohnheit zu pruefen.
[habits_guide_statistics]
Sieh dir hier deine Gewohnheitsstatistiken an.
---
[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.
---
[nav_mode_label]
Navigation
---
+108
View File
@@ -43,6 +43,99 @@ Sessions
[profile_storage_label]
Storage
---
[profile_friends_title]
Friends
---
[profile_leaderboard_title]
Leaderboard
---
[profile_metric_streak]
Streak
---
[profile_metric_avg_time]
Avg time
---
[profile_metric_avg_hold]
Avg hold
---
[profile_none_label]
None
---
[profile_friend_accept_button]
Accept
---
[profile_friend_decline_button]
Decline
---
[profile_friend_remove_title]
Remove friend?
---
[profile_friend_remove_message]
%s will be removed. Send a new request to reconnect.
---
[profile_updating_status]
Updating
---
[profile_no_account]
No account
---
[profile_account_section]
Account
---
[profile_configure_button]
Configure
---
[profile_data_section]
Data
---
[profile_sync_section]
Sync
---
[profile_friends_count_format]
%d friends
---
[profile_pending_count_format]
%d pending
---
[profile_social_section]
Social
---
[profile_add_friend_button]
Add friend
---
[profile_refresh_button]
Refresh
---
[profile_incoming_title]
Incoming
---
[profile_outgoing_title]
Outgoing
---
[profile_no_leaderboard_data]
No leaderboard data
---
[profile_practice_label]
Practice
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Settings
---
@@ -818,6 +911,9 @@ Edit Habit
[habit_name_label]
Name
---
[habit_description_label]
Description
---
[habit_underline_label]
Underline
---
@@ -916,6 +1012,18 @@ Choose Weekly or Calendar to review your habit.
[habits_guide_statistics]
View habit statistics here.
---
[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.
---
[nav_mode_label]
Navigation
---
+116 -8
View File
@@ -5,7 +5,7 @@ Inner Breeze
Historial
---
[tab_profile]
Profile
Perfil
---
[tab_habits]
Hábitos
@@ -29,19 +29,112 @@ Manual
Pet
---
[profile_data_title]
Data
Datos
---
[profile_data_button]
Configure Data
Configurar datos
---
[profile_habits_label]
Habits
Habitos
---
[profile_sessions_label]
Sessions
Sesiones
---
[profile_storage_label]
Storage
Almacenamiento
---
[profile_friends_title]
Amigos
---
[profile_leaderboard_title]
Clasificacion
---
[profile_metric_streak]
Racha
---
[profile_metric_avg_time]
Tiempo medio
---
[profile_metric_avg_hold]
Retencion media
---
[profile_none_label]
Ninguno
---
[profile_friend_accept_button]
Aceptar
---
[profile_friend_decline_button]
Rechazar
---
[profile_friend_remove_title]
¿Eliminar amigo?
---
[profile_friend_remove_message]
Se eliminara a %s. Envia una nueva solicitud para reconectar.
---
[profile_updating_status]
Actualizando
---
[profile_no_account]
Sin cuenta
---
[profile_account_section]
Cuenta
---
[profile_configure_button]
Configurar
---
[profile_data_section]
Datos
---
[profile_sync_section]
Sincronizacion
---
[profile_friends_count_format]
%d amigos
---
[profile_pending_count_format]
%d pendientes
---
[profile_social_section]
Social
---
[profile_add_friend_button]
Anadir amigo
---
[profile_refresh_button]
Actualizar
---
[profile_incoming_title]
Entrantes
---
[profile_outgoing_title]
Salientes
---
[profile_no_leaderboard_data]
Sin datos de clasificacion
---
[profile_practice_label]
Practica
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Configuración
@@ -287,10 +380,10 @@ Apariencia
Idioma
---
[settings_tab_about]
About
Acerca de
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Un companero tranquilo para respiracion, habitos y sincronizacion.
---
[theme_label]
Tema
@@ -776,6 +869,9 @@ Editar hábito
[habit_name_label]
Nombre
---
[habit_description_label]
Description
---
[habit_underline_label]
Subrayado
---
@@ -874,6 +970,18 @@ Elige Semanal o Calendario para revisar tu habito.
[habits_guide_statistics]
Consulta tus estadisticas de habitos aqui.
---
[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.
---
[nav_mode_label]
Navegación
---
+116 -8
View File
@@ -5,7 +5,7 @@ Inner Breeze
Historique
---
[tab_profile]
Profile
Profil
---
[tab_habits]
Habitudes
@@ -29,19 +29,112 @@ Tutoriel
Pet
---
[profile_data_title]
Data
Donnees
---
[profile_data_button]
Configure Data
Configurer les donnees
---
[profile_habits_label]
Habits
Habitudes
---
[profile_sessions_label]
Sessions
Seances
---
[profile_storage_label]
Storage
Stockage
---
[profile_friends_title]
Amis
---
[profile_leaderboard_title]
Classement
---
[profile_metric_streak]
Serie
---
[profile_metric_avg_time]
Temps moyen
---
[profile_metric_avg_hold]
Retenue moyenne
---
[profile_none_label]
Aucun
---
[profile_friend_accept_button]
Accepter
---
[profile_friend_decline_button]
Refuser
---
[profile_friend_remove_title]
Supprimer l'ami ?
---
[profile_friend_remove_message]
%s sera supprime. Envoyez une nouvelle demande pour vous reconnecter.
---
[profile_updating_status]
Mise a jour
---
[profile_no_account]
Aucun compte
---
[profile_account_section]
Compte
---
[profile_configure_button]
Configurer
---
[profile_data_section]
Donnees
---
[profile_sync_section]
Synchronisation
---
[profile_friends_count_format]
%d amis
---
[profile_pending_count_format]
%d en attente
---
[profile_social_section]
Social
---
[profile_add_friend_button]
Ajouter un ami
---
[profile_refresh_button]
Actualiser
---
[profile_incoming_title]
Recues
---
[profile_outgoing_title]
Envoyees
---
[profile_no_leaderboard_data]
Aucune donnee de classement
---
[profile_practice_label]
Pratique
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Réglages
@@ -290,10 +383,10 @@ Apparence
Langue
---
[settings_tab_about]
About
A propos
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Un compagnon discret pour la respiration, les habitudes et la synchronisation.
---
[theme_label]
Thème
@@ -818,6 +911,9 @@ Modifier l'habitude
[habit_name_label]
Nom
---
[habit_description_label]
Description
---
[habit_underline_label]
Soulignement
---
@@ -916,6 +1012,18 @@ Choisissez Hebdomadaire ou Calendrier pour suivre votre habitude.
[habits_guide_statistics]
Consultez vos statistiques d'habitudes ici.
---
[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.
---
[nav_mode_label]
Navigation
---
+115 -7
View File
@@ -5,7 +5,7 @@ Inner Breeze
Riwayat
---
[tab_profile]
Profile
Profil
---
[tab_habits]
Kebiasaan
@@ -32,16 +32,109 @@ Pet
Data
---
[profile_data_button]
Configure Data
Atur data
---
[profile_habits_label]
Habits
Kebiasaan
---
[profile_sessions_label]
Sessions
Sesi
---
[profile_storage_label]
Storage
Penyimpanan
---
[profile_friends_title]
Teman
---
[profile_leaderboard_title]
Papan peringkat
---
[profile_metric_streak]
Rangkaian
---
[profile_metric_avg_time]
Waktu rata-rata
---
[profile_metric_avg_hold]
Tahan rata-rata
---
[profile_none_label]
Tidak ada
---
[profile_friend_accept_button]
Terima
---
[profile_friend_decline_button]
Tolak
---
[profile_friend_remove_title]
Hapus teman?
---
[profile_friend_remove_message]
%s akan dihapus. Kirim permintaan baru untuk terhubung lagi.
---
[profile_updating_status]
Memperbarui
---
[profile_no_account]
Tidak ada akun
---
[profile_account_section]
Akun
---
[profile_configure_button]
Atur
---
[profile_data_section]
Data
---
[profile_sync_section]
Sinkronisasi
---
[profile_friends_count_format]
%d teman
---
[profile_pending_count_format]
%d tertunda
---
[profile_social_section]
Sosial
---
[profile_add_friend_button]
Tambah teman
---
[profile_refresh_button]
Segarkan
---
[profile_incoming_title]
Masuk
---
[profile_outgoing_title]
Keluar
---
[profile_no_leaderboard_data]
Tidak ada data papan peringkat
---
[profile_practice_label]
Latihan
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Pengaturan
@@ -287,10 +380,10 @@ Tampilan
Bahasa
---
[settings_tab_about]
About
Tentang
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Pendamping tenang untuk pernapasan, kebiasaan, dan sinkronisasi.
---
[theme_label]
Tema
@@ -776,6 +869,9 @@ Edit kebiasaan
[habit_name_label]
Nama
---
[habit_description_label]
Description
---
[habit_underline_label]
Garis bawah
---
@@ -874,6 +970,18 @@ Pilih Mingguan atau Kalender untuk meninjau kebiasaan.
[habits_guide_statistics]
Lihat statistik kebiasaan Anda di sini.
---
[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.
---
[nav_mode_label]
Navigasi
---
+116 -8
View File
@@ -5,7 +5,7 @@ Inner Breeze
Cronologia
---
[tab_profile]
Profile
Profilo
---
[tab_habits]
Abitudini
@@ -29,19 +29,112 @@ Manuale
Pet
---
[profile_data_title]
Data
Dati
---
[profile_data_button]
Configure Data
Configura dati
---
[profile_habits_label]
Habits
Abitudini
---
[profile_sessions_label]
Sessions
Sessioni
---
[profile_storage_label]
Storage
Archiviazione
---
[profile_friends_title]
Amici
---
[profile_leaderboard_title]
Classifica
---
[profile_metric_streak]
Serie
---
[profile_metric_avg_time]
Tempo medio
---
[profile_metric_avg_hold]
Tenuta media
---
[profile_none_label]
Nessuno
---
[profile_friend_accept_button]
Accetta
---
[profile_friend_decline_button]
Rifiuta
---
[profile_friend_remove_title]
Rimuovere amico?
---
[profile_friend_remove_message]
%s sara rimosso. Invia una nuova richiesta per riconnetterti.
---
[profile_updating_status]
Aggiornamento
---
[profile_no_account]
Nessun account
---
[profile_account_section]
Account
---
[profile_configure_button]
Configura
---
[profile_data_section]
Dati
---
[profile_sync_section]
Sincronizzazione
---
[profile_friends_count_format]
%d amici
---
[profile_pending_count_format]
%d in attesa
---
[profile_social_section]
Social
---
[profile_add_friend_button]
Aggiungi amico
---
[profile_refresh_button]
Aggiorna
---
[profile_incoming_title]
In arrivo
---
[profile_outgoing_title]
In uscita
---
[profile_no_leaderboard_data]
Nessun dato classifica
---
[profile_practice_label]
Pratica
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Impostazioni
@@ -287,10 +380,10 @@ Aspetto
Lingua
---
[settings_tab_about]
About
Informazioni
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Un compagno discreto per respirazione, abitudini e sincronizzazione.
---
[theme_label]
Tema
@@ -776,6 +869,9 @@ Modifica abitudine
[habit_name_label]
Nome
---
[habit_description_label]
Description
---
[habit_underline_label]
Sottolineatura
---
@@ -874,6 +970,18 @@ Scegli Settimanale o Calendario per rivedere l'abitudine.
[habits_guide_statistics]
Visualizza qui le statistiche delle abitudini.
---
[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.
---
[nav_mode_label]
Navigazione
---
+116 -8
View File
@@ -5,7 +5,7 @@
履歴
---
[tab_profile]
Profile
プロフィール
---
[tab_habits]
習慣
@@ -29,19 +29,112 @@ Profile
Pet
---
[profile_data_title]
Data
データ
---
[profile_data_button]
Configure Data
データを設定
---
[profile_habits_label]
Habits
習慣
---
[profile_sessions_label]
Sessions
セッション
---
[profile_storage_label]
Storage
ストレージ
---
[profile_friends_title]
フレンド
---
[profile_leaderboard_title]
ランキング
---
[profile_metric_streak]
連続日数
---
[profile_metric_avg_time]
平均時間
---
[profile_metric_avg_hold]
平均保持
---
[profile_none_label]
なし
---
[profile_friend_accept_button]
承認
---
[profile_friend_decline_button]
拒否
---
[profile_friend_remove_title]
フレンドを削除?
---
[profile_friend_remove_message]
%s を削除します。再接続には新しいリクエストが必要です。
---
[profile_updating_status]
更新中
---
[profile_no_account]
アカウントなし
---
[profile_account_section]
アカウント
---
[profile_configure_button]
設定
---
[profile_data_section]
データ
---
[profile_sync_section]
同期
---
[profile_friends_count_format]
%d人のフレンド
---
[profile_pending_count_format]
%d件保留中
---
[profile_social_section]
ソーシャル
---
[profile_add_friend_button]
フレンドを追加
---
[profile_refresh_button]
更新
---
[profile_incoming_title]
受信
---
[profile_outgoing_title]
送信
---
[profile_no_leaderboard_data]
ランキングデータなし
---
[profile_practice_label]
プラクティス
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
設定
@@ -287,10 +380,10 @@ OK
言語
---
[settings_tab_about]
About
アプリについて
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
呼吸、習慣、同期のための静かなパートナーです。
---
[theme_label]
テーマ
@@ -776,6 +869,9 @@ https:// または localhost:8080 のようなループバックを使用して
[habit_name_label]
名前
---
[habit_description_label]
Description
---
[habit_underline_label]
下線
---
@@ -874,6 +970,18 @@ https:// または localhost:8080 のようなループバックを使用して
[habits_guide_statistics]
ここで習慣の統計を確認できます。
---
[profile_guide_account]
ここで同期アカウントを設定します。
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
ここからフレンドとランキングを開きます。
---
[profile_guide_social_no_account]
フレンドとランキングを使うには同期アカウントを作成してください。
---
[nav_mode_label]
ナビゲーション
---
+116 -8
View File
@@ -5,7 +5,7 @@ Inner Breeze
기록
---
[tab_profile]
Profile
프로필
---
[tab_habits]
습관
@@ -29,19 +29,112 @@ Profile
Pet
---
[profile_data_title]
Data
데이터
---
[profile_data_button]
Configure Data
데이터 설정
---
[profile_habits_label]
Habits
습관
---
[profile_sessions_label]
Sessions
세션
---
[profile_storage_label]
Storage
저장 공간
---
[profile_friends_title]
친구
---
[profile_leaderboard_title]
순위표
---
[profile_metric_streak]
연속 기록
---
[profile_metric_avg_time]
평균 시간
---
[profile_metric_avg_hold]
평균 유지
---
[profile_none_label]
없음
---
[profile_friend_accept_button]
수락
---
[profile_friend_decline_button]
거절
---
[profile_friend_remove_title]
친구 삭제?
---
[profile_friend_remove_message]
%s 님이 삭제됩니다. 다시 연결하려면 새 요청을 보내세요.
---
[profile_updating_status]
업데이트 중
---
[profile_no_account]
계정 없음
---
[profile_account_section]
계정
---
[profile_configure_button]
설정
---
[profile_data_section]
데이터
---
[profile_sync_section]
동기화
---
[profile_friends_count_format]
친구 %d명
---
[profile_pending_count_format]
대기 %d개
---
[profile_social_section]
소셜
---
[profile_add_friend_button]
친구 추가
---
[profile_refresh_button]
새로 고침
---
[profile_incoming_title]
받은 요청
---
[profile_outgoing_title]
보낸 요청
---
[profile_no_leaderboard_data]
순위표 데이터 없음
---
[profile_practice_label]
연습
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
설정
@@ -287,10 +380,10 @@ Finish
언어
---
[settings_tab_about]
About
정보
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
호흡, 습관, 동기화를 위한 조용한 동반자입니다.
---
[theme_label]
테마
@@ -775,6 +868,9 @@ https:// 또는 localhost:8080 같은 루프백을 사용하세요
[habit_name_label]
이름
---
[habit_description_label]
Description
---
[habit_underline_label]
밑줄
---
@@ -873,6 +969,18 @@ https:// 또는 localhost:8080 같은 루프백을 사용하세요
[habits_guide_statistics]
여기에서 습관 통계를 확인하세요.
---
[profile_guide_account]
여기에서 동기화 계정을 설정하세요.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
여기에서 친구와 순위표를 엽니다.
---
[profile_guide_social_no_account]
친구와 순위표를 사용하려면 동기화 계정을 만드세요.
---
[nav_mode_label]
탐색
---
+116 -8
View File
@@ -5,7 +5,7 @@ Inner Breeze
Histórico
---
[tab_profile]
Profile
Perfil
---
[tab_habits]
Hábitos
@@ -29,19 +29,112 @@ Manual
Pet
---
[profile_data_title]
Data
Dados
---
[profile_data_button]
Configure Data
Configurar dados
---
[profile_habits_label]
Habits
Habitos
---
[profile_sessions_label]
Sessions
Sessoes
---
[profile_storage_label]
Storage
Armazenamento
---
[profile_friends_title]
Amigos
---
[profile_leaderboard_title]
Classificacao
---
[profile_metric_streak]
Sequencia
---
[profile_metric_avg_time]
Tempo medio
---
[profile_metric_avg_hold]
Retencao media
---
[profile_none_label]
Nenhum
---
[profile_friend_accept_button]
Aceitar
---
[profile_friend_decline_button]
Recusar
---
[profile_friend_remove_title]
Remover amigo?
---
[profile_friend_remove_message]
%s sera removido. Envie uma nova solicitacao para reconectar.
---
[profile_updating_status]
Atualizando
---
[profile_no_account]
Sem conta
---
[profile_account_section]
Conta
---
[profile_configure_button]
Configurar
---
[profile_data_section]
Dados
---
[profile_sync_section]
Sincronizacao
---
[profile_friends_count_format]
%d amigos
---
[profile_pending_count_format]
%d pendentes
---
[profile_social_section]
Social
---
[profile_add_friend_button]
Adicionar amigo
---
[profile_refresh_button]
Atualizar
---
[profile_incoming_title]
Recebidos
---
[profile_outgoing_title]
Enviados
---
[profile_no_leaderboard_data]
Sem dados de classificacao
---
[profile_practice_label]
Pratica
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Configurações
@@ -287,10 +380,10 @@ Aparência
Idioma
---
[settings_tab_about]
About
Sobre
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Um companheiro tranquilo para respiracao, habitos e sincronizacao.
---
[theme_label]
Tema
@@ -776,6 +869,9 @@ Editar hábito
[habit_name_label]
Nome
---
[habit_description_label]
Description
---
[habit_underline_label]
Sublinhado
---
@@ -874,6 +970,18 @@ Escolha Semanal ou Calendario para revisar seu habito.
[habits_guide_statistics]
Veja suas estatisticas de habitos aqui.
---
[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.
---
[nav_mode_label]
Navegação
---
+116 -8
View File
@@ -5,7 +5,7 @@ Inner Breeze
История
---
[tab_profile]
Profile
Профиль
---
[tab_habits]
Привычки
@@ -29,19 +29,112 @@ Profile
Pet
---
[profile_data_title]
Data
Данные
---
[profile_data_button]
Configure Data
Настроить данные
---
[profile_habits_label]
Habits
Привычки
---
[profile_sessions_label]
Sessions
Сессии
---
[profile_storage_label]
Storage
Хранилище
---
[profile_friends_title]
Друзья
---
[profile_leaderboard_title]
Рейтинг
---
[profile_metric_streak]
Серия
---
[profile_metric_avg_time]
Среднее время
---
[profile_metric_avg_hold]
Средняя задержка
---
[profile_none_label]
Нет
---
[profile_friend_accept_button]
Принять
---
[profile_friend_decline_button]
Отклонить
---
[profile_friend_remove_title]
Удалить друга?
---
[profile_friend_remove_message]
%s будет удален. Для связи отправьте новый запрос.
---
[profile_updating_status]
Обновление
---
[profile_no_account]
Нет аккаунта
---
[profile_account_section]
Аккаунт
---
[profile_configure_button]
Настроить
---
[profile_data_section]
Данные
---
[profile_sync_section]
Синхронизация
---
[profile_friends_count_format]
%d друзей
---
[profile_pending_count_format]
%d ожидают
---
[profile_social_section]
Социальное
---
[profile_add_friend_button]
Добавить друга
---
[profile_refresh_button]
Обновить
---
[profile_incoming_title]
Входящие
---
[profile_outgoing_title]
Исходящие
---
[profile_no_leaderboard_data]
Нет данных рейтинга
---
[profile_practice_label]
Практика
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
Настройки
@@ -290,10 +383,10 @@ OK
Язык
---
[settings_tab_about]
About
О приложении
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
Спокойный помощник для дыхания, привычек и синхронизации.
---
[theme_label]
Тема
@@ -776,6 +869,9 @@ liboqs не собран для этой платформы.
[habit_name_label]
Название
---
[habit_description_label]
Description
---
[habit_underline_label]
Подчеркивание
---
@@ -874,6 +970,18 @@ liboqs не собран для этой платформы.
[habits_guide_statistics]
Здесь можно посмотреть статистику привычек.
---
[profile_guide_account]
Настройте аккаунт синхронизации здесь.
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
Откройте друзей и рейтинг здесь.
---
[profile_guide_social_no_account]
Создайте аккаунт синхронизации, чтобы открыть друзей и рейтинг.
---
[nav_mode_label]
Навигация
---
+116 -8
View File
@@ -5,7 +5,7 @@
历史
---
[tab_profile]
Profile
个人资料
---
[tab_habits]
习惯
@@ -29,19 +29,112 @@ Profile
Pet
---
[profile_data_title]
Data
数据
---
[profile_data_button]
Configure Data
配置数据
---
[profile_habits_label]
Habits
习惯
---
[profile_sessions_label]
Sessions
会话
---
[profile_storage_label]
Storage
存储
---
[profile_friends_title]
好友
---
[profile_leaderboard_title]
排行榜
---
[profile_metric_streak]
连续记录
---
[profile_metric_avg_time]
平均时间
---
[profile_metric_avg_hold]
平均保持
---
[profile_none_label]
无
---
[profile_friend_accept_button]
接受
---
[profile_friend_decline_button]
拒绝
---
[profile_friend_remove_title]
删除好友?
---
[profile_friend_remove_message]
将删除 %s。重新连接需发送新请求。
---
[profile_updating_status]
正在更新
---
[profile_no_account]
没有账户
---
[profile_account_section]
账户
---
[profile_configure_button]
配置
---
[profile_data_section]
数据
---
[profile_sync_section]
同步
---
[profile_friends_count_format]
%d 位好友
---
[profile_pending_count_format]
%d 个待处理
---
[profile_social_section]
社交
---
[profile_add_friend_button]
添加好友
---
[profile_refresh_button]
刷新
---
[profile_incoming_title]
收到
---
[profile_outgoing_title]
发出
---
[profile_no_leaderboard_data]
没有排行榜数据
---
[profile_practice_label]
练习
---
[profile_my_habits_button]
My habits
---
[profile_my_practices_button]
My practices
---
[profile_my_habits_title]
My habits
---
[profile_my_practices_title]
My practices
---
[move_up_button]
Up
---
[move_down_button]
Down
---
[tab_settings]
设置
@@ -287,10 +380,10 @@ Finish
语言
---
[settings_tab_about]
About
关于
---
[about_text]
A quiet breathing companion for practice, habits, and sync.
用于呼吸、习惯和同步的安静伙伴。
---
[theme_label]
主题
@@ -774,6 +867,9 @@ liboqs 未为此目标构建。
[habit_name_label]
名称
---
[habit_description_label]
Description
---
[habit_underline_label]
下划线
---
@@ -872,6 +968,18 @@ Wim Hof 屏息轮次
[habits_guide_statistics]
在这里查看习惯统计。
---
[profile_guide_account]
在这里配置同步账户。
---
[profile_guide_data]
Manage data, habit order, and visible practices here.
---
[profile_guide_social]
从这里打开好友和排行榜。
---
[profile_guide_social_no_account]
创建同步账户以解锁好友和排行榜。
---
[nav_mode_label]
导航
---
+69 -29
View File
@@ -143,10 +143,10 @@ sync_thread_detach(SyncThread thread)
#endif
static int g_sync_finished = 0;
static int g_sync_finished_result = INBE_SYNC_CLIENT_OK;
static int g_sync_finished_result = FLINT_LYRA_SYNC_OK;
static int g_sync_finished_changed = 0;
static int g_social_finished = 0;
static int g_social_finished_result = INBE_SYNC_CLIENT_OK;
static int g_social_finished_result = FLINT_LYRA_SYNC_OK;
static char g_social_friend_requests_json[8192];
static char g_social_friends_json[8192];
static char g_social_leaderboard_json[8192];
@@ -164,12 +164,12 @@ static sync_thread_return
app_sync_worker(void *userdata)
{
InbeSyncWorkerArgs *args = userdata;
InbeSyncClientResult result = INBE_SYNC_CLIENT_INVALID_URL;
FlintLyraSyncResult result = FLINT_LYRA_SYNC_INVALID_URL;
int changed = 0;
if(args != NULL) {
result = sync_client_sync(args->url);
changed = result == INBE_SYNC_CLIENT_OK && storage_last_sync_changed();
changed = result == FLINT_LYRA_SYNC_OK && storage_last_sync_changed();
free(args);
}
@@ -186,9 +186,9 @@ static sync_thread_return
app_social_worker(void *userdata)
{
InbeSocialWorkerArgs *args = userdata;
InbeSyncClientResult result = INBE_SYNC_CLIENT_INVALID_URL;
InbeSyncClientResult friends_result = INBE_SYNC_CLIENT_REQUEST_FAILED;
InbeSyncClientResult leaderboard_result = INBE_SYNC_CLIENT_REQUEST_FAILED;
FlintLyraSyncResult result = FLINT_LYRA_SYNC_INVALID_URL;
FlintLyraSyncResult friends_result = FLINT_LYRA_SYNC_REQUEST_FAILED;
FlintLyraSyncResult leaderboard_result = FLINT_LYRA_SYNC_REQUEST_FAILED;
char requests_json[8192] = "{\"incoming\":[],\"outgoing\":[]}";
char friends_json[8192] = "{\"friends\":[]}";
char leaderboard_json[8192] = "{\"rows\":[]}";
@@ -196,29 +196,33 @@ app_social_worker(void *userdata)
if(args != NULL) {
if(strcmp(args->action, "send") == 0) {
result = sync_client_send_friend_request(args->url, args->action_value);
if(result != INBE_SYNC_CLIENT_OK)
if(result != FLINT_LYRA_SYNC_OK)
goto done;
} else if(strcmp(args->action, "accept") == 0) {
result = sync_client_accept_friend_request(args->url, args->action_value);
if(result != INBE_SYNC_CLIENT_OK)
if(result != FLINT_LYRA_SYNC_OK)
goto done;
} else if(strcmp(args->action, "decline") == 0) {
result = sync_client_decline_friend_request(args->url, args->action_value);
if(result != INBE_SYNC_CLIENT_OK)
if(result != FLINT_LYRA_SYNC_OK)
goto done;
} else if(strcmp(args->action, "remove") == 0) {
result = sync_client_remove_friend(args->url, args->action_value);
if(result != FLINT_LYRA_SYNC_OK)
goto done;
}
result = sync_client_get_friend_requests(args->url, requests_json,
sizeof(requests_json));
if(result == INBE_SYNC_CLIENT_OK) {
if(result == FLINT_LYRA_SYNC_OK) {
friends_result = sync_client_get_friends(args->url, friends_json,
sizeof(friends_json));
leaderboard_result =
sync_client_get_friend_stats(args->url, "inbe", args->practice,
args->metric, leaderboard_json,
sizeof(leaderboard_json));
if(friends_result != INBE_SYNC_CLIENT_OK)
if(friends_result != FLINT_LYRA_SYNC_OK)
result = friends_result;
else if(leaderboard_result != INBE_SYNC_CLIENT_OK)
else if(leaderboard_result != FLINT_LYRA_SYNC_OK)
result = leaderboard_result;
}
}
@@ -257,14 +261,14 @@ app_collect_finished_sync(void)
if(!finished)
return;
if(result == INBE_SYNC_CLIENT_OK) {
if(result == FLINT_LYRA_SYNC_OK) {
TraceLog(LOG_INFO, "SYNC: background sync complete changed=%d", changed);
g_social_refresh_pending = 1;
if(changed)
g_sync_refresh_pending = 1;
} else {
TraceLog(LOG_WARNING, "SYNC: background sync failed result=%d name=%s",
result, sync_client_result_name(result));
result, flint_lyra_sync_result_name(result));
}
}
@@ -276,7 +280,7 @@ app_sync_events_worker(void *userdata)
if(args == NULL)
return sync_thread_done;
for(;;) {
InbeSyncClientResult result;
FlintLyraSyncResult result;
sync_lock();
if(g_sync_running) {
sync_unlock();
@@ -287,10 +291,10 @@ app_sync_events_worker(void *userdata)
result = sync_client_wait_for_remote_event(args->url);
sync_lock();
if(result == INBE_SYNC_CLIENT_OK)
if(result == FLINT_LYRA_SYNC_OK)
g_remote_sync_due = 1;
sync_unlock();
if(result != INBE_SYNC_CLIENT_OK)
if(result != FLINT_LYRA_SYNC_OK)
sync_sleep(2);
}
return sync_thread_done;
@@ -346,7 +350,7 @@ static double g_sync_events_retry_at = 0.0;
static void
app_collect_finished_sync(void)
{
InbeSyncClientResult result;
FlintLyraSyncResult result;
int changed = 0;
if(sync_client_web_poll_remote_event())
@@ -356,14 +360,14 @@ app_collect_finished_sync(void)
if(!sync_client_web_sync_poll(&result, &changed))
return;
g_sync_running = 0;
if(result == INBE_SYNC_CLIENT_OK) {
if(result == FLINT_LYRA_SYNC_OK) {
TraceLog(LOG_INFO, "SYNC: background sync complete changed=%d", changed);
g_social_refresh_pending = 1;
if(changed)
g_sync_refresh_pending = 1;
} else {
TraceLog(LOG_WARNING, "SYNC: background sync failed result=%d name=%s",
result, sync_client_result_name(result));
result, flint_lyra_sync_result_name(result));
}
}
@@ -398,6 +402,11 @@ app_background_sync_safe(const InbeApp *app)
return 0;
if(app->modal.active)
return 0;
if(app->habit_edit.active ||
app->sync_server_url_focused ||
app->sync_alias_focused ||
app->profile_friend_input_focused)
return 0;
if(app->inbe.screen == InbeScreenPracticeSession ||
app->inbe.screen == InbeScreenMeditation ||
app->inbe.screen == InbeScreenSunSalutation)
@@ -427,6 +436,7 @@ app_modal_type_name(UIModalType type)
case UIModalSyncReview: return "sync_review";
case UIModalSyncAlias: return "sync_alias";
case UIModalSyncPublicId: return "sync_public_id";
case UIModalConfirmRemoveFriend: return "confirm_remove_friend";
default: break;
}
return "unknown";
@@ -603,9 +613,9 @@ app_collect_finished_social_refresh(InbeApp *app)
if(!finished)
return;
if(result != INBE_SYNC_CLIENT_OK) {
if(result != FLINT_LYRA_SYNC_OK) {
TraceLog(LOG_WARNING, "SYNC: social refresh failed result=%d name=%s",
result, sync_client_result_name(result));
result, flint_lyra_sync_result_name(result));
return;
}
storage_set_social_cache_json("friends.requests", requests_json);
@@ -684,6 +694,13 @@ app_request_friend_decline(InbeApp *app, const char *request_id)
app_request_social_action("decline", request_id);
}
void
app_request_friend_remove(InbeApp *app, const char *friend_user_id)
{
(void)app;
app_request_social_action("remove", friend_user_id);
}
static int
app_sync_now(InbeApp *app)
{
@@ -770,7 +787,7 @@ app_pump_sync(InbeApp *app)
return;
app_collect_finished_sync();
app_collect_finished_social_refresh(app);
if(storage_sync_review_pending() && !app->modal.active) {
if(storage_sync_review_pending() && app_background_sync_safe(app)) {
if(storage_sync_review_clear_if_no_visible_diff()) {
app_reload_after_import(app, 0);
} else {
@@ -1710,6 +1727,10 @@ draw_global_modal(InbeApp *app)
}
if(app->modal.type == UIModalThemePicker)
settings_screen_draw_theme_picker_modal(app);
if(app->modal.type == UIModalConfirmRemoveFriend) {
profile_screen_draw_remove_friend_modal(app);
return;
}
if(app->modal.type == UIModalPracticeManual ||
app->modal.type == UIModalPracticeConfig ||
app->modal.type == UIModalEditProgressiveStartSpeed) {
@@ -1746,13 +1767,16 @@ static void
updateapp(InbeApp *app)
{
int center_x = view_width / 2;
int center_y = view_height / 2;
int frame_view_height = view_height;
int center_y;
int play_center_y;
int hover = 0;
int frame_screen = app->inbe.screen;
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;
#if !ANDROID_BUILD && !defined(PLATFORM_WEB)
app->backgrounded = (!IsWindowFocused() || IsWindowMinimized()) ? 1 : 0;
@@ -1766,23 +1790,31 @@ 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 == UIModalPracticeManual ||
app->modal.type == UIModalPracticeConfig ||
app->modal.type == UIModalEditProgressiveStartSpeed);
if(app->modal.active || first_run_guide_active || habits_guide_active) {
if(app->modal.active || first_run_guide_active || habits_guide_active ||
profile_guide_active) {
ui_push_input_capture((Rectangle){0, 0, (float)view_width, (float)view_height}, 0);
}
view_height = app_page_height(app, view_height);
center_y = view_height / 2;
if(IsKeyPressed(KEY_BACK)) {
if(first_run_guide_active || habits_guide_active) {
if(first_run_guide_active || habits_guide_active || profile_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 {
@@ -1896,14 +1928,22 @@ updateapp(InbeApp *app)
}
finish_frame:
if(practice_fullscreen_modal) {
draw_global_modal(app);
global_modal_drawn = 1;
}
view_height = frame_view_height;
app_draw_bottom_nav(app);
practice_screen_draw_first_run_guide(app);
habits_screen_draw_first_run_guide(app);
draw_global_modal(app);
profile_screen_draw_first_run_guide(app);
if(!global_modal_drawn)
draw_global_modal(app);
app_flush_deferred_settings(app);
app_observe_direct_screen_change(app, frame_screen);
if(app->transition_mode == APP_TRANSITION_FADE) {
flint_transition_draw_fade(&app->screen_transition, view_width, view_height,
flint_transition_draw_fade(&app->screen_transition, view_width,
app_page_height(app, view_height),
flint_theme_get_bg());
}
app_advance_screen_transition(app);
+12
View File
@@ -52,6 +52,8 @@ enum {
PROFILE_VIEW_MAIN = 0,
PROFILE_VIEW_DATA,
PROFILE_VIEW_SYNC_ACCOUNT,
PROFILE_VIEW_HABITS,
PROFILE_VIEW_PRACTICES,
};
enum {
@@ -95,6 +97,7 @@ typedef enum {
UIModalSyncReview,
UIModalSyncAlias,
UIModalSyncPublicId,
UIModalConfirmRemoveFriend,
} UIModalType;
typedef struct {
@@ -225,8 +228,11 @@ typedef struct HabitEditState {
int is_new;
int index;
int cursor;
int description_cursor;
int focused;
int description_focused;
char text[INBE_HABIT_NAME_SIZE];
char description[INBE_HABIT_DESCRIPTION_SIZE];
Color color;
int sync_mode;
int sync_activity;
@@ -279,6 +285,8 @@ struct InbeApp {
int profile_friend_input_focused;
int profile_friends_loaded;
char profile_friend_input[80];
char profile_pending_friend_remove_id[80];
char profile_pending_friend_remove_name[96];
char profile_friends_json[8192];
char profile_friend_requests_json[8192];
char profile_leaderboard_json[8192];
@@ -305,7 +313,10 @@ struct InbeApp {
int tutorial_seen;
int habits_guide_step;
int habits_guide_seen;
int profile_guide_step;
int profile_guide_seen;
int exercise_manual_seen_mask;
int practice_visible_mask;
int theme_id;
int dark_mode;
@@ -365,6 +376,7 @@ void app_request_social_refresh(InbeApp *app);
void app_request_friend_send(InbeApp *app, const char *target);
void app_request_friend_accept(InbeApp *app, const char *request_id);
void app_request_friend_decline(InbeApp *app, const char *request_id);
void app_request_friend_remove(InbeApp *app, const char *friend_user_id);
int app_should_use_tab_bar(const InbeApp *app);
void app_play_sound(InbeApp *app, Sound sound, float scale);
Texture2D app_load_asset_texture(const char *name);
+37 -4
View File
@@ -92,7 +92,30 @@ app_content_bottom_reserved(const InbeApp *app)
return 0;
if(app_current_nav_route(app) == APP_NAV_ROUTE_NONE)
return 0;
return ui_bottom_nav_height() + app_android_bottom_nav_height();
return ui_bottom_nav_height();
}
int
app_page_height(const InbeApp *app, int full_height)
{
int bottom_reserved;
if(full_height <= 0)
return 0;
bottom_reserved = app_fullscreen_bottom_reserved(app);
if(bottom_reserved > 0 && bottom_reserved < full_height)
return full_height - bottom_reserved;
return full_height;
}
static int
app_has_fullscreen_overlay(const InbeApp *app)
{
if(app == NULL || !app->modal.active)
return 0;
return app->modal.type == UIModalPracticeManual ||
app->modal.type == UIModalPracticeConfig ||
app->modal.type == UIModalEditProgressiveStartSpeed;
}
static const char *
@@ -172,9 +195,19 @@ app_should_draw_bottom_nav(const InbeApp *app)
{
if(app == NULL)
return 0;
if(app_has_fullscreen_overlay(app))
return 0;
return app_current_nav_route(app) != APP_NAV_ROUTE_NONE;
}
int
app_fullscreen_bottom_reserved(const InbeApp *app)
{
if(app == NULL)
return 0;
return app_android_bottom_nav_height();
}
void
app_draw_bottom_nav(InbeApp *app)
{
@@ -189,6 +222,9 @@ app_draw_bottom_nav(InbeApp *app)
FlintUIBottomNavItem items[BOTTOM_NAV_ROUTE_COUNT];
FlintUIBottomNavResult result;
if(app_android_bottom_nav_height() > 0)
DrawRectangle(0, view_height - app_android_bottom_nav_height(),
view_width, app_android_bottom_nav_height(), BLACK);
if(!app_should_draw_bottom_nav(app))
return;
for(int i = 0; i < BOTTOM_NAV_ROUTE_COUNT; i++) {
@@ -201,9 +237,6 @@ app_draw_bottom_nav(InbeApp *app)
app->modal.active
};
}
if(app_android_bottom_nav_height() > 0)
DrawRectangle(0, view_height - app_android_bottom_nav_height(),
view_width, app_android_bottom_nav_height(), BLACK);
result = ui_draw_bottom_nav((FlintUIBottomNav){
.view_width = view_width,
.view_height = view_height,
+2
View File
@@ -4,7 +4,9 @@
#include "app_fwd.h"
int app_current_nav_route(const InbeApp *app);
int app_page_height(const InbeApp *app, int full_height);
int app_content_bottom_reserved(const InbeApp *app);
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);
+8
View File
@@ -160,7 +160,9 @@ 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},
{"dark_mode", app->dark_mode},
{"theme_mode", app->theme_mode},
@@ -258,6 +260,7 @@ 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
@@ -321,6 +324,11 @@ app_load_settings(InbeApp *app)
if(manual_seen_mask < 0)
manual_seen_mask = app->tutorial_seen ? exercise_manual_bit(EXERCISE_WIM_HOF) : 0;
app->exercise_manual_seen_mask = manual_seen_mask & ((1 << EXERCISE_COUNT) - 1);
app->practice_visible_mask = storage_get_setting_int("practice_visible_mask",
(1 << EXERCISE_COUNT) - 1);
app->practice_visible_mask &= (1 << EXERCISE_COUNT) - 1;
if(app->practice_visible_mask == 0)
app->practice_visible_mask = (1 << EXERCISE_COUNT) - 1;
load_language_setting(app, settings_missing);
+2 -2
View File
@@ -3,7 +3,7 @@
#define INBE_VERSION_MAJOR 1
#define INBE_VERSION_MINOR 7
#define INBE_VERSION_PATCH 0
#define INBE_VERSION_STRING "1.7.0"
#define INBE_VERSION_PATCH 4
#define INBE_VERSION_STRING "1.7.4"
#endif
+2 -1
View File
@@ -175,7 +175,8 @@ meditation_config_screen_draw(InbeApp *app)
}
scroll_y = title_h + flint_px(16);
scroll_h = view_height - scroll_y - bottom_reserved - flint_px(8);
scroll_h = view_height - scroll_y - bottom_reserved -
(integrated ? flint_px(8) : 0);
if(scroll_h < 0)
scroll_h = 0;
+2 -1
View File
@@ -383,7 +383,8 @@ whm_config_screen_draw(InbeApp *app)
app->settings_scroll = 0;
}
scroll_y = title_h + config_tab_h + config_tab_gap;
scroll_h = view_height - scroll_y - bottom_reserved - flint_px(8);
scroll_h = view_height - scroll_y - bottom_reserved -
(integrated ? flint_px(8) : 0);
if(scroll_h < 0)
scroll_h = 0;
+1 -1
View File
@@ -425,7 +425,7 @@ finish_round(InbeApp *app)
if(session_ensure_results_saved(app)) {
#if ANDROID_BUILD
android_allow_screen_off();
android_timer_stop();
stop_android_background_session(app);
#endif
app_switch_screen(app, InbeScreenResults);
#if ANDROID_BUILD
+60 -23
View File
@@ -6,19 +6,23 @@ habit_edit_begin_new(InbeApp *app)
{
const char *default_name;
Color default_color = {99, 196, 165, 255};
int created;
if(app == NULL)
return;
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);
app->habit_edit = (HabitEditState){
.active = 1,
.is_new = 1,
.index = -1,
.color = default_color,
.sync_mode = INBE_HABIT_SYNC_NONE
};
snprintf(app->habit_edit.text, sizeof(app->habit_edit.text), "%s", default_name);
app->habit_edit.cursor = (int)strlen(app->habit_edit.text);
app->habit_edit.focused = 1;
app->habits.tab = HABIT_TAB_EDIT;
app_switch_screen(app, InbeScreenHabits);
}
void
@@ -37,7 +41,10 @@ habit_edit_begin(InbeApp *app, int index)
};
snprintf(app->habit_edit.text, sizeof(app->habit_edit.text), "%s",
app->habits.items[index].name);
snprintf(app->habit_edit.description, sizeof(app->habit_edit.description), "%s",
app->habits.items[index].description);
app->habit_edit.cursor = (int)strlen(app->habit_edit.text);
app->habit_edit.description_cursor = (int)strlen(app->habit_edit.description);
app->habits.tab = HABIT_TAB_EDIT;
app_switch_screen(app, InbeScreenHabits);
}
@@ -183,6 +190,9 @@ habit_edit_commit(InbeApp *app)
app->habit_edit.sync_activity);
if(created >= 0 && created < app->habits.count) {
app->habits.items[created].counter_enabled = app->habit_edit.counter_enabled != 0;
snprintf(app->habits.items[created].description,
sizeof(app->habits.items[created].description), "%s",
app->habit_edit.description);
habits_save(&app->habits);
}
} else {
@@ -195,6 +205,9 @@ habit_edit_commit(InbeApp *app)
}
snprintf(app->habits.items[index].name,
sizeof(app->habits.items[index].name), "%s", text);
snprintf(app->habits.items[index].description,
sizeof(app->habits.items[index].description), "%s",
app->habit_edit.description);
app->habits.items[index].color = app->habit_edit.color;
app->habits.items[index].color.a = 255;
app->habits.items[index].sync_mode = app->habit_edit.sync_mode;
@@ -213,18 +226,18 @@ habit_edit_commit(InbeApp *app)
}
static void
habit_edit_clamp_cursor(InbeApp *app)
habit_edit_clamp_cursor(char *text, int *cursor)
{
int len;
if(app == NULL)
if(text == NULL || cursor == NULL)
return;
len = (int)strlen(app->habit_edit.text);
if(app->habit_edit.cursor < 0)
app->habit_edit.cursor = 0;
if(app->habit_edit.cursor > len)
app->habit_edit.cursor = len;
len = (int)strlen(text);
if(*cursor < 0)
*cursor = 0;
if(*cursor > len)
*cursor = len;
}
static void
@@ -239,7 +252,8 @@ habit_edit_handle_keyboard(InbeApp *app)
}
static FlintUITextField
habit_edit_text_field(InbeApp *app, int font)
habit_edit_text_field(char *text, size_t text_size, int *cursor, int *focused,
int max_codepoints, int font)
{
FlintUITextInputStyle style = {
.background = flint_darken(flint_theme_get_bg(), 4),
@@ -253,11 +267,11 @@ habit_edit_text_field(InbeApp *app, int font)
return (FlintUITextField){
.bounds = {0},
.text = app->habit_edit.text,
.text_size = sizeof(app->habit_edit.text),
.cursor_position = &app->habit_edit.cursor,
.focused = &app->habit_edit.focused,
.max_codepoints = INBE_HABIT_NAME_SIZE - 1,
.text = text,
.text_size = text_size,
.cursor_position = cursor,
.focused = focused,
.max_codepoints = max_codepoints,
.font = font,
.style = style
};
@@ -302,6 +316,10 @@ habit_edit_scroll_content_height(int content_w, void *user_data)
.label = locale_get("habit_name_label"),
.field_h = flint_px(40)
});
height += ui_label_text_field_height((FlintUILabelTextField){
.label = locale_get("habit_description_label"),
.field_h = flint_px(40)
});
height += flint_px(32) + flint_px(34);
height += ui_section_label_height((FlintUISectionLabel){0});
for(int i = 0; i < EXERCISE_COUNT; i++)
@@ -438,12 +456,31 @@ draw_habit_edit_screen(InbeApp *app)
}
(void)ui_draw_label_text_field((FlintUILabelTextField){
.label = locale_get("habit_name_label"),
.field = habit_edit_text_field(app, font),
.field = habit_edit_text_field(app->habit_edit.text,
sizeof(app->habit_edit.text),
&app->habit_edit.cursor,
&app->habit_edit.focused,
INBE_HABIT_NAME_SIZE - 1, font),
.field_h = field_h,
.label_font = label_font,
.label_color = flint_darken(flint_theme_get_text(), 34)
}, content_x, y, content_w);
habit_edit_clamp_cursor(app);
habit_edit_clamp_cursor(app->habit_edit.text, &app->habit_edit.cursor);
y += ui_label_text_field_height((FlintUILabelTextField){.field_h = field_h});
(void)ui_draw_label_text_field((FlintUILabelTextField){
.label = locale_get("habit_description_label"),
.field = habit_edit_text_field(app->habit_edit.description,
sizeof(app->habit_edit.description),
&app->habit_edit.description_cursor,
&app->habit_edit.description_focused,
INBE_HABIT_DESCRIPTION_SIZE - 1, font),
.field_h = field_h,
.label_font = label_font,
.label_color = flint_darken(flint_theme_get_text(), 34)
}, content_x, y, content_w);
habit_edit_clamp_cursor(app->habit_edit.description,
&app->habit_edit.description_cursor);
y += ui_label_text_field_height((FlintUILabelTextField){.field_h = field_h});
flint_text_draw(locale_get("habit_underline_label"), content_x, y,
+68 -15
View File
@@ -328,6 +328,40 @@ habits_delete(InbeHabits *habits, int index)
habits_save(habits);
}
int
habits_move(InbeHabits *habits, int from_index, int to_index)
{
InbeHabit moved;
if(habits == NULL || from_index < 0 || to_index < 0 ||
from_index >= habits->count || to_index >= habits->count ||
from_index == to_index)
return 0;
moved = habits->items[from_index];
if(from_index < to_index) {
for(int i = from_index; i < to_index; i++)
habits->items[i] = habits->items[i + 1];
} else {
for(int i = from_index; i > to_index; i--)
habits->items[i] = habits->items[i - 1];
}
habits->items[to_index] = moved;
if(habits->selected == from_index) {
habits->selected = to_index;
} else if(from_index < to_index &&
habits->selected > from_index && habits->selected <= to_index) {
habits->selected--;
} else if(from_index > to_index &&
habits->selected >= to_index && habits->selected < from_index) {
habits->selected++;
}
habits_save(habits);
return 1;
}
int
habits_name_exists(const InbeHabits *habits, const char *name, int exclude_index)
{
@@ -808,6 +842,7 @@ habits_screen_draw_desktop_tab_bar(InbeApp *app, int y)
{
FlintUITab tabs[INBE_HABIT_MAX + 1];
int tab_count = 0;
int selected_index;
if(app == NULL)
return -1;
@@ -831,11 +866,14 @@ habits_screen_draw_desktop_tab_bar(InbeApp *app, int y)
.disabled = app->modal.active
};
selected_index = app->habit_edit.active && app->habit_edit.is_new
? -1
: app->habits.selected;
int clicked = ui_draw_tab_bar((FlintUITabBar){
.bounds = {0, (float)y, (float)view_width, (float)ui_tab_bar_height()},
.tabs = tabs,
.count = tab_count,
.selected_index = app->habits.selected,
.selected_index = selected_index,
.min_tab_width = flint_px(100),
.max_tab_width = flint_px(160),
.scroll_offset = &app->habits.tab_scroll,
@@ -861,10 +899,13 @@ habits_screen_top_reserved(InbeApp *app)
static void
draw_habits_top_bar(InbeApp *app, int draw_menu)
{
static const char *options[INBE_HABIT_MAX + 1];
static const char *options[INBE_HABIT_MAX + 2];
static int dropdown_selected = 0;
FlintUISubtab tabs[HABIT_TAB_COUNT];
int option_count;
int habit_offset = 0;
int add_option_index;
int draft_new;
int selected;
int top_h = flint_px(58);
int tab_h = flint_px(40);
@@ -875,15 +916,19 @@ draw_habits_top_bar(InbeApp *app, int draw_menu)
if(app == NULL)
return;
option_count = app->habits.count;
if(option_count > INBE_HABIT_MAX)
option_count = INBE_HABIT_MAX;
for(int i = 0; i < option_count; i++)
options[i] = app->habits.items[i].name;
options[option_count++] = locale_get("habit_add_new_option");
draft_new = app->habit_edit.active && app->habit_edit.is_new;
option_count = 0;
if(draft_new) {
options[option_count++] = "";
habit_offset = 1;
}
for(int i = 0; i < app->habits.count && i < INBE_HABIT_MAX; i++)
options[option_count++] = app->habits.items[i].name;
add_option_index = option_count;
options[option_count++] = "+ Habit";
selected = app->habits.selected;
if(selected < 0 || selected >= app->habits.count)
selected = draft_new ? 0 : app->habits.selected + habit_offset;
if(!draft_new && (app->habits.selected < 0 || app->habits.selected >= app->habits.count))
selected = 0;
if(!draw_menu) {
@@ -994,15 +1039,20 @@ draw_habits_top_bar(InbeApp *app, int draw_menu)
.selected_index = &dropdown_selected
});
if(toolbar_result.selected_menu_item >= 0) {
if(dropdown_selected == app->habits.count) {
int selected_habit = dropdown_selected - habit_offset;
if(draft_new && dropdown_selected == 0)
return;
if(dropdown_selected == add_option_index) {
habit_edit_begin_new(app);
return;
}
if(app->habits.selected != dropdown_selected) {
if(selected_habit >= 0 && selected_habit < app->habits.count &&
app->habits.selected != selected_habit) {
int was_edit_tab = app->habits.tab == HABIT_TAB_EDIT;
if(was_edit_tab && app->habit_edit.active)
habit_edit_commit(app);
app->habits.selected = dropdown_selected;
app->habits.selected = selected_habit;
app->habits.scroll = 0;
app->habits.weekly_days = HABIT_WEEKLY_INITIAL_DAYS;
if(was_edit_tab) {
@@ -1045,7 +1095,8 @@ habits_screen_prepare_first_run_guide(InbeApp *app)
app->habits.tab = HABIT_TAB_EDIT;
app->habits.scroll = 0;
if(app->habits.count > 0) {
if(!app->habit_edit.active || app->habit_edit.index != app->habits.selected)
if(!app->habit_edit.active ||
(!app->habit_edit.is_new && app->habit_edit.index != app->habits.selected))
habit_edit_begin(app, app->habits.selected);
} else if(!app->habit_edit.active) {
habit_edit_begin_new(app);
@@ -1137,6 +1188,7 @@ habits_screen_practice_list_anchor(InbeApp *app)
flint_centered_column(flint_px(CONTENT_MAX_W), flint_page_side_padding(),
&content_x, &content_w);
y += ui_label_text_field_height((FlintUILabelTextField){.field_h = field_h});
y += ui_label_text_field_height((FlintUILabelTextField){.field_h = field_h});
y += flint_px(32);
y += flint_px(34);
@@ -1708,7 +1760,8 @@ draw_habits_screen(InbeApp *app)
}
if(app->habits.tab == HABIT_TAB_EDIT) {
if(!app->habit_edit.active || app->habit_edit.index != app->habits.selected)
if(!app->habit_edit.active ||
(!app->habit_edit.is_new && app->habit_edit.index != app->habits.selected))
habit_edit_begin(app, app->habits.selected);
draw_habit_edit_screen(app);
draw_habits_top_bar(app, 0);
+3
View File
@@ -17,6 +17,7 @@ enum {
INBE_HABIT_MAX = 10,
INBE_HABIT_ID_SIZE = 32,
INBE_HABIT_NAME_SIZE = 40,
INBE_HABIT_DESCRIPTION_SIZE = 256,
HABIT_LINKED_ENTRY_MAX = 128,
HABIT_LINKED_PATH_SIZE = 80
};
@@ -50,6 +51,7 @@ typedef struct InbeHabitDay {
typedef struct InbeHabit {
char id[INBE_HABIT_ID_SIZE];
char name[INBE_HABIT_NAME_SIZE];
char description[INBE_HABIT_DESCRIPTION_SIZE];
Color color;
int sync_mode;
int sync_activity;
@@ -123,6 +125,7 @@ void habit_toggle_today(InbeHabits *habits, int index);
void habits_add_default(InbeHabits *habits);
void habits_add_default_set(InbeHabits *habits);
void habits_delete(InbeHabits *habits, int index);
int habits_move(InbeHabits *habits, int from_index, int to_index);
int habits_name_exists(const InbeHabits *habits, const char *name, int exclude_index);
void habits_generate_unique_name(InbeHabits *habits, char *name_buffer, size_t buffer_size, const char *base_name);
int habits_add_custom(InbeHabits *habits, const char *name, Color color,
+80 -8
View File
@@ -13,6 +13,57 @@ enum {
PRACTICE_GUIDE_STEPS = 3
};
int
practice_visible_mask_all(void)
{
return (1 << EXERCISE_COUNT) - 1;
}
static int
practice_sanitize_visible_mask(int mask)
{
mask &= practice_visible_mask_all();
return mask != 0 ? mask : practice_visible_mask_all();
}
int
practice_is_visible(const InbeApp *app, int exercise)
{
int mask;
if(exercise < 0 || exercise >= EXERCISE_COUNT)
return 0;
mask = practice_sanitize_visible_mask(app != NULL ? app->practice_visible_mask : 0);
return (mask & (1 << exercise)) != 0;
}
static int
practice_first_visible(const InbeApp *app)
{
for(int i = 0; i < EXERCISE_COUNT; i++) {
if(practice_is_visible(app, i))
return i;
}
return EXERCISE_WIM_HOF;
}
void
practice_set_visible(InbeApp *app, int exercise, int visible)
{
int mask;
if(app == NULL || exercise < 0 || exercise >= EXERCISE_COUNT)
return;
mask = practice_sanitize_visible_mask(app->practice_visible_mask);
if(visible)
mask |= 1 << exercise;
else if((mask & ~(1 << exercise)) != 0)
mask &= ~(1 << exercise);
app->practice_visible_mask = practice_sanitize_visible_mask(mask);
practice_clamp_activity_to_tab(app);
save_settings(app);
}
int
practice_activity_count_for_tab(int tab)
{
@@ -43,7 +94,10 @@ practice_clamp_activity_to_tab(InbeApp *app)
{
if(app == NULL)
return;
app->practice_visible_mask = practice_sanitize_visible_mask(app->practice_visible_mask);
app->exercise_type = practice_clamp_id(app->exercise_type);
if(!practice_is_visible(app, app->exercise_type))
app->exercise_type = practice_first_visible(app);
}
void
@@ -88,13 +142,20 @@ static int
practice_screen_draw_desktop_tab_bar(InbeApp *app, int y)
{
FlintUITab tabs[EXERCISE_COUNT];
int values[EXERCISE_COUNT];
int tab_count = 0;
int selected_index = 0;
int clicked;
if(app == NULL)
return -1;
// Create tab for each exercise type
for(int i = 0; i < EXERCISE_COUNT; i++) {
if(!practice_is_visible(app, i))
continue;
if(i == app->exercise_type)
selected_index = tab_count;
values[tab_count] = i;
tabs[tab_count++] = (FlintUITab){
.label = practice_activity_label(i),
.icon = (Texture2D){0},
@@ -102,15 +163,18 @@ practice_screen_draw_desktop_tab_bar(InbeApp *app, int y)
.disabled = app->modal.active
};
}
if(tab_count <= 0)
return -1;
return ui_draw_tab_bar((FlintUITabBar){
clicked = ui_draw_tab_bar((FlintUITabBar){
.bounds = {0, (float)y, (float)view_width, (float)ui_tab_bar_height()},
.tabs = tabs,
.count = tab_count,
.selected_index = app->exercise_type,
.selected_index = selected_index,
.min_tab_width = flint_px(120),
.max_tab_width = flint_px(180)
});
return clicked >= 0 && clicked < tab_count ? values[clicked] : -1;
}
static int
@@ -131,12 +195,20 @@ practice_screen_draw_top_bar(InbeApp *app, int draw_menu)
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]);
practice_clamp_activity_to_tab(app);
activity_count = 0;
activity_index = 0;
for(int i = 0; i < EXERCISE_COUNT; i++) {
if(!practice_is_visible(app, i))
continue;
if(i == app->exercise_type)
activity_index = activity_count;
exercise_values[activity_count] = i;
exercise_options[activity_count] = practice_activity_label(i);
activity_count++;
}
activity_index = clampi(app->exercise_type, 0, EXERCISE_COUNT - 1);
if(activity_count <= 0)
return;
if(draw_menu) {
FlintUIToolbarResult menu_result = ui_draw_toolbar_header((FlintUIToolbarHeader){
+3
View File
@@ -11,6 +11,9 @@
int practice_activity_count_for_tab(int tab);
int practice_activity_for_tab(int tab, int index);
const char *practice_activity_label(int exercise);
int practice_visible_mask_all(void);
int practice_is_visible(const InbeApp *app, int exercise);
void practice_set_visible(InbeApp *app, int exercise, int visible);
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);
+420 -70
View File
@@ -4,6 +4,7 @@
#include "flint_locale.h"
#include "flint_theme.h"
#include "flint_ui.h"
#include "practice_screen.h"
#include "settings/settings_data.h"
#include "settings/settings_screen.h"
#include "settings/settings_sync_account.h"
@@ -18,10 +19,12 @@
#include <time.h>
extern int view_height;
extern int view_width;
#define INBE_SYNC_SERVER_URL_KEY "sync_server_url"
enum {
PROFILE_GUIDE_STEPS = 3,
PROFILE_LEADERBOARD_STREAK = 0,
PROFILE_LEADERBOARD_AVG_HOLD,
PROFILE_LEADERBOARD_METRIC_COUNT
@@ -42,13 +45,17 @@ static int
profile_main_content_height(int content_w)
{
(void)content_w;
return flint_px(620);
return flint_px(700);
}
static int
profile_data_content_height(int content_w)
{
return settings_data_content_height(content_w) + flint_px(104);
int height = settings_data_content_height(content_w) + flint_px(104);
if(sync_account_load(&(InbeSyncAccount){0}))
height += flint_px(86);
return height;
}
static int
@@ -58,6 +65,20 @@ profile_sync_content_height(int content_w)
return flint_px(430);
}
static int
profile_habits_content_height(int content_w)
{
(void)content_w;
return flint_px(90) + flint_px(48) * INBE_HABIT_MAX;
}
static int
profile_practices_content_height(int content_w)
{
(void)content_w;
return flint_px(92) + flint_px(46) * EXERCISE_COUNT;
}
static int
profile_content_height(int content_w, void *user_data)
{
@@ -67,6 +88,10 @@ profile_content_height(int content_w, void *user_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(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 flint_px(740);
if(app != NULL && app->profile_tab == PROFILE_TAB_LEADERBOARD)
@@ -165,8 +190,10 @@ static const char *
profile_leaderboard_metric_label(int practice, int metric)
{
if(metric != PROFILE_LEADERBOARD_AVG_HOLD)
return "Streak";
return practice == EXERCISE_MEDITATION ? "AVG time" : "Avg hold";
return locale_get("profile_metric_streak");
return practice == EXERCISE_MEDITATION
? locale_get("profile_metric_avg_time")
: locale_get("profile_metric_avg_hold");
}
static void
@@ -267,6 +294,49 @@ profile_json_number_value(const char *object, const char *key)
static void profile_refresh_friends(InbeApp *app);
static void
profile_public_id_short(char *out, size_t out_size, const char *user_id)
{
if(out == NULL || out_size == 0)
return;
if(user_id == NULL || user_id[0] == '\0')
snprintf(out, out_size, "----");
else
snprintf(out, out_size, "%.*s", 4, user_id);
}
static void
profile_display_name(char *out, size_t out_size, const char *alias,
const char *user_id)
{
char short_id[8];
if(out == NULL || out_size == 0)
return;
if(alias != NULL && alias[0] != '\0') {
snprintf(out, out_size, "@%s", alias);
} else if(user_id != NULL && user_id[0] != '\0') {
profile_public_id_short(short_id, sizeof(short_id), user_id);
snprintf(out, out_size, "%s...", short_id);
} else {
snprintf(out, out_size, "----...");
}
}
static void
profile_prompt_remove_friend(InbeApp *app, const char *friend_user_id,
const char *friend_name)
{
if(app == NULL || friend_user_id == NULL || friend_user_id[0] == '\0')
return;
snprintf(app->profile_pending_friend_remove_id,
sizeof(app->profile_pending_friend_remove_id), "%s", friend_user_id);
snprintf(app->profile_pending_friend_remove_name,
sizeof(app->profile_pending_friend_remove_name), "%s",
friend_name != NULL && friend_name[0] != '\0' ? friend_name : friend_user_id);
app_open_modal(app, UIModalConfirmRemoveFriend);
}
static void
profile_draw_json_people(const char *json, const char *array_key,
int x, int w, int *y, int with_actions, InbeApp *app)
@@ -277,18 +347,22 @@ profile_draw_json_people(const char *json, const char *array_key,
int rows = 0;
int font = flint_ui_font();
int small = flint_ui_font_small();
int with_remove = !with_actions && strcmp(array_key, "friends") == 0;
int with_cancel = !with_actions && strcmp(array_key, "outgoing") == 0;
snprintf(key_pattern, sizeof(key_pattern), "\"%s\"", array_key);
p = strstr(json != NULL ? json : "", key_pattern);
if(p == NULL) {
flint_text_draw("None", x, *y, small, flint_darken(flint_theme_get_text(), 35));
flint_text_draw(locale_get("profile_none_label"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(24);
return;
}
p = strchr(p, '[');
end = p != NULL ? strchr(p, ']') : NULL;
if(p == NULL || end == NULL) {
flint_text_draw("None", x, *y, small, flint_darken(flint_theme_get_text(), 35));
flint_text_draw(locale_get("profile_none_label"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(24);
return;
}
@@ -300,6 +374,8 @@ profile_draw_json_people(const char *json, const char *array_key,
int row_h = with_actions ? flint_px(42) : flint_px(30);
int hover_accept = 0;
int hover_decline = 0;
int hover_remove = 0;
int hover_cancel = 0;
char url[256];
id[0] = '\0';
@@ -324,23 +400,49 @@ profile_draw_json_people(const char *json, const char *array_key,
profile_json_string_value(p, "alias", alias, sizeof(alias));
if(display_id[0] == '\0')
snprintf(display_id, sizeof(display_id), "%s", id);
snprintf(title, sizeof(title), "%s%s", alias[0] != '\0' ? "@" : "",
alias[0] != '\0' ? alias : display_id);
profile_display_name(title, sizeof(title), alias, display_id);
flint_text_draw(title, x, *y, font, flint_theme_get_text());
if(with_remove) {
int icon_size = flint_px(18);
int icon_padding = flint_px(6);
int button_w = icon_size + icon_padding * 2;
if(ui_draw_icon_btn_padded(x + w - button_w, *y - flint_px(6),
icon_size, icon_padding,
app->icons[UI_ICON_TYPE_TRASH],
&hover_remove)) {
profile_prompt_remove_friend(app, display_id, title);
}
} else if(with_cancel) {
int icon_size = flint_px(18);
int icon_padding = flint_px(6);
int button_w = icon_size + icon_padding * 2;
if(ui_draw_icon_btn_padded(x + w - button_w, *y - flint_px(6),
icon_size, icon_padding,
app->icons[UI_ICON_TYPE_TRASH],
&hover_cancel) &&
profile_sync_url(url, sizeof(url))) {
app_request_friend_decline(app, id);
settings_screen_set_status_success(locale_get("profile_updating_status"),
NULL);
}
}
if(with_actions) {
int btn_w = (w - flint_px(8)) / 2;
if(ui_draw_generic_button(x, *y + flint_px(22), btn_w, flint_px(30),
"Accept", UI_BUTTON_STYLE_PRIMARY, 0, &hover_accept) &&
locale_get("profile_friend_accept_button"),
UI_BUTTON_STYLE_PRIMARY, 0, &hover_accept) &&
profile_sync_url(url, sizeof(url))) {
app_request_friend_accept(app, id);
settings_screen_set_status_success("Updating", NULL);
settings_screen_set_status_success(locale_get("profile_updating_status"), NULL);
}
if(ui_draw_generic_button(x + btn_w + flint_px(8), *y + flint_px(22), btn_w,
flint_px(30), "Decline", UI_BUTTON_STYLE_SECONDARY,
flint_px(30),
locale_get("profile_friend_decline_button"),
UI_BUTTON_STYLE_SECONDARY,
0, &hover_decline) &&
profile_sync_url(url, sizeof(url))) {
app_request_friend_decline(app, id);
settings_screen_set_status_success("Updating", NULL);
settings_screen_set_status_success(locale_get("profile_updating_status"), NULL);
}
}
*y += row_h;
@@ -348,11 +450,50 @@ profile_draw_json_people(const char *json, const char *array_key,
p++;
}
if(rows == 0) {
flint_text_draw("None", x, *y, small, flint_darken(flint_theme_get_text(), 35));
flint_text_draw(locale_get("profile_none_label"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(24);
}
}
void
profile_screen_draw_remove_friend_modal(InbeApp *app)
{
char message[384];
int modal_result;
if(app == NULL || !app->modal.active ||
app->modal.type != UIModalConfirmRemoveFriend)
return;
snprintf(message, sizeof(message),
locale_get("profile_friend_remove_message"),
app->profile_pending_friend_remove_name[0] != '\0'
? app->profile_pending_friend_remove_name
: "this friend");
modal_result = ui_draw_modal(locale_get("profile_friend_remove_title"), message,
locale_get("cancel_button"),
locale_get("delete_button"));
if(modal_result == 1) {
app->profile_pending_friend_remove_id[0] = '\0';
app->profile_pending_friend_remove_name[0] = '\0';
app_close_modal(app);
} else if(modal_result == 2) {
char url[256];
if(profile_sync_url(url, sizeof(url))) {
app_request_friend_remove(app, app->profile_pending_friend_remove_id);
settings_screen_set_status_success(locale_get("profile_updating_status"),
NULL);
} else {
settings_screen_set_status_error(locale_get("sync_server_url_invalid"));
}
app->profile_pending_friend_remove_id[0] = '\0';
app->profile_pending_friend_remove_name[0] = '\0';
app_close_modal(app);
}
}
static void
profile_draw_stat_row(int x, int w, int *y, const char *label, const char *value)
{
@@ -390,17 +531,130 @@ profile_tab_title(int tab)
{
switch(tab) {
case PROFILE_TAB_FRIENDS:
return "Friends";
return locale_get("profile_friends_title");
case PROFILE_TAB_LEADERBOARD:
return "Leaderboard";
return locale_get("profile_leaderboard_title");
case PROFILE_TAB_DATA:
return locale_get("profile_data_title");
case PROFILE_TAB_OVERVIEW:
default:
return "Profile";
return locale_get("tab_profile");
}
}
static void
profile_overview_column(int *x, int *w)
{
flint_centered_column(flint_px(CONTENT_MAX_W), flint_page_side_padding(), x, w);
}
static Rectangle
profile_guide_account_anchor(void)
{
int x;
int w;
profile_overview_column(&x, &w);
return (Rectangle){(float)(x - flint_px(6)), (float)flint_px(8),
(float)(w + flint_px(12)), (float)flint_px(70)};
}
static Rectangle
profile_guide_data_anchor(void)
{
int x;
int w;
int y = flint_px(82);
profile_overview_column(&x, &w);
return (Rectangle){(float)(x - flint_px(6)), (float)(y - flint_px(6)),
(float)(w + flint_px(12)), (float)flint_px(190)};
}
static Rectangle
profile_guide_social_anchor(InbeApp *app)
{
int x;
int w;
int y = flint_px(278);
(void)app;
profile_overview_column(&x, &w);
return (Rectangle){(float)(x - flint_px(6)), (float)(y - flint_px(6)),
(float)(w + flint_px(12)), (float)flint_px(102)};
}
static void
profile_screen_finish_first_run_guide(InbeApp *app)
{
if(app == NULL)
return;
app->profile_guide_seen = 1;
app->profile_guide_step = 0;
save_settings(app);
}
int
profile_screen_first_run_guide_active(const InbeApp *app)
{
return app != NULL && !app->profile_guide_seen && !app->modal.active &&
app->inbe.screen == InbeScreenProfile;
}
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)
{
FlintUIGuideStep steps[PROFILE_GUIDE_STEPS];
FlintUIGuideResult result;
if(!profile_screen_first_run_guide_active(app))
return;
steps[0] = (FlintUIGuideStep){
.anchor = profile_guide_account_anchor(),
.text = locale_get("profile_guide_account")
};
steps[1] = (FlintUIGuideStep){
.anchor = profile_guide_data_anchor(),
.text = locale_get("profile_guide_data")
};
steps[2] = (FlintUIGuideStep){
.anchor = profile_guide_social_anchor(app),
.text = locale_get(sync_account_load(&(InbeSyncAccount){0})
? "profile_guide_social"
: "profile_guide_social_no_account")
};
result = flint_ui_draw_guide_overlay((FlintUIGuideOverlay){
.steps = steps,
.count = PROFILE_GUIDE_STEPS,
.step = &app->profile_guide_step,
.view_width = view_width,
.view_height = view_height,
.reserved_top = 0,
.reserved_bottom = ui_bottom_nav_height(),
.max_width = flint_px(300),
.paragraph_font = flint_ui_font_small(),
.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 int
profile_json_array_count(const char *json, const char *array_key)
{
@@ -466,6 +720,8 @@ profile_draw_overview(InbeApp *app, int x, int w, int *y)
int btn_h = flint_px(34);
int hover_account = 0;
int hover_data = 0;
int hover_habits = 0;
int hover_practices = 0;
int hover_friends = 0;
int hover_leaderboard = 0;
int half_w = (w - flint_px(8)) / 2;
@@ -490,21 +746,24 @@ profile_draw_overview(InbeApp *app, int x, int w, int *y)
snprintf(account_text, sizeof(account_text), "%.12s...", account.public_id);
}
} else {
snprintf(account_text, sizeof(account_text), "No account");
snprintf(account_text, sizeof(account_text), "%s", locale_get("profile_no_account"));
}
flint_text_draw("Account", x, *y, small, flint_darken(flint_theme_get_text(), 35));
flint_text_draw(locale_get("profile_account_section"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(18);
flint_text_draw(account_text, x, *y, font, flint_theme_get_text());
if(ui_draw_generic_button(x + w - flint_px(132), *y - flint_px(8), flint_px(132),
btn_h, "Configure", UI_BUTTON_STYLE_SECONDARY, 0,
btn_h, locale_get("profile_configure_button"),
UI_BUTTON_STYLE_SECONDARY, 0,
&hover_account))
settings_data_open_sync_account_config(app);
*y += flint_px(38);
profile_draw_divider(x, w, *y);
*y += flint_px(18);
flint_text_draw("Data", x, *y, small, flint_darken(flint_theme_get_text(), 35));
flint_text_draw(locale_get("profile_data_section"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(24);
profile_draw_summary_columns(x, w, y);
if(ui_draw_generic_button(x, *y, w, btn_h, locale_get("profile_data_button"),
@@ -513,35 +772,43 @@ profile_draw_overview(InbeApp *app, int x, int w, int *y)
app->profile_scroll = 0;
settings_screen_clear_status();
}
*y += btn_h + flint_px(8);
if(ui_draw_generic_button(x, *y, half_w, btn_h, locale_get("profile_my_habits_button"),
UI_BUTTON_STYLE_SECONDARY, 0, &hover_habits)) {
app->profile_view = PROFILE_VIEW_HABITS;
app->profile_scroll = 0;
settings_screen_clear_status();
}
if(ui_draw_generic_button(x + half_w + flint_px(8), *y, half_w, btn_h,
locale_get("profile_my_practices_button"),
UI_BUTTON_STYLE_SECONDARY, 0, &hover_practices)) {
app->profile_view = PROFILE_VIEW_PRACTICES;
app->profile_scroll = 0;
settings_screen_clear_status();
}
*y += btn_h + flint_px(20);
profile_draw_divider(x, w, *y);
*y += flint_px(18);
flint_text_draw("Sync", x, *y, small, flint_darken(flint_theme_get_text(), 35));
*y += flint_px(22);
settings_data_draw_sync_status(x, w, y);
*y += flint_px(8);
profile_draw_divider(x, w, *y);
*y += flint_px(18);
snprintf(friend_text, sizeof(friend_text), "%d friends",
snprintf(friend_text, sizeof(friend_text), locale_get("profile_friends_count_format"),
profile_json_array_count(app->profile_friends_json, "friends"));
snprintf(pending_text, sizeof(pending_text), "%d pending",
snprintf(pending_text, sizeof(pending_text), locale_get("profile_pending_count_format"),
profile_json_array_count(app->profile_friend_requests_json, "incoming"));
flint_text_draw("Social", x, *y, small, flint_darken(flint_theme_get_text(), 35));
flint_text_draw(locale_get("profile_social_section"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(20);
flint_text_draw(friend_text, x, *y, font, flint_theme_get_text());
flint_text_draw(pending_text, x + w - flint_text_measure(pending_text, font), *y,
font, flint_theme_get_text());
*y += flint_px(34);
if(ui_draw_generic_button(x, *y, half_w, btn_h, "Friends",
UI_BUTTON_STYLE_PRIMARY, 0, &hover_friends)) {
if(ui_draw_generic_button(x, *y, half_w, btn_h, locale_get("profile_friends_title"),
UI_BUTTON_STYLE_PRIMARY, !has_account, &hover_friends)) {
app->profile_tab = PROFILE_TAB_FRIENDS;
app->profile_scroll = 0;
}
if(ui_draw_generic_button(x + half_w + flint_px(8), *y, half_w, btn_h,
"Leaderboard", UI_BUTTON_STYLE_PRIMARY, 0,
&hover_leaderboard)) {
locale_get("profile_leaderboard_title"), UI_BUTTON_STYLE_PRIMARY,
!has_account, &hover_leaderboard)) {
app->profile_tab = PROFILE_TAB_LEADERBOARD;
app->profile_scroll = 0;
}
@@ -555,7 +822,7 @@ profile_refresh_friends(InbeApp *app)
return;
profile_load_friends_cache(app);
app_request_social_refresh(app);
settings_screen_set_status_success("Updating", NULL);
settings_screen_set_status_success(locale_get("profile_updating_status"), NULL);
}
static void
@@ -567,12 +834,17 @@ profile_draw_friends(InbeApp *app, int x, int w, int *y)
int hover_refresh = 0;
int commit = 0;
char url[256];
int incoming_count;
int outgoing_count;
if(!app->profile_friends_loaded)
profile_load_friends_cache(app);
incoming_count = profile_json_array_count(app->profile_friend_requests_json, "incoming");
outgoing_count = profile_json_array_count(app->profile_friend_requests_json, "outgoing");
*y += flint_px(16);
flint_text_draw("Friends", x, *y, font, flint_theme_get_text());
flint_text_draw(locale_get("profile_friends_title"), x, *y, font,
flint_theme_get_text());
*y += flint_px(30);
(void)flint_ui_text_field((FlintUITextField){
.bounds = {x, *y, w, flint_px(38)},
@@ -588,12 +860,14 @@ profile_draw_friends(InbeApp *app, int x, int w, int *y)
.commit_pressed = &commit
});
*y += flint_px(46);
if((ui_draw_generic_button(x, *y, w, btn_h, "Add friend", UI_BUTTON_STYLE_PRIMARY,
if((ui_draw_generic_button(x, *y, w, btn_h,
locale_get("profile_add_friend_button"),
UI_BUTTON_STYLE_PRIMARY,
app->profile_friend_input[0] == '\0', &hover_add) || commit) &&
app->profile_friend_input[0] != '\0') {
if(profile_sync_url(url, sizeof(url))) {
app_request_friend_send(app, app->profile_friend_input);
settings_screen_set_status_success("Updating", NULL);
settings_screen_set_status_success(locale_get("profile_updating_status"), NULL);
profile_load_friends_cache(app);
app->profile_friend_input[0] = '\0';
app->profile_friend_input_cursor = 0;
@@ -602,23 +876,31 @@ profile_draw_friends(InbeApp *app, int x, int w, int *y)
}
}
*y += btn_h + flint_px(10);
if(ui_draw_generic_button(x, *y, w, btn_h, "Refresh", UI_BUTTON_STYLE_SECONDARY,
if(ui_draw_generic_button(x, *y, w, btn_h, locale_get("profile_refresh_button"),
UI_BUTTON_STYLE_SECONDARY,
0, &hover_refresh)) {
profile_refresh_friends(app);
}
*y += btn_h + flint_px(22);
flint_text_draw("Incoming", x, *y, font, flint_theme_get_text());
*y += flint_px(28);
profile_draw_json_people(app->profile_friend_requests_json, "incoming", x, w, y, 1, app);
*y += flint_px(16);
flint_text_draw("Friends", x, *y, font, flint_theme_get_text());
if(incoming_count > 0) {
flint_text_draw(locale_get("profile_incoming_title"), x, *y, font,
flint_theme_get_text());
*y += flint_px(28);
profile_draw_json_people(app->profile_friend_requests_json, "incoming", x, w, y, 1, app);
*y += flint_px(16);
}
flint_text_draw(locale_get("profile_friends_title"), x, *y, font,
flint_theme_get_text());
*y += flint_px(28);
profile_draw_json_people(app->profile_friends_json, "friends", x, w, y, 0, app);
*y += flint_px(16);
flint_text_draw("Outgoing", x, *y, font, flint_theme_get_text());
*y += flint_px(28);
profile_draw_json_people(app->profile_friend_requests_json, "outgoing", x, w, y, 0, app);
if(outgoing_count > 0) {
*y += flint_px(16);
flint_text_draw(locale_get("profile_outgoing_title"), x, *y, font,
flint_theme_get_text());
*y += flint_px(28);
profile_draw_json_people(app->profile_friend_requests_json, "outgoing", x, w, y, 0, app);
}
}
static void
@@ -632,24 +914,9 @@ static void
profile_leaderboard_display_name(char *out, size_t out_size,
const char *alias, const char *user_id)
{
int written;
if(out == NULL || out_size == 0)
return;
if(alias != NULL && alias[0] != '\0') {
if(out_size <= 2) {
snprintf(out, out_size, "@");
return;
}
written = snprintf(out, out_size, "@%.*s", (int)out_size - 2, alias);
if(written < 0)
out[0] = '\0';
} else if(user_id != NULL && strlen(user_id) > 12) {
snprintf(out, out_size, "%.12s...", user_id);
} else {
snprintf(out, out_size, "%.*s", (int)out_size - 1,
user_id != NULL ? user_id : "");
}
profile_display_name(out, out_size, alias, user_id);
}
static int
@@ -823,7 +1090,7 @@ profile_draw_leaderboard_rows(InbeApp *app, const char *json, int x, int w, int
}
if(rows == 0) {
flint_text_draw("No leaderboard data", x, *y, small,
flint_text_draw(locale_get("profile_no_leaderboard_data"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(24);
}
@@ -836,7 +1103,7 @@ profile_refresh_leaderboard(InbeApp *app)
return;
profile_load_leaderboard_cache(app);
app_request_social_refresh(app);
settings_screen_set_status_success("Updating", NULL);
settings_screen_set_status_success(locale_get("profile_updating_status"), NULL);
}
void
@@ -905,7 +1172,7 @@ profile_draw_leaderboard(InbeApp *app, int x, int w, int *y)
PROFILE_LEADERBOARD_AVG_HOLD);
*y += flint_px(16);
flint_text_draw("Practice", x, *y, flint_ui_font_small(),
flint_text_draw(locale_get("profile_practice_label"), x, *y, flint_ui_font_small(),
flint_darken(flint_theme_get_text(), 35));
*y += flint_px(22);
before_practice = app->profile_leaderboard_practice;
@@ -944,10 +1211,79 @@ profile_draw_data(InbeApp *app, int x, int w, int *y)
flint_text_draw(locale_get("profile_data_title"), x, *y, font, flint_theme_get_text());
*y += flint_px(28);
profile_draw_data_summary(x, w, y);
settings_data_draw_sync_status(x, w, y);
*y += flint_px(10);
settings_data_draw_actions(app, x, w, y);
}
static void
profile_draw_habits(InbeApp *app, int x, int w, int *y)
{
int font = flint_ui_font();
int small = flint_ui_font_small();
int btn_h = flint_px(32);
int btn_w = flint_px(74);
int gap = flint_px(8);
*y += flint_px(16);
flint_text_draw(locale_get("profile_my_habits_title"), x, *y, font,
flint_theme_get_text());
*y += flint_px(34);
for(int i = 0; i < app->habits.count; i++) {
int row_y = *y;
int up_hover = 0;
int down_hover = 0;
flint_text_draw(app->habits.items[i].name, x, row_y + flint_px(7),
font, flint_theme_get_text());
if(ui_draw_generic_button(x + w - btn_w * 2 - gap, row_y, btn_w, btn_h,
locale_get("move_up_button"),
UI_BUTTON_STYLE_SECONDARY, i == 0, &up_hover)) {
if(habits_move(&app->habits, i, i - 1))
app_auto_sync(app);
return;
}
if(ui_draw_generic_button(x + w - btn_w, row_y, btn_w, btn_h,
locale_get("move_down_button"),
UI_BUTTON_STYLE_SECONDARY,
i == app->habits.count - 1, &down_hover)) {
if(habits_move(&app->habits, i, i + 1))
app_auto_sync(app);
return;
}
*y += flint_px(46);
profile_draw_divider(x, w, *y - flint_px(6));
}
if(app->habits.count <= 0)
flint_text_draw(locale_get("habit_empty_title"), x, *y, small,
flint_darken(flint_theme_get_text(), 35));
}
static void
profile_draw_practices(InbeApp *app, int x, int w, int *y)
{
int font = flint_ui_font();
(void)w;
*y += flint_px(16);
flint_text_draw(locale_get("profile_my_practices_title"), x, *y, font,
flint_theme_get_text());
*y += flint_px(34);
for(int i = 0; i < EXERCISE_COUNT; i++) {
int enabled = practice_is_visible(app, i);
if(ui_draw_checkbox_row((FlintUICheckboxRow){
.label = profile_practice_label(i),
.value = &enabled
}, x, *y)) {
practice_set_visible(app, i, enabled);
}
*y += ui_checkbox_row_height((FlintUICheckboxRow){0});
}
}
int
profile_screen_draw(InbeApp *app)
{
@@ -972,11 +1308,21 @@ profile_screen_draw(InbeApp *app)
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_scroll = 0;
}
if(app->profile_view != PROFILE_VIEW_MAIN) {
const char *title = app->profile_view == PROFILE_VIEW_SYNC_ACCOUNT
? locale_get("sync_configure_account_button")
: locale_get("profile_data_title");
const char *title = locale_get("profile_data_title");
if(app->profile_view == PROFILE_VIEW_SYNC_ACCOUNT)
title = locale_get("sync_configure_account_button");
else if(app->profile_view == PROFILE_VIEW_HABITS)
title = locale_get("profile_my_habits_title");
else if(app->profile_view == PROFILE_VIEW_PRACTICES)
title = locale_get("profile_my_practices_title");
FlintUIHeader header = ui_draw_title_header(header_h, title,
app->icons[UI_ICON_TYPE_RETURN],
(Texture2D){0});
@@ -1016,6 +1362,10 @@ profile_screen_draw(InbeApp *app)
settings_sync_account_draw_config(app, page.content_x, page.content_w, &y);
else if(app->profile_view == PROFILE_VIEW_DATA)
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_FRIENDS)
profile_draw_friends(app, page.content_x, page.content_w, &y);
else if(app->profile_tab == PROFILE_TAB_LEADERBOARD)
+4
View File
@@ -4,6 +4,10 @@
#include "app_fwd.h"
int profile_screen_draw(InbeApp *app);
void profile_screen_draw_remove_friend_modal(InbeApp *app);
void profile_screen_refresh_social_cache(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
+15 -15
View File
@@ -241,21 +241,21 @@ settings_sync_server_connected(InbeApp *app)
}
static const char *
settings_sync_result_key(InbeSyncClientResult result)
settings_sync_result_key(FlintLyraSyncResult result)
{
switch(result) {
case INBE_SYNC_CLIENT_OK:
case FLINT_LYRA_SYNC_OK:
return "sync_connected";
case INBE_SYNC_CLIENT_INVALID_URL:
case FLINT_LYRA_SYNC_INVALID_URL:
return "sync_server_url_invalid";
case INBE_SYNC_CLIENT_NO_ACCOUNT:
case FLINT_LYRA_SYNC_NO_ACCOUNT:
return "sync_no_account";
case INBE_SYNC_CLIENT_AUTH_FAILED:
case FLINT_LYRA_SYNC_AUTH_FAILED:
return "sync_auth_failed";
case INBE_SYNC_CLIENT_PAYLOAD_FAILED:
case INBE_SYNC_CLIENT_CHALLENGE_FAILED:
case INBE_SYNC_CLIENT_SIGN_FAILED:
case INBE_SYNC_CLIENT_REQUEST_FAILED:
case FLINT_LYRA_SYNC_PAYLOAD_FAILED:
case FLINT_LYRA_SYNC_CHALLENGE_FAILED:
case FLINT_LYRA_SYNC_SIGN_FAILED:
case FLINT_LYRA_SYNC_REQUEST_FAILED:
default:
return "sync_failed";
}
@@ -264,7 +264,7 @@ settings_sync_result_key(InbeSyncClientResult result)
static void
settings_sync_run_connect(InbeApp *app)
{
InbeSyncClientResult result;
FlintLyraSyncResult result;
char url[sizeof(app->sync_server_url)];
if(app == NULL)
@@ -275,7 +275,7 @@ settings_sync_run_connect(InbeApp *app)
}
storage_set_setting_text(INBE_SYNC_SERVER_URL_KEY, url);
result = sync_client_sync(url);
if(result == INBE_SYNC_CLIENT_OK) {
if(result == FLINT_LYRA_SYNC_OK) {
if(storage_sync_review_clear_if_no_visible_diff()) {
app_reload_after_import(app, 0);
settings_screen_set_status_success(locale_get(settings_sync_result_key(result)), NULL);
@@ -307,7 +307,7 @@ void
settings_sync_account_clear_remote_confirmed(InbeApp *app)
{
InbeSyncAccount account;
InbeSyncClientResult result;
FlintLyraSyncResult result;
char url[sizeof(app->sync_server_url)];
if(app == NULL)
@@ -319,7 +319,7 @@ settings_sync_account_clear_remote_confirmed(InbeApp *app)
if(settings_sync_server_normalize(app, url, sizeof(url))) {
result = sync_client_delete_account(url);
if(result != INBE_SYNC_CLIENT_OK)
if(result != FLINT_LYRA_SYNC_OK)
TraceLog(LOG_WARNING, "SYNC: remote account delete failed: %d", result);
} else {
TraceLog(LOG_WARNING, "SYNC: remote account delete skipped due to invalid URL");
@@ -670,11 +670,11 @@ settings_sync_account_draw_alias_modal(InbeApp *app)
return 3;
if(clicked == 1 || (commit && settings_sync_alias_valid(app->sync_alias_input) && !unchanged_alias)) {
if(settings_sync_server_normalize(app, url, sizeof(url))) {
InbeSyncClientResult alias_result;
FlintLyraSyncResult alias_result;
TraceLog(LOG_INFO, "SYNC: saving alias @%s with %s",
app->sync_alias_input, url);
alias_result = sync_client_register_alias(url, app->sync_alias_input);
if(alias_result == INBE_SYNC_CLIENT_OK) {
if(alias_result == FLINT_LYRA_SYNC_OK) {
TraceLog(LOG_INFO, "SYNC: alias saved @%s", app->sync_alias_input);
result = 1;
} else {
+7 -2
View File
@@ -217,6 +217,7 @@ schema_create(void)
" id TEXT PRIMARY KEY,"
" user_id TEXT NOT NULL,"
" name TEXT NOT NULL,"
" description TEXT NOT NULL DEFAULT '',"
" color_r INTEGER NOT NULL,"
" color_g INTEGER NOT NULL,"
" color_b INTEGER NOT NULL,"
@@ -391,6 +392,7 @@ migrate_schema(void)
" id TEXT PRIMARY KEY,"
" user_id TEXT NOT NULL,"
" name TEXT NOT NULL,"
" description TEXT NOT NULL DEFAULT '',"
" color_r INTEGER NOT NULL,"
" color_g INTEGER NOT NULL,"
" color_b INTEGER NOT NULL,"
@@ -400,13 +402,16 @@ migrate_schema(void)
" deleted_at INTEGER NOT NULL DEFAULT 0,"
" updated_at INTEGER NOT NULL DEFAULT 0"
");"
"INSERT INTO habits(id,user_id,name,color_r,color_g,color_b,sync_mode,sync_activity,sort_order,deleted_at,updated_at)"
" SELECT id,user_id,name,color_r,color_g,color_b,sync_mode,sync_activity,sort_order,deleted_at,0"
"INSERT INTO habits(id,user_id,name,description,color_r,color_g,color_b,sync_mode,sync_activity,sort_order,deleted_at,updated_at)"
" SELECT id,user_id,name,'',color_r,color_g,color_b,sync_mode,sync_activity,sort_order,deleted_at,0"
" FROM habits_with_sync_topic;"
"DROP TABLE habits_with_sync_topic;"
"COMMIT;"))
return 0;
}
if(!table_has_column("habits", "description") &&
!exec_sql("ALTER TABLE habits ADD COLUMN description TEXT NOT NULL DEFAULT ''"))
return 0;
if(!table_has_column("habits", "counter_enabled") &&
!exec_sql("ALTER TABLE habits ADD COLUMN counter_enabled INTEGER NOT NULL DEFAULT 0"))
return 0;
+2 -1
View File
@@ -102,7 +102,8 @@ static const char *const importable_setting_keys[] = {
"meditation_music_track",
"play_in_background",
"language",
"practice_category_tab"
"practice_category_tab",
"practice_visible_mask"
};
static int
+58 -41
View File
@@ -29,6 +29,8 @@ storage_has_orphan_habit_days(void);
static int
storage_json_array_count(const char *json, const char *path);
static int
storage_apply_remote_full_snapshot(const char *response_json);
static int
storage_clear_local_sync_data(void);
static int
storage_json_valid(const char *json);
@@ -2112,20 +2114,9 @@ storage_apply_sync_response_json(const char *response_json)
storage_set_setting_text(STORAGE_SYNC_ACCOUNT_ALIAS_KEY, account_alias);
if(storage_json_extract_int64(response_json, "$.full_snapshot_required", 0) != 0 &&
get_meta_int64(STORAGE_SYNC_APPLY_REVIEW_KEY, 0) == 0) {
if(!storage_sync_review_json_has_visible_diff(response_json)) {
char *copy = strdup(response_json);
int ok;
if(copy == NULL)
return 0;
if(!storage_clear_local_sync_data()) {
free(copy);
return 0;
}
set_meta_int64(STORAGE_SYNC_APPLY_REVIEW_KEY, 1);
ok = storage_apply_sync_response_json(copy);
free(copy);
return ok;
}
if(!storage_has_any() ||
storage_sync_review_json_should_auto_apply_remote(response_json))
return storage_apply_remote_full_snapshot(response_json);
if(!storage_sync_review_write_json(response_json))
return 0;
set_meta(STORAGE_SYNC_PENDING_REVIEW_KEY, "1");
@@ -2185,6 +2176,27 @@ storage_apply_sync_response_json(const char *response_json)
return 1;
}
static int
storage_apply_remote_full_snapshot(const char *response_json)
{
char *copy;
int ok;
if(response_json == NULL)
return 0;
copy = strdup(response_json);
if(copy == NULL)
return 0;
if(!storage_clear_local_sync_data()) {
free(copy);
return 0;
}
set_meta_int64(STORAGE_SYNC_APPLY_REVIEW_KEY, 1);
ok = storage_apply_sync_response_json(copy);
free(copy);
return ok;
}
static int
storage_clear_local_sync_data(void)
{
@@ -2389,7 +2401,6 @@ storage_profile_activity_stats(int activity, int today_date,
int seen[371] = {0};
int streak = 0;
long avg_value = 0;
int mask = 1 << activity;
if(streak_out != NULL)
*streak_out = 0;
@@ -2401,19 +2412,11 @@ storage_profile_activity_stats(int activity, int today_date,
if(sqlite3_prepare_v2(g_storage.db,
"SELECT local_date FROM sessions "
"WHERE user_id=?1 AND deleted_at=0 AND activity=?2 "
" AND local_date>0 "
"UNION "
"SELECT hd.local_date "
"FROM habit_days hd JOIN habits h ON h.id=hd.habit_id "
"WHERE h.user_id=?1 AND h.deleted_at=0 "
" AND h.sync_mode=?3 AND (h.sync_activity & ?4)<>0 "
" AND (hd.completed!=0 OR hd.count>0)",
" AND local_date>0",
-1, &stmt, NULL) != SQLITE_OK)
return 0;
bind_text(stmt, 1, g_storage.user_id);
sqlite3_bind_int(stmt, 2, activity);
sqlite3_bind_int(stmt, 3, INBE_HABIT_SYNC_ACTIVITIES);
sqlite3_bind_int(stmt, 4, mask);
while(sqlite3_step(stmt) == SQLITE_ROW) {
int offset = storage_profile_day_offset(sqlite3_column_int(stmt, 0), today_date);
if(offset >= 0 && offset <= 370)
@@ -2646,7 +2649,7 @@ storage_habits_load(void *habits_ptr)
memset(habits, 0, sizeof(*habits));
if(sqlite3_prepare_v2(g_storage.db,
"SELECT "
"id,name,color_r,color_g,color_b,sync_mode,sync_activity,counter_"
"id,name,description,color_r,color_g,color_b,sync_mode,sync_activity,counter_"
"enabled "
"FROM habits WHERE deleted_at=0 ORDER BY sort_order,id LIMIT 10",
-1, &stmt, NULL) != SQLITE_OK)
@@ -2657,12 +2660,14 @@ storage_habits_load(void *habits_ptr)
snprintf(habits->loaded_ids[index], sizeof(habits->loaded_ids[index]), "%s", habit->id);
snprintf(habit->name, sizeof(habit->name), "%s",
(const char *)sqlite3_column_text(stmt, 1));
habit->color = (Color){(unsigned char)sqlite3_column_int(stmt, 2),
(unsigned char)sqlite3_column_int(stmt, 3),
(unsigned char)sqlite3_column_int(stmt, 4), 255};
habit->sync_mode = sqlite3_column_int(stmt, 5);
habit->sync_activity = sqlite3_column_int(stmt, 6);
habit->counter_enabled = sqlite3_column_int(stmt, 7) != 0;
snprintf(habit->description, sizeof(habit->description), "%s",
(const char *)sqlite3_column_text(stmt, 2));
habit->color = (Color){(unsigned char)sqlite3_column_int(stmt, 3),
(unsigned char)sqlite3_column_int(stmt, 4),
(unsigned char)sqlite3_column_int(stmt, 5), 255};
habit->sync_mode = sqlite3_column_int(stmt, 6);
habit->sync_activity = sqlite3_column_int(stmt, 7);
habit->counter_enabled = sqlite3_column_int(stmt, 8) != 0;
index++;
}
sqlite3_finalize(stmt);
@@ -2731,12 +2736,13 @@ storage_habits_save(const void *habits_ptr)
const InbeHabit *habit = &habits->items[i];
if(sqlite3_prepare_v2(g_storage.db,
"INSERT INTO "
"habits(id,user_id,name,color_r,color_g,color_b,sync_mode,sync_"
"habits(id,user_id,name,description,color_r,color_g,color_b,sync_mode,sync_"
"activity,counter_enabled,sort_order,deleted_at,updated_at) "
"VALUES(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,0,?11) "
"VALUES(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,0,?12) "
"ON CONFLICT(id) DO UPDATE SET "
"user_id=excluded.user_id,"
"name=excluded.name,"
"description=excluded.description,"
"color_r=excluded.color_r,"
"color_g=excluded.color_g,"
"color_b=excluded.color_b,"
@@ -2761,18 +2767,29 @@ storage_habits_save(const void *habits_ptr)
bind_text(stmt, 1, habit->id);
bind_text(stmt, 2, g_storage.user_id);
bind_text(stmt, 3, habit->name);
sqlite3_bind_int(stmt, 4, habit->color.r);
sqlite3_bind_int(stmt, 5, habit->color.g);
sqlite3_bind_int(stmt, 6, habit->color.b);
sqlite3_bind_int(stmt, 7, habit->sync_mode);
sqlite3_bind_int(stmt, 8, habit->sync_activity);
sqlite3_bind_int(stmt, 9, habit->counter_enabled ? 1 : 0);
sqlite3_bind_int(stmt, 10, i);
sqlite3_bind_int64(stmt, 11, changed_at);
bind_text(stmt, 4, habit->description);
sqlite3_bind_int(stmt, 5, habit->color.r);
sqlite3_bind_int(stmt, 6, habit->color.g);
sqlite3_bind_int(stmt, 7, habit->color.b);
sqlite3_bind_int(stmt, 8, habit->sync_mode);
sqlite3_bind_int(stmt, 9, habit->sync_activity);
sqlite3_bind_int(stmt, 10, habit->counter_enabled ? 1 : 0);
sqlite3_bind_int(stmt, 11, i);
sqlite3_bind_int64(stmt, 12, changed_at);
if(sqlite3_step(stmt) == SQLITE_DONE && sqlite3_changes(g_storage.db) > 0)
storage_enqueue_sync_habit(habit->id);
sqlite3_finalize(stmt);
stmt = NULL;
if(sqlite3_prepare_v2(g_storage.db,
"UPDATE habits SET description=?2 "
"WHERE id=?1 AND description<>?2",
-1, &stmt, NULL) == SQLITE_OK) {
bind_text(stmt, 1, habit->id);
bind_text(stmt, 2, habit->description);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
stmt = NULL;
}
if(sqlite3_prepare_v2(g_storage.db, "INSERT OR IGNORE INTO sync_seen_habits(id) VALUES(?1)",
-1, &stmt, NULL) == SQLITE_OK) {
bind_text(stmt, 1, habit->id);
+1
View File
@@ -89,6 +89,7 @@ int storage_sync_review_details(char **local_out, char **remote_out);
int storage_sync_review_diff(char **diff_out);
int storage_sync_review_has_visible_diff(void);
int storage_sync_review_json_has_visible_diff(const char *json);
int storage_sync_review_json_should_auto_apply_remote(const char *json);
int storage_sync_review_clear_if_no_visible_diff(void);
int storage_sync_review_apply_remote_if_local_empty(void);
int storage_apply_pending_sync_review(int use_remote);
+176 -621
View File
File diff suppressed because it is too large. Load diff
+14 -24
View File
@@ -1,42 +1,32 @@
#ifndef INBE_SYNC_CLIENT_H
#define INBE_SYNC_CLIENT_H
#include <stddef.h>
#include "flint_lyra_sync.h"
typedef enum InbeSyncClientResult {
INBE_SYNC_CLIENT_OK = 0,
INBE_SYNC_CLIENT_INVALID_URL,
INBE_SYNC_CLIENT_NO_ACCOUNT,
INBE_SYNC_CLIENT_PAYLOAD_FAILED,
INBE_SYNC_CLIENT_CHALLENGE_FAILED,
INBE_SYNC_CLIENT_SIGN_FAILED,
INBE_SYNC_CLIENT_REQUEST_FAILED,
INBE_SYNC_CLIENT_AUTH_FAILED
} InbeSyncClientResult;
#include <stddef.h>
int sync_client_url_valid(const char *url);
int sync_client_normalize_url(const char *input, char *out, size_t out_size);
int sync_client_normalize_friend_target(const char *target, char *out, size_t out_size);
InbeSyncClientResult sync_client_sync(const char *base_url);
InbeSyncClientResult sync_client_register_alias(const char *base_url, const char *alias);
InbeSyncClientResult sync_client_send_friend_request(const char *base_url, const char *target);
InbeSyncClientResult sync_client_get_friend_requests(const char *base_url, char *out, size_t out_size);
InbeSyncClientResult sync_client_get_friends(const char *base_url, char *out, size_t out_size);
InbeSyncClientResult sync_client_accept_friend_request(const char *base_url, const char *request_id);
InbeSyncClientResult sync_client_decline_friend_request(const char *base_url, const char *request_id);
InbeSyncClientResult sync_client_remove_friend(const char *base_url, const char *friend_user_id);
InbeSyncClientResult sync_client_get_friend_stats(const char *base_url, const char *app,
FlintLyraSyncResult sync_client_sync(const char *base_url);
FlintLyraSyncResult sync_client_register_alias(const char *base_url, const char *alias);
FlintLyraSyncResult sync_client_send_friend_request(const char *base_url, const char *target);
FlintLyraSyncResult sync_client_get_friend_requests(const char *base_url, char *out, size_t out_size);
FlintLyraSyncResult sync_client_get_friends(const char *base_url, char *out, size_t out_size);
FlintLyraSyncResult sync_client_accept_friend_request(const char *base_url, const char *request_id);
FlintLyraSyncResult sync_client_decline_friend_request(const char *base_url, const char *request_id);
FlintLyraSyncResult sync_client_remove_friend(const char *base_url, const char *friend_user_id);
FlintLyraSyncResult sync_client_get_friend_stats(const char *base_url, const char *app,
const char *practice, const char *metric,
char *out, size_t out_size);
InbeSyncClientResult sync_client_wait_for_remote_event(const char *base_url);
InbeSyncClientResult sync_client_delete_account(const char *base_url);
const char *sync_client_result_name(InbeSyncClientResult result);
FlintLyraSyncResult sync_client_wait_for_remote_event(const char *base_url);
FlintLyraSyncResult sync_client_delete_account(const char *base_url);
void sync_client_clear_auth_token(void);
#if defined(__EMSCRIPTEN__)
int sync_client_web_start_remote_events(const char *base_url);
int sync_client_web_poll_remote_event(void);
int sync_client_web_sync_start(const char *base_url);
int sync_client_web_sync_poll(InbeSyncClientResult *result, int *changed);
int sync_client_web_sync_poll(FlintLyraSyncResult *result, int *changed);
#endif
#endif
+118
View File
@@ -11,6 +11,7 @@
#define STORAGE_SYNC_APPLY_REVIEW_KEY "sync_apply_pending_review"
#define STORAGE_SYNC_FULL_REPLACE_KEY "sync_full_replace_requested"
#define STORAGE_SYNC_LAST_SERVER_HASH_KEY "sync_last_server_state_hash"
#define STORAGE_SYNC_AUTO_APPLY_VISIBLE_CHANGE_LIMIT 2
typedef struct ReviewText {
char *data;
@@ -24,7 +25,10 @@ static void review_append_remote(ReviewText *out, const char *json);
static void review_append_unique_lines(ReviewText *out, const char *prefix,
const char *lines, const char *other);
static int review_has_pending_outbox(void);
static int review_pending_outbox_sessions_only(void);
static int review_has_unknown_activity(const char *json);
static int review_small_session_only_change(const char *diff);
static int review_visible_change_count(const char *diff);
static int
review_reserve(ReviewText *text, size_t extra)
@@ -617,6 +621,31 @@ storage_sync_review_json_has_visible_diff(const char *json)
return has_diff;
}
int
storage_sync_review_json_should_auto_apply_remote(const char *json)
{
char *diff = NULL;
int result;
if(review_has_unknown_activity(json))
return 0;
if(!storage_sync_review_diff_for_json(json, 0, &diff)) {
free(diff);
return 0;
}
if(diff == NULL || diff[0] == '\0') {
free(diff);
return 1;
}
if(!review_has_pending_outbox()) {
free(diff);
return 1;
}
result = review_small_session_only_change(diff);
free(diff);
return result;
}
static int
review_has_pending_outbox(void)
{
@@ -635,6 +664,25 @@ review_has_pending_outbox(void)
return result;
}
static int
review_pending_outbox_sessions_only(void)
{
sqlite3_stmt *stmt = NULL;
int result = 0;
if(g_storage.db == NULL)
return 0;
if(sqlite3_prepare_v2(g_storage.db,
"SELECT EXISTS(SELECT 1 FROM sync_outbox LIMIT 1) "
"AND NOT EXISTS(SELECT 1 FROM sync_outbox WHERE entity_type<>'session')",
-1, &stmt, NULL) != SQLITE_OK)
return 0;
if(sqlite3_step(stmt) == SQLITE_ROW)
result = sqlite3_column_int(stmt, 0) != 0;
sqlite3_finalize(stmt);
return result;
}
static int
review_has_unknown_activity(const char *json)
{
@@ -673,6 +721,76 @@ review_has_unknown_activity(const char *json)
return 0;
}
static int
review_small_session_only_change(const char *diff)
{
int count;
if(!review_pending_outbox_sessions_only())
return 0;
count = review_visible_change_count(diff);
return count > 0 && count <= STORAGE_SYNC_AUTO_APPLY_VISIBLE_CHANGE_LIMIT;
}
static int
review_line_starts_with_date(const char *line, size_t len)
{
if(line == NULL || len < 10)
return 0;
return line[0] >= '0' && line[0] <= '9' &&
line[1] >= '0' && line[1] <= '9' &&
line[2] >= '0' && line[2] <= '9' &&
line[3] >= '0' && line[3] <= '9' &&
line[4] == '-' &&
line[5] >= '0' && line[5] <= '9' &&
line[6] >= '0' && line[6] <= '9' &&
line[7] == '-' &&
line[8] >= '0' && line[8] <= '9' &&
line[9] >= '0' && line[9] <= '9';
}
static int
review_line_equals_literal(const char *line, size_t len, const char *literal)
{
size_t literal_len;
if(line == NULL || literal == NULL)
return 0;
literal_len = strlen(literal);
return len == literal_len && strncmp(line, literal, len) == 0;
}
static int
review_visible_change_count(const char *diff)
{
const char *p = diff;
const char *line;
const char *end;
size_t len;
int date_lines = 0;
int changed_lines = 0;
if(diff == NULL)
return 0;
while(*p != '\0') {
end = strchr(p, '\n');
len = end != NULL ? (size_t)(end - p) : strlen(p);
if(len > 2 && (p[0] == '-' || p[0] == '+') && p[1] == ' ') {
line = p + 2;
len -= 2;
if(review_line_starts_with_date(line, len))
date_lines++;
else if(!review_line_equals_literal(line, len, "Sessions") &&
!review_line_equals_literal(line, len, "Habit days"))
changed_lines++;
}
if(end == NULL)
break;
p = end + 1;
}
return date_lines > 0 ? date_lines : changed_lines;
}
int
storage_apply_pending_sync_review(int use_remote)
{
+75 -2
View File
@@ -261,6 +261,28 @@ mark_empty_local_pending(const char *root)
"VALUES('account','alias',0,1782300000);"));
}
static void
seed_local_session_only(const char *root)
{
check_true("seed local session only",
exec_db_sql(root, "INSERT INTO "
"sessions(id,user_id,started_at,local_date,topic,activity,source,"
"imported_at,rounds_hash,deleted_at,updated_at)"
"VALUES('tiny-local-session',(SELECT id FROM users LIMIT "
"1),1782300000,20260624,1,1,'test',1782300000,101,0,1782300000);"
"INSERT INTO session_rounds(session_id,round_index,seconds)"
"VALUES('tiny-local-session',0,40);"));
}
static void
mark_local_session_only_pending(const char *root)
{
check_true("mark local session only pending",
exec_db_sql(root, "INSERT OR REPLACE INTO "
"sync_outbox(entity_type,entity_id,local_date,queued_at)"
"VALUES('session','tiny-local-session',0,1782300000);"));
}
static void
seed_local_yoga_data(const char *root)
{
@@ -356,6 +378,29 @@ remote_additive_yoga_response(void)
"}";
}
static const char *
remote_tiny_session_snapshot_response(void)
{
return "{"
"\"server_version\":15,"
"\"server_state_hash\":\"remote-hash-tiny-session\","
"\"full_snapshot_required\":true,"
"\"changes_complete\":false,"
"\"changes\":{"
"\"habits\":[],"
"\"habit_days\":[],"
"\"sessions\":[{\"id\":\"tiny-remote-session\",\"started_at\":\"2026-06-24T10:"
"05:00Z\","
"\"local_date\":20260624,\"topic\":1,\"activity\":1,\"source\":\"lyra-"
"test\","
"\"rounds_hash\":404,\"deleted_at\":0,\"updated_at\":\"2026-06-24T10:"
"05:00Z\","
"\"rounds\":[{\"round_index\":0,\"hold_seconds\":55}]}],"
"\"meditation_logs\":[]"
"}"
"}";
}
static void
test_full_snapshot_waits_for_review(void)
{
@@ -406,6 +451,34 @@ test_full_snapshot_waits_for_review(void)
remove_tree(root);
}
static void
test_tiny_pending_snapshot_applies_remote_without_review(void)
{
char root[1024];
make_clean_root(root, sizeof(root), "tiny-pending");
check_true("init tiny pending db", storage_init(root));
seed_local_session_only(root);
mark_local_session_only_pending(root);
check_true("apply tiny review response",
storage_apply_sync_response_json(remote_tiny_session_snapshot_response()));
check_false("tiny review not pending", storage_sync_review_pending());
check_int("tiny local session replaced",
read_db_count(root,
"SELECT COUNT(*) FROM sessions WHERE id='tiny-local-session'"),
0);
check_int("tiny remote session applied",
read_db_count(root,
"SELECT COUNT(*) FROM sessions WHERE id='tiny-remote-session'"),
1);
check_int("tiny outbox cleared",
read_db_count(root, "SELECT COUNT(*) FROM sync_outbox"), 0);
storage_close();
remove_tree(root);
}
static void
test_empty_local_pending_snapshot_applies_remote(void)
{
@@ -417,8 +490,7 @@ test_empty_local_pending_snapshot_applies_remote(void)
check_true("apply empty local review response",
storage_apply_sync_response_json(remote_snapshot_response()));
check_true("empty local review pending before policy", storage_sync_review_pending());
check_true("empty local applies remote", storage_sync_review_apply_remote_if_local_empty());
check_false("empty local review not pending", storage_sync_review_pending());
check_false("empty local review cleared", storage_sync_review_pending());
check_int("empty local remote session applied",
read_db_count(root, "SELECT COUNT(*) FROM sessions WHERE id='remote-session'"), 1);
@@ -696,6 +768,7 @@ main(void)
tzset();
test_full_snapshot_waits_for_review();
test_tiny_pending_snapshot_applies_remote_without_review();
test_empty_local_pending_snapshot_applies_remote();
test_review_ignores_deleted_remote_rows();
test_remote_additions_apply_without_review();
+1 -1
+4 -4
View File
@@ -3,8 +3,8 @@
IDI_APP_ICON ICON "inbe.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,0,0
PRODUCTVERSION 1,7,0,0
FILEVERSION 1,7,4,0
PRODUCTVERSION 1,7,4,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -21,11 +21,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "waozi"
VALUE "FileDescription", "Inner Breeze"
VALUE "FileVersion", "1.7.0"
VALUE "FileVersion", "1.7.4"
VALUE "InternalName", "inbe"
VALUE "OriginalFilename", "inbe-windows-x86_64.exe"
VALUE "ProductName", "Inner Breeze"
VALUE "ProductVersion", "1.7.0"
VALUE "ProductVersion", "1.7.4"
END
END
BLOCK "VarFileInfo"