Compare commits

...
299 Commits
Author SHA1 Message Date
waozi 8b20447a14 Release Inner Breeze 2.1.55
Phone check: 57.7 fps, 0.0% late frames.
2026-10-28 01:11:48 -03:00
waozi 9bd9176995 Preserve existing hosted app loading capabilities 2026-10-27 23:51:31 -03:00
waozi ec08615f21 Keep hosted loading theme resolution portable 2026-10-27 23:47:08 -03:00
waozi 6b4818e2a4 Improve Inbe app loading, recover Play prices and simplify Apps guidance 2026-10-27 23:12:59 -03:00
waozi 5e905491cc Match the itch.io publishing target to the Breeze repository 2026-10-27 20:35:36 -03:00
waozi 8aecef0e2d Release Inner Breeze 2.1.54
Phone check: 57.7 fps, 0.0% late frames.
2026-10-27 18:58:21 -03:00
waozi d9d454da70 Version Inner Breeze 2.1.54: Dew through Google Play in the Google Play version 2026-10-27 18:09:06 -03:00
waozi 955fe51d17 Buy Dew through Google Play in the Google Play version
The Google Play edition (the gplay build type) now builds its native code
with GOOGLE_PLAY and adds Kryon's Play Billing (its gplay sources from the
Kryon package and billing 9.1); the direct and F-Droid builds carry no
Google billing. Top up lists Entity's Dew packs at Google Play's price in the
buyer's currency once Play answers. Breeze sends each purchase to the node
with its own signed-in request through entity/dew_play, and Play forgets it
only after the node has credited the Dew. The Play edition's Top up shows no
Monero address or other coins, and running out of Dew no longer names
Monero. The old payment bridge stubs are gone.

Kryon and Entity move to their Play Billing commits; liboqs stays pinned.
2026-10-27 18:06:54 -03:00
waozi 72c80cc0f6 Release Inner Breeze 2.1.53
Phone check: 57.7 fps, 0.06% late frames.
2026-10-27 16:51:49 -03:00
waozi 14ce6d7a66 Resolve the Play build's outdated Fragment SDK for Inner Breeze 2.1.53
Google Play reported androidx.fragment:fragment:1.1.0 as an outdated SDK in
production 2.1.52. Firebase Messaging's Play services libraries still
request that version, so the Play build now resolves it to Fragment 1.8.9.
2026-10-27 16:22:12 -03:00
waozi 61ecab580e Buy Dew with another coin through dew.waozi.xyz from Top up 2026-10-27 14:32:22 -03:00
waozi 3461cc1bc6 Merge the published 2.1.52 master into the retained local history 2026-10-27 05:46:35 -03:00
waozi 3ad7e8ee19 Merge the published Inner Breeze 2.1.52 release 2026-10-27 05:46:16 -03:00
waozi d55ed0e1f4 Merge tested Inner Breeze 2.1.52 release history 2026-10-27 05:24:36 -03:00
waozi 53efbf0b28 Release Inner Breeze 2.1.52
Phone check: 57.7 fps, 0.03% late frames.
2026-10-27 05:24:36 -03:00
waozi aba1996ccd Keep OpenStore diagnostics separate from release publication 2026-10-27 05:00:02 -03:00
waozi c2421a7862 Keep Focal packaging and active peer source together 2026-10-27 05:00:02 -03:00
waozi 1d0b8d7001 Keep OpenStore diagnostics separate from release publication 2026-10-27 05:00:02 -03:00
waozi d192e789d4 Merge the browser music test fix into the retained local history 2026-10-27 04:57:45 -03:00
waozi b6e1c3bfab Keep OpenStore diagnostics separate from release publication 2026-10-27 04:57:42 -03:00
waozi 82383c3d5d Read a control's position after the browser music test's last scroll
The Apps list scrolls when a control sits low on the screen. The fourth
attempt scrolled and then clicked the position read before that scroll.
With the apps the node offers listed below Lists, the list moved and the
click opened Library instead of Lists, so release-ready failed while the
same code passed before the node's catalog changed.
2026-10-27 04:54:32 -03:00
waozi d5a12b5d97 Keep Focal packaging and active peer source together 2026-10-27 04:36:50 -03:00
waozi 5159e7f098 Publish verified OpenStore updates after the Release workflow 2026-10-27 04:36:50 -03:00
waozi 2e9be2fc18 Publish verified OpenStore updates after the Release workflow 2026-10-27 04:36:49 -03:00
waozi 53f91d4c00 Resolve and verify the target atomic runtime in Click packages 2026-10-27 04:23:19 -03:00
waozi df0709e3f4 Keep Focal packaging and active peer source together 2026-10-27 04:23:19 -03:00
waozi 159e0098ea Resolve and verify the target atomic runtime in Click packages 2026-10-27 04:23:19 -03:00
waozi 61241cd23e Merge the Results test fix into the retained local history 2026-10-27 04:21:56 -03:00
waozi 66824eba50 Give the Results test the real leaderboard screen instead of a stub
Since Profile hosts the leaderboard, entity_host links the leaderboard
screen, so session-results-zi-test defined leaderboard_screen_enter twice.
The Results test now uses the real screen with a stub for the habit
editor's leave check, and only the tests that do not link the screen keep
its stub. This replaces a79ab2ac's foreign call from Profile, whose web
build ended release-ready's music test on Habits instead of Settings; the
app sources are those of 7ccb904f again.
2026-10-27 04:21:49 -03:00
waozi 66676ac3d3 Keep Focal packaging and active peer source together 2026-10-27 04:19:19 -03:00
waozi 87c9cd30a2 Serve the verified released web app on production Pages 2026-10-27 04:19:19 -03:00
waozi bd0c862387 Serve the verified released web app on production Pages 2026-10-27 04:19:18 -03:00
waozi d1ae67efc5 Carry the bundled runtime license notices in Click packages 2026-10-27 04:13:55 -03:00
waozi e23a6e6bd5 Keep Focal packaging and active peer source together 2026-10-27 04:13:55 -03:00
waozi dac6b67935 Carry the bundled runtime license notices in Click packages 2026-10-27 04:13:54 -03:00
waozi d1be47cd59 Restore Ubuntu Touch audio and sync with the device graphics stack 2026-10-27 04:09:31 -03:00
waozi 9a1a963056 Keep Focal packaging and active peer source together 2026-10-27 04:09:31 -03:00
waozi 6369cba877 Restore Ubuntu Touch audio and sync with the device graphics stack 2026-10-27 04:09:31 -03:00
waozi 1dae6f6c3a Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 03:42:31 -03:00
waozi 36d6e6f94e Keep OpenStore repair and pending feature history together 2026-10-27 03:42:31 -03:00
waozi 63af557410 Retain SDL X11 handles required by the Raylib backend 2026-10-27 03:42:30 -03:00
waozi 24fd4c88fe Retain SDL X11 handles required by the Raylib backend 2026-10-27 03:42:30 -03:00
waozi 851759cfd0 Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 03:23:18 -03:00
waozi 6e7ae2dd17 Keep OpenStore repair and pending feature history together 2026-10-27 03:23:18 -03:00
waozi dd12f56834 Verify the generated SDL Wayland configuration 2026-10-27 03:23:17 -03:00
waozi e098eaa686 Verify the generated SDL Wayland configuration 2026-10-27 03:23:17 -03:00
waozi 4147597f6b Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 03:22:14 -03:00
waozi c642c13e21 Build current SDL for Focal and link the bundled runtime first 2026-10-27 03:22:14 -03:00
waozi d4b7252dac Keep OpenStore repair and pending feature history together 2026-10-27 03:22:14 -03:00
waozi 0333d4c12e Build current SDL for Focal and link the bundled runtime first 2026-10-27 03:22:14 -03:00
waozi 32e7bc5900 Merge the executable release script into the retained local history 2026-10-27 03:04:37 -03:00
waozi a78d7d43c4 Keep scripts/release.py executable 2026-10-27 03:04:31 -03:00
waozi 661f620340 Merge the leaderboard link fix into the retained local history 2026-10-27 03:04:08 -03:00
waozi 16161e4482 Let make release read a separate release-ready run
RELEASE_READY_OUTPUT names the run's outputs, as in release-ready.sh.
2026-10-27 03:03:46 -03:00
waozi a79ab2ace9 Keep the leaderboard screen out of the shared navigation unit
Profile reached the leaderboard by importing its screen into entity_host,
which every route imports, so tests with stub hosts linked the whole
screen and its stubs twice (session-results-zi-test). Profile now calls
InbeLeaderboardSnapshot as a foreign function, as the screen already
calls EntityHostOpenLeaderboard.
2026-10-27 03:03:46 -03:00
waozi 9bb025c1ea Keep OpenStore repair and pending feature history together 2026-10-27 02:56:32 -03:00
waozi 990d722a0f Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 02:56:32 -03:00
waozi edbc3df6de Build current TLS libraries for the Focal OpenStore package 2026-10-27 02:56:31 -03:00
waozi 3434a9b4f2 Build current TLS libraries for the Focal OpenStore package 2026-10-27 02:56:31 -03:00
waozi 52940c7ccf Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 02:39:58 -03:00
waozi 94fb71e80a Use the installed CMake for the Focal cross build 2026-10-27 02:39:58 -03:00
waozi 61d91d59b4 Keep OpenStore repair and pending feature history together 2026-10-27 02:39:58 -03:00
waozi 486386519c Use the installed CMake for the Focal cross build 2026-10-27 02:39:58 -03:00
waozi e8dece0969 Merge Inner Breeze 2.1.52 into the retained local history 2026-10-27 02:23:20 -03:00
waozi 7ccb904f89 Release Inner Breeze 2.1.52
Entity ca637d0 saves account aliases typed with capitals, an @ or spaces
and says when an alias is taken.
2026-10-27 02:21:42 -03:00
waozi 440e2ad60a Retain the scoped Apps compiler fix and current owner dependency graph 2026-10-27 02:17:15 -03:00
waozi 6af10f4305 Integrate only the Apps compiler pin while retaining current public source 2026-10-27 02:17:15 -03:00
waozi 4b93cad051 Pin the Apps compiler linkage fix for the Focal build 2026-10-27 02:17:15 -03:00
waozi ebc8678539 Use the Apps compiler linkage fix in the immutable Focal2.1.51 source 2026-10-27 02:17:15 -03:00
waozi a66e629d89 Let website deployments finish while new work continues 2026-10-27 02:06:14 -03:00
waozi a05c2cc469 Preserve active development with reliable website deployment 2026-10-27 02:06:14 -03:00
waozi 71ba093935 Let website deployments finish while new work continues 2026-10-27 02:02:46 -03:00
waozi 32a4fe7951 Record the trusted reference for fixed release publication 2026-10-27 01:55:28 -03:00
waozi c443e918c1 Retain fixed release publication guidance with current development 2026-10-27 01:55:28 -03:00
waozi 64a05aa0d7 Configure the pinned ARM64 Curl and scope the OpenStore upload key 2026-10-27 01:54:49 -03:00
waozi 4cc9eb0527 Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 01:54:49 -03:00
waozi df1ea8d2e0 Keep OpenStore repair and pending feature history together 2026-10-27 01:54:49 -03:00
waozi ea2ef47384 Configure the pinned ARM64 Curl and scope the OpenStore upload key 2026-10-27 01:54:49 -03:00
waozi 287ae35c6a Record the trusted reference for fixed release publication 2026-10-27 01:45:53 -03:00
waozi e56a89e02d Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 01:39:44 -03:00
waozi 37e356f3a5 Keep OpenStore repair and pending feature history together 2026-10-27 01:39:44 -03:00
waozi 4eea7ea6a8 Use current GNU Make with the Focal target SDK 2026-10-27 01:39:43 -03:00
waozi eb17374052 Use current GNU Make with the Focal target SDK 2026-10-27 01:39:43 -03:00
waozi dd4c75fdad Keep OpenStore repair and pending feature history together 2026-10-27 01:23:56 -03:00
waozi 0eade56b75 Trust only the GitHub workspace inside the Focal SDK container 2026-10-27 01:23:56 -03:00
waozi 64207c2ee0 Trust only the GitHub workspace inside the Focal SDK container 2026-10-27 01:23:56 -03:00
waozi 960f2970f4 Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 01:23:56 -03:00
waozi 179c8856f9 Retain the Focal 2.1.51 candidate without changing current source 2026-10-27 01:17:53 -03:00
waozi 381885ac0d Retain the immutable Focal 2.1.51 candidate alongside current master 2026-10-27 01:17:53 -03:00
waozi 882c1a5cad Build the phone-tested Breeze 2.1.51 application for the Focal OpenStore runtime 2026-10-27 01:17:52 -03:00
waozi 2f09d2b87d Use the published shared Profile leaderboard package 2026-10-27 01:14:30 -03:00
waozi 9644918631 Include the portable VM runner in the Focal runtime linkage fix 2026-10-27 01:11:25 -03:00
waozi 8bcd313c7e Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 01:11:25 -03:00
waozi 09ecd923b6 Keep OpenStore repair and pending feature history together 2026-10-27 01:11:25 -03:00
waozi 823ba12468 Include the portable VM runner in the Focal runtime linkage fix 2026-10-27 01:11:25 -03:00
waozi 9d27dca8f6 Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 01:07:57 -03:00
waozi 44b6a2fcad Keep OpenStore repair and pending feature history together 2026-10-27 01:07:57 -03:00
waozi 39c50f66d2 Require the exact phone-tested app content before OpenStore upload 2026-10-27 01:07:56 -03:00
waozi 922a6f1de1 Require the exact phone-tested app content before OpenStore upload 2026-10-27 01:07:56 -03:00
waozi dd09473bcd Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 01:06:41 -03:00
waozi eed7cf217c Pin the upstream Linux runtime linkage fix for Focal builds 2026-10-27 01:06:41 -03:00
waozi 1d09c705bc Keep OpenStore repair and pending feature history together 2026-10-27 01:06:41 -03:00
waozi 4d1efe0740 Pin the upstream Linux runtime linkage fix for Focal builds 2026-10-27 01:06:41 -03:00
waozi 0cdba05f53 Retain tested Breeze 2.1.51 release receipt with current CI repairs 2026-10-27 01:06:16 -03:00
waozi a84cd8afa8 Keep tested release and current development history 2026-10-27 01:06:16 -03:00
waozi b84d960652 Release Inner Breeze 2.1.51
Phone check: 57.7 fps, 0.06% late frames.
2026-10-27 01:05:48 -03:00
waozi a99db8da8c Merge tested Inner Breeze 2.1.51 release history 2026-10-27 01:05:48 -03:00
waozi b2e30beb3b Install native OpenSSL headers for the Ziran compiler bootstrap 2026-10-27 00:53:27 -03:00
waozi d74348c2e2 Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 00:53:27 -03:00
waozi efad4d26f1 Keep OpenStore repair and pending feature history together 2026-10-27 00:53:27 -03:00
waozi 20c046dd9a Install native OpenSSL headers for the Ziran compiler bootstrap 2026-10-27 00:53:27 -03:00
waozi fcb30aa9cd Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 00:43:44 -03:00
waozi 6dc330fa8b Keep OpenStore repair and pending feature history together 2026-10-27 00:43:44 -03:00
waozi fc00732f80 Keep the Ziran bootstrap native in the cross-compilation SDK 2026-10-27 00:43:41 -03:00
waozi b90a88ab86 Keep the Ziran bootstrap native in the cross-compilation SDK 2026-10-27 00:43:41 -03:00
waozi 4d7481f9ff Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 00:42:08 -03:00
waozi 455011da1a Keep OpenStore repair and pending feature history together 2026-10-27 00:42:08 -03:00
waozi cfcba405c4 Use the Focal Clickable SDK for Ubuntu Touch builds 2026-10-27 00:42:07 -03:00
waozi ac2152980e Use the Focal Clickable SDK for Ubuntu Touch builds 2026-10-27 00:42:07 -03:00
waozi daf68f0d26 Integrate the Focal target repair without publishing pending peer package versions 2026-10-27 00:39:42 -03:00
waozi b0c165f575 Keep OpenStore repair and pending feature history together 2026-10-27 00:39:42 -03:00
waozi 2f210aba03 Build Focal-compatible Ubuntu Touch packages and verify their ABI 2026-10-27 00:39:41 -03:00
waozi 1130e9d353 Build Focal-compatible Ubuntu Touch packages and verify their ABI 2026-10-27 00:39:41 -03:00
waozi 192080f176 Fix habit linking and add diary and writing icons 2026-10-27 00:36:16 -03:00
waozi 7cbd20ce2e Retain fixed habit source and pending peer work 2026-10-27 00:36:16 -03:00
waozi 9604f7f0fb Follow Apfelwurm title screen before verifying first play 2026-10-27 00:36:11 -03:00
waozi 4229a0d4b7 Retain tested Arcade first-start automation 2026-10-27 00:36:11 -03:00
waozi 4dcb907a4d Follow Apfelwurm title screen before verifying first play 2026-10-27 00:36:11 -03:00
waozi 992047a992 Fix habit linking and add diary and writing icons 2026-10-27 00:27:29 -03:00
waozi 943e9c3aeb Retain fixed habit source and pending peer work 2026-10-27 00:27:29 -03:00
waozi efe04a3309 Keep habit link choices separate from the Done button 2026-10-26 23:57:59 -03:00
waozi b6b5f1bcfe Retain the verified habit picker layout candidate 2026-10-26 23:57:59 -03:00
waozi b299484555 Keep habit link choices separate from the Done button 2026-10-26 23:57:59 -03:00
waozi 4501b6a253 Link zlib in the Ubuntu Touch native package 2026-10-26 23:51:44 -03:00
waozi f0a06a89d4 Retain the fixed habit editor candidate alongside ongoing feature work 2026-10-26 23:51:44 -03:00
waozi 75e0ab0d02 Verify the Diary entry link persists with new writing icons 2026-10-26 23:51:44 -03:00
waozi ec558927b1 Verify the Diary entry link persists with new writing icons 2026-10-26 23:51:44 -03:00
waozi 856971a017 Integrate the OpenStore repair without publishing pending peer package versions 2026-10-26 23:50:47 -03:00
waozi c719f5b675 Keep OpenStore repair and pending feature history together 2026-10-26 23:50:47 -03:00
waozi 3fe36bd09b Link zlib in the Ubuntu Touch native package 2026-10-26 23:50:46 -03:00
waozi d8f2bcd265 Link zlib in the Ubuntu Touch native package 2026-10-26 23:50:46 -03:00
waozi bc55cc6241 Move Inner Breeze leaderboard into the shared Profile 2026-10-26 23:47:03 -03:00
waozi bdf5fcee7a Use a compact stroke pen symbol in habit choices 2026-10-26 23:46:39 -03:00
waozi ee47be692b Keep detailed pen icon within source line limits 2026-10-26 23:45:52 -03:00
waozi e263d1144e Fix habit linking and add diary and writing icons 2026-10-26 23:43:53 -03:00
waozi 55571c9031 Keep phone-install's output to its own steps 2026-10-26 23:30:47 -03:00
waozi 906e9b8cbc Integrate the OpenStore repair without publishing pending peer package versions 2026-10-26 23:23:53 -03:00
waozi 7fa80efed6 Keep OpenStore repair and pending feature history together 2026-10-26 23:23:53 -03:00
waozi 2c1a22d655 Build Ubuntu Touch from current Ziran ARM64 sources 2026-10-26 23:23:52 -03:00
waozi e7e3f265a3 Build Ubuntu Touch from current Ziran ARM64 sources 2026-10-26 23:23:52 -03:00
waozi cc30f15cc5 Install a committed revision on a phone in one step
scripts/phone-install.sh (make phone-install) builds the debug APK from one
commit in release-ready's container, signs it with this machine's debug
key so the installed app keeps its data, installs it on the Pixel or the
Moto, checks the phone holds that exact APK and opens it from the
launcher.
2026-10-26 23:21:26 -03:00
waozi 5aaab789c5 Let a fixed-commit release-ready run use its own outputs
RELEASE_READY_OUTPUT=build/release-ready-NAME keeps a second run's build,
home and lock apart, so a debug build from a fixed commit can run while
another check holds build/release-ready.
2026-10-26 23:16:00 -03:00
waozi 4f3c22eae5 Hold Practices 1.6.0 and Habits 1.3.5 until their phone check
055eff1f numbers the new packages for the phone build. Until they pass a
phone check, master keeps the published versions so that a push does not
publish them to the node.
2026-10-26 23:15:07 -03:00
waozi 9b4393e512 Wait for active Shovey board input after onboarding 2026-10-26 23:08:28 -03:00
waozi 44ce02ed71 Retain the tested 2.1.50 candidate alongside ongoing feature work 2026-10-26 23:08:28 -03:00
waozi 055eff1f32 Release Practices 1.6.0 and Habits 1.3.5 packages 2026-10-26 23:06:17 -03:00
waozi c8bc917775 Wait for active Shovey board input after onboarding 2026-10-26 22:59:28 -03:00
waozi 4d61bfec0e Link habits to Diary, offer a practice's habit on its first session, and count into each workout exercise
Habit links are now a small registry (src/habits/habit_links.zi): each
practice checks a day by a saved session, and Diary checks a day with a
real entry. Linking a habit to Diary brings its earlier entry days along.
Another app can link by adding its bit there and reporting its days.

A new profile still starts with the Meditation habit. Other habits are no
longer made automatically: with Habits installed, a practice's first
saved session, when no habit links it, asks on its results whether to
make it a habit (host interface 37).

The 7-Minute Workout's get-ready and rests show the next exercise to get
into position for and count down in plain numbers, then Go, spoken as
three, two, one, go. Squats hold the arms straight out at shoulder height.
2026-10-26 22:57:14 -03:00
waozi 3967555601 Install the required font gate dependency for OpenStore builds 2026-10-26 22:49:16 -03:00
waozi 8b1050caa1 Dismiss Shovey onboarding before testing downloaded game movement 2026-10-26 22:19:10 -03:00
waozi 3ebfb8964c Release Inner Breeze 2.1.50
Moto check waived by owner: Owner in this originating conversation: good now you can relase it skip moto testing
2026-10-26 21:40:29 -03:00
waozi 13768728ba Retry interrupted package response bodies during compatibility tests 2026-10-26 21:08:00 -03:00
waozi 5707266d5e Retry transient transport failures in package compatibility tests 2026-10-26 20:45:31 -03:00
waozi 0bf3339102 Resolve the declared packages in the practice download test 2026-10-26 20:32:20 -03:00
waozi 2d52fd695e Link SHA-256 in standalone tests and verify Arcade on the Moto 2026-10-26 20:09:59 -03:00
waozi 8a084a891f Award coins for recent backdated habits 2026-10-26 19:08:08 -03:00
waozi 75a75dcc50 Remove completed app migration todo 2026-10-26 17:35:02 -03:00
waozi 7e63bc4f04 Read explicitly shared game progress in verified add-ons 2026-10-26 04:52:18 -03:00
waozi 5527db97d4 Restart the current breathing phase before stepping back 2026-10-26 03:11:07 -03:00
waozi 5f6c98425d Exercise all new habit options before creation 2026-10-26 03:01:32 -03:00
waozi ae13dd4a2e Bring up the Arcade check's own loopback, and give the node download test a make target
The release check's container has no ip tool, so the isolated download
check could not reach its local game server.
2026-10-26 02:59:29 -03:00
waozi 8a6d3e0040 Keep complete game frames while new sprites load 2026-10-26 02:55:08 -03:00
waozi f8eda9f016 Show Arcade's covers two or three a row on phones, and log why a download does not install
Pins Apps with the phone cover grid and trusts its controller; collections
that pack the previous controller keep opening. A verified download that
fails to prepare now says which part did not open.
2026-10-26 02:25:04 -03:00
waozi 9952c904c5 Supply the trusted controller during collection install validation 2026-10-26 02:07:23 -03:00
waozi 0e921a0f78 Save custom level collections in shared account records 2026-10-26 01:44:16 -03:00
waozi a8d5d6b5a8 Check the node's Arcade as the downloads harness it is, and link SHA-256 in the browser key test
The compatibility check fetches the published Arcade's art and games from
the node and runs the cover-library check, which serves the library art and
answers Apfelwurm's controls question; the isolated test keeps its loopback.
The device key's browser build links the crypto package's SHA-256.
2026-10-26 01:38:30 -03:00
waozi 8bda8b7641 Draw Arcade's covers while their art downloads
Pins Kryon and Apps with the pending-art fix, and Daochi Client with its
replayed-transfer recovery, which the interrupted upload check needs.
2026-10-26 01:09:52 -03:00
waozi c4539a55e9 Keep image key borrows clear of mutable asset lookup 2026-10-26 01:02:21 -03:00
waozi 7f4a0d9deb Release Inner Breeze 2.1.49 2026-10-26 00:47:53 -03:00
waozi 944b698fcd Hold back paged account sync until its Daochi client codec is published
The paged sync needs daochi_client/record_codec, which is not committed in
the Daochi client package yet, so Breeze cannot build it from its lock.
The change is kept in backup/pending-sync-paging/ for its own release.
2026-10-26 00:47:38 -03:00
waozi 0e7cfd587c Merge remote-tracking branch 'origin/master' 2026-10-26 00:36:19 -03:00
waozi 0f8fd26cca Open Arcade as a launcher under one megabyte
A collection that does not pack the Apps controller opens with Breeze's
own reviewed controller, also on the preparation worker, and its covers
arrive as one separate art download published with its games. Pins the
Apps host with both and the shared-code toolchain, and Kryon's browser
missing-file fix. The 2.1.49 notes name the smaller Arcade and its plain
covers.
2026-10-26 00:36:07 -03:00
waozi 0dfdd231cf Trust the reviewed Apps controller and keep earlier collections opening
Breeze trusts the current reviewed controller and keeps opening
collections built before add-on downloads. Arcade's UI test covers
separate game downloads, and storage tests can use a local Daochi client.
2026-10-26 00:35:59 -03:00
waozi e04951514c Show the account alias as written, or the compact account key, in the Apps header 2026-10-26 00:35:52 -03:00
waozi a7670fcdd9 Sync account records in pages that fit the node's request limit
Batches leave room for page selectors within the node's 1 MiB JSON limit,
optional packed variants cannot overflow a batch whose identity form fits,
and a resumable page finishes before sync changes modes.
2026-10-26 00:35:52 -03:00
waozi c82f426424 Publish a collection's separate library art with its games
A catalog that lists its art as one separate ZX, as Arcade's does, gets
that file staged, checked against the catalog digest and published like
an unpacked game.
2026-10-26 00:29:27 -03:00
waozi b1855677fd Integrate automatic game package publication workflows 2026-10-25 23:59:51 -03:00
waozi 89993721d4 Publish each new Arcade release to the node automatically 2026-10-25 23:57:31 -03:00
waozi 62b3f935da Integrate published separate-game publisher repair 2026-10-25 22:47:28 -03:00
waozi 56f6ba33a9 Keep initial game frames covered until pictures settle 2026-10-25 20:24:19 -03:00
waozi 960ef43327 Verify and publish the separate games named by a signed catalog 2026-10-25 20:03:05 -03:00
waozi fae1492f77 Check separate game archives before signing node releases 2026-10-25 20:03:05 -03:00
waozi 6c076d95c2 Use cover download sizes in Arcade collections 2026-10-25 16:42:27 -03:00
waozi c90b37f1ff Support the shared Arcade cover library and portable Apfelwurm 2026-10-25 16:28:41 -03:00
waozi 58a4b5a53b Build the default Apps controller in clean Android releases 2026-10-25 14:21:12 -03:00
waozi 2e6ae1c155 Pin published app downloads and completion-only progress 2026-10-25 14:10:54 -03:00
waozi ec5f98729d Include app record policy in storage law mutation fixture 2026-10-25 13:46:44 -03:00
waozi 72a71e05b7 Stage the reviewed Apps controller into Android packages 2026-10-25 13:41:37 -03:00
waozi 6d5087fc33 Keep Android background ticks outside practice UI frames 2026-10-25 13:32:14 -03:00
waozi 493de309a2 Keep the download regression window inside its private display 2026-10-25 13:26:18 -03:00
waozi 3b46c147ec Keep catalogs open while separate games are missing 2026-10-25 13:17:16 -03:00
waozi 52c71db3c4 Add host32 game downloads and restore app download dialogs 2026-10-25 12:37:17 -03:00
waozi 64a050fbc6 Verify separate node game files against the published catalog 2026-10-25 11:49:03 -03:00
waozi 32d87470b3 Verify migrated Practices controls in isolated desktop fixtures 2026-10-25 04:05:43 -03:00
waozi b3f9df7003 Keep visible games clear of the initial loading cover 2026-10-25 04:02:50 -03:00
waozi 1cded33f1f Move remaining Practices screens into their package 2026-10-25 03:51:25 -03:00
waozi 36dbf728d6 Use the shared loading animation alongside actual progress 2026-10-25 03:47:11 -03:00
waozi 587a2ac55e Strip legacy board state before encrypting account progress 2026-10-25 03:39:59 -03:00
waozi 159f38841a Test that game synchronization carries unlocks and never device boards 2026-10-25 03:33:17 -03:00
waozi 33965188c5 Use one current deposit quote for Dew top-up conversions 2026-10-25 03:32:40 -03:00
waozi e72875f367 Keep device game saves off sync and show actual app loading progress 2026-10-25 03:28:08 -03:00
waozi 9e57756051 Show chapter titles in Library contents and reader 2026-10-25 03:27:12 -03:00
waozi 683d310114 A game or app shows Breeze's loading screen the first time it appears until Kryon has decoded its pictures, instead of black tiles where they will be; lock Kryon 400405ab (ImagesPending, per-folder image reloads) and Ziran 2eafe31e 2026-10-25 03:12:17 -03:00
waozi b8382e11bb Games and pages no longer blink when an app finishes opening
Any change of the asset generation during the frame's content step dropped
every decoded image, and an app finishing its start in the background, or
a practice pack opening or being put away, changed it. Every picture on
screen, a running game's included, then loaded again over several frames
on a phone. Assets that merely became readable now only make readers look
again (an image that could not load yet is read again on its own), and a
practice pack installed, removed or replaced reloads only the practices'
pictures, through Kryon's InvalidateRaylibAssetsUnder.
2026-10-25 03:08:00 -03:00
waozi abd572806b Lock Kryon with typefaces that bake only common glyphs when registered; the module test counts opens after the apps finish opening 2026-10-25 01:59:18 -03:00
waozi 0f516f8511 Practice downloads wait until the Practices app has opened; AppsFinishOpening waits for every app still opening, as the module test does before reading their assets 2026-10-25 01:45:04 -03:00
waozi 0f258e5919 Start in under a second on a slow phone: the first frame no longer waits for the bundled apps' programs, which open on their threads and finish when first run or one a frame after the start; a screen whose app is still opening shows the loading indicator, asset reads never wait for an app and the asset generation changes once it opens; bundles stay uncompressed in the APK; Ziran with cached unchecked opens and hardware SHA-256 2026-10-25 01:38:02 -03:00
waozi b868c162c9 Run only Habits and Practices packages that draw their own screens
This host no longer draws Habits' and Practices' screens, so a package of
theirs built for an older host interface would leave them blank. Each app
in apps/versions.json may now name the oldest host interface its packages
must be built for; Habits and Practices name 30. An older installed or
rolled-back package gives way to the bundled copy, and the compatibility
test skips the node's older releases of those two as this build does.
2026-10-25 00:25:23 -03:00
waozi 86de4a7087 Dew at 10,000 per XMR: Tai Chi shows 100 Dew until the node's price arrives
The node now credits 10,000 Dew per XMR and multiplied every balance,
price and reward by ten. Breeze reads amounts and the ratio from the node,
so only its offline Tai Chi price, the screenshot fixtures and the rate
tests change. The 2.1.46 notes tell people why their balance grew.
2026-10-24 23:55:11 -03:00
waozi b13900bc15 Check packaged practice images against the practices checkout 2026-10-24 23:44:16 -03:00
waozi 434c99f697 Rename bundled app sources and build targets from cells to apps 2026-10-24 23:17:45 -03:00
waozi 284f57e6c2 package-paths.sh reads module_roots without tomllib on Python before 3.11, so the Ubuntu 22.04 Linux package builds find the app's sources again 2026-10-24 23:17:45 -03:00
waozi 8eaa763f81 Build Android from the download rules' new place in src/practices 2026-10-24 23:17:45 -03:00
waozi 6b90f3670c Build practice packs from the practices repository
The practices' pictures, course data and recordings, 184 MB, move out of
Breeze into their own public repository, waozixyz/practices, pinned in
ziran.toml and ziran.lock like the other packages and linked at
build/packages/practices. The build stages them under assets/practices/ as
before, so every pack it makes is byte for byte the same. The narration,
Sun Salutation character and Tai Chi generators write into a practices
checkout mapped in ziran.local.toml. Breeze's history keeps the files.
2026-10-24 23:17:45 -03:00
waozi 1cfa13a6ec Test the habit editor's host with the schedule its page sends 2026-10-24 23:17:45 -03:00
waozi a687881c94 Habits and Practices draw their screens in their own packages
Habits' list with each habit's week and calendar, its day with the entry
dialog, the editor and the statistics now come from the Habits package, and
Practices' home, the Wim Hof, Meditation, Patterns and Astral Projection
manuals, Meditation's and Astral Projection's Customize pages and the
results after a practice come from the Practices package, so they can change
without an app update. The host keeps the data, the rules and the storage,
gives each page its frame and does what the page asks. The pages draw
exactly as before.

Kryon now hosts segmented controls, form sections, toggle sizes, lines,
circles, rings, triangles, sliders and progress bars for bundles and lets a
bundle import up to 256 host calls; plot hosts its band chart. Host
interface 30; Habits 1.3.0 and Practices 1.4.0.
2026-10-24 23:17:45 -03:00
waozi e7c90e9d25 Dew in every build: balance, plans, practices and game rewards; Monero top-up only outside the Play build, the only place a dollar value shows; games claim node rewards through entity.dew; Dew gifts paused 2026-10-24 23:17:45 -03:00
waozi ae356e0a46 Open the store tagline with the practices instead of Lumi 2026-10-24 23:17:45 -03:00
waozi 6863c3c3b3 Node app release: sign and publish an app another repository built and checked, such as Arcade, with the package key from this repository's secrets 2026-10-24 22:38:31 -03:00
waozi 6cf048cfee Fix stale sync test baselines and missing test targets 2026-10-24 15:50:01 -03:00
waozi b3246778b7 Prepare Inner Breeze 2.1.46 2026-10-24 15:13:32 -03:00
waozi d5dc80c5b6 Make Wim Hof reminders follow the breath hold
Use one optional 30- or 60-second hold reminder and keep the normal last-breath bell automatic. Preserve the existing saved keys, simplify the wording in every locale, and resolve Wim Hof modules through declared source roots.
2026-10-24 15:05:59 -03:00
waozi b9cdf450bf Combine Wim Hof time signals in one dropdown 2026-10-24 14:44:29 -03:00
waozi 0904848f1d Give the bookshelf reader a new Library package release 2026-10-24 14:30:26 -03:00
waozi e55930f241 Share canonical account game progress with nested apps 2026-10-24 14:20:06 -03:00
waozi f2200afee0 Keep app loading on a spinner and show actual failures in a dialog 2026-10-24 14:15:59 -03:00
waozi f6d1d21def Space friend rows and show their saved profile pictures 2026-10-24 13:41:10 -03:00
waozi 25010f89ab Give Library a wooden bookshelf and a paginated reader 2026-10-24 13:41:03 -03:00
waozi 441a6744fe Restore the Apps controller digest that the locked packages build
CI builds the Apps controller from the locked Kryon and passed with this
digest. The digest from 7c7e9428 came from a local build that used the
live Kryon working tree, so CI's package builds stopped at the check.
2026-10-24 13:00:11 -03:00
waozi 7c7e942815 Trust the Apps controller built with the current Kryon lock
Moving Kryon in b75ccabb changed the Apps controller bytes without
re-pinning their digest, so make native stopped in prepare-package-assets.
2026-10-24 12:53:25 -03:00
waozi 9e1918bfe9 Merge tested Inner Breeze 2.1.45 release history 2026-10-24 12:52:47 -03:00
waozi 81d54265fe Release Inner Breeze 2.1.45
Phone check: 57.7 fps, 0.0% late frames.
2026-10-24 12:52:47 -03:00
waozi f7ef8cd889 Take the phone check's Moto screenshots directly again
The owner's screenshot consent covers desktop screenshots only; ADB
phone screenshots in app checks need no popup. This reverts c0f81874.
2026-10-24 12:50:43 -03:00
waozi b75ccabbdc Use Kryon shared Android frame pipeline
Delegate native composition to the common app/render host, keeping web serial. Adopt the Moto-verified image decoder and pacing revision; preserve the reader font support included in that upstream history.
2026-10-24 06:43:22 -03:00
waozi 49f7cd2d0a Link Windows builds with winpthreads, which parallel regions use
Kryon's image preview and JPEG decoding run #parallel regions, whose
Ziran runtime starts POSIX threads, so the Windows link failed on
pthread_create. Package checkouts are cached per runner image too: the
Apps controller build compiles its own Ziran inside them, and an Ubuntu
22.04 job could not run one built on 24.04.
2026-10-24 05:09:26 -03:00
waozi 293459cde5 Test sync against the Daochi server that stores entity records
The pinned server, from 10-22, predates the entity records and photo
chunks Breeze now syncs, so its requests failed. The server generates
its Go with Ziran since 143a229, so its build gets Breeze's toolchain.
2026-10-24 05:05:38 -03:00
waozi c0f8187426 Ask the owner before the phone check reads the phone's screenshots
The check keeps each Moto screenshot as a private pending copy and shows
it in Harmony's screenshot consent window. Only approved images are
checked for a blank screen and resume shift; a discard, close or timeout
fails the check and deletes the pending copies.
2026-10-24 04:35:34 -03:00
waozi 6b77b8dcfc Play Shovey inside Arcade in the Arcade UI test, now that Arcade carries only Shovey 2026-10-24 04:32:05 -03:00
waozi c183881164 Bring the release gate's checks up to date
Three tests still built Ziran's removed C++ target. The Telegram fixture
now expects Diary among a new profile's apps. The web smoke opens the
first-run route that exists now, #/audio_setup. The release overlay can
remove read-only directories, such as a node backup's data, from its
private copy.
2026-10-24 04:31:03 -03:00
waozi a5b4eec148 Raise the synced record fields for photo preview sizes
Node storage counts preview.size since 14c57367, so a device that kept
media records from an older version downloads them again once.
2026-10-24 04:31:03 -03:00
waozi 87f9d22559 Describe Breeze 2.1.45: native apps, one loading animation, short profile names and the tray fix 2026-10-24 04:04:03 -03:00
waozi 522b728a90 Make the tray's first entry show or hide the window, and name the tray breeze
On panels where clicking the icon only opens the menu, such as Xfce, the
first entry was a greyed-out status line, so a hidden window could not
be brought back. It is now Show or Hide; the status stays in the tooltip.
The tray id is breeze, which Kryon also uses as the program name the
panel lists, instead of breeze-linux-x86_64.
2026-10-24 04:00:47 -03:00
waozi c2f53f5109 Lock Ziran 3b54282c, which Kryon's parallel image code needs, and regenerate the app codec
Kryon e6a3509d scales previews and decodes JPEGs in #parallel regions
that write through their own slots and slice windows. Ziran 8e36629e
rejected those writes, so every locked build failed in image_preview.zi.
The app codec follows Kryon e6a3509d's widget records.
2026-10-24 04:00:37 -03:00
waozi bc045875e7 Use Entity's short account names: name DaochiClient's entity module where Breeze imports it, and pin Entity f26a99b 2026-10-24 03:58:59 -03:00
waozi 946d2a13f5 Show Kryon's loading dots while an app opens and while Lumi types, and in Apps' download dialog 2026-10-24 03:52:49 -03:00
waozi 509f3b58a8 Cover photo entity records in the account restore check
Since 14c57367 an account restore also queues each photo kept in the
account's entity data, an eighteenth kind of record, so CI failed on
the old count. The check now expects it, queues a photo stored under its
64-hex digest, and leaves out other names, unreadable values and another
account's photos.
2026-10-24 03:49:05 -03:00
waozi 30407588f5 State held-key repeat and display wake for hosted games as laws, and log repeated widget keys 2026-10-24 03:42:39 -03:00
waozi 6e76e3656c Ask before downloading an app, repeat held keys and keep the display on in games, clip hosted apps to their area 2026-10-24 03:22:51 -03:00
waozi ea65808328 Publish Library, Photos and Radio in the ZX format current hosts download 2026-10-24 02:27:10 -03:00
waozi 6a5f639395 Run apps as native code with Ziran's native ZX engine
Lock Ziran 8e36629e, which compiles bundles to machine code in memory on
Android and Linux, and Kryon c3840d2e, which finds cached textures faster.
On the Moto, Shovey inside Arcade moves at 53 fps instead of 21.6, and
every built-in app starts natively.

Ziran no longer has a C++ target, so the toolchain and the behaviour
tests stop building C++ variants.
2026-10-24 02:10:11 -03:00
waozi a5ec0669ba End the entity photos test without a trailing blank line 2026-10-24 00:30:41 -03:00
waozi 032ac3264f Follow the device language on first run and ask once about voice guidance
New profiles no longer start with a Choose Language screen. They use the
device's language, or English when Inner Breeze has no translation for it,
and keep following the device until a language is picked in Settings, which
stays the only language control. Profiles that already chose a language
keep it.

The multi-choice Optional audio step becomes one question, "Add voice
guidance?", with the total size: Download turns on the guide and practice
voices and fetches them in the background, Not now leaves both off without
asking again. Per-voice controls stay in Settings and each practice. The
language screen, its Back path, the audio setup step machine and its saved
step, and the strings only they used are removed.
2026-10-24 00:22:14 -03:00
waozi cbcf115c3a Start new installs with Diary installed, like Lists and Leaderboard
A new profile, or one that never chose its apps, comes with every app Inner
Breeze ships: Lumi, Habits and Practice pinned, and Lists, Diary and
Leaderboard ready under them. A Diary choice still at its untouched default
becomes installed, as Lists and Leaderboard did; a removal stays removed.
2026-10-24 00:14:19 -03:00
waozi 2b3dc7967f Run Kryon's Android process setup at start
Inbe runs its own Android loop, so it missed Kryon's setup: TMPDIR, which
natively compiled apps need for scratch files, and the test driver that
lets a debuggable build be driven by widget labels on a phone.
2026-10-24 00:13:01 -03:00
waozi 14c57367d5 Keep each photo once in the account's private entity data, shared by every app
Diary and Photos keep their photos as records of the account's entity data
(Daochi docs/entity-data.md): entity.photos.<sha256>, synced as
private.entity.v1.photos in Inbe's own signed v6 sync and sealed in Daochi's
record profile with the account's photos key, the same bytes libsodium writes.
A photo's bytes travel as sealed chunks of at most 8 MiB at
/api/v1/blobs/entity/, so the same picture is stored once per node for every
app of the account.

Photos released versions kept move there by themselves: library photos once
their bytes are on the device, and Diary files that an entry includes, named
and dated as before. An old copy goes only after the sync node confirmed the
photo's record and chunks and they came back whole; then the old records name
the photo and keep every field for released versions, which read them through
2027-10-24, the Diary file leaves the device, hex chunks shrink, and the old
copies are deleted from each node. Any failure keeps the old copy for a later
pass, and a delegate device moves nothing.
2026-10-23 23:46:53 -03:00
waozi 07486d6d54 Lock DaochiClient's chunked entity data and Apps' publisher for either package format
DaochiClient 9976953 seals the account's entity data in 8 MiB chunks keyed by
their index. Apps 8cf8a1d publishes a node app only when it advances past its
newest release in either format; updating it pins Kryon master dae0401f, whose
only source change is the floating DirectionPad.
2026-10-23 23:46:43 -03:00
waozi 9cda3cc49a Publish and verify ZX packages, and leave apps released before ZX on their own packages 2026-10-23 22:47:16 -03:00
waozi 7d0b1e34ca Draw still screens and held figures cheaply on phones
Android now draws into the retained frame target like desktop, so a frame
whose paint matches the last one is presented again instead of rasterized.
A figure that holds still (a guide's pose chart, a paused practice) keeps
its meshes and replays them instead of solving the pose every frame, and
the bundle runtime is compiled for speed. On the Moto the Sun Salutation
guide went from 11.6 fps at 95% CPU to the 15 fps idle rate at 25% CPU,
and the practice from 81% to 66% of a core.
2026-10-23 22:05:12 -03:00
waozi 74c4a6d935 Build and run apps in the ZX format
Ziran 0.3.1 writes portable bundles as .zx with a ZX header and rejects
.zib. Pin Ziran 620c407, Kryon 935d5fc1, Apps 12e52c0 and Entity 86e72720,
and build, embed, download, verify and store every bundle as .zx: the root
and cell bundles, node apps (the node is asked for format=zx releases),
practice packs and the shared Apps controller, now the only trusted one.

Practice packs stored by older versions count as installed and update
themselves to ZX; a node app's unusable .zib payload is removed so its ZX
release installs. Bundle staging starts empty, so no stale bundle is
embedded, and Android reads asset names by their length.
The generated app codec matches the pinned generator again.
2026-10-23 22:05:05 -03:00
waozi 4551dca454 Keep the integrated Sun Salutation guide clean on desktop 2026-10-23 18:38:57 -03:00
waozi bdc8b21eda Pin shared Apps presentation options while retaining collection trust 2026-10-23 18:17:47 -03:00
waozi 4276dbbf75 Sun Salutation drawn like the studio's 3D woman: a seat under a draped top
A three.js body lab (design/tai-chi/sun-salutation.html, tools/sun-salutation.mjs)
plays the app's exact Sun Salutation motion, exported by
render-sun-salutation-live.py --motion, on the studio's skinned 3D woman in
the app's look. There the long top drapes over the hips and a seat
ellipsoid sits inside it, which looks natural in every pose. The app now
draws her the same way: the slimmer top at the Jade woman's length over one
seat ellipsoid on the pelvis, in place of separate buttock shapes.
2026-10-23 17:46:18 -03:00
waozi 8675cbdee3 Use the shared Apps screen for the Inbe launcher 2026-10-23 17:44:24 -03:00
waozi 685bbc7a39 Sun Salutation: buttocks as rounded domes
The ring-built seat looked like a block when her hips were high and
tipped. Each buttock is now an ellipsoid on the pelvis, behind and a
little below its hip, so it shows one smooth curve into the thigh from
any side, and lies over the farther leg.
2026-10-23 17:16:39 -03:00
waozi 9cf4c7bb85 Sun Salutation: a human seat, built in rings like the top
The trousers' seat is a loft of rings along the spine, fullest just below
the hips and set back behind them, rounding under into the fold above
the thighs, so it curves like a body in every pose instead of a ball.
It lies over the farther leg, whose darker tone no longer crosses it,
and the top's hem follows its curve.
2026-10-23 17:11:57 -03:00
waozi 7fe1badd65 Note the smoother Sun Salutation in 2.1.44 2026-10-23 17:02:35 -03:00
waozi 2aa0db2ebb Sun Salutation: a rounder seat that shows in plank 2026-10-23 17:02:12 -03:00
waozi 73fda991b1 Sun Salutation: a gentle seat, cobra on the tops of the feet, a full shadow
The seat rounds just past the hip into the thigh instead of bulging. In
cobra the feet roll over onto their tops, toes pointing back, the hips
rest on the floor and the legs lie long; the hips slide forward before
they settle into it and lift before they press back out of it, so the
knees stay off the floor. A foot turned past standing on its toes now
rolls about the ankle onto its top. The shadow also reaches under the
hands and head when they come near the floor.
2026-10-23 16:59:46 -03:00
waozi c20c95a908 Sun Salutation frames her like the workout and shows a real seat
Prayer is seen a little from her right with her feet in view, the other
poses from her right side turned enough to show her face, with the
workout's camera tilt. Her top ends at the hips, so her seat rounds into
each thigh in the trousers as she bends.
2026-10-23 16:48:28 -03:00
waozi 215e1b4d4e Sun Salutation moves like Tai Chi and the workout, without snaps or slides
The woman is the Jade figure of Tai Chi and the workout in the chosen
auburn colours, cut slimmer, with rounded hips, finer hands and feet and
upright prayer hands. No joint snaps: elbows turn gradually as the hands
go flat, knees stay just soft at full reach, and every floor pose keeps
the hands and feet on one spot. Stepping feet lift, the body leads and
the head follows, a hold keeps breathing, Mountain stands straight, and
the camera turns only while she stands. A live offscreen renderer
exports the app's own drawing.
2026-10-23 16:43:56 -03:00
waozi 8f229619ff Offer host interface 28, which Arcade's cover collection needs
Arcade 0.7.x requires host 28 for its hosted carousel (Kryon 0af2fae4) and the reviewed carousel controller, which Inbe already trusts (f493b059); Inbe only never declared it, so no released Inbe could install Arcade from the node.
2026-10-23 15:16:16 -03:00
waozi b6df02ff01 Remove functions and translations nothing uses
Sixty functions that no code, test, host or other repository references, and the six translations only they used (837 lines). The full test suite passes; functions that C code or tests reach by their module-prefixed names stay.
2026-10-23 14:56:32 -03:00
waozi 667bb87505 Count the pre-push checks as tooling, not app content 2026-10-23 14:24:46 -03:00
waozi 5fc49412a0 Expect the longer storage retries in the web storage test
The web build now retries a vanished file up to eight times; the pre-push check runs this test whenever the web boot code changes.
2026-10-23 14:24:30 -03:00
waozi 3220589102 Start the local release check's container without a session keyring
Each container's session keyring counts against the account's 200 kernel keys, which long-lived sessions fill; then no container starts (crun: Disk quota exceeded).
2026-10-23 14:15:53 -03:00
waozi 1118412652 Version Inner Breeze 2.1.44
Lists with wrapping chips, pull-down finished items, List settings and profile pictures; profile pictures shared with friends; the Linux program is named breeze. Every app package is versioned for the release.
2026-10-23 14:09:56 -03:00
waozi adbb3c3116 Stop the always-red runs and check pushes locally first
A pushed version that is already released no longer starts the forty-minute release builds; CI still tests every push. A package version waiting for the next release is a notice in App packages instead of a failure. The web build keeps saving its storage while practice packs install (up to about ten seconds of retries), and the package compatibility check asks the node again while a deploy restarts it. The pre-push hook now runs the quick checks that match the pushed files (versions, translations and fonts, UI APIs, app bundles, workflows, script syntax); make pre-push-check runs them by hand.
2026-10-23 14:08:39 -03:00
waozi 2bc7e5fe65 Show people's own profile pictures in Lists
Inner Breeze now sends the profile picture chosen in Profile to the account's node, in the background once per new choice, so friends receive it with the friend list. Lists draws each person's picture in List settings and in the names under the lists, this account's own for You, and keeps the first letter for anyone without one. Pictures the node kept from older clients map to the same pictures.
2026-10-23 13:08:44 -03:00
waozi 7ea822f21c Manage each list in List settings, as the owner chose from four proposals
The gear on the selected list opens List settings: the name with Save, the people with access with avatars and their roles, an invitation by name with the access it gives, and for the owner Delete list behind a question. The Share dialog and the Share and Edit icons under the field are gone. A shared list names its people under the lists, and an item swiped right is edited in its own row, where Escape leaves it.
2026-10-23 12:48:02 -03:00
waozi e05e70e0f2 Check that each list shows its own items with many lists 2026-10-23 12:13:20 -03:00
waozi 8881ea1b8d Leave the finished count out of Lists
No line counts the finished items and no heading names them; a pull down on the items still shows and hides them.
2026-10-23 12:08:48 -03:00
waozi a0c9c6d515 Run the app's own package when a saved one is the same release
A phone that had downloaded the node's root before installing that release's APK kept running the saved root, so a build that changed an app without a new root version never showed its change: the owner's Pixel stayed on the old Lists. At startup a saved root or app now replaces the bundled one only when it is a newer release.
2026-10-23 12:08:48 -03:00
waozi 39b0f211a9 Show lists as wrapping chips and pull the items down for finished ones, as in 1List
Every list keeps its whole name however many there are: the chips wrap onto more rows (scrolling past three) and the last chip makes a new list. The Open and All tabs are gone; finished items stay hidden until a pull down on the items shows them above the open ones, and another pull hides them. Share and Edit sit under the field beside a line that counts the finished items. Lists 1.1.11.
2026-10-23 11:55:18 -03:00
waozi 40e9fd3c1a Name the program breeze and move existing launcher shortcuts to it 2026-10-23 11:54:46 -03:00
waozi b2126cfac2 Point source, release and update links at github.com/waozixyz/breeze 2026-10-23 11:54:46 -03:00
waozi 949644bfda Give the list tabs their own row and keep them where a swipe leaves them
Share, Edit and New list move beside the Open/All filter, so the tabs use the full width. A tab is scrolled into view only when the selection changes, so swiping back to the first lists no longer jumps to the selected one. Undo takes a line under the items while it is offered.
2026-10-23 11:36:16 -03:00
waozi 0183eef6b7 Give launcher test apps their usual startup time again 2026-10-23 10:56:42 -03:00
waozi 8283367948 Merge tested Inner Breeze 2.1.43 release history 2026-10-23 10:38:29 -03:00
waozi 6fd9ed80db Keep git maintenance out of the temporary repositories tests remove 2026-10-23 04:36:10 -03:00
14183 changed files with 45866 additions and 32490 deletions

No files matched your search

+1
View File
@@ -15,3 +15,4 @@ else
fi
scripts/check-secrets.py --pre-push "$@" < "$tmp"
scripts/pre-push-checks.py < "$tmp"
+8 -4
View File
@@ -2,8 +2,9 @@ name: Fetch Ziran packages
description: >
Fetch the packages pinned in ziran.lock. The built Ziran compiler is cached
by the runner image and the toolchain commit, so bumping another package
such as Kryon keeps it; the package checkouts are cached by the whole lock and fall back
to the previous checkouts, so a bump fetches only what changed.
such as Kryon keeps it; the package checkouts are cached by the runner image
and the whole lock and fall back to the previous checkouts, so a bump
fetches only what changed.
inputs:
save-toolchain:
@@ -48,13 +49,16 @@ runs:
restore-keys: |
ziran-toolchain-${{ runner.os }}-${{ runner.arch }}-${{ steps.toolchain.outputs.system }}-
# Package checkouts can hold programs built inside them, such as the
# Ziran an Apps controller build compiles for its own lock, so they are
# kept per runner image as well.
- name: Restore the package sources
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/ziran/sources
key: ziran-sources-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('ziran.lock') }}
key: ziran-sources-${{ runner.os }}-${{ runner.arch }}-${{ steps.toolchain.outputs.system }}-${{ hashFiles('ziran.lock') }}
restore-keys: |
ziran-sources-${{ runner.os }}-${{ runner.arch }}-
ziran-sources-${{ runner.os }}-${{ runner.arch }}-${{ steps.toolchain.outputs.system }}-
- name: Fetch Ziran packages
shell: sh
-2
View File
@@ -3,8 +3,6 @@
# belong here; drafts, renders and design explorations go in the ignored
# backup/ folder, and large media can go in Git LFS (see .gitattributes).
# Sun Salutation practice videos
assets/practices/sunsalutation/animations/*/sun-salutation-*.mp4
# Lumi and the default profile picture
assets/lumi/mascot.png
assets/profile-pictures/flowers.png
+5 -2
View File
@@ -20,7 +20,10 @@ if [ -n "$(git -c safe.directory="$server/vendor/liboqs" -C "$server/vendor/libo
exit 2
fi
# Emscripten's PATH entry holds a cmake directory, which make's own command
# lookup would try to run instead of the cmake program.
make -C "$server" BUILD_DIR=/src/build/sync-test-server CMAKE="$(command -v cmake)" build
# lookup would try to run instead of the cmake program. The server generates
# its Go with Ziran, Breeze's own toolchain.
make /src/build/ziran-toolchain/bin/zi2c
make -C "$server" BUILD_DIR=/src/build/sync-test-server CMAKE="$(command -v cmake)" \
ZIRAN=/src/build/ziran-toolchain/bin/ziran build
DAOCHI_BIN="$server/daochi" make sync-server-test
git -c safe.directory="$server" -C "$server" diff --exit-code "$commit" -- .
+1 -1
View File
@@ -1 +1 @@
1ef10d91aba32b45a381cd6a5af4db029698c343
c692ab12f21e5bf1c5901363bcd9b449b55efd2f
+3 -1
View File
@@ -159,7 +159,9 @@ jobs:
- name: Verify sync and recovery
if: matrix.shard == 0
run: |
make -C .test-server build
# The server generates its Go with Ziran, Breeze's own toolchain.
make "$GITHUB_WORKSPACE/build/ziran-toolchain/bin/zi2c"
make -C .test-server build ZIRAN="$GITHUB_WORKSPACE/build/ziran-toolchain/bin/ziran"
make sync-server-test DAOCHI_BIN="$GITHUB_WORKSPACE/.test-server/daochi"
browser-addons:
+77
View File
@@ -0,0 +1,77 @@
name: Node app follower
# Arcade releases reach Waozi's node by themselves. Arcade's Game updates
# workflow attaches each new release (node-arcade-VERSION) when a game
# publishes an update; this checks every fifteen minutes for a release newer
# than the version the node serves and publishes it through the Node app
# release job, which signs exactly those bytes with the package key.
on:
schedule:
- cron: '12,27,42,57 * * * *'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: node-app-follower
cancel-in-progress: false
jobs:
check:
name: Find an Arcade release the node does not serve
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
publish: ${{ steps.release.outputs.publish }}
commit: ${{ steps.release.outputs.commit }}
tag: ${{ steps.release.outputs.tag }}
sha256: ${{ steps.release.outputs.sha256 }}
steps:
- name: Compare Arcade's newest release with the node
id: release
env:
GH_TOKEN: ${{ github.token }}
run: |
python3 - <<'PY'
import hashlib, json, os, re, subprocess, urllib.request
def gh(*args):
return subprocess.check_output(['gh', *args], text=True).strip()
def number(version):
return tuple(map(int, version.split('.')))
releases = json.loads(gh('release', 'list', '--repo', 'waozixyz/arcade', '--limit', '50',
'--json', 'tagName,isDraft'))
tags = [item['tagName'] for item in releases if not item['isDraft'] and
re.fullmatch(r'node-arcade-\d+\.\d+\.\d+', item['tagName'])]
tag = max(tags, key=lambda name: number(name.removeprefix('node-arcade-')))
request = urllib.request.Request(
'https://api.waozi.xyz/api/v2/packages/inbe.arcade/latest?bucket=0&format=zx',
headers={'User-Agent': 'Inbe-Publisher/1.0', 'Cache-Control': 'no-cache'})
with urllib.request.urlopen(request, timeout=60) as response:
live = json.load(response)['version']
with open(os.environ['GITHUB_OUTPUT'], 'a') as output:
if number(tag.removeprefix('node-arcade-')) <= number(live):
print(f'The node already serves Arcade {live}; newest release is {tag}.')
output.write('publish=false\n')
raise SystemExit(0)
commit = gh('api', f'repos/waozixyz/arcade/commits/{tag}', '--jq', '.sha')
subprocess.run(['gh', 'release', 'download', tag, '--repo', 'waozixyz/arcade',
'--pattern', 'arcade.zx', '--dir', 'bundle'], check=True)
with open('bundle/arcade.zx', 'rb') as bundle:
digest = hashlib.sha256(bundle.read()).hexdigest()
print(f'Publishing {tag} ({commit}, arcade.zx {digest}); the node serves {live}.')
output.write(f'publish=true\ncommit={commit}\ntag={tag}\nsha256={digest}\n')
PY
publish:
name: Publish it to Waozi's node
needs: check
if: needs.check.outputs.publish == 'true'
uses: ./.github/workflows/node-app-release.yml
with:
app: arcade
repository: waozixyz/arcade
commit: ${{ needs.check.outputs.commit }}
tag: ${{ needs.check.outputs.tag }}
sha256: ${{ needs.check.outputs.sha256 }}
secrets: inherit
+155
View File
@@ -0,0 +1,155 @@
name: Node app release
# Publishes one app the node offers that is built and checked in its own
# repository, such as Arcade from Shovey's publisher. That publisher builds
# the bundle, runs its screen checks, records the version in its repository's
# apps/versions.json and attaches the checked bundle to a GitHub release
# there. This workflow signs exactly those bytes with the package key, which
# lives only in this repository's secrets, uploads the release to Waozi's
# node and verifies what the node serves.
on:
workflow_dispatch:
inputs:
app:
description: The app's name in its ledger, such as arcade
required: true
type: string
repository:
description: Repository whose commit records the release, such as waozixyz/arcade
required: true
type: string
commit:
description: Full commit in that repository whose apps/versions.json names the release
required: true
type: string
tag:
description: GitHub release in that repository with the checked bundle attached as APP.zx
required: true
type: string
sha256:
description: SHA-256 of the checked bundle; any other bytes are refused
required: true
type: string
# The node app follower publishes each new release through this same job.
workflow_call:
inputs:
app:
description: The app's name in its ledger, such as arcade
required: true
type: string
repository:
description: Repository whose commit records the release, such as waozixyz/arcade
required: true
type: string
commit:
description: Full commit in that repository whose apps/versions.json names the release
required: true
type: string
tag:
description: GitHub release in that repository with the checked bundle attached as APP.zx
required: true
type: string
sha256:
description: SHA-256 of the checked bundle; any other bytes are refused
required: true
type: string
permissions:
contents: read
concurrency:
group: inbe-package-publishing
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Check separate-game archive validation
run: python3 tests/node_app_games_test.py
- name: Check the request
env:
APP: ${{ inputs.app }}
REPOSITORY: ${{ inputs.repository }}
COMMIT: ${{ inputs.commit }}
TAG: ${{ inputs.tag }}
SHA256: ${{ inputs.sha256 }}
run: |
python3 - <<'PY'
import os, re
checks = {'APP': r'[a-z][a-z0-9-]{0,63}', 'REPOSITORY': r'waozixyz/[A-Za-z0-9._-]+',
'COMMIT': r'[0-9a-f]{40}', 'TAG': r'[A-Za-z0-9._-]{1,100}', 'SHA256': r'[0-9a-f]{64}'}
for name, pattern in checks.items():
if not re.fullmatch(pattern, os.environ[name]):
raise SystemExit(f'{name} is not valid')
PY
- name: Fetch the release record, the publisher and the checked bundle
env:
GH_TOKEN: ${{ github.token }}
APP: ${{ inputs.app }}
REPOSITORY: ${{ inputs.repository }}
COMMIT: ${{ inputs.commit }}
TAG: ${{ inputs.tag }}
SHA256: ${{ inputs.sha256 }}
run: |
set -eu
work="$RUNNER_TEMP/node-app"
mkdir -p "$work/bundles"
git init -q "$work/source"
git -C "$work/source" fetch -q --depth 1 "https://github.com/$REPOSITORY.git" "$COMMIT"
git -C "$work/source" checkout -q FETCH_HEAD
# The Apps publisher at the commit the release's own lock pins.
apps=$(python3 -c 'import json,sys; print(next(p["commit"] for p in json.load(open(sys.argv[1]))["packages"] if p["url"].rstrip("/").removesuffix(".git").endswith("waozixyz/apps")))' "$work/source/ziran.lock")
git init -q "$work/apps"
git -C "$work/apps" fetch -q --depth 1 https://github.com/waozixyz/apps.git "$apps"
git -C "$work/apps" checkout -q FETCH_HEAD
gh release download "$TAG" --repo "$REPOSITORY" --pattern "$APP.zx" --dir "$work/bundles"
echo "$SHA256 $work/bundles/$APP.zx" | sha256sum --check --strict
python3 scripts/node_app_games.py --bundle "$work/bundles/$APP.zx" --list > "$work/required-games.txt"
if [ -s "$work/required-games.txt" ]; then
gh release download "$TAG" --repo "$REPOSITORY" --pattern "$APP.games.tar" --dir "$work/bundles"
python3 scripts/node_app_games.py --bundle "$work/bundles/$APP.zx" \
--archive "$work/bundles/$APP.games.tar" --output "$work/bundles/$APP.games"
fi
- name: Install signing dependencies
run: sudo apt-get update && sudo apt-get install -y python3-cryptography
- name: Configure publisher
env:
SIGNING_KEY: ${{ secrets.INBE_PACKAGE_SIGNING_KEY }}
SSH_KEY: ${{ secrets.INBE_NODE_SSH_KEY }}
SSH_HOSTS: ${{ secrets.INBE_NODE_KNOWN_HOSTS }}
run: |
python3 - <<'PY'
import os
from pathlib import Path
directory = Path(os.environ['RUNNER_TEMP']) / 'inbe-publisher'
directory.mkdir(mode=0o700)
for filename, name in (('publisher.pem', 'SIGNING_KEY'), ('node.key', 'SSH_KEY'), ('known_hosts', 'SSH_HOSTS')):
if not os.environ.get(name):
raise SystemExit(f'{name} is not configured')
path = directory / filename
path.write_text(os.environ[name] + '\n')
path.chmod(0o600)
PY
- name: Sign, publish to Waozi's Daochi node and verify
env:
APP: ${{ inputs.app }}
KEY_ID: ${{ vars.INBE_PACKAGE_KEY_ID }}
TARGET: ${{ secrets.INBE_NODE_SSH_TARGET }}
STORE: ${{ secrets.INBE_NODE_PACKAGE_STORE }}
run: |
set -eu
work="$RUNNER_TEMP/node-app"
export INBE_SSH_IDENTITY="$RUNNER_TEMP/inbe-publisher/node.key"
export INBE_SSH_KNOWN_HOSTS="$RUNNER_TEMP/inbe-publisher/known_hosts"
python3 "$work/apps/scripts/node_release.py" --store "$work/releases" --node-app "$APP" \
--key "$RUNNER_TEMP/inbe-publisher/publisher.pem" --key-id "$KEY_ID" \
--publishers apps/publishers.json --app-ledger "$work/source/apps/versions.json" \
--bundle-directory "$work/bundles" \
--ssh-target "$TARGET" --remote-store "$STORE" --verify-origin https://api.waozi.xyz
- name: Remove signing material
if: always()
run: rm -rf "$RUNNER_TEMP/inbe-publisher"
+6 -5
View File
@@ -10,10 +10,11 @@ on:
- 'themes/**'
- 'scripts/prepare-package-assets.py'
- 'src/**'
- 'scripts/build-cells.sh'
- 'scripts/build-apps.sh'
- 'scripts/build-node-apps.sh'
- 'scripts/package-release.py'
- 'scripts/practice_content.py'
- 'scripts/practice_media.py'
- 'design/tai-chi/narration*.json'
- 'design/tai-chi/text/**'
- 'scripts/generate-package-versions.py'
@@ -56,7 +57,7 @@ jobs:
make package-workflow-test
make package-manifest-test
make package-upload-test
make cells node-apps build-laws
make apps node-apps build-laws
python3 tests/package_release_test.py
- name: Run new packages in the last released app
run: python3 tests/package_compat_test.py --skip-forward
@@ -136,9 +137,9 @@ jobs:
with:
name: inbe-app-packages
path: |
build/inbe.zib
build/cells/*.zib
build/node-apps/*.zib
build/inbe.zx
build/apps/*.zx
build/node-apps/*.zx
build/package-releases/
if-no-files-found: error
- name: Remove signing material
+12 -9
View File
@@ -23,7 +23,8 @@ permissions:
concurrency:
# A failed Release produces a skipped refresh, which must not cancel a push.
group: pages-${{ github.ref }}-${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' && 'skipped' || 'deploy' }}
cancel-in-progress: true
# Finish the active deployment; newer pushes replace only the pending refresh.
cancel-in-progress: false
jobs:
build:
@@ -31,6 +32,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
env:
# Production follows the phone-verified release; previews test new source.
USE_RELEASED_WEB: ${{ github.event_name != 'pull_request' || inputs.released_web }}
steps:
- name: Checkout Repository
@@ -51,7 +55,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh api repos/waozixyz/inbe/releases/latest > "$RUNNER_TEMP/inbe-published-release.json"
gh api repos/waozixyz/breeze/releases/latest > "$RUNNER_TEMP/inbe-published-release.json"
python3 - "$RUNNER_TEMP/inbe-published-release.json" >> "$GITHUB_ENV" <<'PY'
import json
import re
@@ -71,16 +75,16 @@ jobs:
PY
- name: Install Packages
if: ${{ !inputs.released_web }}
if: ${{ env.USE_RELEASED_WEB != 'true' }}
timeout-minutes: 15
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
- name: Set Up Emscripten
if: ${{ !inputs.released_web }}
if: ${{ env.USE_RELEASED_WEB != 'true' }}
uses: ./.github/actions/emscripten
- name: Download Released Web App
if: ${{ inputs.released_web }}
if: ${{ env.USE_RELEASED_WEB == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
@@ -93,7 +97,7 @@ jobs:
test -s build/dist/web/index.wasm
- name: Web runner diagnostics
if: ${{ !inputs.released_web }}
if: ${{ env.USE_RELEASED_WEB != 'true' }}
run: |
set -euo pipefail
lscpu
@@ -107,7 +111,7 @@ jobs:
- name: Build Site
run: |
set -euo pipefail
if [ "$RELEASED_WEB" = "true" ]; then
if [ "$USE_RELEASED_WEB" = "true" ]; then
make package-unpackaged-assets
sh site/build.sh
else
@@ -127,10 +131,9 @@ jobs:
fi
env:
GH_TOKEN: ${{ github.token }}
RELEASED_WEB: ${{ inputs.released_web }}
- name: Upload Web diagnostics after a failed build
if: ${{ failure() && !inputs.released_web }}
if: ${{ failure() && env.USE_RELEASED_WEB != 'true' }}
uses: actions/upload-artifact@v4
with:
name: inbe-web-diagnostics
+224 -47
View File
@@ -3,6 +3,14 @@ name: Publish OpenStore
on:
workflow_dispatch:
inputs:
revision:
description: Exact committed source to build (defaults to the selected ref)
required: false
type: string
build_only:
description: Verify and archive the package without publishing it
type: boolean
default: false
changelog:
description: Changelog text for the OpenStore revision
required: false
@@ -11,30 +19,186 @@ on:
description: OpenStore channel
required: false
default: focal
release:
types: [published]
push:
tags:
- "v*"
# Release-created tags/events do not start another workflow with GITHUB_TOKEN.
workflow_run:
workflows: [Release]
types: [completed]
branches: [master]
permissions:
contents: read
jobs:
source:
runs-on: ubuntu-24.04
timeout-minutes: 5
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
outputs:
revision: ${{ steps.select.outputs.revision }}
run: ${{ steps.select.outputs.run }}
steps:
- name: Select the immutable release source
id: select
env:
GH_TOKEN: ${{ github.token }}
REQUESTED_REVISION: ${{ inputs.revision || github.sha }}
OPENSTORE_CHANNEL: ${{ inputs.channel || 'focal' }}
run: |
python3 - <<'PY'
import datetime
import json
import os
from pathlib import Path
import re
import subprocess
def api(path):
return json.loads(subprocess.check_output(["gh", "api", path]))
def timestamp(value):
return datetime.datetime.fromisoformat(value.replace("Z", "+00:00"))
def finish(revision=""):
with open(os.environ["GITHUB_OUTPUT"], "a") as output:
output.write(f"revision={revision}\nrun={'true' if revision else 'false'}\n")
raise SystemExit(0)
revision = os.environ["REQUESTED_REVISION"]
if os.environ["GITHUB_EVENT_NAME"] == "workflow_run":
event = json.loads(Path(os.environ["GITHUB_EVENT_PATH"]).read_text())
repo = os.environ["GITHUB_REPOSITORY"]
release = api(f"repos/{repo}/releases/latest")
if release["draft"] or release["prerelease"] or timestamp(release["published_at"]) < timestamp(event["workflow_run"]["created_at"]):
print("This run did not publish a new stable release; no OpenStore update.")
finish()
match = re.fullmatch(r"v(\d+)\.(\d+)\.(\d+)", release["tag_name"])
assert match, "Expected a numeric published release"
version = tuple(map(int, match.groups()))
store = json.loads(subprocess.check_output([
"curl", "--fail", "--silent", "--show-error", "--retry", "3",
"https://open-store.io/api/v4/apps/inbe"]))
assert store.get("success"), "OpenStore metadata lookup failed"
for item in store["data"].get("revisions", []):
existing = re.fullmatch(r"(\d+)\.(\d+)\.(\d+)", item.get("version", ""))
if item.get("channel") == os.environ["OPENSTORE_CHANNEL"] and item.get("architecture") == "arm64" and existing and tuple(map(int, existing.groups())) >= version:
print("OpenStore already has this release or a newer one.")
finish()
revision = api(f"repos/{repo}/commits/{release['tag_name']}")["sha"]
assert re.fullmatch(r"[0-9a-f]{40}", revision), "An exact commit is required"
finish(revision)
PY
publish:
runs-on: ubuntu-latest
needs: source
if: needs.source.outputs.run == 'true'
concurrency:
# Skipped source checks and diagnostics cannot replace a pending release.
group: openstore-${{ inputs.channel || 'focal' }}-${{ inputs.build_only && 'verify' || 'publish' }}
cancel-in-progress: false
runs-on: ubuntu-24.04
# The published focal channel must use Focal's ARM64 libc and libraries.
container: clickable/ci-20.04-arm64@sha256:c6227ffcdb2abb50101a8469dd2a8df3ffd9208e04a3e07e351db63d36bec5d6
defaults:
run:
shell: bash
timeout-minutes: 90
env:
OPENSTORE_API_KEY: ${{ secrets.OPENSTORE_API_KEY }}
DEBIAN_FRONTEND: noninteractive
# Ziran runs on the builder; only Click artifacts use the cross compiler.
CC: gcc
CXX: g++
OPENSTORE_APP_ID: inbe
OPENSTORE_CHANNEL: ${{ github.event.inputs.channel || 'focal' }}
CHANGELOG: ${{ github.event.inputs.changelog || github.event.release.name || github.event.release.tag_name || '' }}
steps:
- name: Require an immutable source
env:
CANDIDATE: ${{ needs.source.outputs.revision }}
run: |
[[ "$CANDIDATE" =~ ^[0-9a-f]{40}$ ]] || { echo 'An exact commit is required'; exit 1; }
- name: Install the Focal build environment
run: |
set -euo pipefail
apt-get update
apt-get install -y --no-install-recommends \
build-essential binutils-aarch64-linux-gnu ca-certificates ccache \
click curl gcc-aarch64-linux-gnu git git-lfs jq make patchelf \
perl pkg-config tcl xz-utils zlib1g-dev libbz2-1.0 libffi7 liblzma5 \
libsqlite3-0 libssl-dev \
libdrm-dev:arm64 libegl1-mesa-dev:arm64 libgbm-dev:arm64 \
libgles2-mesa-dev:arm64 libsdl2-dev:arm64 libssl-dev:arm64 zlib1g-dev:arm64
apt-get install -y --no-install-recommends libwayland-bin \
libwayland-dev:arm64 libxkbcommon-dev:arm64 libpulse-dev:arm64 libdbus-1-dev:arm64
- name: Set up build Python for Focal
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
# Last upstream Actions build that supports Ubuntu 20.04.
python-version: '3.12.10'
- name: Install current build tools
run: |
# The project uses GNU Make 4.3+ function/comment parsing.
python3 -m pip install cmake==3.28.4 fonttools==4.58.5 gnumake==4.4.1
make --version
- name: Build Focal TLS libraries
run: |
set -euo pipefail
# The locked Curl requires OpenSSL 3. Build its current LTS for
# Focal instead of importing a newer distribution's libc.
tls_source="$RUNNER_TEMP/inbe-openssl"
mkdir -p "$tls_source"
curl --fail --location --retry 3 \
https://github.com/openssl/openssl/releases/download/openssl-3.5.9/openssl-3.5.9.tar.gz \
--output "$tls_source/source.tar.gz"
printf '%s %s\n' \
603f5602e2eef00d77fbd429d34dcd5822bb301757a1bc9cdb24c670f1eb859a \
"$tls_source/source.tar.gz" | sha256sum --check -
tar -xzf "$tls_source/source.tar.gz" -C "$tls_source"
cd "$tls_source/openssl-3.5.9"
./Configure linux-aarch64 --cross-compile-prefix=aarch64-linux-gnu- \
--prefix=/opt/inbe-openssl --libdir=lib --openssldir=/etc/ssl shared no-tests
make -j2 build_sw
make install_sw
cp LICENSE.txt /opt/inbe-openssl/lib/OpenSSL-LICENSE.txt
- name: Build Focal SDL with Wayland
run: |
set -euo pipefail
sdl_source="$RUNNER_TEMP/inbe-sdl2"
mkdir -p "$sdl_source"
curl --fail --location --retry 3 \
https://github.com/libsdl-org/SDL/releases/download/release-2.32.10/SDL2-2.32.10.tar.gz \
--output "$sdl_source/source.tar.gz"
printf '%s %s\n' \
5f5993c530f084535c65a6879e9b26ad441169b3e25d789d83287040a9ca5165 \
"$sdl_source/source.tar.gz" | sha256sum --check -
tar -xzf "$sdl_source/source.tar.gz" -C "$sdl_source"
unset PKG_CONFIG_PATH
export PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
cmake_bin="$(python3 -c 'import cmake; print(cmake.CMAKE_BIN_DIR + "/cmake")')"
"$cmake_bin" -S "$sdl_source/SDL2-2.32.10" -B "$sdl_source/build" \
-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/opt/inbe-sdl2 -DCMAKE_INSTALL_LIBDIR=lib \
-DSDL_SHARED=ON -DSDL_STATIC=OFF -DSDL_TEST=OFF \
-DSDL_WAYLAND=ON -DSDL_WAYLAND_SHARED=ON -DSDL_WAYLAND_LIBDECOR=OFF \
-DSDL_X11=ON -DSDL_KMSDRM=OFF -DSDL_OPENGL=OFF -DSDL_OPENGLES=ON \
-DSDL_PULSEAUDIO=ON -DSDL_ALSA=OFF
grep -q '^#define SDL_VIDEO_DRIVER_WAYLAND 1' "$sdl_source/build/SDL_config.h.intermediate"
"$cmake_bin" --build "$sdl_source/build" --parallel 2
"$cmake_bin" --install "$sdl_source/build"
cp "$sdl_source/SDL2-2.32.10/LICENSE.txt" /opt/inbe-sdl2/lib/SDL2-LICENSE.txt
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.source.outputs.revision }}
fetch-depth: 0
lfs: true
@@ -44,42 +208,12 @@ jobs:
- name: Scan Tracked Files and History
run: |
set -euo pipefail
# The SDK container runs under a different UID from the checkout.
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git ls-files -z >/dev/null
python3 scripts/check-secrets.py --working-tree
python3 scripts/check-secrets.py --history
- name: Install build dependencies
run: |
sudo dpkg --add-architecture arm64
# Ubuntu's archive/security mirrors only carry amd64/i386; arm64
# lives on ports.ubuntu.com. Pin the stock deb822 sources to amd64
# and add a ports source, otherwise apt-get update 404s on
# binary-arm64 and the install step fails.
sudo sed -i 's/^Types: deb$/Types: deb\nArchitectures: amd64 i386/' /etc/apt/sources.list.d/ubuntu.sources
printf 'Types: deb\nURIs: http://ports.ubuntu.com/ubuntu-ports\nSuites: noble noble-updates noble-backports noble-security\nComponents: main universe restricted multiverse\nArchitectures: arm64\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' | sudo tee /etc/apt/sources.list.d/ports-arm64.sources >/dev/null
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
binutils-aarch64-linux-gnu \
ccache \
click \
cmake \
curl \
gcc-aarch64-linux-gnu \
jq \
make \
patchelf \
pkg-config \
tcl \
zlib1g-dev \
libcurl4-openssl-dev:arm64 \
libdrm-dev:arm64 \
libegl-dev:arm64 \
libgbm-dev:arm64 \
libgles-dev:arm64 \
libsdl2-dev:arm64 \
libssl-dev:arm64 \
zlib1g-dev:arm64
- name: Build Click package
run: |
set -euo pipefail
@@ -89,19 +223,42 @@ jobs:
export AARCH64_CC="$(command -v aarch64-linux-gnu-gcc)"
export AARCH64_AR="$(command -v aarch64-linux-gnu-ar)"
export AARCH64_RANLIB="$(command -v aarch64-linux-gnu-ranlib)"
export AARCH64_PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
export OPENSSL_ROOT_DIR=/opt/inbe-openssl
# Cross builds cannot autodetect the device's CA store.
export CMAKE_TOOLCHAIN_FILE="$RUNNER_TEMP/inbe-focal-arm64.cmake"
cat > "$CMAKE_TOOLCHAIN_FILE" <<'CMAKE'
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(OPENSSL_ROOT_DIR /opt/inbe-openssl CACHE PATH "Focal-built TLS")
set(CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt CACHE FILEPATH "Device CA bundle")
set(CURL_CA_PATH /etc/ssl/certs CACHE PATH "Device CA directory")
CMAKE
unset PKG_CONFIG_PATH
export AARCH64_PKG_CONFIG_PATH=/opt/inbe-openssl/lib/pkgconfig:/opt/inbe-sdl2/lib/pkgconfig:/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
export PKG_CONFIG_LIBDIR="$AARCH64_PKG_CONFIG_PATH"
export AARCH64_RAY_SDL_CFLAGS="$(pkg-config --cflags sdl2)"
export AARCH64_RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
export AARCH64_RAY_GL_CFLAGS="$(pkg-config --cflags libdrm gbm egl glesv2)"
export AARCH64_RAY_GL_LDLIBS="$(pkg-config --libs libdrm gbm egl glesv2)"
export AARCH64_RAY_CFLAGS="$AARCH64_RAY_SDL_CFLAGS $AARCH64_RAY_GL_CFLAGS"
export AARCH64_RAY_LDLIBS="$AARCH64_RAY_SDL_LDLIBS $AARCH64_RAY_GL_LDLIBS"
export AARCH64_RAY_SDL_INCLUDE_DIR=/usr/include/SDL2
export AARCH64_KRYON_CURL_CFLAGS="$(pkg-config --cflags libcurl)"
export AARCH64_KRYON_CURL_LDLIBS="$(pkg-config --libs libcurl)"
export AARCH64_CLICK_RUNTIME_LIBS="/usr/lib/aarch64-linux-gnu/libSDL2-2.0.so.0 /usr/lib/aarch64-linux-gnu/libcurl.so.4 /usr/lib/aarch64-linux-gnu/libssl.so.3 /usr/lib/aarch64-linux-gnu/libcrypto.so.3 /usr/lib/aarch64-linux-gnu/libdrm.so.2 /usr/lib/aarch64-linux-gnu/libgbm.so.1 /usr/lib/aarch64-linux-gnu/libEGL.so.1 /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 /usr/lib/aarch64-linux-gnu/libz.so.1"
make CLICK_ARCH=arm64 click
# Search bundled TLS and SDL before the SDK's older system copies.
export AARCH64_RAY_LDLIBS="-L/opt/inbe-openssl/lib $AARCH64_RAY_SDL_LDLIBS $AARCH64_RAY_GL_LDLIBS"
export AARCH64_RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2)/SDL2"
click_curl_dir="$PWD/vendor-builds/click/arm64/curl"
export AARCH64_KRYON_CURL_CFLAGS="-DCURL_STATICLIB -I$click_curl_dir/include"
export AARCH64_KRYON_CURL_LDLIBS="$click_curl_dir/lib/libcurl.a -L/opt/inbe-openssl/lib -lssl -lcrypto -lz -lpthread"
# The framework supplies graphics libraries for the device's GPU.
atomic_runtime="$("$AARCH64_CC" -print-file-name=libatomic.so.1)"
export AARCH64_CLICK_RUNTIME_LIBS="$(pkg-config --variable=libdir sdl2)/libSDL2-2.0.so.0 /opt/inbe-sdl2/lib/SDL2-LICENSE.txt /opt/inbe-openssl/lib/libssl.so.3 /opt/inbe-openssl/lib/libcrypto.so.3 /opt/inbe-openssl/lib/OpenSSL-LICENSE.txt $atomic_runtime /usr/lib/aarch64-linux-gnu/libz.so.1"
for runtime_file in $AARCH64_CLICK_RUNTIME_LIBS; do
test -f "$runtime_file"
done
# Make otherwise prefers the SDK's older /usr/bin/cmake.
export CMAKE="$(python3 -c 'import cmake; print(cmake.CMAKE_BIN_DIR + "/cmake")')"
"$CMAKE" --version
make CMAKE="$CMAKE" LDFLAGS="-Wl,--gc-sections -s -L/opt/inbe-openssl/lib" CLICK_ARCH=arm64 click
python3 scripts/check-click-abi.py build/dist/click/*.click
- name: Show package contents
run: |
@@ -110,8 +267,28 @@ jobs:
echo "Built $click_file"
dpkg-deb --contents "$click_file" | grep -E 'manifest.json|inbe.png|metainfo|inbe.desktop'
- name: Archive the verified package source and digest
run: |
mkdir -p build/release/openstore
cp build/dist/click/*.click build/release/openstore/
git rev-parse HEAD > build/release/openstore/source-commit.txt
cd build/release/openstore
sha256sum *.click > SHA256SUMS
- name: Preserve Click artifact
uses: actions/upload-artifact@v4
with:
name: openstore-click
path: build/release/openstore/*
if-no-files-found: error
- name: Publish to OpenStore
if: ${{ !inputs.build_only }}
env:
OPENSTORE_API_KEY: ${{ secrets.OPENSTORE_API_KEY }}
run: |
set -euo pipefail
version="$(python3 scripts/check-version.py --print-version)"
python3 scripts/check-phone-check.py "$version" --revision "$(git rev-parse HEAD)"
click_file="$(ls -t build/dist/click/*.click | head -1)"
scripts/publish-openstore.sh "$click_file"
+36 -18
View File
@@ -6,7 +6,7 @@ on:
- master
paths:
- 'src/**'
- '!src/cells/versions.zi'
- '!src/apps/versions.zi'
- 'droid/**'
- 'apps/publishers.json'
- 'CHANGELOG.md'
@@ -17,6 +17,7 @@ on:
- 'scripts/**'
- '!scripts/package-release.py'
- '!scripts/practice_content.py'
- '!scripts/practice_media.py'
- '!scripts/update-package-version.py'
- '!scripts/generate-package-versions.py'
- '!scripts/prepare-package-assets.py'
@@ -52,6 +53,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
reuse_artifacts: ${{ steps.reuse.outputs.reuse_artifacts }}
release_due: ${{ steps.due.outputs.release_due }}
steps:
- name: Require an immutable candidate
env:
@@ -68,6 +70,22 @@ jobs:
ref: ${{ inputs.revision || github.sha }}
fetch-depth: 0
# A push of a version that is already released has nothing to release:
# CI tests it, and the platform builds wait for the next version.
- name: Release only a new version or a requested run
id: due
env:
EVENT: ${{ github.event_name }}
run: |
set -euo pipefail
version=$(python3 scripts/check-version.py --print-version)
if [ "$EVENT" = "workflow_dispatch" ] || ! git rev-parse -q --verify "refs/tags/v$version" >/dev/null; then
echo "release_due=true" >> "$GITHUB_OUTPUT"
else
echo "release_due=false" >> "$GITHUB_OUTPUT"
echo "::notice title=Release::v$version is already released; CI tests this push and no release builds run"
fi
- name: Verify identical source and every gate before reusing artifacts
id: reuse
env:
@@ -168,7 +186,7 @@ jobs:
python3 scripts/check-secrets.py --history
test:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Test (${{ matrix.shard }}/3)
runs-on: ubuntu-latest
needs: secret-scan
@@ -227,7 +245,7 @@ jobs:
fdroid:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: F-Droid
needs: secret-scan
uses: ./.github/workflows/fdroid.yml
@@ -238,7 +256,7 @@ jobs:
name: Verify F-Droid reproducibility
runs-on: ubuntu-latest
needs: [secret-scan, fdroid, build-android]
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
timeout-minutes: 15
steps:
- name: Download independent F-Droid build
@@ -271,7 +289,7 @@ jobs:
apksigcopier compare --unsigned "${signed[0]}" "${rebuilt[0]}"
build-web:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Web
runs-on: ubuntu-latest
timeout-minutes: 60
@@ -328,7 +346,7 @@ jobs:
if-no-files-found: error
build-chrome-extension:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Chrome Extension
runs-on: ubuntu-latest
timeout-minutes: 60
@@ -385,7 +403,7 @@ jobs:
if-no-files-found: error
build-firefox-addons:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Firefox Add-on
runs-on: ubuntu-latest
timeout-minutes: 60
@@ -443,7 +461,7 @@ jobs:
if-no-files-found: error
build-linux-appimage:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Linux AppImage
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
@@ -562,7 +580,7 @@ jobs:
if-no-files-found: error
build-linux-deb:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Linux Deb
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
@@ -624,7 +642,7 @@ jobs:
if-no-files-found: error
build-linux-rpm:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Linux RPM
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
@@ -686,7 +704,7 @@ jobs:
if-no-files-found: error
build-linux-snap:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Linux Snap
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
@@ -745,7 +763,7 @@ jobs:
if-no-files-found: error
build-linux-flatpak:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Linux Flatpak
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
@@ -804,7 +822,7 @@ jobs:
if-no-files-found: error
build-windows:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Windows
runs-on: ubuntu-latest
timeout-minutes: 60
@@ -870,7 +888,7 @@ jobs:
if-no-files-found: error
build-android:
if: needs.secret-scan.outputs.reuse_artifacts != 'true'
if: needs.secret-scan.outputs.reuse_artifacts != 'true' && needs.secret-scan.outputs.release_due == 'true'
name: Build Android
runs-on: ubuntu-latest
timeout-minutes: 60
@@ -1144,7 +1162,7 @@ jobs:
set -euo pipefail
VERSION='${{ steps.tag_version.outputs.version }}'
TAG="v$VERSION"
BASE="https://github.com/waozixyz/inbe/releases/download/$TAG"
BASE="https://github.com/waozixyz/breeze/releases/download/$TAG"
WINZIP="$(find build/release -maxdepth 2 -name '*-windows.zip' -print -quit || true)"
channels=()
for appimage in build/release/inbe-linux-*.AppImage; do
@@ -1187,7 +1205,7 @@ jobs:
python3 scripts/make_appcast.py \
--version "$VERSION" \
--base-url "$BASE" \
--notes-url "https://github.com/waozixyz/inbe/releases/tag/$TAG" \
--notes-url "https://github.com/waozixyz/breeze/releases/tag/$TAG" \
--changelog CHANGELOG.md \
--out build/release/appcast.json \
"${channels[@]}"
@@ -1306,7 +1324,7 @@ jobs:
log_file="$(mktemp)"
for attempt in 1 2 3 4 5 6; do
if butler push "$target" "waozi/inbe:$channel" --userversion "$VERSION" 2>&1 | tee "$log_file"; then
if butler push "$target" "waozi/breeze:$channel" --userversion "$VERSION" 2>&1 | tee "$log_file"; then
rm -f "$log_file"
return 0
fi
@@ -1650,7 +1668,7 @@ jobs:
run: |
set -euo pipefail
VERSION='${{ needs.release.outputs.version }}'
SETUP_URL="https://github.com/waozixyz/inbe/releases/download/v$VERSION/inbe-windows-setup-$VERSION.exe"
SETUP_URL="https://github.com/waozixyz/breeze/releases/download/v$VERSION/inbe-windows-setup-$VERSION.exe"
if ! curl -fsSL -o /dev/null "$SETUP_URL"; then
echo "::warning::setup exe not published yet; skipping winget update"
exit 0
+3
View File
@@ -86,3 +86,6 @@ design/sun-salutation/girl-parts/head-layers-check.png
/design/promo-film/
/design/videos/
/design/lumi-promo/
# Sun Salutation motion exported for the three.js lab (render-sun-salutation-live.py --motion).
/design/tai-chi/lab/
+9 -5
View File
@@ -9,6 +9,9 @@
`ziran.lock`. Run `make package-check` after dependency changes. For local
debugging, map a package to a working repository in the ignored
`ziran.local.toml`; release builds use `PACKAGE_FLAGS=--locked`.
- Practice media (pictures, course data, recordings) lives in the
`practices` package (waozixyz/practices), not under
`assets/`. Commit media there, then update the lock here.
- Add the numeric release to `CHANGELOG.md`, then run `./update_version.sh`.
The canonical macros are `APP_VERSION_STRING`, `APP_VERSION_MAJOR`,
`APP_VERSION_MINOR`, and `APP_VERSION_PATCH`; do not create aliases.
@@ -22,7 +25,7 @@
commit retains the tested source; if master advanced, a merge preserves
all newer source and history. The workflow can release that exact commit
through its `revision` input. Never freeze the checkout for testing.
See [docs/cells.md](docs/cells.md#verification).
See [docs/apps.md](docs/apps.md#verification).
- Packages declare the oldest host interface they run on (`host_api` per app
in `apps/versions.json`); the host runs `oldest_host_api` to `host_api`.
Raise `host_api` when the host interface changes and `oldest_host_api` only
@@ -31,10 +34,11 @@
- Goal (owner, 2026-10-11): every app updates through its own package
without a new APK. Work toward it in small steps alongside requested work;
discuss larger moves with the owner first. Put app screens, rules and text
in `apps/<app>/`, not in the host under `src/`. Habits and Practices still
draw compiled host screens (see [docs/cells.md](docs/cells.md)); when work
touches one, prefer moving it into its package. Keep the host interface
small and generic (storage, network, locale, platform effects), because
in `apps/<app>/`, not in the host under `src/`. Practices draws its
screen layouts in `apps/practice/`; its native figure painters and
platform effects remain host capabilities (see [docs/apps.md](docs/apps.md)).
Keep the host interface small and generic (storage, network, locale,
platform effects), because
each new host call needs an APK before a package can use it. Apps share
data only through the host interface, never another app's internals.
- Translate changed strings in every affected locale; no English placeholders.
+93 -15
View File
@@ -1,5 +1,83 @@
# Changelog
## [2.1.55] - 2026-10-27
- Retry Google Play prices when the store cannot load Dew packs.
- Open apps with a calmer, themed loading screen and their own icon.
- Learn Apps in one short guide, with current app options.
## [2.1.54] - 2026-10-27
- Buy Dew through Google Play in the Google Play version.
## [2.1.53] - 2026-10-27
- Top up Dew with Bitcoin, USDT and other coins through dew.waozi.xyz.
- The Google Play version uses current Android components.
## [2.1.52] - 2026-10-27
- Set an account alias with capitals, an @ or spaces; a taken alias now says so.
- Restore audio playback and account sync on Ubuntu Touch.
## [2.1.51] - 2026-10-27
- Open Link to reliably while choosing a new habit's icon.
- Choose diary, notebook, pen, pencil, writing, notes, keyboard and idea icons for habits and rewards.
- Link habits to Diary entries and add a linked habit after a practice's first session.
- Get a short count-in before each workout exercise.
## [2.1.50] - 2026-10-26
- Habits award coins when you record a recent day before you created the habit.
## [2.1.49] - 2026-10-25
- Download Arcade in under one megabyte; its games and their covers arrive separately.
- Arcade’s covers show only the game art; the download dialog shows the size.
- Install game editors with their required games and review the complete download size.
- Reuse Shovey’s downloaded artwork and sounds in its editor.
## [2.1.48] - 2026-10-25
- Arcade uses large rounded game covers in the same dark library on every device.
- Download Apfelwurm and other Arcade games individually while keeping installed games and saves.
## [2.1.47] - 2026-10-25
- App downloads show their progress and open the app when ready.
- Installed apps no longer show download sizes.
- Arcade can download each game separately from its smaller catalog.
## [2.1.46] - 2026-10-24
- Practices can update its session controls, guides and settings without reinstalling Breeze.
- Wim Hof reminders now count from the start of each breath hold, with clear Off, every 30 seconds and every minute choices.
- Dew works in every version of the app; the Play version doesn't offer top-ups yet.
- Prices show in Dew; the dollar value appears only when you top up.
- Games can reward you with Dew, such as Shovey's secret chest.
- 1 XMR now buys 10,000 Dew: your balance and every price are ten times larger and worth the same.
- Sending Dew to friends is paused for now.
## [2.1.45] - 2026-10-24
- Smoother on phones: apps run as native code, and Shovey runs over twice as fast.
- Apps ask before downloading and show one loading animation.
- Games repeat held keys and keep the screen on.
- Finishing an Arcade level no longer turns the screen black.
- New installs follow your device's language and start with Diary, Lists and Leaderboard.
- Diary and Photos keep each photo once, privately, for all your apps.
- Profiles show your @name or a short ID.
- Linux tray: Show or Hide comes first.
## [2.1.44] - 2026-10-23
- Lists: lists are chips that wrap onto more rows; pull the items down to show finished ones.
- Lists: the gear on a list opens its settings: name, who has access and their roles, invitations, and Delete.
- Your profile picture is shared with friends, and shared lists show everyone's pictures.
- Sun Salutation moves smoothly, like Tai Chi and the workout.
- On Linux the program is now called breeze.
## [2.1.43] - 2026-10-23
- Lists: tap an item to finish it, swipe right to edit it and swipe left to delete it.
@@ -395,58 +473,58 @@
## [2.1.7] - 2026-10-06
### Changed
- Manage Lumi and all other cells in one compact list with icons, drag handles and add/remove controls.
- Include Lists and Diary with the app so every cell can be added to the sidebar offline.
- Manage Lumi and all other apps in one compact list with icons, drag handles and add/remove controls.
- Include Lists and Diary with the app so every app can be added to the sidebar offline.
## [2.1.6] - 2026-10-06
### Changed
- Manage installed and available cells together in Settings, with drag reordering, trash controls and quick reinstallation from saved packages.
- Manage installed and available apps together in Settings, with drag reordering, trash controls and quick reinstallation from saved packages.
- Keep Lumi included as the app companion while allowing her sidebar shortcut to be hidden, with an outlined firefly icon matching the other navigation icons.
- Let Lumi change themes and appearance directly through chat and app tools.
### Fixed
- Keep sidebars steady while dragging the scale slider and apply the new scale on release.
- Keep Settings available in the final sidebar position.
- Honor every checked startup cell, including Diary, and report Diary correctly when opened in Harmony.
- Honor every checked startup app, including Diary, and report Diary correctly when opened in Harmony.
- Exit promptly when Quit is pressed in the close dialog.
## [2.1.5] - 2026-10-06
### Changed
- Chat with Lumi in a simpler conversation view, with her avatar beside replies and a standard cell icon.
- Chat with Lumi in a simpler conversation view, with her avatar beside replies and a standard app icon.
- Let Lumi complete today’s habits and start practices immediately, including WHM.
- Show Lumi commands only for installed and enabled cells.
- Show Lumi commands only for installed and enabled apps.
- Ask which habit to complete, choose it by name, and use compact autocomplete chips with case-insensitive matching and command spelling correction.
## [2.1.4] - 2026-10-06
### Added
- Meet Lumi, Inner Breeze's firefly companion, as the first recommended cell and home screen.
- Meet Lumi, Inner Breeze's firefly companion, as the first recommended app and home screen.
- Chat privately with Lumi, complete commands and todo names as you type, and add, complete or reopen todos locally.
### Fixed
- Restore missing characters in translations and mixed-language labels, including the Android language picker.
## [2.1.3] - 2026-10-06
### Fixed
- Restore translated text after the cell packages load, and refresh translations when packages change.
- Restore translated text after the app packages load, and refresh translations when packages change.
## [2.1.2] - 2026-10-06
### Changed
- Call the independently installed features Cells, with a translated cell picker and separate versions in About.
- Call the independently installed features Apps, with a translated app picker and separate versions in About.
## [2.1.1] - 2026-10-06
### Added
- Attach, browse and remove Diary photos while preserving imported originals.
- Load graphics, translations, fonts and styles from cell packages so these resources can update without replacing the APK.
- Update the cell picker, Diary and Lists screens through their cell packages.
- Load graphics, translations, fonts and styles from app packages so these resources can update without replacing the APK.
- Update the app picker, Diary and Lists screens through their app packages.
### Fixed
- Keep browser account signing and update checks working with the current web runtime.
- Keep importing saved account data working in the browser.
## [2.1.0] - 2026-10-06
### Added
- Choose recommended Habits and Practices or download optional Lists and Diary from the cell picker.
- Receive verified cell updates independently, with a switch to disable automatic updates and a manual update check.
- Choose recommended Habits and Practices or download optional Lists and Diary from the app picker.
- Receive verified app updates independently, with a switch to disable automatic updates and a manual update check.
- Sync selected apps with your account, including removals, while keeping saved data on each device.
- Write private daily entries in Diary and browse them by calendar, preserving the existing Harmony entry format.
- View the main application version and each cell version in About.
- View the main application version and each app version in About.
## [2.0.12] - 2026-10-06
### Fixed
@@ -801,7 +879,7 @@
## [1.9.0] - 2026-08-15
### Added
- Break reminders, Workrave-style: micro, rest and daily break timers with statistics and a desktop timer HUD that lives as a real OS window next to the app (desktop only, off by default, with its own settings tab).
- A dedicated Notifications settings tab. Push delivery uses UnifiedPush (no Google services): "Set up push" opens an in-cell picker that lists installed distributor apps with their name and icon and registers with the one you pick; the status line reports the real registration state.
- A dedicated Notifications settings tab. Push delivery uses UnifiedPush (no Google services): "Set up push" opens an in-app picker that lists installed distributor apps with their name and icon and registers with the one you pick; the status line reports the real registration state.
- Reminders are an editable list: add as many as you want, each with a practice dropdown (Wim Hof, Meditation, Sun Salutation), a [-] time [+] stepper, an on/off toggle and delete. Ships with one enabled Wim-Hof 08:00 reminder.
- A notification when new friend requests arrive over social sync (toggleable, on by default).
- Screenshot scenes for the first-run guide and the notifications settings, for regression coverage.
+4 -4
View File
@@ -1,17 +1,17 @@
# Contributing to Inner Breeze
Report a bug through Lumi's feedback card in the app or
[GitHub Issues](https://github.com/waozixyz/inbe/issues). Include the app version,
[GitHub Issues](https://github.com/waozixyz/breeze/issues). Include the app version,
platform, steps to reproduce, what you expected, and what happened. Keep account
keys, private conversations and personal practice data out of public reports.
For a security issue, use [Security](SECURITY.md).
## Development
Build with `make native cells`. Dependencies and the Ziran toolchain are pinned
Build with `make native apps`. Dependencies and the Ziran toolchain are pinned
in `ziran.lock`; see [build guide](docs/building.md) for other platforms. Read
[AGENTS.md](AGENTS.md) for repository conventions and
[app packages](docs/cells.md) for module ownership.
[app packages](docs/apps.md) for module ownership.
Keep a change focused. Put app UI in its owning package, reusable Kryon changes
in Kryon, and compiler changes in Ziran. Preserve existing data and upgrade
@@ -23,7 +23,7 @@ private-display UI tests. `make test` and `make visual-test` are the CI gates.
Android adapter tests need Java 21 and Android SDK platform 36; set
`ANDROID_SDK_ROOT` to your SDK directory.
Visual tests create disposable profiles and private displays; they must never
use your desktop or personal profile. See [verification](docs/cells.md#verification)
use your desktop or personal profile. See [verification](docs/apps.md#verification)
for the additional exact-source phone and release checks.
In a pull request, explain the user-visible change and list the checks you ran,
+29 -22
View File
@@ -1,6 +1,8 @@
.DEFAULT_GOAL := all
APP_NAME := inbe
# The program people run; package, store and data names keep APP_NAME.
APP_EXECUTABLE := breeze
APP_TITLE := Inner Breeze
# `make install` installs the production desktop app for this user.
PREFIX ?= $(HOME)/.local
@@ -363,10 +365,13 @@ SYSTEM_THEME_CFLAGS :=
SYSTEM_THEME_LDLIBS :=
LOCALE_FILES := $(wildcard locales/*.txt)
IMAGE_FILES := assets/app/icon.png assets/easteregg/art.png assets/easteregg/waozi.png assets/practices/whm/1.png assets/practices/whm/2.png assets/practices/meditation/1.png assets/pet/egg1.png $(wildcard assets/practices/*/banner*.png) $(wildcard assets/practices/sunsalutation/characters/*/*.png) $(wildcard assets/practices/taichi/*.png assets/practices/taichi/*/*.png) assets/practices/taichi/course.tch
# The practice media is the practices package, packaged under
# assets/practices/ (scripts/practice_media.py).
PRACTICE_MEDIA := build/packages/practices
IMAGE_FILES := assets/app/icon.png assets/easteregg/art.png assets/easteregg/waozi.png $(PRACTICE_MEDIA)/whm/1.png $(PRACTICE_MEDIA)/whm/2.png $(PRACTICE_MEDIA)/meditation/1.png assets/pet/egg1.png $(wildcard $(PRACTICE_MEDIA)/*/banner*.png) $(wildcard $(PRACTICE_MEDIA)/sunsalutation/characters/*/*.png) $(wildcard $(PRACTICE_MEDIA)/taichi/*.png $(PRACTICE_MEDIA)/taichi/*/*.png) $(PRACTICE_MEDIA)/taichi/course.tch
SOUND_FILES := $(wildcard assets/sounds/*.ogg)
FONT_SUBSET_DIR := assets/fonts/subset
FONT_SUBSET_CORPUS := locales assets/fonts/input_common.txt assets/fonts/ui_symbols.txt assets/practices/astral_projection/text assets/practices/workout/text
FONT_SUBSET_CORPUS := locales assets/fonts/input_common.txt assets/fonts/ui_symbols.txt $(PRACTICE_MEDIA)/astral_projection/text $(PRACTICE_MEDIA)/workout/text
FONT_FILES := \
$(FONT_SUBSET_DIR)/NotoSans-App-Regular.ttf \
$(FONT_SUBSET_DIR)/NotoSansSC-App-Regular.otf \
@@ -381,23 +386,25 @@ IMAGE_FILES += assets/app/icon-sky-cradle.png assets/app/icon-ink-and-air.png
IMAGE_FILES += $(wildcard assets/social/*.png)
IMAGE_FILES += $(wildcard assets/profile-pictures/*.png)
IMAGE_FILES += $(KRYON_DIR)/icons/ui.png $(KRYON_DIR)/icons/pfp.png
CELL_BUNDLES := $(addprefix $(BUILD_DIR)/cells/,lists.zib habits.zib practices.zib diary.zib lumi.zib leaderboard.zib)
INBE_BUNDLE := $(BUILD_DIR)/inbe.zib
INBE_FULL_BUNDLE := $(BUILD_DIR)/inbe-full.zib
CELL_SOURCES := $(shell find apps src/cells -name '*.zi' | LC_ALL=C sort) src/core/types.zi src/core/breath_timing.zi $(wildcard src/practices/patterns/*rules.zi) src/practices/patterns/patterns_clock.zi src/practices/patterns/patterns_types.zi src/practices/sun_salutation/sun_salutation_rules.zi src/practices/meditation/meditation_timing.zi
CELL_RESOURCES := $(shell rg --files assets/habits assets/lists assets/diary assets/lumi assets/mcp 2>/dev/null)
CELL_RESOURCES += $(shell rg --files assets/practices design/tai-chi/text 2>/dev/null) apps/practice/content.json design/tai-chi/narration.json design/tai-chi/narration-lines.json $(wildcard design/tai-chi/narration-receipt.json) $(wildcard design/sun-salutation/narration/*.json) $(wildcard design/sun-salutation/narration/text/*.txt) $(wildcard design/lumi-guide/*.json) scripts/practice_content.py scripts/generate-lumi-guide-narration.py
CELL_RESOURCES += $(wildcard apps/*/achievements.json) $(wildcard apps/*/achievement-locales/*.json)
CELL_RESOURCES += $(wildcard assets/*/sidebar.shape)
APP_BUNDLES := $(addprefix $(BUILD_DIR)/apps/,lists.zx habits.zx practices.zx diary.zx lumi.zx leaderboard.zx)
INBE_BUNDLE := $(BUILD_DIR)/inbe.zx
INBE_FULL_BUNDLE := $(BUILD_DIR)/inbe-full.zx
APP_SOURCES := $(shell find apps src/apps -name '*.zi' | LC_ALL=C sort) src/core/types.zi src/core/breath_timing.zi $(wildcard src/practices/patterns/*rules.zi) src/practices/patterns/patterns_clock.zi src/practices/patterns/patterns_types.zi src/practices/sun_salutation/sun_salutation_rules.zi src/practices/meditation/meditation_timing.zi
APP_RESOURCES := $(shell rg --files assets/habits assets/lists assets/diary assets/lumi assets/mcp 2>/dev/null)
APP_RESOURCES += $(shell find -L $(PRACTICE_MEDIA) -type f -not -path '*/.git/*' 2>/dev/null) $(shell rg --files design/tai-chi/text 2>/dev/null) apps/practice/content.json design/tai-chi/narration.json design/tai-chi/narration-lines.json $(wildcard design/tai-chi/narration-receipt.json) $(wildcard design/sun-salutation/narration/*.json) $(wildcard design/sun-salutation/narration/text/*.txt) $(wildcard design/lumi-guide/*.json) scripts/practice_content.py scripts/generate-lumi-guide-narration.py
APP_RESOURCES += $(wildcard apps/*/achievements.json) $(wildcard apps/*/achievement-locales/*.json)
APP_RESOURCES += $(wildcard assets/*/sidebar.shape)
EMBEDDED_ASSET_FILES := apps/publishers.json $(INBE_BUNDLE) build/apps-ui/apps.zib assets/app/icon.png
APPS_BUNDLE ?= build/apps-ui/apps.zx
EMBEDDED_ASSET_FILES := apps/publishers.json $(INBE_BUNDLE) $(APPS_BUNDLE) assets/app/icon.png
KRY_GEN_DIR := $(BUILD_DIR)/kryon/generated
# Dependencies are imported as PACKAGE/Module through their linked packages.
ZI_PACKAGE_PATHS := $(shell sh scripts/package-paths.sh)
ZI_SRCS := $(shell find src -type f -name '*.zi' 2>/dev/null | LC_ALL=C sort) apps/practice/downloads_view.zi $(wildcard apps/practice/astral_projection*.zi) $(wildcard apps/practice/workout*.zi)
ZI_SRCS := $(shell find src -type f -name '*.zi' 2>/dev/null | LC_ALL=C sort) apps/practice/hold_reminder.zi apps/practice/whm_controls.zi $(wildcard apps/practice/astral_projection*.zi) $(wildcard apps/practice/workout*.zi) $(wildcard apps/practice/sun_salutation*.zi)
GAME2D_DIR := build/packages/game2d
GAME2D_MODULES := $(wildcard $(GAME2D_DIR)/src/*/*.zi)
DAOCHI_CLIENT_MODULES := $(wildcard build/packages/daochi-client/*.zi)
DAOCHI_CLIENT_DIR ?= build/packages/daochi-client
DAOCHI_CLIENT_MODULES := $(wildcard $(DAOCHI_CLIENT_DIR)/*.zi)
ZIRAN_STD_MODULES := $(wildcard $(ZIRAN_DIR)/std/*.zi)
KRYON_ZI_MODULES := $(shell find $(KRYON_DIR)/src -type f -name '*.zi' | LC_ALL=C sort)
KRY_GEN_SRCS := $(patsubst %.zi,$(KRY_GEN_DIR)/%.c,$(ZI_SRCS))
@@ -447,7 +454,7 @@ LAW_MODULES := src/app/sync_retry_laws.zi src/app/practice_lifecycle_laws.zi \
src/app/modal_rules_laws.zi \
src/app/sync_recovery_policy_laws.zi src/storage/habit_merge_laws.zi \
src/storage/sync_restore_laws.zi src/storage/storage_layout_laws.zi \
src/guide_laws.zi
src/guide_laws.zi src/apps/node_app_input_laws.zi
RAY_PKGS ?= sdl2 libdrm gbm egl glesv2
RAY_SDL_CFLAGS ?= $(shell pkg-config --cflags sdl2 2>/dev/null)
RAY_SDL_LDLIBS ?= $(shell pkg-config --libs sdl2 2>/dev/null)
@@ -481,14 +488,14 @@ WEB_CFLAGS := $(filter-out -Os -DNATIVE_WINDOW_HAVE_SDL,$(COMMON_CFLAGS)) -O2 -s
CLICK_CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DUI_EMBEDDED_ONLY=1 -DDISABLE_KRYON_FILE_DIALOG -DHAS_LIBCURL=1 -DKRYON_WITH_SYNC=1 $(AARCH64_KRYON_CURL_CFLAGS)
LDFLAGS := -Wl,--gc-sections -s
WINDOWS_LDFLAGS := -Wl,--gc-sections -static -static-libgcc -mwindows
WINDOWS_LDLIBS := -lgdi32 -lwinmm -lopengl32 -luser32 -lshell32 -lole32 -lcomdlg32 -lcomctl32 -luuid -lwininet -lws2_32 -liphlpapi -lcrypt32 -lsecur32 -lbcrypt -ladvapi32 -lz -lm -latomic
WINDOWS_LDLIBS := -lgdi32 -lwinmm -lopengl32 -luser32 -lshell32 -lole32 -lcomdlg32 -lcomctl32 -luuid -lwininet -lws2_32 -liphlpapi -lcrypt32 -lsecur32 -lbcrypt -ladvapi32 -lz -lm -latomic -lpthread
ifneq ($(strip $(MCFGTHREADS)),)
WIN64_THREAD_LDFLAGS := -L$(MCFGTHREADS)/lib
else
WIN64_THREAD_LDFLAGS :=
endif
BINARY_NAME := $(APP_NAME)-$(NATIVE_PLATFORM)-$(ARCH)
BINARY_NAME := $(APP_EXECUTABLE)-$(NATIVE_PLATFORM)-$(ARCH)
TARGET := $(NATIVE_BIN_DIR)/$(BINARY_NAME)
# Native sources compile to per-file objects through mk/native-objects.mk.
NATIVE_OBJ_DIR := $(abspath $(BUILD_OBJ_DIR)/native)
@@ -498,7 +505,7 @@ NATIVE_COMPILE_FLAGS = $(KRYON_NATIVE_CFLAGS) $(APP_INCLUDE) $(KRYON_INCLUDE) \
$(KRYON_NATIVE_BACKEND_CFLAGS) -DHAS_LIBOQS=1 -DSUPPORT_MODULE_RAUDIO=1 \
-DSUPPORT_FILEFORMAT_OGG=1 -DSUPPORT_FILEFORMAT_MP3=1
KRYON_HOST_TARGET := $(BUILD_DIR)/kryon/app_host.so
WIN64_BINARY_NAME := $(APP_NAME)-windows-$(WIN64_ARCH).exe
WIN64_BINARY_NAME := $(APP_EXECUTABLE)-windows-$(WIN64_ARCH).exe
WIN64_TARGET := $(WINDOWS_BIN_DIR)/$(WIN64_ARCH)/$(WIN64_BINARY_NAME)
WINDOWS_DIST := $(WINDOWS_DIST_DIR)/$(APP_NAME)-windows.zip
APPIMAGE_NAME := $(APP_NAME)-linux-$(ARCH).AppImage
@@ -605,7 +612,7 @@ all: native
# Tests take the whole toolchain directory, so every tool rebuilds together;
# mixing a new zi2zir with an old ziran fails on the ZIR version.
ZIRAN_TOOLS := $(addprefix $(ZIRAN_BUILD_DIR)/bin/,zi2c zi2zir zi2zib zi2cpp zi2go ziran)
ZIRAN_TOOLS := $(addprefix $(ZIRAN_BUILD_DIR)/bin/,zi2c zi2zir zi2zx zi2go ziran)
$(ZI2C_BIN) $(ZIRAN_BUILD_DIR)/libziran.a &: $(ZIRAN_SOURCES) ziran.lock
$(MAKE) -C $(ZIRAN_DIR) BUILD_DIR=$(ZIRAN_BUILD_DIR) $(ZIRAN_TOOLS) $(ZIRAN_BUILD_DIR)/libziran.a
@@ -664,7 +671,7 @@ $(KRY_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODULES)
--module-path $(KRYON_DIR)/src/backend \
--module-path $(GAME2D_DIR)/src \
--module-path $(ZIRAN_DIR)/std \
--module-path build/packages/daochi-client $(ZI_PACKAGE_PATHS) \
--module-path $(DAOCHI_CLIENT_DIR) $(ZI_PACKAGE_PATHS) \
-o $(KRY_GEN_DIR) $(ZI_SRCS)
touch $@
@@ -796,7 +803,7 @@ endif
endif
include mk/laws.mk
include mk/cells.mk
include mk/apps.mk
include mk/windows.mk
include mk/web.mk
include mk/android.mk
@@ -828,7 +835,7 @@ $(CLICK_BIN): $(CLICK_BUNDLE_RUNTIME)
# Build fragments affect the artifacts even when Makefile itself is unchanged.
BUILD_MAKEFILES := $(filter-out mk/tests-%.mk,$(MAKEFILE_LIST)) mk/native-objects.mk
$(TARGET) $(KRYON_HOST_TARGET) $(KRY_GEN_STAMP) $(WINDOWS_GEN_STAMP) $(WEB_GEN_STAMP) $(WIN64_TARGET) $(WEB_JS_TARGET) $(WEB_TARGET) $(WEB_CANVAS_TARGET) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE) $(CELL_BUNDLES): $(BUILD_MAKEFILES)
$(TARGET) $(KRYON_HOST_TARGET) $(KRY_GEN_STAMP) $(WINDOWS_GEN_STAMP) $(WEB_GEN_STAMP) $(WIN64_TARGET) $(WEB_JS_TARGET) $(WEB_TARGET) $(WEB_CANVAS_TARGET) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE) $(APP_BUNDLES): $(BUILD_MAKEFILES)
# UI prerequisites are expanded only after all artifact paths are defined.
include mk/tests-lumi.mk
@@ -839,6 +846,6 @@ include mk/tests-platform.mk
include mk/tests-app.mk
include mk/tests-android.mk
include mk/tests-web.mk
include mk/tests-cells.mk
include mk/tests-apps.mk
include mk/tests-ui.mk
include mk/tests-suite.mk
+3 -1
View File
@@ -17,7 +17,7 @@ Free, open-source apps for breathing, meditation, habits and everyday life.
Use them offline, keep your data on your device, and optionally connect an
account to sync across devices.
[Download the latest release](https://github.com/waozixyz/inbe/releases/latest)
[Download the latest release](https://github.com/waozixyz/breeze/releases/latest)
· [What's new](CHANGELOG.md)
## Make space for yourself
@@ -34,6 +34,8 @@ account to sync across devices.
changing your app. Offline commands work without an AI connection.
- **Your apps:** arrange Apps as a list or grid, choose colours and icons,
listen to ambient Radio, and explore Arcade games and achievements.
- **Profile:** compare practice and game rankings with friends in Leaderboard.
Only installed apps, ranked practices and installed games appear there.
## A look inside
+1 -1
View File
@@ -5,6 +5,6 @@ Inner Breeze version, platform, reproduction steps and expected impact.
Use a disposable account or sample data when possible. Do not include private
keys, API keys or other people's data.
Use [GitHub Issues](https://github.com/waozixyz/inbe/issues) for ordinary bugs.
Use [GitHub Issues](https://github.com/waozixyz/breeze/issues) for ordinary bugs.
Please keep unpatched security details out of public reports while the issue
is investigated.
-17
View File
@@ -1,17 +0,0 @@
# Inner Breeze TODO
Remaining work checked against the current source on 22 October 2026. Remove
an item when it is implemented and verified. Release status belongs in the
release workflow and changelog.
## App packages
- Move the remaining host-drawn Habits screens into `apps/habits/`, followed
by Practices, so those screens can update without a new APK. The hosted
editor, table, statistics and typed data calls are still needed.
## Media sources
- Practice packs download separately on devices, but their source media is
still tracked here. Moving it out requires an owner-approved home for the
pack sources first.
+49 -1
View File
@@ -1,5 +1,53 @@
# Changelog
## [1.3.19] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.55.
## [1.3.18] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.54.
## [1.3.17] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.53.
## [1.3.16] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.52.
## [1.3.15] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.51.
## [1.3.14] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.3.13] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
## [1.3.12] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.48.
## [1.3.11] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.3.10] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
## [1.3.9] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.45.
## [1.3.8] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.44.
## [1.3.7] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.43.
@@ -99,7 +147,7 @@
## [1.1.1] - 2026-10-06
- Use Cells consistently in the cell and its independently delivered package.
- Use Apps consistently in the app and its independently delivered package.
## [1.1.0] - 2026-10-06
+70 -20
View File
@@ -11,10 +11,10 @@
#import, file "../../src/storage/db.zi";
#import, file "../../src/storage/state.zi";
#import, file "../../src/storage/storage_core.zi";
#import, file "../../src/storage/cell_records.zi";
#import, file "../../src/cells/diary_records.zi";
#import, file "../../src/cells/media_store.zi";
#import, file "../../src/cells/package_files.zi";
#import, file "../../src/storage/bundled_app_records.zi";
#import, file "../../src/apps/diary_records.zi";
#import, file "../../src/apps/media_store.zi";
#import, file "../../src/apps/package_files.zi";
#import, file "../../src/app/text_buffers.zi";
AchievementDiaryPhoto :: (target: string, library: bool) -> bool {
@@ -26,29 +26,35 @@ AchievementDiaryPhoto :: (target: string, library: bool) -> bool {
}
if !DiaryFileNameValid(target) { return false }
key := DiaryRecordKey(target)
record := CellRecordRead(key)
record := BundledAppRecordRead(key)
defer { PackageFree(key); PackageFree(record) }
return DiaryMediaParse(record).valid
}
AchievementDiarySaved :: (name: string, document: string, live: bool = true) {
if name.count != 15 || name[10:] != ".json" { return }
// A saved document's day, whether it shows a photo, and whether it is a
// real entry: authored text or a valid photo. `day` is 0 when the name is
// not a day's document.
DiaryEntry :: struct {
day: s32
photo: bool
qualified: bool
}
DiaryEntryOf :: (name: string, document: string) -> DiaryEntry {
entry: DiaryEntry
if name.count != 15 || name[10:] != ".json" { return entry }
day := AchievementParseDay(name[:10])
if day == 0 || document.count > 16777216 { return }
photo := false
qualified := false
defer {
unused AchievementRecord("diary", name, day, 1, ifx photo then "photo" else "", "", true, live, !qualified)
}
if day == 0 || document.count > 16777216 { return entry }
entry.day = day
end := ValueEnd(document, Space(document, 0), 0)
if end < 0 || Space(document, end) != document.count { return }
if end < 0 || Space(document, end) != document.count { return entry }
version := ReadNumber(document, FieldAt(document, 0, "version"))
date: [11]u8
if !version.valid || version.value != 1 ||
ReadStringText(document, FieldAt(document, 0, "date"), date[:]) != 10 ||
TextUntilNul(date[:]) != name[:10] { return }
TextUntilNul(date[:]) != name[:10] { return entry }
decoded := ReadStringValue(document, FieldAt(document, 0, "text"), 16777216)
if !decoded.valid { return }
if !decoded.valid { return entry }
text := BuilderFinish(decoded.value)
defer { PackageFree(text) }
authored := false
@@ -56,7 +62,7 @@ AchievementDiarySaved :: (name: string, document: string, live: bool = true) {
while offset < text.count {
embed := DiaryEmbedAt(text, offset)
if embed.valid {
if AchievementDiaryPhoto(DiaryEmbedTarget(text, embed), embed.library) { photo = true }
if AchievementDiaryPhoto(DiaryEmbedTarget(text, embed), embed.library) { entry.photo = true }
offset = embed.end
continue
}
@@ -75,9 +81,19 @@ AchievementDiarySaved :: (name: string, document: string, live: bool = true) {
row := ElementAt(document, old_photos, index)
file: [201]u8
if ReadStringText(document, FieldAt(document, row, "file"), file[:]) > 0 &&
AchievementDiaryPhoto(TextUntilNul(file[:]), false) { photo = true }
AchievementDiaryPhoto(TextUntilNul(file[:]), false) { entry.photo = true }
}
qualified = authored || photo
entry.qualified = authored || entry.photo
return entry
}
// Records the day's fact and answers whether the day has a real entry.
AchievementDiarySaved :: (name: string, document: string, live: bool = true) -> bool {
entry := DiaryEntryOf(name, document)
if entry.day == 0 { return false }
unused AchievementRecord("diary", name, entry.day, 1, ifx entry.photo then "photo" else "", "", true, live,
!entry.qualified)
return entry.qualified
}
AchievementDiaryBackfill :: (offset: s32) -> s32 {
@@ -92,9 +108,43 @@ AchievementDiaryBackfill :: (offset: s32) -> s32 {
while SqliteStep(statement) == SQLITE_ROW {
name := AppTextFromCString(SqliteColumnText(statement, 0), 96)
document := DiaryRecordRead(name)
AchievementDiarySaved(name, document, false)
unused AchievementDiarySaved(name, document, false)
PackageFree(document)
rows += 1
}
return rows
}
// Every day of the account with a real entry, oldest first, from the synced
// documents, so a newly linked habit brings its earlier days along. The
// caller frees the list.
DiaryWrittenDays :: () -> Vec(s32) {
days: Vec(s32)
offset: s32 = 0
more := true
while more {
statement: *void
if SqlitePrepareText(storage_db_handle(),
"SELECT substr(key,17) FROM settings WHERE user_id=?1 AND key GLOB 'cell.diary.file.????-??-??.json' ORDER BY key LIMIT 128 OFFSET ?2",
-1, *statement, null) != SQLITE_OK {
break
}
bind_text(statement, 1, AchievementOwner())
SqliteBindInt(statement, 2, offset)
rows: s32 = 0
while SqliteStep(statement) == SQLITE_ROW {
name := AppTextFromCString(SqliteColumnText(statement, 0), 96)
document := DiaryRecordRead(name)
entry := DiaryEntryOf(name, document)
PackageFree(document)
if entry.qualified {
unused VecPush(days, entry.day)
}
rows += 1
}
SqliteFinalize(statement)
more = rows == 128
offset += rows
}
return days
}
-4
View File
@@ -82,10 +82,6 @@ DiaryObservedFrame :: () -> DiaryUiFrame {
return frame
}
DiarySaveDue :: () -> bool {
return frame.now >= frame.save_at
}
// The entry previews its Markdown (diary_markdown.zi): away from the lines
// holding the caret or a selection, markers are hidden, emphasis is bold or
// slanted, headings are larger, links and list and quote marks take their
+56 -1
View File
@@ -1,5 +1,60 @@
# Changelog
## [1.3.10] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.55.
## [1.3.9] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.54.
## [1.3.8] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.53.
## [1.3.7] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.52.
## [1.3.6] - 2026-10-27
- Open Link to reliably with the expanded icon picker.
- Choose eight more diary and writing symbols for habits and rewards.
- Link habits to Diary entries.
- Requires Breeze 2.1.51 or later.
## [1.3.4] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.3.3] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
## [1.3.2] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.48.
## [1.3.1] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.3.0] - 2026-10-24
- The habit list, each habit's week and calendar, its day with its entries, its editor and its statistics now come with Habits, so they can change without an app update.
## [1.2.11] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
## [1.2.10] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.45.
## [1.2.9] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.44.
## [1.2.8] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.43.
@@ -80,7 +135,7 @@
## [1.0.2] - 2026-10-06
- Use Cells consistently in the cell and its independently delivered package.
- Use Apps consistently in the app and its independently delivered package.
## [1.0.1] - 2026-10-06
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+22 -3
View File
@@ -1,11 +1,15 @@
// Habits owns page transitions, linked-day actions, form validation, the
// count dialog and the shop.
#import, file "../../src/cells/habits_types.zi";
// habit list and each habit's page, the count dialog and the shop.
#import, file "../../src/apps/habits_types.zi";
#import, file "habits_view.zi";
#import, file "shop_view.zi";
#import, file "habit_list_view.zi";
#import, file "habit_day_view.zi";
#import, file "habit_edit_view.zi";
#import, file "habit_stats_view.zi";
#import, file "../../src/habits/habit_types.zi";
#import, file "../../src/core/types.zi";
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/module_types.zi";
#import "apps/node_types"
host_api :: #system_library "host_api";
ReadHabitsHost :: () -> HabitsMessage #foreign host_api;
@@ -38,6 +42,21 @@ HabitsApply :: (message: HabitsMessage) -> HabitsMessage {
if message.action == HABITS_SHOP_VIEW || message.action == HABITS_SHOP_BUY_DIALOG {
return HabitsShopView(message)
}
if message.action == HABITS_LIST_VIEW {
return HabitsListView(message)
}
if message.action == HABITS_DAY_VIEW {
return HabitsDayView(message)
}
if message.action == HABITS_ENTRY_VIEW {
return HabitsEntryView(message)
}
if message.action == HABITS_EDIT_VIEW {
return HabitsEditView(message)
}
if message.action == HABITS_STATS_VIEW {
return HabitsStatsView(message)
}
if message.action == HABITS_ROUTE {
message.succeeded = message.screen == ScreenHabits ||
message.screen == ScreenHabitEdit || message.screen == ScreenHabitSessionEdit
+1 -1
View File
@@ -12,7 +12,7 @@
#import, file "../../src/habits/habit_types.zi";
#import, file "../../src/habits/habit_calendar.zi";
#import, file "../../src/habits/habit_schedule.zi";
#import, file "../../src/cells/package_files.zi";
#import, file "../../src/apps/package_files.zi";
AchievementHabitCreatedBackfill :: (offset: s32) -> s32 {
return AchievementSourceRows("habit.created", "SELECT id,0,1,'',id,0,deleted_at!=0 FROM habits WHERE user_id=?1 ORDER BY id LIMIT 128 OFFSET ?2", offset)
+2 -2
View File
@@ -18,8 +18,8 @@
#import "modal_props"
#import "modal_frame_widget"
#import "tree"
#import, file "../../src/cells/habits_ui_types.zi";
#import, file "../../src/cells/habits_types.zi";
#import, file "../../src/apps/habits_ui_types.zi";
#import, file "../../src/apps/habits_types.zi";
#import, file "../../src/app/color.zi";
#import, file "editor_dialogs.zi";
+2 -2
View File
@@ -29,8 +29,8 @@
#import "svg_icon_props"
#import "svg_icon_widget"
#import "tree"
#import, file "../../src/cells/habits_ui_types.zi";
#import, file "../../src/cells/habits_types.zi";
#import, file "../../src/apps/habits_ui_types.zi";
#import, file "../../src/apps/habits_types.zi";
#import, file "../../src/habits/habit_types.zi";
#import, file "../../src/habits/habit_icons.zi";
#import, file "../../src/habits/habit_coins.zi";
File renamed without changes.
+54 -6
View File
@@ -1,5 +1,53 @@
# Changelog
## [2.1.55] - 2026-10-27
- Bring Lumi 1.5.22, Habits 1.3.10, Practices 1.6.4, Lists 1.1.23, Diary 1.3.19 and Leaderboard 1.0.24 for Inner Breeze 2.1.55.
## [2.1.54] - 2026-10-27
- Bring Lumi 1.5.21, Habits 1.3.9, Practices 1.6.3, Lists 1.1.22, Diary 1.3.18 and Leaderboard 1.0.23 for Inner Breeze 2.1.54.
## [2.1.53] - 2026-10-27
- Bring Lumi 1.5.20, Habits 1.3.8, Practices 1.6.2, Lists 1.1.21, Diary 1.3.17 and Leaderboard 1.0.22 for Inner Breeze 2.1.53.
## [2.1.52] - 2026-10-27
- Bring Lumi 1.5.19, Habits 1.3.7, Practices 1.6.1, Lists 1.1.20, Diary 1.3.16 and Leaderboard 1.0.21 for Inner Breeze 2.1.52.
## [2.1.51] - 2026-10-26
- Bring Lumi 1.5.18, Habits 1.3.6, Practices 1.6.0, Lists 1.1.19, Diary 1.3.15 and Leaderboard 1.0.20 for Inner Breeze 2.1.51.
## [2.1.50] - 2026-10-26
- Bring Lumi 1.5.17, Habits 1.3.4, Practices 1.5.4, Lists 1.1.18, Diary 1.3.14 and Leaderboard 1.0.19 for Inner Breeze 2.1.50.
## [2.1.49] - 2026-10-25
- Bring Lumi 1.5.16, Habits 1.3.3, Practices 1.5.3, Lists 1.1.17, Diary 1.3.13 and Leaderboard 1.0.18 for Inner Breeze 2.1.49.
## [2.1.48] - 2026-10-25
- Bring Lumi 1.5.15, Habits 1.3.2, Practices 1.5.2, Lists 1.1.16, Diary 1.3.12 and Leaderboard 1.0.17 for Inner Breeze 2.1.48.
## [2.1.47] - 2026-10-25
- Bring Lumi 1.5.14, Habits 1.3.1, Practices 1.5.1, Lists 1.1.15, Diary 1.3.11 and Leaderboard 1.0.16 for Inner Breeze 2.1.47.
## [2.1.46] - 2026-10-24
- Bring Lumi 1.5.13, Habits 1.2.11, Practices 1.3.11, Lists 1.1.14, Diary 1.3.10 and Leaderboard 1.0.15 for Inner Breeze 2.1.46.
## [2.1.45] - 2026-10-23
- Bring Lumi 1.5.11, Habits 1.2.10, Practices 1.3.10, Lists 1.1.13, Diary 1.3.9 and Leaderboard 1.0.14 for Inner Breeze 2.1.45.
## [2.1.44] - 2026-10-23
- Bring Lumi 1.5.10, Habits 1.2.9, Practices 1.3.9, Lists 1.1.12, Diary 1.3.8 and Leaderboard 1.0.13 for Inner Breeze 2.1.44.
## [2.1.43] - 2026-10-23
- Bring Lumi 1.5.9, Habits 1.2.8, Practices 1.3.8, Lists 1.1.10, Diary 1.3.7 and Leaderboard 1.0.12 for Inner Breeze 2.1.43.
@@ -148,28 +196,28 @@
## [2.1.7] - 2026-10-06
- Show Lumi alongside every other cell in one compact, reorderable list.
- Include all cells for instant sidebar additions without a download.
- Show Lumi alongside every other app in one compact, reorderable list.
- Include all apps for instant sidebar additions without a download.
## [2.1.6] - 2026-10-06
- Show a clearer firefly icon for Lumi and keep the bundled companion available when her shortcut is hidden.
- Keep every selected startup cell in the sidebar and preserve cached packages for quick reinstallation.
- Keep every selected startup app in the sidebar and preserve cached packages for quick reinstallation.
- Provide app tools for changing themes, appearance and settings directly.
## [2.1.5] - 2026-10-06
- Use a standard cell icon for Lumi and include translations for her habit and practice commands.
- Use a standard app icon for Lumi and include translations for her habit and practice commands.
## [2.1.4] - 2026-10-06
- Recommend Lumi first in the cell picker and open her chat as the default home.
- Recommend Lumi first in the app picker and open her chat as the default home.
- Keep the firefly helper available offline alongside Habits and Practices.
- Include every character used by the current translations in the shared fonts.
## [2.1.3] - 2026-10-06
- Use Cells consistently in the cell picker and its independently delivered package.
- Use Apps consistently in the app picker and its independently delivered package.
## [2.1.2] - 2026-10-06
+4 -4
View File
@@ -1,9 +1,9 @@
// The portable root owns app selection and unified navigation policy.
// Its assets contain Lumi, Habits and Practices as recommended cells, and
// Its assets contain Lumi, Habits and Practices as recommended apps, and
// Lists, Diary and Leaderboard as optional ones.
#import, file "../../src/cells/inbe_types.zi";
#import, file "../../src/apps/inbe_types.zi";
#import, file "inbe_view.zi";
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/module_types.zi";
#import "apps/node_types"
#import, file "../../src/core/types.zi";
host_api :: #system_library "host_api";
@@ -84,7 +84,7 @@ InbeApply :: (message: InbeMessage) -> InbeMessage {
message.screen = InbeHome(message.enabled_apps)
} else if message.action == INBE_INITIAL_SCREEN {
if !message.language_selected {
message.screen = ScreenLanguage
message.screen = ScreenAudioSetup
} else if !message.apps_selected {
message.screen = ScreenAppSelection
} else {
+2 -2
View File
@@ -12,8 +12,8 @@
#import "tree"
#import "toggle_props"
#import "toggle_widget"
#import, file "../../src/cells/inbe_types.zi";
#import, file "../../src/cells/inbe_ui_types.zi";
#import, file "../../src/apps/inbe_types.zi";
#import, file "../../src/apps/inbe_ui_types.zi";
using ButtonTone;
using ButtonEmphasis;
host_api :: #system_library "host_api";
+48
View File
@@ -1,5 +1,53 @@
# Changelog
## [1.0.24] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.55.
## [1.0.23] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.54.
## [1.0.22] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.53.
## [1.0.21] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.52.
## [1.0.20] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.51.
## [1.0.19] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.0.18] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
## [1.0.17] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.48.
## [1.0.16] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.0.15] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
## [1.0.14] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.45.
## [1.0.13] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.44.
## [1.0.12] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.43.
+2 -2
View File
@@ -1,7 +1,7 @@
// Leaderboard ranks you with your friends for each practice. The unified
// host fetches friend results, keeps them for offline use and ranks rows.
#import, file "../../src/cells/leaderboard_types.zi";
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/leaderboard_types.zi";
#import, file "../../src/apps/module_types.zi";
#import "apps/node_types"
#import, file "../../src/core/types.zi";
#import, file "leaderboard_view.zi";
+1 -1
View File
@@ -2,7 +2,7 @@
#import "std/text_buffer"
#import "std/vec"
#import, file "../../src/storage/achievements.zi";
#import, file "../../src/cells/package_files.zi";
#import, file "../../src/apps/package_files.zi";
AchievementLeaderboardViewed :: (practice: string) {
day := AchievementToday()
+2 -2
View File
@@ -18,8 +18,8 @@
#import "tree"
#import "dropdown_props"
#import "dropdown_widget"
#import, file "../../src/cells/leaderboard_ui_types.zi";
#import, file "../../src/cells/leaderboard_types.zi";
#import, file "../../src/apps/leaderboard_ui_types.zi";
#import, file "../../src/apps/leaderboard_types.zi";
using ButtonTone;
using ButtonEmphasis;
+10
View File
@@ -1,5 +1,15 @@
# Library
## [1.0.4] - 2026-10-24
- Browse books on wooden shelves, with the title and author on the cover.
- Open a book with a short animation and continue from your saved page.
- Swipe through pages and use the top tools for passage annotations, font, layout, contents and independent light or dark reading.
## [1.0.3] - 2026-10-24
- Download on the current Inner Breeze, which only runs the new app format.
## [1.0.2] - 2026-10-21
- Swipe left or right to turn chapters.
+109 -10
View File
@@ -1,37 +1,136 @@
// The Library's books, each a list of chapters.
// Book content, stable text positions and the account record format.
#import "text_buffer"
#import, file "tao_te_ching.zi";
BOOK_COUNT :: 1
LIBRARY_PAGE_LIMIT :: 4096
LIBRARY_ANNOTATION_LIMIT :: 128
LibraryPage :: struct {
chapter: s32
start: s32
end: s32
}
LibraryAnnotation :: struct {
start: s32
end: s32
highlighted: bool
note: string
}
BookTitle :: (index: s32) -> string {
unused index
return TAO_TE_CHING_TITLE
}
BookCover :: (index: s32) -> string {
unused index
return "assets/library/tao-te-ching.png"
}
BookAuthor :: (index: s32) -> string {
unused index
return TAO_TE_CHING_AUTHOR
return "Lao Tzu"
}
// Where the book's words come from.
BookNote :: (index: s32) -> string {
unused index
return TAO_TE_CHING_NOTE
}
// The record that keeps the chapter a book is open at.
// Keep reading the released chapter record when no text position exists.
BookRecord :: (index: s32) -> string {
unused index
return "tao-te-ching.chapter"
}
BookPositionRecord :: (index: s32) -> string {
unused index
return "tao-te-ching.position"
}
BookAnnotationsRecord :: (index: s32, chapter: s32) -> string {
unused index
value: Vec(u8)
BuilderPrint(*value, "tao-te-ching.annotations.%", chapter)
return BuilderFinish(value)
}
BookChapters :: (index: s32) -> s32 {
unused index
return TAO_TE_CHING_CHAPTERS
}
// Chapter number's words, from 1.
BookChapter :: (index: s32, number: s32) -> string {
unused index
return TaoTeChing(number)
}
BookChapterTitle :: (index: s32, number: s32) -> string {
unused index
return TaoTeChingChapterTitle(number)
}
LibraryChapterLabel :: (number: s32, title: string) -> string {
value: Vec(u8)
BuilderPrint(*value, "%", number)
if title != "" {
BuilderPrint(*value, " · %", title)
}
return BuilderFinish(value)
}
// Decimal fields are bounded and separated by one non-digit byte.
ReadLibraryNumber :: (text: string, at: *s32) -> s32 {
value: s32
digits: s32
while at.* < text.count && text[at.*] >= #char "0" && text[at.*] <= #char "9" {
if digits >= 7 { return -1 }
value = value * 10 + cast(s32)text[at.*] - 48
at.* += 1
digits += 1
}
if digits == 0 { return -1 }
if at.* < text.count { at.* += 1 }
return value
}
LibraryPageFor :: (pages: []LibraryPage, chapter: s32, offset: s32) -> s32 {
found: s32
for index: cast(s32)0..cast(s32)pages.count - 1 {
page := pages[index]
if page.chapter < chapter || (page.chapter == chapter && page.start <= offset) {
found = index
}
}
return found
}
LibraryOverlaps :: (page: LibraryPage, annotation: LibraryAnnotation) -> bool {
return annotation.start < page.end && annotation.end > page.start
}
// Length-prefixed notes preserve newlines and punctuation without an escape
// convention. Each chapter has a single atomic account record.
DecodeLibraryAnnotations :: (text: string, output: []LibraryAnnotation) -> s32 {
at: s32
count: s32
while at < text.count && count < output.count {
start := ReadLibraryNumber(text, *at)
end := ReadLibraryNumber(text, *at)
highlight := ReadLibraryNumber(text, *at)
length := ReadLibraryNumber(text, *at)
if start < 0 || end <= start || highlight < 0 || highlight > 1 ||
length < 0 || length > 2048 || length > text.count - at { return 0 }
output[count] = LibraryAnnotation.{start, end, highlight == 1, text[at:at + length]}
at += length
count += 1
}
if at != text.count { return 0 }
return count
}
EncodeLibraryAnnotations :: (annotations: []LibraryAnnotation) -> string {
value: Vec(u8)
for annotation: annotations {
BuilderPrint(*value, "% % % %\n%", annotation.start, annotation.end,
ifx annotation.highlighted then 1 else 0, annotation.note.count, annotation.note)
}
return BuilderFinish(value)
}
+695 -189
View File
@@ -1,6 +1,4 @@
// Library: books to read slowly, a chapter at a time. Its first book is the
// Tao Te Ching. Books live in this bundle as text; the host only keeps the
// chapter each one is open at.
// Cover shelf and a paginated reader. Only account records leave this app.
#import "session"
#import "geometry"
#import "vec"
@@ -8,6 +6,13 @@
#import "text_props"
#import "text_widget"
#import "text_measure"
#import "text_align"
#import "image_props"
#import "image_widget"
#import "grid"
#import "grid_props"
#import "press_props"
#import "press_widget"
#import "button_props"
#import "button_widget"
#import "control_props"
@@ -17,12 +22,24 @@
#import "pointer_input"
#import "swipe"
#import "swipe_props"
#import "box_props"
#import "input_protocol"
#import "drawing_props"
#import "box_props"
#import "box_widget"
#import, file "../../src/cells/app_presentation.zi";
#import "spinbox_props"
#import "spinbox_widget"
#import "dropdown_props"
#import "dropdown_widget"
#import "toggle_props"
#import "toggle_widget"
#import "text_input_props"
#import "text_area_widget"
#import "widget_palette"
#import "icon"
#import "transition"
#import, file "../../src/apps/app_presentation.zi";
#import "apps/node_types"
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/module_types.zi";
#import, file "../../src/app/text_buffers.zi";
#import, file "books.zi";
@@ -33,28 +50,53 @@ ReadAppUiHost :: () -> AppUiFrame #foreign host_api;
AppLocaleHost :: (key: string) -> string #foreign host_api;
AppRecordHost :: (record: string) -> string #foreign host_api;
SaveAppRecordHost :: (record: string, value: string) -> bool #foreign host_api;
AppKeyHost :: () -> s32 #foreign host_api;
AppFieldInputHost :: () -> TextFieldInput #foreign host_api;
CloseAppHost :: () -> bool #foreign host_api;
SmoothFramesHost :: (frames: s32) -> bool #foreign host_api;
using TextWrap;
using ButtonTone;
using ButtonEmphasis;
LIBRARY_SHELF :: 0
LIBRARY_CONTENTS :: 1
LIBRARY_CHAPTER :: 2
using TextAlign;
frame: AppUiFrame;
view: s32 = LIBRARY_SHELF;
reading: bool;
book: s32;
chapter: s32 = 1;
// The view a chapter was opened from, where Back returns.
came_from: s32 = LIBRARY_SHELF;
loaded_account: string;
loaded: bool;
// Each view keeps its own place.
shelf_scroll: s32;
contents_scroll: s32;
chapter_scroll: s32;
chapter_swipe: SwipeGesture;
pages: [LIBRARY_PAGE_LIMIT]LibraryPage;
page_count: s32;
page_index: s32;
anchor_chapter: s32 = 1;
anchor_offset: s32;
layout_width: s32;
layout_height: s32;
layout_scale: float32;
font_size: s32 = 21;
font_face: s32;
margin: s32 = 24;
line_gap: s32 = 8;
settings_dirty: bool;
position_dirty: bool;
save_failed: bool;
panel_open: bool;
panel_tab: s32;
panel_scroll: s32;
annotation_chapter: s32;
annotations: [LIBRARY_ANNOTATION_LIMIT]LibraryAnnotation;
annotation_count: s32;
annotation_index: s32 = -1;
annotation_dirty: bool;
note: [2049]u8;
note_state: TextAreaResult;
passage_state: TextAreaResult;
reader_swipe: SwipeGesture;
book_dark: bool;
opening_started: float64;
opening: bool;
opening_from: Rectangle;
Scale :: (value: s32) -> s32 {
return cast(s32)(cast(float32)value * frame.scale)
@@ -64,217 +106,681 @@ Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
return Rectangle.{cast(float32)x, cast(float32)y, cast(float32)width, cast(float32)height}
}
// The text of key with number in place of its %s.
Numbered :: (key: string, number: s32, buffer: []u8) -> string {
args: [1]FormatArg
args[0].number = number
unused FormatTemplate(AppLocaleHost(key), args[:], buffer[:])
return TextUntilNul(buffer)
NumberText :: (value: s32) -> string {
text: Vec(u8)
BuilderPrint(*text, "%", value)
return BuilderFinish(text)
}
ReadNumber :: (value: string) -> s32 {
if value.count == 0 || value.count > 4 { return 0 }
answer: s32 = 0
for index: cast(s64)0..value.count - 1 {
if value[index] < cast(u8)48 || value[index] > cast(u8)57 { return 0 }
answer = answer * 10 + cast(s32)value[index] - 48
}
return answer
RecordNumber :: (key: string, fallback: s32, minimum: s32, maximum: s32) -> s32 {
at: s32
value := ReadLibraryNumber(AppRecordHost(key), *at)
return ifx value >= minimum && value <= maximum then value else fallback
}
// The chapter a book is open at, or 0 before its first reading.
SavedChapter :: (index: s32) -> s32 {
saved := ReadNumber(AppRecordHost(BookRecord(index)))
return ifx saved >= 1 && saved <= BookChapters(index) then saved else 0
}
Open :: (index: s32, number: s32) {
if view != LIBRARY_CHAPTER { came_from = view }
book = index
chapter = number
chapter_scroll = 0
view = LIBRARY_CHAPTER
SaveSettings :: () -> bool {
if !settings_dirty { return true }
value: Vec(u8)
BuilderPrint(*value, "%", number)
unused SaveAppRecordHost(BookRecord(index), BuilderFinish(value))
BuilderPrint(*value, "% % % %", font_size, font_face, margin, line_gap)
if !SaveAppRecordHost("reader.settings", BuilderFinish(value)) { return false }
if !SaveAppRecordHost("tao-te-ching.theme", ifx book_dark then "1" else "0") { return false }
settings_dirty = false
return true
}
SavePosition :: () -> bool {
if !position_dirty { return true }
value: Vec(u8)
BuilderPrint(*value, "% %", anchor_chapter, anchor_offset)
if !SaveAppRecordHost(BookPositionRecord(book), BuilderFinish(value)) { return false }
position_dirty = false
return true
}
SaveAnnotations :: () -> bool {
if !annotation_dirty { return true }
if annotation_index >= 0 {
value: Vec(u8)
BuilderPrint(*value, "%", TextUntilNul(note[:]))
annotations[annotation_index].note = BuilderFinish(value)
}
if !SaveAppRecordHost(BookAnnotationsRecord(book, annotation_chapter),
EncodeLibraryAnnotations(annotations[:annotation_count])) { return false }
annotation_dirty = false
return true
}
SaveReader :: () -> bool {
notes_saved := SaveAnnotations()
settings_saved := SaveSettings()
position_saved := SavePosition()
save_failed = !notes_saved || !settings_saved || !position_saved
return !save_failed
}
LoadSettings :: () {
font_size = 21
font_face = 0
margin = 24
line_gap = 8
book_dark = RecordNumber("tao-te-ching.theme", ifx frame.dark then 1 else 0, 0, 1) == 1
text := AppRecordHost("reader.settings")
at: s32
size := ReadLibraryNumber(text, *at)
face := ReadLibraryNumber(text, *at)
inset := ReadLibraryNumber(text, *at)
gap := ReadLibraryNumber(text, *at)
if size >= 14 && size <= 36 { font_size = size }
if face >= 0 && face <= 1 { font_face = face }
if inset >= 12 && inset <= 56 { margin = inset }
if gap >= 2 && gap <= 20 { line_gap = gap }
}
ReadingBounds :: () -> Rectangle {
width := frame.width - Scale(margin * 2)
if width > Scale(680) { width = Scale(680) }
top := frame.top + Scale(16)
height := frame.height - frame.bottom - top - Scale(48)
return Bounds((frame.width - width) / 2, top, width, height)
}
ChapterHeadingProps :: (chapter: s32) -> TextProps {
props := TextProps.{.key = 27501,
.text = LibraryChapterLabel(chapter, BookChapterTitle(book, chapter)),
.bounds = ReadingBounds(), .font = Scale(font_size),
.typeface = ifx font_face == 1 then "assets/library/noto-sans.ttf" else "ui",
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapAuto}
props.bounds.height = cast(float32)TextHeight(frame.session, props)
return props
}
ReadingProps :: (chapter: s32) -> TextProps {
bounds := ReadingBounds()
heading := ChapterHeadingProps(chapter)
inset := heading.bounds.height + cast(float32)Scale(16)
bounds.y += inset
bounds.height -= inset
return TextProps.{.bounds = bounds, .font = Scale(font_size),
.typeface = ifx font_face == 1 then "assets/library/noto-sans.ttf" else "ui",
.line_gap = Scale(line_gap), .wrap = cast(TextWrap)TextWrapAuto}
}
Reflow :: () {
bounds := ReadingBounds()
if page_count > 0 && layout_width == cast(s32)bounds.width &&
layout_height == cast(s32)bounds.height && layout_scale == frame.scale { return }
// During a transient resize (for example a phone keyboard), keep the
// passage rather than saving a fabricated page with no room for a line.
if bounds.width < cast(float32)Scale(60) || bounds.height < cast(float32)Scale(font_size + line_gap) { return }
count: s32
for chapter: cast(s32)1..BookChapters(book) {
props := ReadingProps(chapter)
props.text = BookChapter(book, chapter)
at: s32
while at < props.text.count && count < LIBRARY_PAGE_LIMIT {
part := TextPage(frame.session, props, at)
if part.next <= at { return }
pages[count] = LibraryPage.{chapter, part.start, part.end}
count += 1
at = part.next
}
}
page_count = count
page_index = LibraryPageFor(pages[:page_count], anchor_chapter, anchor_offset)
layout_width = cast(s32)bounds.width
layout_height = cast(s32)bounds.height
layout_scale = frame.scale
}
LoadPageAnnotations :: () {
current := pages[page_index]
if annotation_chapter != current.chapter {
annotation_count = DecodeLibraryAnnotations(AppRecordHost(BookAnnotationsRecord(book, current.chapter)), annotations[:])
annotation_chapter = current.chapter
}
annotation_index = -1
for index: cast(s32)0..annotation_count - 1 {
if annotation_index < 0 && LibraryOverlaps(current, annotations[index]) { annotation_index = index }
}
note[0] = 0
if annotation_index >= 0 { unused AppCopyText(annotations[annotation_index].note, note[:]) }
note_state = TextAreaResult.{}
passage_state = TextAreaResult.{}
if annotation_index >= 0 {
saved := annotations[annotation_index]
// Keep older page-wide notes, without selecting the entire page.
if saved.end - saved.start < current.end - current.start {
passage_state.anchor = ifx saved.start > current.start then saved.start - current.start else 0
passage_state.cursor = ifx saved.end < current.end then saved.end - current.start else current.end - current.start
}
}
}
OpenBook :: (index: s32) {
book = index
text := AppRecordHost(BookPositionRecord(book))
at: s32
anchor_chapter = ReadLibraryNumber(text, *at)
anchor_offset = ReadLibraryNumber(text, *at)
if anchor_chapter < 1 || anchor_chapter > BookChapters(book) {
anchor_chapter = RecordNumber(BookRecord(book), 1, 1, BookChapters(book))
anchor_offset = 0
}
if anchor_offset < 0 || anchor_offset >= BookChapter(book, anchor_chapter).count { anchor_offset = 0 }
page_count = 0
annotation_chapter = 0
panel_open = false
reading = true
opening = true
opening_started = frame.now
unused SmoothFramesHost(24)
reader_swipe = SwipeGesture.{}
Reflow()
if page_count > 0 { LoadPageAnnotations() }
}
TurnPage :: (index: s32) {
if index < 0 || index >= page_count || !SaveReader() { return }
page_index = index
anchor_chapter = pages[index].chapter
anchor_offset = pages[index].start
position_dirty = true
unused SaveReader()
LoadPageAnnotations()
}
LibraryBack :: () -> bool {
if view == LIBRARY_CHAPTER { view = came_from; return true }
if view == LIBRARY_CONTENTS { view = LIBRARY_SHELF; return true }
return false
if !reading { return false }
if !SaveReader() { return true }
if panel_open { panel_open = false }
else { reading = false }
return true
}
// A centred reading column, as wide as reads comfortably.
Column :: () -> Rectangle {
margin := Scale(20)
width := frame.width - margin * 2
if width > Scale(640) { width = Scale(640) }
top := frame.top + Scale(12)
return Bounds((frame.width - width) / 2, top, width, frame.height - frame.bottom - top)
BookJacket :: (index: s32, cover: Rectangle, key: u64) {
Image(frame.session, ImageProps.{.key = key, .asset_path = BookCover(index),
.alt_text = BookTitle(index), .bounds = cover,
.fit = ImageFit.ImageFitStretch, .smooth = true})
if cover.width < cast(float32)Scale(80) { return }
label_height := cast(s32)(cover.height * 0.30)
unused Box(frame.session, BoxProps.{.key = key + 1,
.bounds = Bounds(cast(s32)cover.x + Scale(4), cast(s32)cover.y + Scale(4),
cast(s32)cover.width - Scale(8), label_height),
.fill = Color.{244, 233, 204, 245}, .fill_bottom = Color.{244, 233, 204, 0},
.has_fill_bottom = true})
palette := ReaderPalette()
palette.text = cast(u32)0x40372bff
unused WidgetPaletteUse(frame.session, palette)
title_font := cast(s32)(cover.width * 0.105)
author_font := cast(s32)(cover.width * 0.075)
Text(frame.session, TextProps.{.key = key + 2, .text = BookTitle(index), .font = title_font,
.align = cast(TextAlign)TextAlignCenter,
.bounds = Bounds(cast(s32)cover.x + Scale(8), cast(s32)cover.y + Scale(12),
cast(s32)cover.width - Scale(16), title_font + Scale(4))})
Text(frame.session, TextProps.{.key = key + 3, .text = BookAuthor(index), .font = author_font,
.align = cast(TextAlign)TextAlignCenter,
.bounds = Bounds(cast(s32)cover.x + Scale(8), cast(s32)cover.y + Scale(18) + title_font,
cast(s32)cover.width - Scale(16), author_font + Scale(4))})
unused WidgetPaletteRestore(frame.session)
}
Title :: (bounds: Rectangle, text: string, size: s32) -> s32 {
height := TextHeight(frame.session, TextProps.{.text = text, .font = size, .bounds = bounds,
.wrap = cast(TextWrap)TextWrapAuto})
bounds.height = cast(float32)height
Text(frame.session, TextProps.{.text = text, .font = size, .bounds = bounds,
.wrap = cast(TextWrap)TextWrapAuto})
return height
}
ShelfNoteHeight :: (index: s32, width: s32) -> s32 {
return TextHeight(frame.session, TextProps.{.text = BookNote(index), .font = frame.font - Scale(2),
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto})
OpeningView :: () {
progress := cast(float32)((frame.now - opening_started) / 0.32)
if progress >= 1.0 {
opening = false
return
}
unused SmoothFramesHost(2)
width := ReadingBounds().width
if width > cast(float32)Scale(260) { width = cast(float32)Scale(260) }
target := Rectangle.{(cast(float32)frame.width - width) / 2.0,
cast(float32)frame.top + cast(float32)Scale(24), width, width * 1.5}
lift := TransitionSmoothProgress(progress / 0.45)
cover := Rectangle.{opening_from.x + (target.x - opening_from.x) * lift,
opening_from.y + (target.y - opening_from.y) * lift,
opening_from.width + (target.width - opening_from.width) * lift,
opening_from.height + (target.height - opening_from.height) * lift}
turn := TransitionSmoothProgress((progress - 0.45) / 0.55)
cover.width *= 1.0 - turn
if cover.width > 1.0 { BookJacket(book, cover, 27800) }
}
ShelfView :: () {
column := Column()
height := Scale(64)
for index: cast(s32)0..BOOK_COUNT - 1 {
height += Scale(132) + ShelfNoteHeight(index, cast(s32)column.width)
}
scroll := Scroll(frame.session, ScrollProps.{.key = 27000, .bounds = column,
.content_height = height, .scroll_offset = shelf_scroll, .scale = frame.scale})
area := Bounds(Scale(12), frame.top + Scale(12), frame.width - Scale(24),
frame.height - frame.bottom - frame.top - Scale(24))
grid := MeasureGrid(GridProps.{.bounds = area, .min_item_width = Scale(132),
.max_columns = 5, .gap = Scale(28), .padding = Scale(20)})
cover_width := grid.cell_width - Scale(8)
if cover_width > Scale(160) { cover_width = Scale(160) }
height := cover_width * 3 / 2
row_height := height + Scale(72)
rows := GridRowCount(grid, BOOK_COUNT)
visible_rows := (cast(s32)area.height + row_height - 1) / row_height
if rows < visible_rows { rows = visible_rows }
content_height := rows * row_height + Scale(20)
unused Box(frame.session, BoxProps.{.key = 27900, .bounds = area,
.fill = Color.{73, 43, 28, 255}, .fill_bottom = Color.{111, 71, 44, 255},
.has_fill_bottom = true})
scroll := Scroll(frame.session, ScrollProps.{.key = 27000, .bounds = area,
.content_height = content_height,
.scroll_offset = shelf_scroll, .scale = frame.scale})
shelf_scroll = scroll.scroll_offset
if !scroll.opened { return }
defer { unused End(frame.session) }
x := cast(s32)scroll.content.x
y := cast(s32)scroll.content.y
width := cast(s32)scroll.content.width
y += Title(Bounds(x, y, width, 0), AppLocaleHost("app_name_library"), frame.font + Scale(8)) + Scale(20)
buffer: [128]u8
grid.content.y = scroll.content.y + cast(float32)Scale(20)
// Recessed backs, a lit board top, and a thick wood edge make each row
// a shelf. Empty rows remain part of the bookcase as the library grows.
for row: cast(s32)0..rows - 1 {
x := cast(s32)scroll.content.x
y := cast(s32)scroll.content.y + row * row_height
width := cast(s32)scroll.content.width
board := y + height + Scale(20)
key := cast(u64)(28000 + row * 32)
unused Box(frame.session, BoxProps.{.key = key,
.bounds = Bounds(x + Scale(10), y, width - Scale(20), row_height),
.fill = Color.{57, 35, 25, 255}, .fill_bottom = Color.{126, 87, 55, 255},
.has_fill_bottom = true})
unused Box(frame.session, BoxProps.{.key = key + 1,
.bounds = Bounds(x + Scale(10), board - Scale(14), width - Scale(20), Scale(14)),
.fill = Color.{158, 110, 65, 255}, .fill_bottom = Color.{193, 143, 85, 255},
.has_fill_bottom = true})
unused Box(frame.session, BoxProps.{.key = key + 2,
.bounds = Bounds(x, board, width, Scale(22)),
.fill = Color.{163, 111, 63, 255}, .fill_bottom = Color.{108, 65, 36, 255},
.has_fill_bottom = true})
unused Box(frame.session, BoxProps.{.key = key + 3,
.bounds = Bounds(x, board, width, Scale(2)), .fill = Color.{217, 167, 104, 255}})
unused Box(frame.session, BoxProps.{.key = key + 4,
.bounds = Bounds(x + Scale(10), board + Scale(22), width - Scale(20), Scale(18)),
.fill = Color.{25, 15, 10, 120}, .fill_bottom = Color.{25, 15, 10, 0},
.has_fill_bottom = true})
for grain: cast(s32)0..3 {
unused Box(frame.session, BoxProps.{.key = key + cast(u64)(5 + grain),
.bounds = Bounds(x + Scale(8 + grain * 13), board + Scale(5 + grain * 4),
width - Scale(40 + grain * 14), Scale(1)),
.fill = Color.{75, 43, 24, 65}})
}
}
for index: cast(s32)0..BOOK_COUNT - 1 {
Text(frame.session, TextProps.{.text = BookTitle(index), .font = frame.font + Scale(4),
.bounds = Bounds(x, y, width, Scale(30))})
Text(frame.session, TextProps.{.text = BookAuthor(index), .font = frame.font - Scale(1),
.bounds = Bounds(x, y + Scale(30), width, Scale(22))})
note := ShelfNoteHeight(index, width)
Text(frame.session, TextProps.{.text = BookNote(index), .font = frame.font - Scale(2),
.bounds = Bounds(x, y + Scale(56), width, note), .wrap = cast(TextWrap)TextWrapAuto})
y += note + Scale(8)
saved := SavedChapter(index)
label := ifx saved > 0 then Numbered("library_continue", saved, buffer[:]) else AppLocaleHost("library_start")
half := (width - Scale(12)) / 2
if Button(frame.session, ButtonProps.{.id = 27010 + index * 2, .bounds = Bounds(x, y + Scale(60), half, Scale(48)),
.label = label, .tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
Open(index, ifx saved > 0 then saved else 1)
cover := GridCellBounds(grid, index, row_height - grid.gap)
cover.width = cast(float32)cover_width
cover.height = cast(float32)height
x := cast(s32)cover.x
y := cast(s32)cover.y
key := cast(u64)(29000 + index * 16)
unused Box(frame.session, BoxProps.{.key = key,
.bounds = Bounds(x + Scale(6), y + Scale(8), cover_width + Scale(8), height),
.fill = Color.{20, 12, 8, 105}, .radius = cast(float32)Scale(3)})
unused Box(frame.session, BoxProps.{.key = key + 1,
.bounds = Bounds(x + Scale(5), y + Scale(3), cover_width, height - Scale(3)),
.fill = Color.{221, 208, 171, 255}, .border = Color.{121, 101, 66, 255}})
press := Press(frame.session, PressProps.{.key = cast(u64)(27010 + index),
.bounds = cover, .label = BookTitle(index), .now = frame.now})
BookJacket(index, cover, key + 4)
unused Box(frame.session, BoxProps.{.key = key + 2,
.bounds = Bounds(x, y, Scale(5), height), .fill = Color.{18, 24, 17, 85}})
unused Box(frame.session, BoxProps.{.key = key + 3,
.bounds = Bounds(x + Scale(6), y, Scale(1), height), .fill = Color.{255, 243, 192, 75}})
if press.clicked {
opening_from = cover
OpenBook(index)
}
if Button(frame.session, ButtonProps.{.id = 27011 + index * 2,
.bounds = Bounds(x + half + Scale(12), y + Scale(60), half, Scale(48)),
.label = AppLocaleHost("library_contents"), .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
book = index
contents_scroll = 0
view = LIBRARY_CONTENTS
}
y += Scale(132)
}
}
// Every chapter's number, in rows, to open any of them.
ContentsView :: () {
column := Column()
width := cast(s32)column.width
size := Scale(56)
gap := Scale(8)
across := (width + gap) / (size + gap)
if across < 1 { across = 1 }
count := BookChapters(book)
rows := (count + across - 1) / across
height := Scale(72) + rows * (size + gap)
scroll := Scroll(frame.session, ScrollProps.{.key = 27100, .bounds = column,
.content_height = height, .scroll_offset = contents_scroll, .scale = frame.scale})
contents_scroll = scroll.scroll_offset
EnsureAnnotation :: () -> bool {
if annotation_index >= 0 { return true }
if annotation_count >= LIBRARY_ANNOTATION_LIMIT { return false }
current := pages[page_index]
start := ifx passage_state.anchor < passage_state.cursor then passage_state.anchor else passage_state.cursor
end := ifx passage_state.anchor > passage_state.cursor then passage_state.anchor else passage_state.cursor
if end <= start { return false }
annotation_index = annotation_count
annotation_count += 1
annotations[annotation_index] = LibraryAnnotation.{.start = current.start + start, .end = current.start + end}
return true
}
AnnotationPanel :: (bounds: Rectangle) {
y := cast(s32)bounds.y
width := cast(s32)bounds.width
current := pages[page_index]
input := AppFieldInputHost()
Text(frame.session, TextProps.{.text = AppLocaleHost("library_select_passage"), .font = frame.font,
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(32))})
y += Scale(40)
previous_start := ifx passage_state.anchor < passage_state.cursor then passage_state.anchor else passage_state.cursor
previous_end := ifx passage_state.anchor > passage_state.cursor then passage_state.anchor else passage_state.cursor
passage_state = TextArea(frame.session, TextAreaProps.{.key = 27619, .focus_id = 27619,
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(168)),
.value = BookChapter(book, current.chapter)[current.start:current.end],
.label = AppLocaleHost("library_select_passage"), .read_only = true, .wrap = true,
.cursor = passage_state.cursor, .anchor = passage_state.anchor,
.focused = passage_state.focused, .scroll_y = passage_state.scroll_y,
.selecting = passage_state.selecting, .scale = frame.scale,
.input = TextAreaInput.{.left = input.left, .right = input.right,
.home = input.home, .end = input.end, .shift = input.shift,
.select_all = input.select_all, .copy = input.copy, .now_seconds = frame.now}})
start := ifx passage_state.anchor < passage_state.cursor then passage_state.anchor else passage_state.cursor
end := ifx passage_state.anchor > passage_state.cursor then passage_state.anchor else passage_state.cursor
if end > start && (start != previous_start || end != previous_end) && SaveAnnotations() {
annotation_index = -1
for index: cast(s32)0..annotation_count - 1 {
if annotations[index].start == current.start + start && annotations[index].end == current.start + end {
annotation_index = index
}
}
note[0] = 0
if annotation_index >= 0 { unused AppCopyText(annotations[annotation_index].note, note[:]) }
note_state = TextAreaResult.{}
}
y += Scale(184)
selected := end > start || annotation_index >= 0
highlighted := annotation_index >= 0 && annotations[annotation_index].highlighted
Text(frame.session, TextProps.{.text = AppLocaleHost("library_highlight"), .font = frame.font,
.bounds = Bounds(cast(s32)bounds.x, y, width - Scale(72), Scale(48))})
toggle := Toggle(frame.session, ToggleProps.{.key = 27620,
.bounds = Bounds(cast(s32)bounds.x + width - Scale(64), y, Scale(64), Scale(48)),
.label = AppLocaleHost("library_highlight"), .value = highlighted, .disabled = !selected})
if toggle.changed && EnsureAnnotation() {
annotations[annotation_index].highlighted = toggle.value
annotation_dirty = true
unused SaveReader()
}
y += Scale(64)
edit := TextArea(frame.session, TextAreaProps.{.key = 27621, .focus_id = 27621,
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(160)),
.value = TextUntilNul(note[:]), .label = AppLocaleHost("library_note"),
.placeholder = AppLocaleHost("library_note"), .max_bytes = 2048, .max_codepoints = 2048,
.cursor = note_state.cursor, .anchor = note_state.anchor,
.scroll_y = note_state.scroll_y, .focused = note_state.focused,
.composition = note_state.composition, .wrap = true, .scale = frame.scale, .disabled = !selected,
.input = TextAreaInput.{.text = input.text, .paste_text = input.paste_text,
.composition_event = input.composition_event, .left = input.left, .right = input.right,
.home = input.home, .end = input.end, .shift = input.shift,
.backspace = input.backspace, .delete_forward = input.delete_forward,
.select_all = input.select_all, .copy = input.copy, .cut = input.cut,
.paste = input.paste, .enter = input.commit, .escape = input.escape,
.now_seconds = frame.now}})
note_state = edit
if edit.edit.changed && EnsureAnnotation() {
if AppReplaceText(note[:], edit.edit.start, edit.edit.end, edit.edit.replacement) {
annotation_dirty = true
}
}
y += Scale(176)
// Reflow can put several older annotated passages on this page. Keep
// their notes visible as well as the editable first annotation.
for index: cast(s32)0..annotation_count - 1 {
if index != annotation_index && LibraryOverlaps(current, annotations[index]) && annotations[index].note != "" {
Text(frame.session, TextProps.{.text = annotations[index].note, .font = frame.font,
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(100))})
y += Scale(112)
}
}
}
FontPanel :: (bounds: Rectangle) {
x := cast(s32)bounds.x
y := cast(s32)bounds.y
width := cast(s32)bounds.width
Text(frame.session, TextProps.{.text = AppLocaleHost("library_font_size"), .font = frame.font,
.bounds = Bounds(x, y, width, Scale(28))})
size := Spinbox(frame.session, SpinboxProps.{.key = 27630,
.bounds = Bounds(x, y + Scale(32), width, Scale(56)), .label = AppLocaleHost("library_font_size"),
.min = 14, .max = 36, .step = 1, .value = font_size, .value_text = NumberText(font_size)})
if size.changed {
font_size = size.value
layout_width = 0
settings_dirty = true
}
options: [2]DropdownOption
options[0].label = AppLocaleHost("library_font_system")
options[1].label = "Noto Sans"
Text(frame.session, TextProps.{.text = AppLocaleHost("library_typeface"), .font = frame.font,
.bounds = Bounds(x, y + Scale(112), width, Scale(28))})
face := Dropdown(frame.session, DropdownProps.{.key = 27631,
.bounds = Bounds(x, y + Scale(144), width, Scale(48)),
.placeholder = AppLocaleHost("library_typeface"), .selected_index = font_face,
.scale = frame.scale}, options[:])
if face.changed {
font_face = face.selected_index
layout_width = 0
settings_dirty = true
}
unused SaveReader()
}
LayoutPanel :: (bounds: Rectangle) {
x := cast(s32)bounds.x
y := cast(s32)bounds.y
width := cast(s32)bounds.width
Text(frame.session, TextProps.{.text = AppLocaleHost("library_margins"), .font = frame.font,
.bounds = Bounds(x, y, width, Scale(28))})
Text(frame.session, TextProps.{.text = AppLocaleHost("library_line_spacing"), .font = frame.font,
.bounds = Bounds(x, y + Scale(112), width, Scale(28))})
inset := Spinbox(frame.session, SpinboxProps.{.key = 27640,
.bounds = Bounds(x, y + Scale(32), width, Scale(56)), .label = AppLocaleHost("library_margins"),
.min = 12, .max = 56, .step = 4, .value = margin, .value_text = NumberText(margin)})
gap := Spinbox(frame.session, SpinboxProps.{.key = 27641,
.bounds = Bounds(x, y + Scale(144), width, Scale(56)), .label = AppLocaleHost("library_line_spacing"),
.min = 2, .max = 20, .step = 2, .value = line_gap, .value_text = NumberText(line_gap)})
if inset.changed || gap.changed {
margin = inset.value
line_gap = gap.value
layout_width = 0
settings_dirty = true
}
unused SaveReader()
}
ContentsPanel :: (bounds: Rectangle) {
for chapter: cast(s32)1..BookChapters(book) {
if Button(frame.session, ButtonProps.{.id = 27200 + chapter,
.bounds = Bounds(cast(s32)bounds.x, cast(s32)bounds.y + (chapter - 1) * Scale(56),
cast(s32)bounds.width, Scale(48)),
.label = LibraryChapterLabel(chapter, BookChapterTitle(book, chapter)),
.content_alignment = ContentAlignment.ContentAlignmentStart, .fit_content = true,
.size = ControlSize.ControlSizeLarge,
.selected = chapter == pages[page_index].chapter,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
TurnPage(LibraryPageFor(pages[:page_count], chapter, 0))
if !save_failed { panel_open = false }
}
}
}
ReaderPalette :: () -> WidgetPalette {
return WidgetPalette.{
.background = ifx book_dark then cast(u32)0x28231dff else cast(u32)0xf8f1e0ff,
.base = ifx book_dark then cast(u32)0x342e25ff else cast(u32)0xeee3ccff,
.text = ifx book_dark then cast(u32)0xe8dfccff else cast(u32)0x40372bff,
.selected = ifx book_dark then cast(u32)0xb49b70ff else cast(u32)0x89724eff,
.selected_text = ifx book_dark then cast(u32)0x211c16ff else cast(u32)0xfffbf1ff,
.border = ifx book_dark then cast(u32)0x655947ff else cast(u32)0xc9b993ff,
.danger = cast(u32)0xb54f45ff, .warning = cast(u32)0xb08b40ff,
.success = cast(u32)0x70835aff}
}
ReaderToolbar :: () {
icons: [4]s32 = .[cast(s32)IconType.IconPencil, cast(s32)IconType.IconText,
cast(s32)IconType.IconGear, cast(s32)IconType.IconManual]
labels: [4]string = .["library_annotations", "library_font", "library_layout", "library_contents"]
size := Scale(44)
gap := Scale(4)
left := frame.width - Scale(12) - size * 5 - gap * 4
for index: cast(s32)0..3 {
if Button(frame.session, ButtonProps.{.id = 27700 + index,
.bounds = Bounds(left + index * (size + gap), Scale(6), size, size),
.label = AppLocaleHost(labels[index]), .icon_type = icons[index], .icon_only = true,
.size = cast(ControlSize)ControlSize.ControlSizeLarge,
.selected = panel_open && panel_tab == index,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 && SaveReader() {
panel_open = !panel_open || panel_tab != index
panel_tab = index
panel_scroll = 0
reader_swipe = SwipeGesture.{}
LoadPageAnnotations()
}
}
if Button(frame.session, ButtonProps.{.id = 27704,
.bounds = Bounds(left + 4 * (size + gap), Scale(6), size, size),
.label = AppLocaleHost(ifx book_dark then "theme_light" else "theme_dark"),
.icon_type = cast(s32)(ifx book_dark then IconType.IconSun else IconType.IconMoon),
.icon_only = true, .size = cast(ControlSize)ControlSize.ControlSizeLarge,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
book_dark = !book_dark
settings_dirty = true
unused SaveReader()
}
}
ReaderPanel :: () {
bounds := ReadingBounds()
bounds.y = cast(float32)(frame.top + Scale(16))
bounds.height = cast(float32)(frame.height - frame.bottom - cast(s32)bounds.y - Scale(48))
Text(frame.session, TextProps.{.key = 27600, .text = AppLocaleHost(
ifx panel_tab == 0 then "library_annotations" else ifx panel_tab == 1 then "library_font"
else ifx panel_tab == 2 then "library_layout" else "library_contents"),
.font = frame.font, .bounds = bounds})
if Button(frame.session, ButtonProps.{.id = 27601,
.bounds = Bounds(cast(s32)(bounds.x + bounds.width) - Scale(44), cast(s32)bounds.y - Scale(8), Scale(44), Scale(44)),
.label = AppLocaleHost("close_button"), .icon_type = cast(s32)IconType.IconCheck,
.icon_only = true, .size = cast(ControlSize)ControlSize.ControlSizeLarge,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 && SaveReader() { panel_open = false }
bounds.y += cast(float32)Scale(48)
bounds.height -= cast(float32)Scale(48)
content_height := ifx panel_tab == 0 then Scale(600) else Scale(420)
if panel_tab == 0 {
for index: cast(s32)0..annotation_count - 1 {
if index != annotation_index && LibraryOverlaps(pages[page_index], annotations[index]) &&
annotations[index].note != "" { content_height += Scale(112) }
}
}
if panel_tab == 3 {
content_height = BookChapters(book) * Scale(56) - Scale(8)
}
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)(27602 + panel_tab), .bounds = bounds,
.content_height = content_height, .scroll_offset = panel_scroll, .scale = frame.scale})
panel_scroll = scroll.scroll_offset
if !scroll.opened { return }
defer { unused End(frame.session) }
x := cast(s32)scroll.content.x
y := cast(s32)scroll.content.y
y += Title(Bounds(x, y, width, 0), BookTitle(book), frame.font + Scale(6)) + Scale(16)
saved := SavedChapter(book)
for number: cast(s32)1..count {
at := number - 1
label: Vec(u8)
BuilderPrint(*label, "%", number)
if Button(frame.session, ButtonProps.{.id = 27200 + number,
.bounds = Bounds(x + (at % across) * (size + gap), y + (at / across) * (size + gap), size, size),
.label = BuilderFinish(label), .selected = number == saved,
.tone = ifx number == saved then cast(ButtonTone)ButtonToneAccent else cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
Open(book, number)
}
}
if panel_tab == 0 { AnnotationPanel(scroll.content) }
else if panel_tab == 1 { FontPanel(scroll.content) }
else if panel_tab == 2 { LayoutPanel(scroll.content) }
else { ContentsPanel(scroll.content) }
}
// The chapter scrolls above its page buttons, which stay at the bottom.
ChapterView :: () {
paper := ifx frame.dark then Color.{40, 35, 29, 255} else Color.{248, 241, 224, 255}
unused Box(frame.session, BoxProps.{.key = cast(u64)27500,
ReaderView :: () {
unused WidgetPaletteUse(frame.session, ReaderPalette())
paper := ifx book_dark then Color.{40, 35, 29, 255} else Color.{248, 241, 224, 255}
unused Box(frame.session, BoxProps.{.key = 27500,
.bounds = Bounds(0, 0, frame.width, frame.height), .fill = paper})
column := Column()
width := cast(s32)column.width
reading := frame.font + Scale(3)
buttons := Scale(48)
page := column
page.height -= cast(float32)(buttons + Scale(24))
pointer := SamplePointer()
turn := Swipe(SwipeSpec.{.bounds = Bounds(0, frame.top, frame.width, cast(s32)(page.y + page.height) - frame.top),
.directions = cast(u32)SwipeDirection.SwipeHorizontal,
.min_distance = cast(float32)Scale(48), .axis_bias = 1.5, .max_duration = 0.8},
chapter_swipe, SwipeFrame.{.pointer = Vector2.{pointer.x, pointer.y},
.pressed = pointer.pressed, .down = pointer.down, .released = pointer.released,
.input_clear = true, .owner_clear = true, .now_seconds = frame.now, .scale = frame.scale})
chapter_swipe = turn.gesture
if turn.direction == SwipeDirection.SwipeLeft && chapter < BookChapters(book) {
Open(book, chapter + 1)
} else if turn.direction == SwipeDirection.SwipeRight && chapter > 1 {
Open(book, chapter - 1)
if opening {
OpeningView()
unused WidgetPaletteUse(frame.session, ReaderPalette())
if opening { return }
}
words := BookChapter(book, chapter)
text_height := TextHeight(frame.session, TextProps.{.text = words, .font = reading,
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto})
height := Scale(64) + text_height + Scale(24)
scroll := Scroll(frame.session, ScrollProps.{.key = 27300 + cast(u64)chapter, .bounds = page,
.content_height = height, .scroll_offset = chapter_scroll, .scale = frame.scale})
chapter_scroll = scroll.scroll_offset
if scroll.opened {
x := cast(s32)scroll.content.x
y := cast(s32)scroll.content.y
buffer: [64]u8
Text(frame.session, TextProps.{.text = Numbered("library_chapter", chapter, buffer[:]),
.font = frame.font - Scale(1), .bounds = Bounds(x, y, width, Scale(24))})
y += Scale(64)
Text(frame.session, TextProps.{.text = words, .font = reading, .selectable = true,
.bounds = Bounds(x, y, width, text_height), .wrap = cast(TextWrap)TextWrapAuto})
unused End(frame.session)
// Opening the keyboard inside the panel must not repaginate the book.
if !panel_open {
previous_width := layout_width
previous_height := layout_height
previous_scale := layout_scale
Reflow()
if page_count > 0 && (layout_width != previous_width || layout_height != previous_height ||
layout_scale != previous_scale) { LoadPageAnnotations() }
}
x := cast(s32)column.x
y := cast(s32)(column.y + column.height) - buttons - Scale(12)
half := (width - Scale(12)) / 2
if Button(frame.session, ButtonProps.{.id = 27400, .bounds = Bounds(x, y, half, buttons),
.label = AppLocaleHost("library_previous"), .disabled = chapter <= 1,
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
Open(book, chapter - 1)
if page_count <= 0 { return }
if !panel_open && !opening {
pointer := SamplePointer()
swipe := Swipe(SwipeSpec.{.bounds = ReadingBounds(),
.directions = cast(u32)SwipeDirection.SwipeHorizontal,
.min_distance = cast(float32)Scale(48), .axis_bias = 1.5},
reader_swipe, SwipeFrame.{.pointer = Vector2.{pointer.x, pointer.y},
.pressed = pointer.pressed, .down = pointer.down, .released = pointer.released,
.input_clear = true, .owner_clear = true, .now_seconds = frame.now, .scale = frame.scale})
reader_swipe = swipe.gesture
key := AppKeyHost()
if swipe.direction == SwipeDirection.SwipeLeft || key == KeyRight { TurnPage(page_index + 1) }
else if swipe.direction == SwipeDirection.SwipeRight || key == KeyLeft { TurnPage(page_index - 1) }
}
if Button(frame.session, ButtonProps.{.id = 27401, .bounds = Bounds(x + half + Scale(12), y, half, buttons),
.label = AppLocaleHost("library_next"), .disabled = chapter >= BookChapters(book),
.tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
Open(book, chapter + 1)
current := pages[page_index]
heading: TextProps = ChapterHeadingProps(current.chapter)
props: TextProps = ReadingProps(current.chapter)
props.text = BookChapter(book, current.chapter)[current.start:current.end]
props.key = 27502
// Emphasize only marked words; never paint a rectangle over the page.
marks: [LIBRARY_ANNOTATION_LIMIT]TextRange
mark_count: s32
for annotation: annotations[:annotation_count] {
if !annotation.highlighted || !LibraryOverlaps(current, annotation) { continue }
start := ifx annotation.start > current.start then annotation.start - current.start else 0
end := ifx annotation.end < current.end then annotation.end - current.start else current.end - current.start
place := mark_count
while place > 0 && marks[place - 1].start > start {
marks[place] = marks[place - 1]
place -= 1
}
marks[place] = TextRange.{start, end}
mark_count += 1
}
merged: s32
for index: cast(s32)0..mark_count - 1 {
if merged > 0 && marks[index].start <= marks[merged - 1].end {
if marks[index].end > marks[merged - 1].end { marks[merged - 1].end = marks[index].end }
} else {
marks[merged] = marks[index]
merged += 1
}
}
props.strong = marks[:merged]
if !panel_open {
Text(frame.session, heading)
Text(frame.session, props)
}
ReaderToolbar()
label: Vec(u8)
BuilderPrint(*label, "% / %", page_index + 1, page_count)
Text(frame.session, TextProps.{.key = 27511, .text = BuilderFinish(label), .font = frame.font - Scale(2),
.align = cast(TextAlign)TextAlignCenter,
.bounds = Bounds(0, frame.height - frame.bottom - Scale(40), frame.width, Scale(32))})
if panel_open { ReaderPanel() }
unused WidgetPaletteUse(frame.session, ReaderPalette())
if save_failed {
Text(frame.session, TextProps.{.text = AppLocaleHost("library_save_failed"), .font = frame.font,
.bounds = Bounds(Scale(16), frame.top + Scale(8), frame.width - Scale(216), Scale(48))})
}
}
LibraryView :: (message: AppMessage) -> AppMessage {
frame = ReadAppUiHost()
// Another account starts on the shelf.
frame.top = Scale(56)
if !loaded || loaded_account != message.account {
loaded = true
loaded_account = message.account
view = LIBRARY_SHELF
reading = false
panel_open = false
annotation_dirty = false
settings_dirty = false
position_dirty = false
save_failed = false
LoadSettings()
}
if view == LIBRARY_CHAPTER { ChapterView() }
else if view == LIBRARY_CONTENTS { ContentsView() }
if reading { ReaderView() }
else { ShelfView() }
if Button(frame.session, ButtonProps.{.id = 27710,
.bounds = Bounds(Scale(8), Scale(6), Scale(44), Scale(44)),
.label = AppLocaleHost("back_button"), .icon_type = cast(s32)IconType.IconLeft,
.icon_only = true, .size = cast(ControlSize)ControlSize.ControlSizeLarge,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
if !LibraryBack() { unused CloseAppHost() }
}
unused WidgetPaletteRestore(frame.session)
message.succeeded = true
return message
}
@@ -289,7 +795,7 @@ Main :: () -> s32 {
if message.action == APP_BACK { message.succeeded = LibraryBack() }
if message.action == APP_PRESENTATION {
message.succeeded = true
message.screen = ifx view == LIBRARY_CHAPTER then APP_PRESENTATION_IMMERSIVE else 0
message.screen = APP_PRESENTATION_OWN_HEADER | (ifx reading then APP_PRESENTATION_IMMERSIVE else 0)
}
WriteAppHost(message)
return 0
+94 -3
View File
@@ -1,12 +1,103 @@
// The Tao Te Ching, a new English rendering made for Inner Breeze from J. H.
// The Tao Te Ching, a new English rendering made for Breeze from J. H.
// McDonald's public-domain translation (1996), checked line by line against
// James Legge's (1891) and the Chinese Wang Bi text. Each chapter is its own
// text: a Ziran literal holds up to 4 KB.
TAO_TE_CHING_TITLE :: "Tao Te Ching"
TAO_TE_CHING_AUTHOR :: "Lao Tzu"
TAO_TE_CHING_NOTE :: "A new English rendering, from J. H. McDonald’s public-domain translation, checked against James Legge’s and the Chinese text."
TAO_TE_CHING_CHAPTERS :: 81
// Descriptive headings for this English edition, in the language of its text.
// Keep them separate from passages: saved positions and notes use text bytes.
tao_chapter_titles: [81]string = .[
"The Nameless Tao",
"Beauty and Opposites",
"Governing Without Desire",
"The Empty Bowl",
"Heaven and Earth",
"The Valley Spirit",
"Lasting by Giving",
"Like Water",
"Knowing When to Stop",
"Holding to the One",
"The Use of Emptiness",
"Beyond the Senses",
"Favor and Disgrace",
"The Hidden Tao",
"The Sages of Old",
"Returning to Stillness",
"The Best Rulers",
"When the Tao Is Lost",
"Returning to Simplicity",
"Apart from the Crowd",
"Following the Tao",
"Bending to Be Whole",
"Speaking Little",
"Standing on Tiptoe",
"Before Heaven and Earth",
"The Root of Stillness",
"Leaving No Tracks",
"The Uncarved Block",
"The Sacred Vessel",
"The Return of Force",
"Weapons and Peace",
"The Nameless Whole",
"Knowing Yourself",
"The Overflowing Tao",
"The Great Image",
"The Strength of Softness",
"Doing Without Forcing",
"The Highest Virtue",
"Holding to the One",
"Turning Back",
"Hearing of the Tao",
"The Birth of All Things",
"The Softest Thing",
"Knowing What Is Enough",
"Fullness and Emptiness",
"Contentment",
"Knowing Without Going",
"Less and Less",
"The Sage's Heart",
"Life and Death",
"Life and Nurture",
"Finding the Mother",
"The Great Road",
"Cultivating Virtue",
"Like a Newborn",
"Knowing and Silence",
"Leading Without Forcing",
"Fortune and Misfortune",
"Storing Up Virtue",
"Cooking a Little Fish",
"The Low River",
"The Shelter of All Things",
"Beginning with the Small",
"Before Trouble Begins",
"Keeping Things Simple",
"Leading by Lying Low",
"The Three Treasures",
"The Virtue of Not Fighting",
"Yielding in Conflict",
"Jade Beneath Plain Clothes",
"Knowing You Do Not Know",
"Power and Respect",
"The Courage Not to Dare",
"The Master Carpenter",
"Why People Hunger",
"The Softness of Life",
"The Bow of Heaven",
"Water Overcomes the Hard",
"Settling a Quarrel",
"A Small Country",
"Words That Are True"
];
TaoTeChingChapterTitle :: (number: s32) -> string {
if number < 1 || number > TAO_TE_CHING_CHAPTERS {
return ""
}
return tao_chapter_titles[number - 1]
}
TaoTeChing :: (number: s32) -> string {
if number == 1 { return TAO_1 }
if number == 2 { return TAO_2 }
+51 -1
View File
@@ -1,5 +1,55 @@
# Changelog
## [1.1.23] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.55.
## [1.1.22] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.54.
## [1.1.21] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.53.
## [1.1.20] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.52.
## [1.1.19] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.51.
## [1.1.18] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.1.17] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
## [1.1.16] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.48.
## [1.1.15] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.1.14] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
## [1.1.13] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.45.
## [1.1.12] - 2026-10-23
- Lists are chips that wrap onto more rows; pull the items down to show or hide finished ones.
- List settings, from the gear on the selected list: its name, who has access, invitations with a role, and Delete after a question.
- A shared list names its people under the lists, with their profile pictures; items are edited in their own row.
## [1.1.10] - 2026-10-23
- Tap an item to finish it, swipe right to edit it and swipe left to delete it.
@@ -74,7 +124,7 @@
## [1.0.2] - 2026-10-06
- Use Cells consistently in the cell and its independently delivered package.
- Use Apps consistently in the app and its independently delivered package.
## [1.0.1] - 2026-10-06
+2 -2
View File
@@ -1,8 +1,8 @@
// Lists owns edit decisions and list/item mutations. Storage capabilities use
// the unified host's open database and identity.
#import, file "../../src/cells/lists_types.zi";
#import, file "../../src/apps/lists_types.zi";
#import, file "../../src/core/types.zi";
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/module_types.zi";
#import "apps/node_types"
#import, file "lists_view.zi";
host_api :: #system_library "host_api";
+4 -4
View File
@@ -1,8 +1,8 @@
#import "std/c_string"
#import "std/json_scan"
#import, file "../../src/storage/cell_records.zi";
#import, file "../../src/storage/bundled_app_records.zi";
#import, file "../../src/storage/lists_shared_storage.zi";
#import, file "../../src/cells/package_files.zi";
#import, file "../../src/apps/package_files.zi";
#import, file "../../src/storage/achievements.zi";
#import, file "../../src/storage/achievement_sources.zi";
#import, file "../../src/storage/sqlite.zi";
@@ -36,7 +36,7 @@ AchievementListBackfill :: (offset: s32) -> s32 {
AchievementListRetract :: (metric: string, id: string) {
key := AchievementKey(metric, id)
previous := CellRecordRead(key)
previous := BundledAppRecordRead(key)
defer { PackageFree(key); PackageFree(previous) }
if previous.count > 0 {
unused AchievementRecord(metric, id, 0, active = false, live = false, deleted = true)
@@ -66,7 +66,7 @@ AchievementListItemBackfill :: (offset: s32) -> s32 {
deleted := SqliteColumnInt(statement, 3) != 0
if !ListsSharedId(list_id) {
key := AchievementKey("list.completed", id)
previous := CellRecordRead(key)
previous := BundledAppRecordRead(key)
if done || previous.count > 0 {
unused AchievementRecord("list.completed", id, 0, active = false, live = false, deleted = deleted || !done)
}
+684 -237
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -2,8 +2,8 @@
// wrapper provides authenticated transport and account-scoped cached bytes.
#import "text"
#import "vec"
#import, file "../../src/cells/lists_types.zi";
#import, file "../../src/cells/lists_ui_types.zi";
#import, file "../../src/apps/lists_types.zi";
#import, file "../../src/apps/lists_ui_types.zi";
ListsJsonString :: (out: *Vec(u8), value: string) {
BuilderPrint(out, "\"")
+53 -1
View File
@@ -1,5 +1,57 @@
# Changelog
## [1.5.22] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.55.
## [1.5.21] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.54.
## [1.5.20] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.53.
## [1.5.19] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.52.
## [1.5.18] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.51.
## [1.5.17] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.5.16] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
## [1.5.15] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.48.
## [1.5.14] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.5.13] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
## [1.5.12] - 2026-10-24
- Lumi types with the same loading dots every app shows.
## [1.5.11] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.45.
## [1.5.10] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.44.
## [1.5.9] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.43.
@@ -146,7 +198,7 @@
- Place Lumi’s avatar beside her replies in a chat without a title bar.
- Complete habits for today and start WHM, meditation, Sun Salutation or breathing patterns directly from chat.
- Offer only commands supported by installed and enabled cells.
- Offer only commands supported by installed and enabled apps.
- Ask which habit to complete, choose it by name, and use compact autocomplete chips with case-insensitive matching and command spelling correction.
## [1.0.0] - 2026-10-06
+1 -8
View File
@@ -3,7 +3,7 @@
#import "utf8"
#import, file "command_text.zi";
#import, file "regex.zi";
#import, file "../../src/cells/lumi_types.zi";
#import, file "../../src/apps/lumi_types.zi";
#import, file "../../src/app/route_types.zi";
using AppNavRoute;
@@ -20,13 +20,6 @@ LumiTrim :: (value: string) -> string {
return value[start:end]
}
LumiLower :: (byte: u8) -> u8 {
if byte >= cast(u8)65 && byte <= cast(u8)90 {
return byte + cast(u8)32
}
return byte
}
LumiStarts :: (value: string, prefix: string) -> bool {
a: s32 = 0
b: s32 = 0
+1 -1
View File
@@ -8,7 +8,7 @@
#import "byte_text_linux"
#import, file "habit_intent.zi";
#import, file "habit_patterns.zi";
#import, file "../../src/cells/lumi_types.zi";
#import, file "../../src/apps/lumi_types.zi";
LUMI_HABITS_MAX :: 48
+3 -3
View File
@@ -1,10 +1,10 @@
// Lumi owns conversation decisions. The host supplies only explicit app tools.
#import "text"
#import "vec"
#import, file "../../src/cells/lumi_types.zi";
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/lumi_types.zi";
#import, file "../../src/apps/module_types.zi";
#import "apps/node_types"
#import, file "../../src/cells/lumi_ui_types.zi";
#import, file "../../src/apps/lumi_ui_types.zi";
#import, file "../../src/core/types.zi";
#import, file "engine.zi";
#import, file "lumi_view.zi";
+1 -1
View File
@@ -3,7 +3,7 @@
#import "std/vec"
#import, file "../../src/storage/achievements.zi";
#import, file "../../src/storage/storage_core.zi";
#import, file "../../src/cells/package_files.zi";
#import, file "../../src/apps/package_files.zi";
achievement_lumi_practice_offline: bool;
+8 -17
View File
@@ -13,6 +13,7 @@
#import "control_props"
#import "box_props"
#import "box_widget"
#import "loading_indicator"
#import "checkbox_props"
#import "checkbox_widget"
#import "context_menu_widget"
@@ -29,9 +30,9 @@
#import "c_string"
#import "vec"
#import "math"
#import, file "../../src/cells/lumi_types.zi";
#import, file "../../src/cells/lumi_ui_types.zi";
#import, file "../../src/cells/lumi_chart.zi";
#import, file "../../src/apps/lumi_types.zi";
#import, file "../../src/apps/lumi_ui_types.zi";
#import, file "../../src/apps/lumi_chart.zi";
#import, file "command_text.zi";
#import, file "engine.zi";
#import, file "message_text.zi";
@@ -550,20 +551,10 @@ TypingDots :: (x: s32, top: s32) {
Text(frame.session, TextProps.{.key = cast(u64)300382,
.bounds = Bounds(left + Scale(14), top + Scale(8), Scale(68), Scale(20)),
.text = "Lumi", .font = Scale(12)})
for dot: cast(s32)0..2 {
phase := frame.now * 1.4 - cast(float64)dot * 0.2
phase = phase - cast(float64)cast(s64)phase
if phase < 0.0 {
phase += 1.0
}
level := ifx phase < 0.5 then phase * 2.0 else (1.0 - phase) * 2.0
size := Scale(8)
Box(frame.session, BoxProps.{.key = cast(u64)(300383 + dot),
.bounds = Bounds(left + Scale(16) + dot * Scale(14),
top + Scale(38) - cast(s32)(level * cast(float64)Scale(4)), size, size),
.fill = Color.{170, 170, 170, cast(u8)(90.0 + 165.0 * level)},
.radius = cast(float32)size / 2.0})
}
// Kryon's loading dots, the same animation every app shows.
LoadingIndicator(frame.session, LoadingIndicatorProps.{.key = cast(u64)300383,
.bounds = Bounds(left + Scale(16), top + Scale(34), Scale(36), Scale(12)),
.now = frame.now, .scale = frame.scale})
}
// Tapped, Lumi swirls twice around her place beside her message, for fun:
+1 -1
View File
@@ -2,7 +2,7 @@
// typed messages and code keep their literal text.
#import "text_props"
#import "byte_text_linux"
#import, file "../../src/cells/lumi_types.zi";
#import, file "../../src/apps/lumi_types.zi";
LumiMessageText :: struct {
bytes: [LUMI_INPUT_MAX]u8
+1 -1
View File
@@ -4,7 +4,7 @@
#import "byte_text_linux"
#import "std/format"
#import "vec"
#import, file "../../src/cells/lumi_types.zi";
#import, file "../../src/apps/lumi_types.zi";
// The most changelog entries an update message shows.
LUMI_UPDATE_NOTES_MAX :: 3
+4
View File
@@ -1,5 +1,9 @@
# Photos changelog
## [1.0.4] - 2026-10-24
- Download on the current Inner Breeze, which only runs the new app format.
## [1.0.3] - 2026-10-22
- Make Photos available to everyone without enabling beta apps.
+1 -1
View File
@@ -2,7 +2,7 @@
// once per photo on the account's nodes. It is one of the apps the node
// offers; the host runs it through the generic app interface and grants it
// the account's media library.
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/module_types.zi";
#import "apps/node_types"
#import, file "photos_view.zi";
host_api :: #system_library "host_api";
+7 -4
View File
@@ -6,7 +6,7 @@
#import, file "../../src/storage/state.zi";
#import, file "../../src/storage/storage_core.zi";
#import, file "../../src/app/text_buffers.zi";
#import, file "../../src/cells/media_store.zi";
#import, file "../../src/apps/media_store.zi";
#import "std/date_parse"
#import, file "../../src/storage/achievement_records.zi";
#import "std/text_buffer"
@@ -14,7 +14,7 @@
AchievementPhotoBackfill :: (offset: s32) -> s32 {
statement: *void
if SqlitePrepareText(storage_db_handle(),
"SELECT value FROM settings WHERE user_id=?1 AND key GLOB 'cell.media.*' AND length(key)=75 ORDER BY key LIMIT 128 OFFSET ?2",
"SELECT value FROM settings WHERE user_id=?1 AND ((key GLOB 'entity.photos.*' AND length(key)=78) OR (key GLOB 'cell.media.*' AND length(key)=75 AND NOT EXISTS (SELECT 1 FROM settings e WHERE e.user_id=?1 AND e.key='entity.photos.'||substr(settings.key,12)))) ORDER BY key LIMIT 128 OFFSET ?2",
-1, *statement, null) != SQLITE_OK { return -1 }
defer { SqliteFinalize(statement) }
bind_text(statement, 1, AchievementOwner())
@@ -24,8 +24,11 @@ AchievementPhotoBackfill :: (offset: s32) -> s32 {
document := AppTextFromCString(SqliteColumnText(statement, 0), 65536)
item := MediaParse(document)
if item.valid {
capture := ReadNumber(document, FieldAt(document, 0, "capture"))
day := ifx capture.valid && capture.value == 1 then AchievementParseDay(TextUntilNul(item.day[:])) else 0
// Entity records say true; a released version's library said 1.
capture_at := FieldAt(document, 0, "capture")
capture := ReadNumber(document, capture_at)
captured := MatchLiteral(document, capture_at, "true") || (capture.valid && capture.value == 1)
day := ifx captured then AchievementParseDay(TextUntilNul(item.day[:])) else 0
unused AchievementRecord("photo.original", TextUntilNul(item.hash[:]), day, 1, "", "", false, false, item.trashed)
}
rows += 1
+60 -1
View File
@@ -1,5 +1,64 @@
# Changelog
## [1.6.4] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.55.
## [1.6.3] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.54.
## [1.6.2] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.53.
## [1.6.1] - 2026-10-27
- Maintenance release for Inner Breeze 2.1.52.
## [1.6.0] - 2026-10-27
- Offer a linked habit after the first saved session of a practice.
- Give each workout exercise a short count-in.
## [1.5.4] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.5.3] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
## [1.5.2] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.48.
## [1.5.1] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.5.0] - 2026-10-25
- Running Meditation, Breathing Patterns, Wim Hof, Sun Salutation, Tai Chi, Astral Projection and 7-Minute Workout layouts now come with Practices.
- Move the remaining Customize pages, Sun Salutation's manual and Tai Chi's course chooser into the package.
- Keep animated movement figures smooth while their screens update independently. This Practices version requires an updated Breeze app.
## [1.4.0] - 2026-10-24
- Practice's home, the Wim Hof, Meditation, Patterns and Astral Projection manuals, Meditation's and Astral Projection's Customize pages, and the results after a practice now come with Practices, so they can change without an app update.
## [1.3.11] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
## [1.3.10] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.45.
## [1.3.9] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.44.
## [1.3.8] - 2026-10-23
- Maintenance release for Inner Breeze 2.1.43.
@@ -82,7 +141,7 @@
## [1.1.1] - 2026-10-06
- Use Cells consistently in the cell and its independently delivered package.
- Use Apps consistently in the app and its independently delivered package.
## [1.1.0] - 2026-10-06
+19 -45
View File
@@ -1,3 +1,6 @@
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
#import, file "../../src/practices/practice_movement_host.zi";
// Astral Projection owns its guidance and session; the host supplies the
// existing audio, storage and platform lifecycle effects.
#import, file "astral_projection_rules.zi";
@@ -212,8 +215,13 @@ AstralDrawWindow :: (app: *InnerBreeze, picture: Rectangle, output: []u8) -> str
return AstralTimeText(output)
}
AstralSessionFigure :: (app: *InnerBreeze, request: PracticeFigureRequest) {
AstralSceneDraw(app.ui.session, cast(s64)astral_clock.elapsed_seconds * 1000 + astral_clock.remainder_ms,
request.bounds, app.theme_mode == APP_THEME_DARK || (app.theme_mode != APP_THEME_LIGHT && app.dark_mode != 0),
request.key, request.alt_text)
}
AstralDraw :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
unused center_y
top := PracticeTitleBarHeight()
if PracticeTitleBar(app, LocaleText("exercise_astral_projection"), top) {
AstralRequestExit(app)
@@ -222,55 +230,19 @@ AstralDraw :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
return
}
practice_draw_audio_controls(app)
pad := AppScale(24)
width := app.ui.view_width - pad * 2
time: [32]u8
Text(app.ui.session, TextProps.{
.text = FrameTextHold(*app.ui.frame_text, AstralTimeText(time[:])),
.bounds = Rectangle.{cast(float32)pad, cast(float32)(top + AppScale(12)),
cast(float32)width, cast(float32)AppScale(48)},
.font = AppScale(28), .align = cast(TextAlign)TextAlignCenter})
cue := AstralCueAt(*astral_course, AstralElapsed())
if cue != astral_last_cue {
astral_scroll = 0
astral_last_cue = cue
}
text := AstralCueText()
text_top := top + AppScale(80)
button_y := app.ui.view_height - AppScale(76)
height := button_y - text_top - AppScale(16)
if height < AppScale(40) {
height = AppScale(40)
}
if height >= AppScale(160) {
scene_height := height * 48 / 100
AstralSceneDraw(app.ui.session, cast(s64)astral_clock.elapsed_seconds * 1000 + astral_clock.remainder_ms,
Rectangle.{cast(float32)pad, cast(float32)text_top, cast(float32)width, cast(float32)scene_height},
app.theme_mode == APP_THEME_DARK || (app.theme_mode != APP_THEME_LIGHT && app.dark_mode != 0),
KeyHash("astral/scene"), LocaleText("exercise_astral_projection"))
text_top += scene_height + AppScale(12)
height -= scene_height + AppScale(12)
}
text_h := AppParagraphHeight(text, width, AppFontSize(), 0)
scroll := Scroll(app.ui.session, ScrollProps.{.key = KeyHash("astral/guidance"),
.bounds = Rectangle.{cast(float32)pad, cast(float32)text_top,
cast(float32)width, cast(float32)height},
.content_height = text_h, .scroll_offset = astral_scroll})
astral_scroll = scroll.scroll_offset
Text(app.ui.session, TextProps.{.text = text, .bounds = Rectangle.{
scroll.content.x, scroll.content.y, cast(float32)width, cast(float32)text_h},
.font = AppFontSize(), .align = cast(TextAlign)TextAlignCenter})
unused End(app.ui.session)
button_w := AppScale(220)
if button_w > width {
button_w = width
}
if Button(app.ui.session, ButtonProps.{.key = KeyHash("astral/pause"),
.label = LocaleText(ifx app.session_paused != 0 then "patterns_resume_button" else "pause_button"),
.bounds = Rectangle.{cast(float32)(center_x - button_w / 2), cast(float32)button_y,
cast(float32)button_w, cast(float32)AppScale(48)},
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
time: [32]u8
frame := PracticeMovementFrameFor(app, EXERCISE_ASTRAL_PROJECTION, top)
frame.time = FrameTextHold(*app.ui.frame_text, AstralTimeText(time[:]))
frame.cue = AstralCueText()
frame.scroll = astral_scroll
frame = PracticeMovementRun(app, frame, AstralSessionFigure)
astral_scroll = frame.scroll
if frame.action == PRACTICE_MOVEMENT_PAUSE {
app.session_paused = ifx app.session_paused != 0 then 0 else 1
}
if app.backgrounded == 0 {
@@ -279,4 +251,6 @@ AstralDraw :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
astral_frame_carry = total - cast(float64)milliseconds
AstralAdvanceElapsed(app, milliseconds)
}
unused center_x
unused center_y
}
+13 -142
View File
@@ -1,6 +1,5 @@
// Astral Projection's How to and Customize pages, laid out as the other
// meditation practices' are: a two-page guide, and the music and voice
// narration it plays with.
// Astral Projection's How to and Customize pages: the two-page guide, which
// Practices draws, and the music and voice narration it plays with.
manual_host :: #system_library "c";
app_start_practice_from_ui :: (app: *InnerBreeze, id: s32) -> bool #foreign manual_host "practice_actions_app_start_practice_from_ui";
#import "geometry"
@@ -41,6 +40,9 @@ app_start_practice_from_ui :: (app: *InnerBreeze, id: s32) -> bool #foreign manu
#import, file "../../src/screens/practice_manual_layout.zi";
#import, file "../../src/screens/practice_screen_calls.zi";
#import, file "../../src/screens/practice_subscreen_layout.zi";
#import, file "../../src/practices/practice_manual_host.zi";
#import, file "../../src/practices/practice_settings_host.zi";
#import, file "../../src/apps/practice_types.zi";
using AppThemeMode;
using ImageFit;
@@ -74,151 +76,20 @@ AstralManualClose :: (app: *InnerBreeze, mark_seen: s32) {
app_switch_screen(app, ScreenStart)
}
AstralManualParagraph :: (step: s32, content_w: s32) -> ManualParagraphSpec {
key := ifx step == 0 then "astral_manual_intro_text" else "astral_manual_customize_text"
return manual_screen_tutorial_paragraph(LocaleText(key), content_w)
}
AstralManualContentHeight :: (step: s32, content_w: s32) -> s32 {
paragraph := AstralManualParagraph(step, content_w)
return content_w * 222 / 394 + AppScale(24) + manual_screen_guide_header_height() +
AppParagraphHeight(paragraph.text, paragraph.width, paragraph.font, paragraph.line_gap)
}
// The first page shows the practice's own picture; the second the ring the
// other meditation guides draw for Customize.
AstralManualDrawPage :: (app: *InnerBreeze, content_x: s32, content_w: s32, step: s32, y: *s32) {
hero_h := content_w * 222 / 394
hero := manual_screen_hero_bounds(content_x, content_w, y.*, hero_h)
if step == 0 {
dark := app.theme_mode == APP_THEME_DARK || (app.theme_mode != APP_THEME_LIGHT && app.dark_mode != 0)
picture: ImageProps
picture.asset_path = "assets/practices/astral_projection/banner-light.png"
if dark {
picture.asset_path = "assets/practices/astral_projection/banner-dark.png"
}
picture.alt_text = LocaleText("exercise_astral_projection")
picture.bounds = hero
picture.fit = cast(ImageFit)ImageFitCover
Image(app.ui.session, picture)
} else {
center_x := content_x + content_w / 2
center_y := y.* + hero_h / 2
face := GuideFace(2)
PaintRoundedFill(app.ui.session, -1, hero, cast(float32)AppScale(14), 10,
ColorFromPacked(face.value.background))
outer_radius := AppScale(68)
inner_radius := AppScale(48)
outer := Rectangle.{cast(float32)(center_x - outer_radius), cast(float32)(center_y - outer_radius),
cast(float32)(outer_radius * 2), cast(float32)(outer_radius * 2)}
inner := Rectangle.{cast(float32)(center_x - inner_radius), cast(float32)(center_y - inner_radius),
cast(float32)(inner_radius * 2), cast(float32)(inner_radius * 2)}
PaintRoundedFill(app.ui.session, -1, outer, cast(float32)outer_radius, 16,
ColorFromPacked(Opacity(face.value.foreground, 0.24)))
PaintRoundedFill(app.ui.session, -1, inner, cast(float32)inner_radius, 16,
ColorFromPacked(face.value.background))
title: TextProps
title.bounds = inner
title.text = LocaleText("practice_configure_button")
title.wrap = cast(TextWrap)TextWrapNone
title.align = cast(TextAlign)TextAlignCenter
title.vertical_align = cast(TextAlign)TextAlignCenter
Text(app.ui.session, title)
}
manual_screen_draw_hero_progress(hero, step, ASTRAL_MANUAL_PAGES)
y.* += hero_h + AppScale(24)
manual_screen_draw_guide_header(LocaleText(ifx step == 0 then "exercise_astral_projection" else
"practice_configure_button"), step, ASTRAL_MANUAL_PAGES, content_x, y, content_w)
ManualParagraph(app, AstralManualParagraph(step, content_w), content_x, y)
}
// Practices draws the manual (practice_manual_host.zi).
AstralManualDraw :: (app: *InnerBreeze) {
if app == null || !SessionValid(app.ui.session) { return }
step := app.tutorial_step
if step < 0 { step = 0 }
if step >= ASTRAL_MANUAL_PAGES {
step = ASTRAL_MANUAL_PAGES - 1
}
app.tutorial_step = step
responsive_max_w := cast(s32)(cast(float32)app.ui.view_width * 0.96)
if responsive_max_w > manual_screen_tutorial_max_width() {
responsive_max_w = manual_screen_tutorial_max_width()
}
if responsive_max_w < AppScale(200) {
responsive_max_w = AppScale(200)
}
layout := practice_screen_manual_layout(app, cast(ModalType)ModalPracticeManual,
ASTRAL_MANUAL_PAGES, manual_screen_tutorial_top_gap(), 0, AppScale(120))
if manual_screen_draw_title_bar(app, LocaleText("exercise_astral_projection"), layout.title_h) != 0 {
action := PracticeManualDraw(app)
if action == PRACTICE_MANUAL_CLOSE {
AstralManualClose(app, 0)
return
}
column := CenteredColumnFor(app.ui.view_width, responsive_max_w, manual_screen_tutorial_side_padding())
props: ScrollProps
props.key = KeyHash("astral/manual/scroll")
props.bounds = Rectangle.{0.0, cast(float32)layout.content_y, cast(float32)app.ui.view_width,
cast(float32)layout.content_h}
props.content_height = AstralManualContentHeight(step, column.width)
props.scroll_offset = app.manual_scroll
props.scale = MetricsScale()
result := Scroll(app.ui.session, props)
app.manual_scroll = result.scroll_offset
if result.opened {
y := cast(s32)result.content.y
AstralManualDrawPage(app, column.x, column.width, step, *y)
unused End(app.ui.session)
}
nav: ManualGuideNav
nav.page = step
nav.page_count = ASTRAL_MANUAL_PAGES
nav.y = layout.nav_y
nav.h = layout.nav_h
nav.content_y = layout.content_y
nav.content_h = layout.content_h
nav.focus_id = 425
decision := manual_screen_guide_controls(app, nav)
if decision.closed {
AstralManualClose(app, 0)
} else if decision.finished {
} else if action == PRACTICE_MANUAL_START {
AstralManualStart(app)
}
}
// Customize: the music that plays, and the voice narration with its language.
// Customize: the music that plays, and the voice narration with its
// language, which Practices draws (practice_settings_host.zi).
AstralConfigDraw :: (app: *InnerBreeze) {
if app == null {
return
if PracticeSettingsDraw(app, EXERCISE_ASTRAL_PROJECTION) != 0 {
PracticeConfigLeave(app, cast(s32)ModalPracticeConfig)
}
layout := PracticeSubscreenLayout.{0}
app.practice_config_tab = 0
PracticeConfigLayout(app, ModalPracticeConfig, AppScale(14), *layout)
if PracticeConfigTitle(app, LocaleText("practice_configure_button"), cast(s32)ModalPracticeConfig, 0) != 0 {
return
}
side_padding := GetPageSidePadding()
max_content_w := AppScale(CONTENT_MAX_W)
if max_content_w > app.ui.view_width - side_padding * 2 {
max_content_w = app.ui.view_width - side_padding * 2
}
if max_content_w < AppScale(320) {
max_content_w = AppScale(320)
}
content_x: s32 = 0
content_w: s32 = 0
GetCenteredColumn(max_content_w, side_padding, *content_x, *content_w)
content_h := AppScale(320) + PracticeNarrationSettingsHeight(app, EXERCISE_ASTRAL_PROJECTION, false, content_w)
props: ScrollProps
props.key = KeyHash("astral/customize/scroll")
props.bounds = Rectangle.{0.0, cast(float32)layout.scroll_y, cast(float32)app.ui.view_width,
cast(float32)layout.scroll_h}
props.content_height = content_h
props.scroll_offset = app.settings_scroll
result := Scroll(CurrentApp().ui.session, props)
app.settings_scroll = result.scroll_offset
y := cast(s32)result.content.y
meditation_music_draw_practice_settings(app, EXERCISE_ASTRAL_PROJECTION, content_x, content_w, *y, 0, 1)
y += AppScale(12)
unused PracticeNarrationSettings(app, EXERCISE_ASTRAL_PROJECTION, false,
app.astral_projection_narration_language[:], content_x, content_w, *y)
End(CurrentApp().ui.session)
}
+240
View File
@@ -0,0 +1,240 @@
// Tai Chi's course chooser uses the same package-owned widget surface as
// its running session. The host supplies course records and plays a choice.
#import "session"
#import "geometry"
#import "dpi"
#import "layout"
#import "text_props"
#import "semantic"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "dropdown_props"
#import "dropdown_widget"
#import "modal_props"
#import "modal_frame_widget"
#import "scroll_props"
#import "scroll_widget"
#import "tree"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
#import, file "../../src/app/exercise_types.zi";
#import, file "figure_view.zi";
using ExerciseType;
using SemanticKind;
using ButtonTone;
using ButtonEmphasis;
using ContentAlignment;
using TextAlign;
using TextWrap;
host_api :: #system_library "host_api";
ReadPracticeCourseHost :: () -> PracticeCourseFrame #foreign host_api;
WritePracticeCourseHost :: (frame: PracticeCourseFrame) #foreign host_api;
ReadPracticeCourseRowHost :: (lesson: bool, index: s32) -> PracticeCourseRow #foreign host_api;
CourseLocaleHost :: (key: string) -> string #foreign host_api;
course: PracticeCourseFrame;
COURSE_LESSON_LIMIT :: 32
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, course.scale)
}
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
return Rectangle.{cast(float32)x, cast(float32)y, cast(float32)width, cast(float32)height}
}
Locale :: (key: string) -> string {
return CourseLocaleHost(key)
}
ParagraphHeight :: (text: string, width: s32, font: s32) -> s32 {
return TextHeight(course.session, TextProps.{.text = text, .font = font,
.bounds = Bounds(0, 0, width, 0), .line_gap = Scale(3)})
}
Section :: (text: string, bounds: Rectangle) {
strong: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)text.count}]
Text(course.session, TextProps.{.text = text, .bounds = bounds,
.font = course.font + Scale(2), .strong = strong[:],
.semantic_kind = cast(SemanticKind)SemanticHeading, .heading_level = 2})
}
ChooseLesson :: (lesson: s32) {
if lesson != course.lesson && lesson >= 0 && lesson < course.lesson_count {
course.lesson = lesson
course.item_scroll = 0
course.reveal_next = false
}
}
Navigation :: (bounds: Rectangle) {
gap := Scale(8)
row_h := Scale(58)
scrolled := Scroll(course.session, ScrollProps.{.key = KeyHash("inbe/tai_chi/lessons"),
.bounds = bounds, .content_height = course.lesson_count * (row_h + gap), .scroll_offset = course.lesson_scroll})
course.lesson_scroll = scrolled.scroll_offset
if !scrolled.opened {
return
}
for index: cast(s32)0..course.lesson_count - 1 {
lesson := ReadPracticeCourseRowHost(true, index)
selected := index == course.lesson
if Button(course.session, ButtonProps.{.key = KeyHash("inbe/tai_chi/lesson") + cast(u64)index,
.bounds = Rectangle.{scrolled.content.x, scrolled.content.y + cast(float32)(index * (row_h + gap)),
bounds.width - cast(float32)Scale(10), cast(float32)row_h},
.label = lesson.title, .detail = lesson.subtitle, .selected = selected,
.tone = cast(ButtonTone)(ifx selected then ButtonToneAccent else ButtonToneNeutral),
.emphasis = cast(ButtonEmphasis)(ifx selected then ButtonEmphasisFilled else ButtonEmphasisSoft),
.content_alignment = cast(ContentAlignment)ContentAlignmentStart}) != 0 {
ChooseLesson(index)
}
}
unused End(course.session)
}
Card :: (bounds: Rectangle, index: s32, row: PracticeCourseRow) -> bool {
key := KeyHash("inbe/tai_chi/item-card") + cast(u64)index * cast(u64)4096
clicked := Button(course.session, ButtonProps.{.key = key, .bounds = bounds,
.selected = index == course.next_item, .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0
padding := cast(float32)Scale(14)
text_y := bounds.y + bounds.height - cast(float32)Scale(76)
PracticeFigure(PracticeFigureRequest.{.practice = EXERCISE_TAI_CHI, .preview = true,
.index = index, .character = course.character, .key = key + cast(u64)1000, .alt_text = row.title,
.bounds = Rectangle.{bounds.x + padding, bounds.y + padding,
bounds.width - padding * 2.0, bounds.height - cast(float32)Scale(94)}})
Text(course.session, TextProps.{.text = row.title, .font = course.font,
.bounds = Rectangle.{bounds.x + padding, text_y, bounds.width - padding * 2.0, cast(float32)Scale(44)}})
Text(course.session, TextProps.{.text = row.detail, .font = course.small_font, .class_name = course.muted_class,
.wrap = cast(TextWrap)TextWrapEllipsis, .bounds = Rectangle.{bounds.x + padding,
text_y + cast(float32)Scale(48), bounds.width - padding * 2.0, cast(float32)Scale(24)}})
if row.done {
unused Button(course.session, ButtonProps.{.key = key + cast(u64)2000,
.bounds = Rectangle.{bounds.x + bounds.width - cast(float32)Scale(38), bounds.y + cast(float32)Scale(8),
cast(float32)Scale(30), cast(float32)Scale(30)},
.icon_only = true, .icon_shape = TAI_CHI_DONE_ICON, .disabled = true,
.tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft})
}
return clicked
}
Cards :: (bounds: Rectangle) {
lesson := ReadPracticeCourseRowHost(true, course.lesson)
gap := Scale(14)
columns: s32 = ifx bounds.width >= cast(float32)Scale(460) then 2 else 1
card_w := (cast(s32)bounds.width - gap * (columns - 1) - Scale(10)) / columns
card_h := Scale(252)
heading_h := ParagraphHeight(lesson.title, cast(s32)bounds.width - Scale(12), course.font + Scale(2))
summary_h: s32 = 0
if lesson.summary.count > 0 {
summary_h = ParagraphHeight(lesson.summary, cast(s32)bounds.width - Scale(12), course.font) + gap
}
header_h := heading_h + gap + summary_h + gap
rows := (lesson.count + columns - 1) / columns
if course.reveal_next {
course.reveal_next = false
offset := course.next_item - lesson.first
if offset >= columns {
course.item_scroll = header_h + (offset / columns) * (card_h + gap)
}
}
scrolled := Scroll(course.session, ScrollProps.{.key = KeyHash("inbe/tai_chi/items"),
.bounds = bounds, .content_height = header_h + rows * (card_h + gap), .scroll_offset = course.item_scroll})
course.item_scroll = scrolled.scroll_offset
if !scrolled.opened {
return
}
Section(lesson.title, Rectangle.{scrolled.content.x, scrolled.content.y, bounds.width - cast(float32)Scale(12),
cast(float32)heading_h})
Text(course.session, TextProps.{.text = lesson.summary, .class_name = course.muted_class,
.bounds = Rectangle.{scrolled.content.x, scrolled.content.y + cast(float32)(heading_h + gap),
bounds.width - cast(float32)Scale(12), cast(float32)summary_h}})
for offset: cast(s32)0..lesson.count - 1 {
index := lesson.first + offset
card := Rectangle.{scrolled.content.x + cast(float32)(offset % columns * (card_w + gap)),
scrolled.content.y + cast(float32)(header_h + offset / columns * (card_h + gap)),
cast(float32)card_w, cast(float32)card_h}
if card.y + card.height < bounds.y || card.y > bounds.y + bounds.height {
continue
}
if Card(card, index, ReadPracticeCourseRowHost(false, index)) {
course.action = PRACTICE_COURSE_PLAY
course.value = index
break
}
}
unused End(course.session)
}
Course :: () {
width := course.view_width - Scale(32)
if width > Scale(1060) {
width = Scale(1060)
}
height := course.view_height - Scale(48)
if height > Scale(740) {
height = Scale(740)
}
frame := ModalFrame(course.session, ModalFrameProps.{.key = KeyHash("inbe/tai_chi/modal"),
.title = Locale("tai_chi_course_title"), .width = width, .height = height, .scale = course.scale,
.title_at_start = true, .strong_title = true, .has_right_action = true, .right_label = Locale("close_button")})
if frame.dismissed || frame.right_clicked {
course.action = PRACTICE_COURSE_CLOSE
return
}
if !frame.opened {
return
}
bounds := frame.layout.content
progress_h := Scale(32)
Text(course.session, TextProps.{.text = course.progress, .class_name = course.muted_class,
.wrap = cast(TextWrap)TextWrapEllipsis,
.bounds = Rectangle.{bounds.x, bounds.y, bounds.width, cast(float32)progress_h}})
bounds.y += cast(float32)(progress_h + Scale(10))
bounds.height -= cast(float32)(progress_h + Scale(10))
if bounds.width >= cast(float32)Scale(700) {
sidebar := bounds
sidebar.width = cast(float32)Scale(190)
Navigation(sidebar)
bounds.x += sidebar.width + cast(float32)Scale(24)
bounds.width -= sidebar.width + cast(float32)Scale(24)
} else {
options: [COURSE_LESSON_LIMIT]DropdownOption
for index: cast(s32)0..course.lesson_count - 1 {
options[index].label = ReadPracticeCourseRowHost(true, index).title
}
choice := Dropdown(course.session, DropdownProps.{.key = KeyHash("inbe/tai_chi/lesson-select"),
.bounds = Rectangle.{bounds.x, bounds.y, bounds.width, cast(float32)Scale(48)},
.selected_index = course.lesson}, options[:course.lesson_count])
if choice.changed {
ChooseLesson(choice.selected_index)
}
bounds.y += cast(float32)Scale(62)
bounds.height -= cast(float32)Scale(62)
}
Cards(bounds)
unused End(course.session)
}
PracticeCourseView :: (message: PracticeMessage) -> PracticeMessage {
course = ReadPracticeCourseHost()
course.action = PRACTICE_COURSE_NONE
course.value = 0
if course.lesson_count < 1 || course.lesson_count > COURSE_LESSON_LIMIT {
message.succeeded = false
return message
}
if course.lesson < 0 || course.lesson >= course.lesson_count {
course.lesson = 0
}
Course()
WritePracticeCourseHost(course)
message.succeeded = true
return message
}
TAI_CHI_DONE_ICON :: "F:M8.46431 11.2095C8.07379 10.819 7.44063 10.819 7.0501 11.2095C6.65958 11.6 6.65958 12.2332 7.0501 12.6237L7.75721 11.9166L8.46431 11.2095ZM10.5856 14.745L9.87853 15.4522C10.2691 15.8427 10.9022 15.8427 11.2927 15.4522L10.5856 14.745ZM16.9496 9.7953C17.3401 9.40478 17.3401 8.77161 16.9496 8.38109C16.5591 7.99056 15.9259 7.99056 15.5354 8.38109L16.2425 9.08819L16.9496 9.7953ZM21 12H20C20 16.4183 16.4183 20 12 20V21V22C17.5228 22 22 17.5228 22 12H21ZM12 21V20C7.58172 20 4 16.4183 4 12H3H2C2 17.5228 6.47715 22 12 22V21ZM3 12H4C4 7.58172 7.58172 4 12 4V3V2C6.47715 2 2 6.47715 2 12H3ZM12 3V4C16.4183 4 20 7.58172 20 12H21H22C22 6.47715 17.5228 2 12 2V3ZM7.75721 11.9166L7.0501 12.6237L9.87853 15.4522L10.5856 14.745L11.2927 14.0379L8.46431 11.2095L7.75721 11.9166ZM10.5856 14.745L11.2927 15.4522L16.9496 9.7953L16.2425 9.08819L15.5354 8.38109L9.87853 14.0379L10.5856 14.745Z"
-342
View File
@@ -1,342 +0,0 @@
// What a practice's card on Practice offers when the practice is not ready:
// Install with its size, Unlock with its price for a paid practice, or
// Cancel while it downloads; practices that come with the app are always
// ready.
#import "entity/dew_model"
#import, file "../../src/app/app_types.zi";
#import, file "../../src/app/app_modal_state.zi";
#import, file "../../src/app/app_settings.zi";
#import, file "../../src/app/exercise_types.zi";
#import, file "../../src/app/color.zi";
#import, file "../../src/app/locale.zi";
#import, file "../../src/app/metrics.zi";
#import, file "../../src/app/text_buffers.zi";
#import, file "../../src/practices/practice_registry.zi";
#import, file "../../src/practices/practice_downloads.zi";
#import, file "../../src/storage/temporary_data.zi";
#import, file "../../src/storage/dew.zi";
#import, file "../../src/storage/practice_unlocks.zi";
#import, file "../../src/screens/dew_worth.zi";
#import "text_buffer"
#import "box_props"
#import "box_widget"
#import "drawing_props"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "geometry"
#import "paint_queue"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "tree"
#import "session"
#import "layout"
using ButtonTone;
using ButtonEmphasis;
using ControlSize;
using TextWrap;
using TextAlign;
// The one thing a card's download button does.
PRACTICE_ACTION_NONE :: 0
PRACTICE_ACTION_INSTALL :: 1
PRACTICE_ACTION_BUY :: 2
PRACTICE_ACTION_CANCEL :: 3
// A paid practice this account has not unlocked offers its unlock instead of
// a download, even when its pack is on this device.
PracticeDownloadLocked :: (practice: s32) -> bool {
product := PracticeProduct(practice)
return product.count > 0 && !UnlockOwned(product)
}
PracticeDownloadPriceText :: (app: *InnerBreeze, key: string) -> string {
price: [32]u8
unused DewFormat(unlock_price, DewUnits, price[:])
args: [1]FormatArg = .[FormatArg.{.text = TextUntilNul(price[:]), .is_text = true}]
buffer: [256]u8
unused FormatTemplate(LocaleText(key), args[:], buffer[:])
return FrameTextHold(*app.ui.frame_text, AppTextFromCString(*buffer[0], 256))
}
PracticeDownloadPriceRowHeight :: () -> s32 {
return AppSmallFontSize() + AppScale(12)
}
// The offer row, with what the price is worth under it once the node's
// rates are known.
PracticeDownloadPriceHeight :: () -> s32 {
height: s32 = 0
if UnlockOffer() && unlock_regular_price > 0 {
height = PracticeDownloadPriceRowHeight()
}
worth: [128]u8
if DewWorthText(unlock_price, worth[:]) {
height += AppSmallFontSize() + AppScale(6)
}
return height
}
// The Unlock button says the price; during an offer the regular price is
// struck through beside its discount badge, such as -90%.
PracticeDownloadPrice :: (app: *InnerBreeze, x: s32, y: s32, width: s32) {
DewRatesRefresh()
font := AppSmallFontSize()
height: s32 = 0
if UnlockOffer() && unlock_regular_price > 0 {
height = PracticeDownloadPriceRowHeight()
regular_text: [32]u8
unused DewFormat(unlock_regular_price, DewUnits, regular_text[:])
unused AppAppendText(" Dew", regular_text[:])
regular := FrameTextHold(*app.ui.frame_text, TextUntilNul(regular_text[:]))
regular_w := AppTextWidth(regular, font)
Text(app.ui.session, TextProps.{
.bounds = Rectangle.{cast(float32)x, cast(float32)y, cast(float32)regular_w, cast(float32)height},
.text = regular, .font = font, .vertical_align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapNone, .disabled = true, .strikethrough = true})
percent := ((unlock_regular_price - unlock_price) * 100 + unlock_regular_price / 2) / unlock_regular_price
badge_text: [16]u8
unused AppCopyText("-", badge_text[:])
number: [8]u8
unused AppFormatS64(percent, number[:])
unused AppAppendText(TextUntilNul(number[:]), badge_text[:])
unused AppAppendText("%", badge_text[:])
badge := FrameTextHold(*app.ui.frame_text, TextUntilNul(badge_text[:]))
badge_h := font + AppScale(8)
badge_w := AppTextWidth(badge, font) + AppScale(14)
left := x + regular_w + AppScale(10)
tint := StyleTokenColor("accent")
tint.a = cast(u8)64
Box(app.ui.session, BoxProps.{
.bounds = Rectangle.{cast(float32)left, cast(float32)(y + (height - badge_h) / 2),
cast(float32)badge_w, cast(float32)badge_h},
.fill = tint, .radius = cast(float32)badge_h / 2.0})
Text(app.ui.session, TextProps.{
.bounds = Rectangle.{cast(float32)left, cast(float32)(y + (height - badge_h) / 2),
cast(float32)badge_w, cast(float32)badge_h},
.text = badge, .font = font, .align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone})
}
worth: [128]u8
if DewWorthText(unlock_price, worth[:]) {
Text(app.ui.session, TextProps.{
.bounds = Rectangle.{cast(float32)x, cast(float32)(y + height),
cast(float32)width, cast(float32)(font + AppScale(6))},
.text = FrameTextHold(*app.ui.frame_text, TextUntilNul(worth[:])),
.font = font, .vertical_align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapNone})
}
}
// Narration follows its practice in the language it speaks, so it counts in
// the size.
PracticeDownloadBytes :: (app: *InnerBreeze, practice: s32) -> s64 {
bytes := PracticeContentBytes(practice)
if app.voice_narration_enabled != 0 {
bytes += PracticeNarrationFollowingBytes(practice)
}
return bytes
}
// Small packs show kilobytes instead of a rounded-up megabyte.
PracticeDownloadSmall :: (bytes: s64) -> bool {
return bytes < 1024 * 1024
}
PracticeDownloadAmount :: (bytes: s64) -> s32 {
if PracticeDownloadSmall(bytes) {
return cast(s32)((bytes + 1023) / 1024)
}
return cast(s32)((bytes + 512 * 1024) / (1024 * 1024))
}
// A practice's size, such as "12 MB" or "596 KB".
PracticeDownloadSize :: (app: *InnerBreeze, practice: s32, output: []u8) {
bytes := PracticeDownloadBytes(app, practice)
args: [1]FormatArg = .[FormatArg.{.number = PracticeDownloadAmount(bytes)}]
unused FormatTemplate(LocaleText(ifx PracticeDownloadSmall(bytes) then "practice_size_kb" else "practice_size_mb"),
args[:], output)
}
// Content from an older app package, without a pack of its own: on Practice,
// with nothing to manage.
PracticeDownloadIncluded :: (practice: s32) -> bool {
return PracticePackFind(practice, "") < 0 && PracticeContentReady(practice)
}
// A downloaded copy can be deleted to free its space; a practice that ships
// with the app cannot.
PracticeDownloadStored :: (practice: s32) -> bool {
return !PracticeDownloadLocked(practice) && !PracticeDownloadIncluded(practice) &&
!PracticeShipped(practice) && PracticeContentStatus(practice) == 2
}
// Ready to start: on this device, unlocked when it is paid.
PracticeDownloadReady :: (practice: s32) -> bool {
if PracticeDownloadLocked(practice) {
return false
}
return PracticeDownloadIncluded(practice) || (PracticeInstalled(practice) && PracticeContentReady(practice))
}
// What the card offers in place of Start: Unlock for a paid practice not
// unlocked yet, Cancel while it downloads, Install otherwise, and nothing
// once it is ready.
PracticeDownloadAction :: (practice: s32) -> s32 {
if PracticeDownloadLocked(practice) {
return PRACTICE_ACTION_BUY
}
if PracticeDownloadReady(practice) {
return PRACTICE_ACTION_NONE
}
if PracticeContentStatus(practice) == 1 {
return PRACTICE_ACTION_CANCEL
}
return PRACTICE_ACTION_INSTALL
}
// The line under a practice's description: how its download is going.
PracticeDownloadLine :: (app: *InnerBreeze, practice: s32) -> string {
unused app
status := PracticeContentStatus(practice)
if status == 1 {
return LocaleText("practice_download_busy")
}
if status == 3 {
return LocaleText("practice_download_failed")
}
return ""
}
// Why a paid practice cannot be unlocked yet, or nothing.
PracticeDownloadNote :: (practice: s32) -> string {
if !PracticeDownloadLocked(practice) {
return ""
}
if !DewReady() {
return LocaleText("practice_unlock_account")
}
if UnlockBuying() {
return LocaleText("practice_unlock_busy")
}
if unlock_notice.count > 0 {
return LocaleText(unlock_notice)
}
return ""
}
PracticeDownloadActionLabel :: (app: *InnerBreeze, practice: s32, action: s32) -> string {
if action == PRACTICE_ACTION_BUY {
return PracticeDownloadPriceText(app, "practice_unlock_button")
}
if action == PRACTICE_ACTION_CANCEL {
return LocaleText("cancel_button")
}
// The size rides on the button, so the row's text stays short.
size: [32]u8
PracticeDownloadSize(app, practice, size[:])
label: [128]u8
unused AppCopyText(LocaleText("practice_install"), label[:])
unused AppAppendText(" · ", label[:])
unused AppAppendText(TextUntilNul(size[:]), label[:])
return FrameTextHold(*app.ui.frame_text, TextUntilNul(label[:]))
}
// Does what a card's download button says.
PracticeDownloadAct :: (app: *InnerBreeze, practice: s32, action: s32) {
if action == PRACTICE_ACTION_BUY {
UnlockStart()
} else if action == PRACTICE_ACTION_CANCEL {
PracticeContentCancel(practice)
} else if action == PRACTICE_ACTION_INSTALL {
if DataTemporary() {
app.exercise_type = practice
}
PracticeContentRequest(practice)
}
}
// Each frame Practice shows: one stored copy checked, unlocks kept current,
// and a finished unlock downloads what it unlocked.
PracticeDownloadsTick :: () {
PracticeContentReviewNext()
UnlockRefresh()
if UnlockTakeBought() {
for practice: cast(s32)0..practice_count() - 1 {
if PracticeProduct(practice) == UnlockTaiChi {
PracticeContentRequest(practice)
}
}
}
}
// The card's lines under its description: the download's progress or
// failure, the price of a paid practice and why it cannot be unlocked yet.
PracticeCardStatusHeight :: (app: *InnerBreeze, practice: s32, width: s32) -> s32 {
height: s32 = 0
line := PracticeDownloadLine(app, practice)
if line.count > 0 {
height += AppParagraphHeight(line, width, AppSmallFontSize(), AppScale(3)) + AppScale(4)
}
if PracticeDownloadLocked(practice) && PracticeDownloadPriceHeight() > 0 {
height += PracticeDownloadPriceHeight() + AppScale(4)
}
note := PracticeDownloadNote(practice)
if note.count > 0 {
height += AppParagraphHeight(note, width, AppSmallFontSize(), AppScale(3)) + AppScale(4)
}
return height
}
PracticeCardStatus :: (app: *InnerBreeze, practice: s32, x: s32, y: s32, width: s32) {
line := PracticeDownloadLine(app, practice)
if line.count > 0 {
height := AppParagraphHeight(line, width, AppSmallFontSize(), AppScale(3))
Text(app.ui.session, TextProps.{
.bounds = Rectangle.{cast(float32)x, cast(float32)(y + AppScale(4)), cast(float32)width, cast(float32)height},
.text = line, .font = AppSmallFontSize(), .align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapAuto})
y += height + AppScale(4)
}
if PracticeDownloadLocked(practice) && PracticeDownloadPriceHeight() > 0 {
price_w := width
if price_w > AppScale(300) {
price_w = AppScale(300)
}
PracticeDownloadPrice(app, x + (width - price_w) / 2, y + AppScale(4), price_w)
y += PracticeDownloadPriceHeight() + AppScale(4)
}
note := PracticeDownloadNote(practice)
if note.count > 0 {
height := AppParagraphHeight(note, width, AppSmallFontSize(), AppScale(3))
Text(app.ui.session, TextProps.{
.bounds = Rectangle.{cast(float32)x, cast(float32)(y + AppScale(4)), cast(float32)width, cast(float32)height},
.text = note, .font = AppSmallFontSize(), .align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapAuto})
}
}
// The card's download button in place of Start.
PracticeCardAction :: (app: *InnerBreeze, practice: s32, bounds: Rectangle) {
action := PracticeDownloadAction(practice)
if action == PRACTICE_ACTION_NONE {
return
}
disabled := app.modal.active != 0 || practice_active(app) != null
if action == PRACTICE_ACTION_BUY {
disabled = disabled || !DewReady() || UnlockBuying()
} else if action == PRACTICE_ACTION_INSTALL {
disabled = disabled || !PracticePackReviewed(practice, "")
}
cancel := action == PRACTICE_ACTION_CANCEL
if Button(app.ui.session, ButtonProps.{
.id = 17410 + practice * 2, .bounds = bounds, .pill = true,
.label = PracticeDownloadActionLabel(app, practice, action), .disabled = disabled,
.tone = cast(ButtonTone)(ifx cancel then ButtonToneNeutral else ButtonToneAccent),
.emphasis = cast(ButtonEmphasis)(ifx cancel then ButtonEmphasisSoft else ButtonEmphasisFilled),
.size = cast(ControlSize)ControlSizeLarge}) != 0 {
PracticeDownloadAct(app, practice, action)
}
}
+9
View File
@@ -0,0 +1,9 @@
// One bounded host effect per figure keeps the native mesh caches and
// avoids sending hundreds of mesh records over the portable UI boundary.
#import, file "../../src/apps/practice_ui_types.zi";
host_api :: #system_library "host_api";
DrawPracticeFigureHost :: (request: PracticeFigureRequest) #foreign host_api;
PracticeFigure :: (request: PracticeFigureRequest) {
DrawPracticeFigureHost(request)
}
+28
View File
@@ -0,0 +1,28 @@
// Reminders follow the elapsed hold, independently of the breathing rounds.
HoldReminderResult :: struct {
last_bucket: s32
ring: bool
}
HoldReminderSeconds :: (seconds: s32) -> s32 {
if seconds == 30 || seconds == 60 {
return seconds
}
return 0
}
HoldReminderAdvance :: (holding: bool, seconds: s32,
interval: s32, last_bucket: s32) -> HoldReminderResult {
result: HoldReminderResult
interval = HoldReminderSeconds(interval)
if !holding || interval == 0 || seconds < 0 {
return result
}
result.last_bucket = last_bucket
bucket := seconds / interval
if bucket > 0 && bucket > last_bucket {
result.last_bucket = bucket
result.ring = true
}
return result
}
+853
View File
@@ -0,0 +1,853 @@
#import, file "figure_view.zi";
// A practice's manual: a few pages, each with a picture or a small preview,
// its title with "Step 1 of 4", and what to know, turned with Back and Next,
// a swipe or the arrow keys; the last page's Next starts the practice. The
// Wim Hof manual changes the breathing speed on its breathing page. The host
// keeps the page, the settings and what closing or starting does.
#import "session"
#import "geometry"
#import "vec"
#import "dpi"
#import "layout"
#import "drawing_props"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "box_props"
#import "box_widget"
#import "image_props"
#import "image_widget"
#import "scroll_props"
#import "scroll_widget"
#import "shape_props"
#import "shape_widget"
#import "slider_props"
#import "slider_widget"
#import "progress_props"
#import "progress_widget"
#import "title_bar_props"
#import "title_bar_widget"
#import "dropdown_props"
#import "swipe_props"
#import "swipe"
#import "tree"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
#import, file "../../src/app/exercise_types.zi";
#import, file "../../src/practices/patterns/patterns_rules.zi";
using ButtonTone;
using ButtonEmphasis;
using ExerciseType;
using ImageFit;
using SwipeDirection;
using TextAlign;
using TextWrap;
host_api :: #system_library "host_api";
ReadPracticeManualHost :: () -> PracticeManualFrame #foreign host_api;
WritePracticeManualHost :: (frame: PracticeManualFrame) #foreign host_api;
ManualLocaleHost :: (key: string) -> string #foreign host_api;
manual: PracticeManualFrame;
MANUAL_MAX_WIDTH :: 640
MANUAL_SIDE_PADDING :: 24
MANUAL_TOP_GAP :: 24
MANUAL_LINE_GAP :: 6
MANUAL_NAV_HEIGHT :: 68
MANUAL_SPEED_ID :: 490
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, manual.scale)
}
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
return Rectangle.{cast(float32)x, cast(float32)y,
cast(float32)width, cast(float32)height}
}
Locale :: (key: string) -> string {
return ManualLocaleHost(key)
}
Width :: (text: string, font: s32) -> s32 {
return TextWidth(manual.session, TextProps.{.text = text, .font = font})
}
FitFont :: (text: string, max_width: s32, preferred: s32, minimum: s32) -> s32 {
font := preferred
if max_width <= 0 {
return font
}
while font > minimum && Width(text, font) > max_width {
font -= 1
}
return font
}
Alpha :: (color: Color, opacity: float32) -> Color {
color.a = cast(u8)(cast(float32)color.a * opacity)
return color
}
// The template with each %d replaced by the next value.
Filled :: (template: string, first: s32, second: s32) -> string {
out: Vec(u8)
values: [2]s32 = .[first, second]
used: s32 = 0
at: s64 = 0
while at < template.count {
if at + 1 < template.count && template[at] == cast(u8)37 &&
template[at + 1] == cast(u8)100 && used < 2 {
BuilderPrint(*out, "%", values[used])
used += 1
at += 2
} else {
BuilderPrint(*out, "%", template[at:at + 1])
at += 1
}
}
return BuilderFinish(out)
}
Number :: (value: s32) -> string {
out: Vec(u8)
BuilderPrint(*out, "%", value)
return BuilderFinish(out)
}
// ---- What every manual shares ---------------------------------------------------
PageCount :: () -> s32 {
if manual.practice == EXERCISE_WIM_HOF { return 4 }
if manual.practice == EXERCISE_PATTERNS || manual.practice == EXERCISE_SUN_SALUTATION { return 3 }
return 2
}
ParagraphHeight :: (text: string, width: s32) -> s32 {
return TextHeight(manual.session, TextProps.{.text = text, .font = manual.font,
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto,
.line_gap = Scale(MANUAL_LINE_GAP)})
}
// A paragraph, measured with the manual's line gap; y moves below it.
Paragraph :: (text: string, x: s32, y: *s32, width: s32, align: TextAlign) {
if width <= 0 {
return
}
height := ParagraphHeight(text, width)
Text(manual.session, TextProps.{.bounds = Bounds(x, y.*, width, height), .text = text,
.font = manual.font, .wrap = cast(TextWrap)TextWrapAuto, .align = align})
y.* += height
}
// One line, centred on its height and, when asked, across it.
Label :: (text: string, bounds: Rectangle, font: s32, centred: bool) {
Text(manual.session, TextProps.{.text = text, .bounds = bounds, .font = font,
.wrap = cast(TextWrap)TextWrapNone, .vertical_align = cast(TextAlign)TextAlignCenter,
.align = cast(TextAlign)(ifx centred then TextAlignCenter else TextAlignStart)})
}
// A rounded card in the guide's colours, outlined when it stands out.
Panel :: (bounds: Rectangle, radius: s32, outline: bool) {
Box(manual.session, BoxProps.{.bounds = bounds, .fill = manual.guide_background,
.border = ifx outline then manual.guide_foreground else Color.{},
.radius = cast(float32)radius})
}
Disc :: (center_x: s32, center_y: s32, radius: s32, color: Color) {
Box(manual.session, BoxProps.{.bounds = Bounds(center_x - radius, center_y - radius,
radius * 2, radius * 2), .fill = color, .radius = cast(float32)radius})
}
HeaderHeight :: () -> s32 {
return Scale(42) + Scale(10) + Scale(24) + Scale(16)
}
// The page's title, with "Step 2 of 4" under it.
Header :: (title: string, x: s32, y: *s32, width: s32) {
page := manual.page
Text(manual.session, TextProps.{.bounds = Bounds(x, y.*, width, Scale(42)), .text = title,
.wrap = cast(TextWrap)TextWrapNone, .vertical_align = cast(TextAlign)TextAlignCenter})
Text(manual.session, TextProps.{.bounds = Bounds(x, y.* + Scale(52), width, Scale(24)),
.text = Filled(Locale("tutorial_step_progress"), page + 1, PageCount()),
.wrap = cast(TextWrap)TextWrapNone})
y.* += HeaderHeight()
}
// The page dots along the bottom of a page's picture.
HeroDots :: (bounds: Rectangle) {
count := PageCount()
if bounds.width <= 0.0 || bounds.height <= 0.0 {
return
}
gap := Scale(18)
dots_width := (count - 1) * gap
center_x := cast(s32)(bounds.x + bounds.width / 2.0)
dots_y := cast(s32)(bounds.y + bounds.height - cast(float32)Scale(15))
for index: cast(s32)0..count - 1 {
active := index == manual.page
radius := ifx active then Scale(4) else Scale(3)
Disc(center_x - dots_width / 2 + index * gap, dots_y, radius,
ifx active then manual.guide_foreground else manual.guide_border)
}
}
// A page's picture keeps to the screen.
Hero :: (x: s32, width: s32, y: s32, height: s32) -> Rectangle {
if x < 0 {
width += x
x = 0
}
if x + width > manual.view_width {
width = manual.view_width - x
}
if width < 0 {
width = 0
}
return Bounds(x, y, width, height)
}
Picture :: (asset: string, alt: string, bounds: Rectangle, fit: ImageFit) {
Image(manual.session, ImageProps.{.asset_path = asset, .alt_text = alt, .bounds = bounds,
.fit = fit})
}
// The ring Meditation and Astral Projection show for Customize.
CustomizeRing :: (hero: Rectangle, label: string) {
Box(manual.session, BoxProps.{.bounds = hero, .fill = manual.guide_background,
.radius = cast(float32)Scale(14)})
center_x := cast(s32)(hero.x + hero.width / 2.0)
center_y := cast(s32)(hero.y + hero.height / 2.0)
Disc(center_x, center_y, Scale(68), Alpha(manual.guide_foreground, 0.24))
Disc(center_x, center_y, Scale(48), manual.guide_background)
inner := Scale(48)
Text(manual.session, TextProps.{.bounds = Bounds(center_x - inner, center_y - inner,
inner * 2, inner * 2), .text = label, .wrap = cast(TextWrap)TextWrapNone,
.align = cast(TextAlign)TextAlignCenter, .vertical_align = cast(TextAlign)TextAlignCenter})
}
// ---- Meditation and Astral Projection ---------------------------------------------
PictureHeight :: (width: s32) -> s32 {
return width * 222 / 394
}
PictureBodyKey :: () -> string {
if manual.practice == EXERCISE_ASTRAL_PROJECTION {
return ifx manual.page == 0 then "astral_manual_intro_text" else "astral_manual_customize_text"
}
return ifx manual.page == 0 then "meditation_manual_intro_text" else "meditation_manual_customize_text"
}
PicturePageHeight :: (width: s32) -> s32 {
return PictureHeight(width) + Scale(24) + HeaderHeight() +
ParagraphHeight(Locale(PictureBodyKey()), width)
}
PicturePage :: (x: s32, width: s32, y: *s32) {
astral := manual.practice == EXERCISE_ASTRAL_PROJECTION
height := PictureHeight(width)
hero := Hero(x, width, y.*, height)
title := Locale("practice_configure_button")
if manual.page == 0 {
if astral {
title = Locale("exercise_astral_projection")
Picture(ifx manual.dark then "assets/practices/astral_projection/banner-dark.png"
else "assets/practices/astral_projection/banner-light.png", title, hero,
cast(ImageFit)ImageFitCover)
} else {
title = Locale("meditation_title")
Picture("assets/practices/meditation/1.png", title, hero, cast(ImageFit)ImageFitContain)
}
} else {
CustomizeRing(hero, ifx astral then title else Locale("meditation_title"))
}
HeroDots(hero)
y.* += height + Scale(24)
Header(title, x, y, width)
Paragraph(Locale(PictureBodyKey()), x, y, width, cast(TextAlign)TextAlignStart)
}
// ---- Wim Hof ----------------------------------------------------------------------------
WhmBodyKey :: (page: s32) -> string {
if page == 0 { return "tutorial_step_intro" }
if page == 1 { return "tutorial_step_breathe" }
if page == 2 { return "tutorial_step_exhale_hold" }
return "tutorial_step_inhale_hold"
}
WhmTitleKey :: (page: s32) -> string {
if page == 0 { return "tutorial_title_before_begin" }
if page == 1 { return "tutorial_title_breathe" }
if page == 2 { return "tutorial_title_exhale_hold" }
return "tutorial_title_recovery_breath"
}
WhmHintKey :: (page: s32) -> string {
return ifx page == 3 then "tutorial_step_inhale_hold_hint" else "tutorial_step_exhale_hold_hint"
}
WhmVisualHeight :: (page: s32) -> s32 {
return ifx page == 1 || page == 2 then Scale(238) else Scale(242)
}
WhmHintHeight :: (text: string, width: s32) -> s32 {
text_width := width - Scale(72)
if text_width < Scale(160) {
text_width = width - Scale(32)
}
height := ParagraphHeight(text, text_width) + Scale(42)
if height < Scale(112) {
height = Scale(112)
}
return height
}
WhmPageHeight :: (width: s32) -> s32 {
page := manual.page
height := HeaderHeight() + WhmVisualHeight(page) + ParagraphHeight(Locale(WhmBodyKey(page)), width)
if page == 0 {
height += Scale(16 + 34 + 36 + 6) +
ParagraphHeight(Locale("tutorial_safety_warning"), width - Scale(84))
} else if page == 1 {
height += Scale(18 + 24 + 86)
} else {
height += Scale(24) + ifx page == 2 then Scale(18) else Scale(16)
height += WhmHintHeight(Locale(WhmHintKey(page)), width)
}
return height
}
// The breath, or the held breath with its time, in a soft ring.
WhmCircle :: (center_x: s32, center_y: s32, radius: s32, label: string) {
Disc(center_x, center_y, radius + Scale(18), Alpha(manual.guide_foreground, 0.20))
Disc(center_x, center_y, radius, manual.guide_background)
Ring(manual.session, RingProps.{
.center = Vector2.{cast(float32)center_x, cast(float32)center_y},
.inner_radius = cast(float32)(radius - Scale(2)), .outer_radius = cast(float32)radius,
.end_angle = 360.0, .color = manual.guide_foreground})
if label.count > 0 {
Label(label, Bounds(center_x - radius, center_y - radius, radius * 2, radius * 2),
manual.font, true)
}
}
WhmSafety :: (x: s32, width: s32, y: *s32) {
text := Locale("tutorial_safety_warning")
text_width := width - Scale(84)
height := ParagraphHeight(text, text_width) + Scale(36)
Panel(Bounds(x, y.*, width, height), Scale(16), true)
badge := Scale(30)
Label("!", Bounds(x + Scale(19), y.* + (height - badge) / 2, badge, badge), manual.font, true)
text_y := y.* + Scale(18)
Paragraph(text, x + Scale(64), *text_y, text_width, cast(TextAlign)TextAlignStart)
y.* += height + Scale(6)
}
WhmHint :: (x: s32, width: s32, y: *s32) {
text := Locale(WhmHintKey(manual.page))
height := WhmHintHeight(text, width)
Panel(Bounds(x, y.*, width, height), Scale(16), true)
padding := Scale(36)
text_width := width - padding * 2
if text_width < Scale(160) {
padding = Scale(16)
text_width = width - padding * 2
}
text_y := y.* + (height - ParagraphHeight(text, text_width)) / 2
Paragraph(text, x + padding, *text_y, text_width, cast(TextAlign)TextAlignCenter)
y.* += height
}
// The breathing speed, changed right on the page.
WhmSpeed :: (x: s32, width: s32, y: *s32) {
height := Scale(86)
Panel(Bounds(x, y.*, width, height), Scale(14), false)
row_x := x + Scale(18)
row_width := width - Scale(36)
row_y := y.* + Scale(9)
label := Locale("speed_label")
Text(manual.session, TextProps.{.text = label, .font = manual.small_font,
.wrap = cast(TextWrap)TextWrapNone, .bounds = Bounds(row_x, row_y, row_width - Scale(64), Scale(20))})
Text(manual.session, TextProps.{.text = Number(manual.speed), .font = manual.small_font,
.wrap = cast(TextWrap)TextWrapNone, .align = cast(TextAlign)TextAlignEnd,
.bounds = Bounds(row_x + row_width - Scale(64), row_y, Scale(64), Scale(20))})
step := DiscreteSlider(manual.session, DiscreteSliderProps.{.id = MANUAL_SPEED_ID,
.bounds = Bounds(row_x, row_y + Scale(20), row_width, Scale(36)),
.semantic_label = label, .value = manual.speed, .min = manual.speed_min,
.max = manual.speed_max})
if step.changed && step.value != manual.speed {
manual.speed = step.value
manual.speed_changed = true
}
y.* += height
}
WhmPage :: (x: s32, width: s32, y: *s32) {
page := manual.page
height := WhmVisualHeight(page)
hero := Hero(x, width, y.*, height)
if page == 0 || page == 3 {
Picture(ifx page == 3 then "assets/practices/whm/2.png" else "assets/practices/whm/1.png",
Locale(WhmTitleKey(page)), hero, cast(ImageFit)ImageFitContain)
HeroDots(hero)
y.* += height + Scale(16)
} else {
Panel(hero, Scale(16), false)
center_x := x + width / 2
center_y := y.* + height / 2 - Scale(8)
if page == 1 {
WhmCircle(center_x, center_y, manual.breath_radius, "")
} else {
WhmCircle(center_x, center_y, Scale(68), "0:00")
Progress(manual.session, ProgressProps.{
.bounds = Bounds(x + Scale(36), y.* + height - Scale(34), width - Scale(72), Scale(5)),
.min = 0, .max = 60, .value = manual.hold_progress})
}
HeroDots(hero)
y.* += height + Scale(18)
}
Header(Locale(WhmTitleKey(page)), x, y, width)
Paragraph(Locale(WhmBodyKey(page)), x, y, width, cast(TextAlign)TextAlignStart)
if page == 0 {
y.* += Scale(34)
WhmSafety(x, width, y)
} else if page == 1 {
y.* += Scale(24)
WhmSpeed(x, width, y)
} else {
y.* += Scale(24)
WhmHint(x, width, y)
}
}
// ---- Breathing patterns -------------------------------------------------------------
PatternsBodyKey :: (page: s32) -> string {
if page == 0 { return "patterns_manual_choose_text" }
if page == 1 { return "patterns_manual_phases_text" }
return "patterns_manual_customize_text"
}
PatternsTitleKey :: (page: s32) -> string {
if page == 0 { return "patterns_preset_label" }
if page == 1 { return "patterns_cycle_label" }
return "patterns_ready_label"
}
PatternsVisualHeight :: (page: s32) -> s32 {
if page == 0 { return Scale(330) }
if page == 1 { return Scale(300) }
return Scale(248)
}
PatternsPageHeight :: (width: s32) -> s32 {
return PatternsVisualHeight(manual.page) + Scale(18) + HeaderHeight() +
ParagraphHeight(Locale(PatternsBodyKey(manual.page)), width)
}
PatternsCustom :: (phase: s32) -> s32 {
if phase == 0 { return manual.inhale }
if phase == 1 { return manual.hold_in }
if phase == 2 { return manual.exhale }
return manual.hold_out
}
PatternsPhase :: (preset: s32, phase: s32) -> s32 {
if preset == PATTERNS_PRESET_CUSTOM {
return PatternsCustom(phase)
}
return patterns_preset_ratio(preset, phase)
}
// A pattern's seconds, as "4-7-8-0".
PatternsRatio :: (preset: s32) -> string {
out: Vec(u8)
for phase: cast(s32)0..3 {
BuilderPrint(*out, "%", PatternsPhase(preset, phase))
if phase < 3 {
BuilderPrint(*out, "-")
}
}
return BuilderFinish(out)
}
// A card in the guide's colours, its border marking the chosen one.
PatternsPanel :: (bounds: Rectangle, radius: s32, selected: bool) {
Box(manual.session, BoxProps.{.bounds = bounds, .fill = manual.guide_background,
.border = ifx selected then manual.guide_foreground else manual.guide_border,
.radius = cast(float32)radius})
}
PatternsPresetCard :: (preset: s32, bounds: Rectangle) {
PatternsPanel(bounds, Scale(12), manual.preset == preset)
label := Locale(patterns_preset_label_key(preset))
Label(label, Rectangle.{bounds.x + cast(float32)Scale(8), bounds.y + cast(float32)Scale(5),
bounds.width - cast(float32)Scale(16), cast(float32)Scale(24)},
FitFont(label, cast(s32)bounds.width - Scale(22), manual.font, manual.small_font), true)
Label(PatternsRatio(preset), Rectangle.{bounds.x + cast(float32)Scale(8),
bounds.y + cast(float32)Scale(30), bounds.width - cast(float32)Scale(16),
cast(float32)Scale(22)}, manual.small_font, true)
}
PatternsPresets :: (x: s32, width: s32, y: *s32) {
height := PatternsVisualHeight(0)
PatternsPanel(Bounds(x, y.*, width, height), Scale(16), false)
padding := Scale(16)
gap := Scale(12)
card_height := Scale(58)
card_width := (width - padding * 2 - gap) / 2
Label(Locale("patterns_preset_label"), Bounds(x + padding, y.* + Scale(18), width - padding * 2,
Scale(24)), manual.font, false)
Label(PatternsRatio(manual.preset), Bounds(x + padding, y.* + Scale(44), width - padding * 2,
Scale(22)), manual.small_font, false)
count := patterns_preset_count()
for index: cast(s32)0..count - 1 {
card_x := x + padding + (index % 2) * (card_width + gap)
card_y := y.* + Scale(74) + (index / 2) * (card_height + gap)
card_w := card_width
if index == count - 1 {
card_x = x + padding
card_w = width - padding * 2
}
PatternsPresetCard(index, Bounds(card_x, card_y, card_w, card_height))
}
y.* += height + Scale(18)
}
PatternsPhaseCard :: (phase: s32, bounds: Rectangle) {
PatternsPanel(bounds, Scale(11), phase == 0)
key := "patterns_phase_inhale"
if phase == 1 { key = "patterns_phase_hold_in" }
if phase == 2 { key = "patterns_phase_exhale" }
if phase == 3 { key = "patterns_phase_hold_out" }
Label(Locale(key), Rectangle.{bounds.x + cast(float32)Scale(54), bounds.y,
bounds.width - cast(float32)Scale(120), bounds.height}, manual.font, false)
badge := Scale(28)
badge_x := cast(s32)bounds.x + Scale(12)
badge_y := cast(s32)(bounds.y + (bounds.height - cast(float32)badge) / 2.0)
Disc(badge_x + badge / 2, badge_y + badge / 2, badge / 2, manual.guide_background)
Label(Number(phase + 1), Bounds(badge_x, badge_y, badge, badge), manual.small_font, true)
Label(Number(PatternsPhase(manual.preset, phase)), Rectangle.{bounds.x + bounds.width -
cast(float32)Scale(62), bounds.y, cast(float32)Scale(48), bounds.height}, manual.font, true)
}
PatternsVisual :: (x: s32, width: s32, y: *s32) {
if manual.page == 0 {
PatternsPresets(x, width, y)
return
}
height := PatternsVisualHeight(manual.page)
PatternsPanel(Bounds(x, y.*, width, height), Scale(16), false)
card_x := x + Scale(16)
card_width := width - Scale(32)
if manual.page == 1 {
card_y := y.* + Scale(18)
for phase: cast(s32)0..3 {
PatternsPhaseCard(phase, Bounds(card_x, card_y, card_width, Scale(54)))
card_y += Scale(64)
}
} else {
card_y := y.* + Scale(24)
PatternsPanel(Bounds(card_x, card_y, card_width, Scale(76)), Scale(12), false)
label := Bounds(card_x + Scale(18), card_y + Scale(10), card_width - Scale(36), Scale(24))
Label(Locale("patterns_preset_label"), label, manual.font, false)
label.y += cast(float32)Scale(28)
Label(PatternsRatio(manual.preset), label, manual.small_font, false)
card_y += Scale(88)
PatternsPanel(Bounds(card_x, card_y, card_width, Scale(76)), Scale(12), false)
label.y = cast(float32)(card_y + Scale(10))
Label(Locale("patterns_duration_label"), label, manual.font, false)
duration := Locale("patterns_duration_open")
if manual.duration_minutes != 0 {
out: Vec(u8)
BuilderPrint(*out, "% min", manual.duration_minutes)
duration = BuilderFinish(out)
}
label.y += cast(float32)Scale(28)
Label(duration, label, manual.small_font, false)
}
y.* += height + Scale(18)
}
PatternsPage :: (x: s32, width: s32, y: *s32) {
hero := Hero(x, width, y.*, PatternsVisualHeight(manual.page))
PatternsVisual(cast(s32)hero.x, cast(s32)hero.width, y)
HeroDots(hero)
Header(Locale(PatternsTitleKey(manual.page)), x, y, width)
Paragraph(Locale(PatternsBodyKey(manual.page)), x, y, width, cast(TextAlign)TextAlignStart)
}
// Sun Salutation's twelve-pose chart, timing guide and current settings.
SunBodyKey :: () -> string {
if manual.page == 0 { return "sun_manual_move_text" }
if manual.page == 1 { return "sun_manual_guide_text" }
return "sun_manual_customize_text"
}
SunTitleKey :: () -> string {
if manual.page == 0 { return "exercise_sun_salutation" }
if manual.page == 1 { return "sun_salutation_tempo_preview_label" }
return "practice_configure_button"
}
SunVisualHeight :: (width: s32) -> s32 {
if manual.page != 0 { return Scale(178) }
card_width := (width - Scale(20) - Scale(8) * 2) / 3
return Scale(10) + 4 * (card_width * 4 / 3 + Scale(8)) + Scale(28)
}
SunFigure :: (step: s32, bounds: Rectangle, key: u64, alt: string) {
PracticeFigure(PracticeFigureRequest.{.practice = EXERCISE_SUN_SALUTATION,
.preview = true, .index = step, .character = manual.sun_character,
.bounds = bounds, .key = key, .alt_text = alt})
}
SunStat :: (label: string, value: string, x: s32, y: s32, width: s32) {
Label(label, Bounds(x + Scale(18), y, width - Scale(100), Scale(32)), manual.font, false)
Label(value, Bounds(x + width - Scale(70), y, Scale(54), Scale(32)), manual.font, false)
}
SunPage :: (x: s32, width: s32, y: *s32) {
height := SunVisualHeight(width)
hero := Hero(x, width, y.*, height)
Panel(hero, Scale(16), false)
x = cast(s32)hero.x
width = cast(s32)hero.width
if manual.page == 0 {
gap := Scale(8)
inset := Scale(10)
card_w := (width - inset * 2 - gap * 2) / 3
card_h := card_w * 4 / 3
number_h := Scale(22)
name_h := Scale(38)
card_color := manual.guide_background
card_color.r = ifx card_color.r > 8 then card_color.r - cast(u8)8 else cast(u8)0
card_color.g = ifx card_color.g > 8 then card_color.g - cast(u8)8 else cast(u8)0
card_color.b = ifx card_color.b > 8 then card_color.b - cast(u8)8 else cast(u8)0
for step: cast(s32)0..11 {
card := Bounds(x + inset + step % 3 * (card_w + gap),
y.* + inset + step / 3 * (card_h + gap), card_w, card_h)
Box(manual.session, BoxProps.{.bounds = card, .fill = card_color, .radius = cast(float32)Scale(12)})
Label(Number(step + 1), Rectangle.{card.x + cast(float32)Scale(8), card.y + cast(float32)Scale(4),
card.width - cast(float32)Scale(16), cast(float32)number_h}, manual.small_font, false)
key: Vec(u8)
BuilderPrint(*key, "sun_salutation_step_%", step + 1)
name := Locale(BuilderFinish(key))
SunFigure(step, Rectangle.{card.x + cast(float32)Scale(4), card.y + cast(float32)number_h,
card.width - cast(float32)Scale(8), card.height - cast(float32)(number_h + name_h)},
KeyHash("sun-salutation/manual/chart") + cast(u64)step * cast(u64)4096, name)
Text(manual.session, TextProps.{.text = name, .font = manual.small_font,
.align = cast(TextAlign)TextAlignCenter,
.bounds = Rectangle.{card.x + cast(float32)Scale(4), card.y + card.height - cast(float32)name_h,
card.width - cast(float32)Scale(8), cast(float32)name_h}})
}
} else if manual.page == 1 {
pose_width := (width - Scale(36)) / 3
steps: [3]s32 = .[0, 3, 7]
keys: [3]string = .["sun-salutation/manual/first", "sun-salutation/manual/middle", "sun-salutation/manual/last"]
for index: cast(s32)0..2 {
pose_bounds := Bounds(x + Scale(10) + index * (pose_width + Scale(8)),
y.* + Scale(24), pose_width, Scale(112))
SunFigure(steps[index], pose_bounds, KeyHash(keys[index]), Locale("exercise_sun_salutation"))
Disc(cast(s32)(pose_bounds.x + pose_bounds.width / 2.0), y.* + Scale(151), Scale(4),
ifx index == 1 then manual.guide_foreground else manual.guide_border)
}
} else {
row_y := y.* + Scale(24)
SunStat(Locale("sun_salutation_repetitions_label"), Filled("%dx", manual.sun_repetitions, 0), x, row_y, width)
row_y += Scale(45)
SunStat(Locale("sun_salutation_start_speed_label"), Filled("%d s", manual.sun_start_seconds, 0), x, row_y, width)
row_y += Scale(45)
SunStat(Locale("sun_salutation_end_speed_label"), Filled("%d s", manual.sun_end_seconds, 0), x, row_y, width)
}
y.* += height + Scale(18)
HeroDots(hero)
Header(Locale(SunTitleKey()), x, y, width)
Paragraph(Locale(SunBodyKey()), x, y, width, cast(TextAlign)TextAlignStart)
}
// ---- The manual ------------------------------------------------------------------------
Title :: () -> string {
if manual.practice == EXERCISE_SUN_SALUTATION { return Locale("exercise_sun_salutation") }
if manual.practice == EXERCISE_WIM_HOF { return Locale("practice_manual_button") }
if manual.practice == EXERCISE_PATTERNS { return Locale("patterns_title") }
if manual.practice == EXERCISE_ASTRAL_PROJECTION { return Locale("exercise_astral_projection") }
return Locale("meditation_manual_title")
}
PageHeight :: (width: s32) -> s32 {
if manual.practice == EXERCISE_SUN_SALUTATION {
return SunVisualHeight(width) + Scale(18) + HeaderHeight() + ParagraphHeight(Locale(SunBodyKey()), width)
}
if manual.practice == EXERCISE_WIM_HOF { return WhmPageHeight(width) }
if manual.practice == EXERCISE_PATTERNS { return PatternsPageHeight(width) }
return PicturePageHeight(width)
}
Page :: (x: s32, width: s32, y: s32) {
if manual.practice == EXERCISE_SUN_SALUTATION {
SunPage(x, width, *y)
} else if manual.practice == EXERCISE_WIM_HOF {
WhmPage(x, width, *y)
} else if manual.practice == EXERCISE_PATTERNS {
PatternsPage(x, width, *y)
} else {
PicturePage(x, width, *y)
}
}
// Each manual keeps its own scroll position, as before.
ScrollKey :: () -> u64 {
if manual.practice == EXERCISE_SUN_SALUTATION { return KeyHash("sun/manual/scroll") }
if manual.practice == EXERCISE_WIM_HOF { return KeyHash("whm/manual/scroll") }
if manual.practice == EXERCISE_PATTERNS { return KeyHash("patterns/manual/scroll") }
if manual.practice == EXERCISE_ASTRAL_PROJECTION { return KeyHash("astral/manual/scroll") }
return KeyHash("meditation/manual/scroll")
}
FocusId :: () -> s32 {
if manual.practice == EXERCISE_SUN_SALUTATION { return 440 }
if manual.practice == EXERCISE_WIM_HOF { return 400 }
if manual.practice == EXERCISE_PATTERNS { return 460 }
if manual.practice == EXERCISE_ASTRAL_PROJECTION { return 425 }
return 420
}
// Back and Next at the bottom, a swipe or the keys turn the page; Back on
// the first page closes the manual and Next on the last starts the practice.
Pager :: (nav_y: s32, nav_height: s32, content_y: s32, content_height: s32) {
count := PageCount()
swipe := Swipe(SwipeSpec.{.bounds = Bounds(0, content_y, manual.view_width, content_height),
.directions = cast(u32)SwipeHorizontal, .min_distance = cast(float32)Scale(48),
.axis_bias = 1.25, .max_duration = 0.8}, manual.swipe, manual.swipe_frame)
manual.swipe = swipe.gesture
manual.claim_pointer = swipe.claim_pointer
manual.release_pointer = swipe.release_pointer
manual.block_click = swipe.capture_input || swipe.consume_release
previous := manual.previous || swipe.direction == cast(SwipeDirection)SwipeRight
next := manual.next || swipe.direction == cast(SwipeDirection)SwipeLeft
finish := manual.finish
close := manual.close
padding := Scale(12)
content_width := manual.view_width - Scale(MANUAL_SIDE_PADDING) * 2
if content_width > Scale(MANUAL_MAX_WIDTH) {
content_width = Scale(MANUAL_MAX_WIDTH)
}
content_x := (manual.view_width - content_width) / 2
width := (content_width - padding) / 2
height := nav_height - padding * 2
if height > Scale(48) {
height = Scale(48)
}
if !close && width > 0 && height > 0 {
Box(manual.session, BoxProps.{.bounds = Bounds(0, nav_y, manual.view_width, nav_height),
.fill = manual.guide_background})
button_y := nav_y + (nav_height - height) / 2
if Button(manual.session, ButtonProps.{.id = FocusId(),
.bounds = Bounds(content_x, button_y, width, height), .label = Locale("back_button"),
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
if manual.page == 0 {
close = true
} else {
previous = true
}
}
if Button(manual.session, ButtonProps.{.id = FocusId() + 1,
.bounds = Bounds(content_x + padding + width, button_y, width, height),
.label = Locale(ifx manual.page == count - 1 then "practice_start_button" else "next_button"),
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
finish = true
}
}
if finish && manual.page < count - 1 {
next = true
finish = false
}
if close {
manual.action = PRACTICE_MANUAL_CLOSE
manual.block_click = true
} else if finish {
manual.action = PRACTICE_MANUAL_START
manual.block_click = true
} else if previous && manual.page > 0 {
manual.page -= 1
manual.scroll = 0
} else if next && manual.page < count - 1 {
manual.page += 1
manual.scroll = 0
} else if next && manual.page == count - 1 {
manual.action = PRACTICE_MANUAL_START
manual.block_click = true
}
}
Manual :: () {
count := PageCount()
if manual.page < 0 {
manual.page = 0
}
if manual.page >= count {
manual.page = count - 1
}
if manual.title_height > 0 {
options: [1]DropdownOption
bar := TitleBar(manual.session, TitleBarProps.{.title = Title(),
.height = manual.title_height,
.bounds = Bounds(0, 0, manual.view_width, manual.title_height),
.has_leading_action = true, .leading_label = Locale("back_button")}, options[0:0])
if bar.clicked_leading {
manual.action = PRACTICE_MANUAL_CLOSE
manual.block_click = true
return
}
}
nav_height := ifx count > 1 then Scale(MANUAL_NAV_HEIGHT) else 0
content_y := manual.title_height + Scale(MANUAL_TOP_GAP)
nav_y := manual.view_height - manual.bottom - nav_height
content_height := nav_y - content_y
minimum := ifx manual.practice == EXERCISE_WIM_HOF then 0 else Scale(120)
if content_height < minimum {
content_height = minimum
}
max_width := cast(s32)(cast(float32)manual.view_width * 0.96)
if max_width > Scale(MANUAL_MAX_WIDTH) {
max_width = Scale(MANUAL_MAX_WIDTH)
}
least := ifx manual.practice == EXERCISE_WIM_HOF then Scale(280) else Scale(200)
if max_width < least {
max_width = least
}
column := CenteredColumnFor(manual.view_width, max_width, Scale(MANUAL_SIDE_PADDING))
scrolled := Scroll(manual.session, ScrollProps.{.key = ScrollKey(),
.bounds = Bounds(0, content_y, manual.view_width, content_height),
.content_height = PageHeight(column.width), .scroll_offset = manual.scroll,
.scale = manual.scale})
manual.scroll = scrolled.scroll_offset
if scrolled.opened {
Page(column.x, column.width, cast(s32)scrolled.content.y)
unused End(manual.session)
}
Pager(nav_y, nav_height, content_y, content_height)
}
PracticeManualView :: (message: PracticeMessage) -> PracticeMessage {
manual = ReadPracticeManualHost()
manual.action = PRACTICE_MANUAL_NONE
manual.speed_changed = false
manual.claim_pointer = false
manual.release_pointer = false
manual.block_click = false
Manual()
WritePracticeManualHost(manual)
message.succeeded = true
return message
}
+121
View File
@@ -0,0 +1,121 @@
// A running Meditation: the circle with the time left in it and, when the
// time can be extended, +1, +5 and +10 minutes, with Finish once the time is
// up. The host keeps the clock, the bell and the music, draws the title bar
// and the question on leaving, and does what was pressed.
#import "session"
#import "geometry"
#import "dpi"
#import "drawing_props"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "shape_props"
#import "shape_widget"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
using ButtonTone;
using ButtonEmphasis;
using TextAlign;
using TextWrap;
host_api :: #system_library "host_api";
ReadPracticeMeditationHost :: () -> PracticeMeditationFrame #foreign host_api;
WritePracticeMeditationHost :: (frame: PracticeMeditationFrame) #foreign host_api;
meditation: PracticeMeditationFrame;
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, meditation.scale)
}
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
return Rectangle.{cast(float32)x, cast(float32)y,
cast(float32)width, cast(float32)height}
}
FitFont :: (text: string, max_width: s32, preferred: s32, minimum: s32) -> s32 {
font := preferred
while font > minimum &&
TextWidth(meditation.session, TextProps.{.text = text, .font = font}) > max_width {
font -= 1
}
return font
}
// Keeps a row of the given width inside the screen's side margins.
RowX :: (center_x: s32, width: s32) -> s32 {
x := center_x - width / 2
margin := Scale(12)
if x < margin {
x = margin
}
if x + width > meditation.view_width - margin {
x = meditation.view_width - margin - width
}
return x
}
ExtendControls :: (y: s32) {
if !meditation.extend {
return
}
minutes: [3]s32 = .[1, 5, 10]
labels: [3]string = .["+1", "+5", "+10"]
gap := Scale(8)
height := Scale(34)
width := Scale(58)
x := RowX(meditation.center_x, width * 3 + gap * 2)
for index: cast(s32)0..2 {
if Button(meditation.session, ButtonProps.{
.bounds = Bounds(x + index * (width + gap), y, width, height),
.label = labels[index],
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
meditation.action = PRACTICE_MEDITATION_EXTEND
meditation.value = minutes[index] * 60
}
}
if !meditation.complete {
return
}
finish_width := Scale(96)
if Button(meditation.session, ButtonProps.{
.bounds = Bounds(RowX(meditation.center_x, finish_width),
y + height + Scale(10), finish_width, height),
.label = meditation.finish_label,
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
meditation.action = PRACTICE_MEDITATION_FINISH
}
}
PracticeMeditationView :: (message: PracticeMessage) -> PracticeMessage {
meditation = ReadPracticeMeditationHost()
meditation.action = PRACTICE_MEDITATION_NONE
meditation.value = 0
radius := Scale(86)
center := Vector2.{cast(float32)meditation.center_x, cast(float32)meditation.center_y}
halo := meditation.accent_color
halo.a = cast(u8)(255.0 * 0.24)
Circle(meditation.session, CircleProps.{.center = center,
.radius = cast(float32)(radius + Scale(20)), .fill = halo})
Circle(meditation.session, CircleProps.{.center = center,
.radius = cast(float32)radius, .fill = meditation.accent_color})
Text(meditation.session, TextProps.{
.text = meditation.time_text,
.bounds = Bounds(meditation.center_x - radius,
meditation.center_y - radius, radius * 2, radius * 2),
.font = FitFont(meditation.time_text, radius * 2 - Scale(20),
Scale(Text24), Scale(Text16)),
.class_name = meditation.ink_class,
.wrap = cast(TextWrap)TextWrapNone,
.align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter})
ExtendControls(meditation.center_y + radius + Scale(24))
WritePracticeMeditationHost(meditation)
message.succeeded = true
return message
}
+356
View File
@@ -0,0 +1,356 @@
#import "session"
#import "geometry"
#import "dpi"
#import "layout"
#import "vec"
#import "drawing_props"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "toolbar"
#import "toolbar_props"
#import "image_props"
#import "progress_props"
#import "progress_widget"
#import "box_props"
#import "box_widget"
#import "shape_props"
#import "shape_widget"
#import "scroll_props"
#import "scroll_widget"
#import "segmented_control_props"
#import "segmented_control_widget"
#import "tree"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
#import, file "../../src/app/exercise_types.zi";
#import, file "workout_rules.zi";
#import, file "figure_view.zi";
using ExerciseType;
using TextAlign;
using TextWrap;
using ButtonTone;
using ButtonEmphasis;
host_api :: #system_library "host_api";
ReadPracticeMovementHost :: () -> PracticeMovementFrame #foreign host_api;
WritePracticeMovementHost :: (frame: PracticeMovementFrame) #foreign host_api;
MovementLocaleHost :: (key: string) -> string #foreign host_api;
movement: PracticeMovementFrame;
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, movement.scale)
}
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
return Rectangle.{cast(float32)x, cast(float32)y, cast(float32)width, cast(float32)height}
}
Locale :: (key: string) -> string {
return MovementLocaleHost(key)
}
Alpha :: (color: Color, opacity: float32) -> Color {
color.a = cast(u8)(cast(float32)color.a * opacity)
return color
}
ParagraphHeight :: (text: string, width: s32, font: s32, gap: s32 = 0) -> s32 {
return TextHeight(movement.session, TextProps.{.text = text, .font = font,
.bounds = Bounds(0, 0, width, 0), .line_gap = gap, .wrap = cast(TextWrap)TextWrapAuto})
}
Figure :: (bounds: Rectangle, key: string, alt: string) {
PracticeFigure(PracticeFigureRequest.{.practice = movement.practice,
.bounds = bounds, .key = KeyHash(key), .alt_text = alt})
}
// The same three 44-unit targets and bottom-row geometry as the host used.
Controls :: () -> s32 {
layout := BottomIconRowLayoutFor(BottomIconRowProps.{
.center_x = movement.view_width / 2, .view_width = movement.view_width,
.view_height = movement.view_height, .count = 3}, movement.scale)
labels: [3]string = .[Locale("back_button"),
Locale(ifx movement.paused then "play_button" else "pause_button"), Locale("next_button")]
sources: [3]Rectangle = .[Rectangle.{128, 0, 64, 64},
Rectangle.{ifx movement.paused then 256.0 else 64.0, 192, 64, 64}, Rectangle.{128, 64, 64, 64}]
for index: cast(s32)0..2 {
if Button(movement.session, ButtonProps.{.id = 83000 + index,
.bounds = BottomIconRowButtonBoundsFor(layout, index), .label = labels[index],
.icon_only = true, .image = ImageProps.{.asset_path = "icons/ui.png",
.source = sources[index], .alt_text = labels[index]},
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
.disabled = index == 0 && !movement.can_back}) != 0 {
movement.action = index + 1
}
}
return layout.y
}
CenteredLine :: (text: string, y: s32, preferred: s32, minimum: s32, strong: bool) -> s32 {
font := preferred
if TextWidth(movement.session, TextProps.{.text = text, .font = font}) > movement.view_width - Scale(80) {
font = minimum
}
emphasis: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)text.count}]
Text(movement.session, TextProps.{.text = text,
.bounds = Bounds(0, y, movement.view_width, 0), .font = font,
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone,
.strong = ifx strong then emphasis[:1] else emphasis[:0]})
return y + TextHeight(movement.session, TextProps.{.text = "M", .font = font})
}
SunSalutation :: () {
bottom := Controls() - Scale(18)
y := CenteredLine(movement.heading, movement.top + Scale(18), Scale(24), Scale(20), true)
y = CenteredLine(movement.cue, y + Scale(2), Scale(20), Scale(18), false)
width := movement.view_width - Scale(96)
if width > Scale(280) {
width = Scale(280)
}
y += Scale(8)
Progress(movement.session, ProgressProps.{.bounds = Bounds((movement.view_width - width) / 2,
y, width, Scale(10)), .min = 0, .max = 1000, .value = movement.progress})
y += Scale(22)
Figure(Bounds(Scale(24), y, movement.view_width - Scale(48), bottom - y),
"sun-salutation/figure", Locale("exercise_sun_salutation"))
}
TaiChi :: () {
row_y := Controls()
y := movement.top + Scale(12)
if movement.subtitle.count > 0 {
Text(movement.session, TextProps.{.text = movement.subtitle,
.bounds = Bounds(Scale(24), y, movement.view_width - Scale(48), 0),
.font = Scale(16), .class_name = movement.muted_class,
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapEllipsis})
y += TextHeight(movement.session, TextProps.{.text = "M", .font = Scale(16)}) + Scale(4)
}
cue_height := TextHeight(movement.session, TextProps.{.text = "M", .font = Scale(20)}) * 2
Text(movement.session, TextProps.{.text = movement.cue,
.bounds = Bounds(Scale(24), y, movement.view_width - Scale(48), cue_height),
.font = Scale(20), .align = cast(TextAlign)TextAlignCenter})
y += cue_height + Scale(8)
progress_y := row_y - Scale(22)
width := movement.view_width - Scale(96)
if width > Scale(420) {
width = Scale(420)
}
Progress(movement.session, ProgressProps.{.key = KeyHash("inbe/practices/tai_chi/progress"),
.bounds = Bounds((movement.view_width - width) / 2, progress_y, width, Scale(10)),
.min = 0, .max = 1000, .value = movement.progress})
angle_y := progress_y - Scale(52)
width = movement.view_width - Scale(48)
if width > Scale(440) {
width = Scale(440)
}
options: [4]SegmentOption = .[SegmentOption.{.label = Locale("tai_chi_view_front")},
SegmentOption.{.label = Locale("tai_chi_view_back")}, SegmentOption.{.label = Locale("tai_chi_view_side")},
SegmentOption.{.label = Locale("tai_chi_view_angled")}]
choice := SegmentedControl(movement.session, SegmentedControlProps.{
.key = KeyHash("inbe/practices/tai_chi/angle"), .bounds = Bounds((movement.view_width - width) / 2,
angle_y, width, Scale(40)), .height = Scale(40), .selected_index = movement.view,
.has_selection = true}, options[:])
if choice.changed {
movement.action = PRACTICE_MOVEMENT_VIEWPOINT
movement.value = choice.selected_index
}
Figure(Bounds(Scale(12), y, movement.view_width - Scale(24), angle_y - Scale(12) - y),
"inbe/practices/tai_chi/figure", Locale("exercise_tai_chi"))
}
Pause :: (x: s32, y: s32, width: s32) {
if Button(movement.session, ButtonProps.{
.key = KeyHash(ifx movement.practice == EXERCISE_WORKOUT then "workout/pause" else "astral/pause"),
.label = Locale(ifx movement.paused then "patterns_resume_button" else "pause_button"),
.bounds = Bounds(x, y, width, Scale(48)), .tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
movement.action = PRACTICE_MOVEMENT_PAUSE
}
}
Astral :: () {
pad := Scale(24)
width := movement.view_width - pad * 2
Text(movement.session, TextProps.{.text = movement.time,
.bounds = Bounds(pad, movement.top + Scale(12), width, Scale(48)),
.font = Scale(28), .align = cast(TextAlign)TextAlignCenter})
y := movement.top + Scale(80)
button_y := movement.view_height - Scale(76)
height := button_y - y - Scale(16)
if height < Scale(40) {
height = Scale(40)
}
if height >= Scale(160) {
scene_height := height * 48 / 100
Figure(Bounds(pad, y, width, scene_height), "astral/scene", Locale("exercise_astral_projection"))
y += scene_height + Scale(12)
height -= scene_height + Scale(12)
}
text_h := ParagraphHeight(movement.cue, width, movement.font)
scrolled := Scroll(movement.session, ScrollProps.{.key = KeyHash("astral/guidance"),
.bounds = Bounds(pad, y, width, height), .content_height = text_h, .scroll_offset = movement.scroll})
movement.scroll = scrolled.scroll_offset
if scrolled.opened {
Text(movement.session, TextProps.{.text = movement.cue,
.bounds = Rectangle.{scrolled.content.x, scrolled.content.y, cast(float32)width, cast(float32)text_h},
.font = movement.font, .align = cast(TextAlign)TextAlignCenter})
unused End(movement.session)
}
button_w := Scale(220)
if button_w > width {
button_w = width
}
Pause((movement.view_width - button_w) / 2, button_y, button_w)
}
WorkoutProgress :: (x: s32, y: s32, width: s32) {
gap := Scale(4)
bar_w := (width - gap * (WORKOUT_EXERCISE_COUNT - 1)) / WORKOUT_EXERCISE_COUNT
bar_h := Scale(6)
for index: cast(s32)0..WORKOUT_EXERCISE_COUNT - 1 {
bar := Bounds(x + index * (bar_w + gap), y, bar_w, bar_h)
Box(movement.session, BoxProps.{.bounds = bar, .fill = Alpha(movement.text_color, 0.14),
.radius = cast(float32)bar_h / 2.0})
share: float32 = 0.0
if index < movement.exercise || movement.phase == WORKOUT_PHASE_DONE {
share = 1.0
} else if index == movement.exercise && movement.phase == WORKOUT_PHASE_WORK && movement.length_ms > 0 {
share = cast(float32)movement.elapsed_ms / cast(float32)movement.length_ms
} else if index == movement.exercise {
// The exercise being got ready for is tinted.
Box(movement.session, BoxProps.{.bounds = bar, .fill = Alpha(movement.accent_color, 0.35),
.radius = cast(float32)bar_h / 2.0})
}
if share > 0.0 {
bar.width *= share
if bar.width < cast(float32)bar_h {
bar.width = cast(float32)bar_h
}
Box(movement.session, BoxProps.{.bounds = bar, .fill = movement.accent_color,
.radius = cast(float32)bar_h / 2.0})
}
}
}
// While getting ready or resting, the seconds left as a large plain number,
// then "Go!" as the exercise starts.
WorkoutCountdownNumber :: (center: Vector2, radius: float32, count: s32) {
text := Locale("workout_go")
if count != WORKOUT_COUNT_GO {
number: Vec(u8)
BuilderPrint(*number, "%", count)
text = BuilderFinish(number)
}
emphasis: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)text.count}]
Text(movement.session, TextProps.{.text = text,
.bounds = Rectangle.{center.x - radius * 2.0, center.y - radius, radius * 4.0, radius * 2.0},
.font = Scale(64), .align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone,
.strong = emphasis[:1]})
}
// The exercise's seconds left in a ring.
WorkoutCountdown :: (center: Vector2, radius: float32) {
count := WorkoutCountdownAt(WorkoutStep.{.phase = movement.phase, .exercise = movement.exercise,
.elapsed_ms = movement.elapsed_ms, .length_ms = movement.length_ms})
if count != WORKOUT_COUNT_NONE {
WorkoutCountdownNumber(center, radius, count)
return
}
thickness := cast(float32)Scale(6)
Ring(movement.session, RingProps.{.center = center, .inner_radius = radius - thickness,
.outer_radius = radius, .start_angle = 0.0, .end_angle = 360.0,
.color = Alpha(movement.text_color, 0.12)})
left: float32 = 1.0
if movement.length_ms > 0 {
left -= cast(float32)movement.elapsed_ms / cast(float32)movement.length_ms
}
if left > 0.0 {
Ring(movement.session, RingProps.{.center = center, .inner_radius = radius - thickness,
.outer_radius = radius, .start_angle = -90.0, .end_angle = -90.0 + 360.0 * left,
.color = movement.accent_color})
}
number: Vec(u8)
BuilderPrint(*number, "%", movement.seconds_left)
Text(movement.session, TextProps.{.text = BuilderFinish(number),
.bounds = Rectangle.{center.x - radius, center.y - radius, radius * 2.0, radius * 2.0},
.font = Scale(30), .align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone})
}
Workout :: () {
pad := Scale(20)
wide := movement.view_width >= Scale(760) && movement.view_width * 10 >= movement.view_height * 12
panel_w := ifx wide then movement.view_width * 2 / 5 else movement.view_width - pad * 2
if panel_w > Scale(560) {
panel_w = Scale(560)
}
panel_x := ifx wide then movement.view_width - pad - panel_w else pad
progress_y := movement.top + Scale(10)
WorkoutProgress(pad, progress_y, movement.view_width - pad * 2)
heading_h := ParagraphHeight(movement.heading, panel_w, Scale(26))
sub_h := ParagraphHeight(movement.subtitle, panel_w, movement.font)
tip_h := ParagraphHeight(movement.cue, panel_w, movement.font, Scale(3))
content_top := progress_y + Scale(20)
words_h := heading_h + Scale(4) + sub_h
ring_r := Scale(44)
lower_h := tip_h + Scale(16) + ring_r * 2 + Scale(16 + 48 + 20)
panel_top := content_top
stage: Rectangle
if wide {
stage = Bounds(pad, content_top, panel_x - pad * 2, movement.view_height - content_top - pad)
panel_top = content_top + (movement.view_height - content_top - pad - words_h - Scale(24) - lower_h) / 2
if panel_top < content_top {
panel_top = content_top
}
} else {
stage = Bounds(pad, content_top + words_h + Scale(8), movement.view_width - pad * 2,
movement.view_height - content_top - words_h - Scale(12) - lower_h)
}
emphasis: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)movement.heading.count}]
Text(movement.session, TextProps.{.text = movement.heading,
.bounds = Bounds(panel_x, panel_top, panel_w, heading_h), .font = Scale(26),
.align = cast(TextAlign)TextAlignCenter, .strong = emphasis[:1]})
Text(movement.session, TextProps.{.text = movement.subtitle,
.bounds = Bounds(panel_x, panel_top + heading_h + Scale(4), panel_w, sub_h),
.font = movement.font, .align = cast(TextAlign)TextAlignCenter, .disabled = true})
if stage.height > cast(float32)Scale(60) {
Figure(stage, "workout/figure", movement.heading)
}
lower_y := ifx wide then panel_top + words_h + Scale(24) else movement.view_height - lower_h
Text(movement.session, TextProps.{.text = movement.cue, .bounds = Bounds(panel_x, lower_y, panel_w, tip_h),
.font = movement.font, .align = cast(TextAlign)TextAlignCenter})
WorkoutCountdown(Vector2.{cast(float32)(panel_x + panel_w / 2),
cast(float32)(lower_y + tip_h + Scale(16) + ring_r)}, cast(float32)ring_r)
width := Scale(220)
if width > panel_w {
width = panel_w
}
Pause(panel_x + (panel_w - width) / 2, lower_y + tip_h + Scale(16) + ring_r * 2 + Scale(16), width)
}
PracticeMovementView :: (message: PracticeMessage) -> PracticeMessage {
movement = ReadPracticeMovementHost()
movement.action = PRACTICE_MOVEMENT_NONE
movement.value = 0
if movement.practice == EXERCISE_SUN_SALUTATION {
SunSalutation()
} else if movement.practice == EXERCISE_TAI_CHI {
TaiChi()
} else if movement.practice == EXERCISE_ASTRAL_PROJECTION {
Astral()
} else if movement.practice == EXERCISE_WORKOUT {
Workout()
} else {
message.succeeded = false
return message
}
WritePracticeMovementHost(movement)
message.succeeded = true
return message
}
+87
View File
@@ -0,0 +1,87 @@
// A running breathing pattern: the circle growing on the inhale and
// shrinking on the exhale inside its well, the phase to breathe, the cycle
// with the time, and Pause, or Resume while paused. The host keeps the
// pattern's clock and cues, draws the title bar and the question on leaving,
// and does what was pressed.
#import "session"
#import "geometry"
#import "dpi"
#import "drawing_props"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "shape_props"
#import "shape_widget"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
using ButtonTone;
using ButtonEmphasis;
using TextWrap;
host_api :: #system_library "host_api";
ReadPracticePatternsHost :: () -> PracticePatternsFrame #foreign host_api;
WritePracticePatternsHost :: (frame: PracticePatternsFrame) #foreign host_api;
patterns: PracticePatternsFrame;
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, patterns.scale)
}
Width :: (text: string, font: s32) -> s32 {
return TextWidth(patterns.session, TextProps.{.text = text, .font = font})
}
// A line of text centred on x with its middle at y.
CenteredLine :: (text: string, font: s32, x: s32, y: s32) {
width := Width(text, font)
Text(patterns.session, TextProps.{.text = text, .font = font,
.bounds = Rectangle.{cast(float32)(x - width / 2), cast(float32)(y - font / 2), 0, 0},
.wrap = cast(TextWrap)TextWrapNone})
}
PracticePatternsView :: (message: PracticeMessage) -> PracticeMessage {
patterns = ReadPracticePatternsHost()
patterns.action = PRACTICE_PATTERNS_NONE
patterns.value = 0
center_x := patterns.center_x
center_y := patterns.center_y
center := Vector2.{cast(float32)center_x, cast(float32)center_y}
Circle(patterns.session, CircleProps.{.center = center,
.radius = cast(float32)patterns.max_radius, .fill = patterns.well_color})
Circle(patterns.session, CircleProps.{.center = center,
.radius = cast(float32)patterns.radius, .fill = patterns.accent_color})
phase_font := Scale(Text32)
if Width(patterns.phase_label, phase_font) > patterns.view_width - Scale(80) {
phase_font = Scale(Text24)
}
CenteredLine(patterns.phase_label, phase_font, center_x, center_y)
status_font := Scale(Text20)
if Width(patterns.status, status_font) > patterns.view_width - Scale(96) {
status_font = patterns.small_font
}
CenteredLine(patterns.status, status_font, center_x, patterns.status_y)
width := patterns.view_width - Scale(112)
bounds := Rectangle.{cast(float32)(center_x - width / 2),
cast(float32)(center_y + patterns.max_radius + Scale(42)), cast(float32)width,
cast(float32)Scale(56)}
if patterns.paused {
if Button(patterns.session, ButtonProps.{.bounds = bounds, .label = patterns.resume_label,
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
patterns.action = PRACTICE_PATTERNS_RESUME
}
} else if Button(patterns.session, ButtonProps.{.bounds = bounds, .label = patterns.pause_label,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
patterns.action = PRACTICE_PATTERNS_PAUSE
}
WritePracticePatternsHost(patterns)
message.succeeded = true
return message
}
+50 -4
View File
@@ -1,13 +1,23 @@
// The live practice clocks run in this bundle; the unified host performs
// audio, notification, session-save and mobile lifecycle effects.
#import, file "../../src/cells/practice_types.zi";
// The live practice clocks run in this bundle, and Practice's home draws
// here; the unified host performs audio, notification, session-save and
// mobile lifecycle effects.
#import, file "../../src/apps/practice_types.zi";
#import, file "../../src/core/breath_timing.zi";
#import, file "../../src/practices/meditation/meditation_timing.zi";
#import, file "../../src/practices/patterns/patterns_clock.zi";
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/module_types.zi";
#import "apps/node_types"
#import, file "../../src/core/types.zi";
#import, file "../../src/practices/sun_salutation/sun_salutation_rules.zi";
#import, file "practice_home_view.zi";
#import, file "manual_view.zi";
#import, file "settings_view.zi";
#import, file "results_view.zi";
#import, file "meditation_view.zi";
#import, file "patterns_view.zi";
#import, file "whm_view.zi";
#import, file "movement_view.zi";
#import, file "course_view.zi";
host_api :: #system_library "host_api";
ReadPracticeHost :: () -> PracticeMessage #foreign host_api;
WritePracticeHost :: (message: PracticeMessage) #foreign host_api;
@@ -67,6 +77,42 @@ Main :: () -> s32 {
}
return MODULE_PRACTICE
}
if message.action == PRACTICE_HOME_VIEW {
WritePracticeHost(PracticeHomeView(message))
return 0
}
if message.action == PRACTICE_MANUAL_VIEW {
WritePracticeHost(PracticeManualView(message))
return 0
}
if message.action == PRACTICE_SETTINGS_VIEW {
WritePracticeHost(PracticeSettingsView(message))
return 0
}
if message.action == PRACTICE_RESULTS_VIEW {
WritePracticeHost(PracticeResultsView(message))
return 0
}
if message.action == PRACTICE_MEDITATION_VIEW {
WritePracticeHost(PracticeMeditationView(message))
return 0
}
if message.action == PRACTICE_PATTERNS_VIEW {
WritePracticeHost(PracticePatternsView(message))
return 0
}
if message.action == PRACTICE_WHM_VIEW {
WritePracticeHost(PracticeWhmView(message))
return 0
}
if message.action == PRACTICE_MOVEMENT_VIEW {
WritePracticeHost(PracticeMovementView(message))
return 0
}
if message.action == PRACTICE_COURSE_VIEW {
WritePracticeHost(PracticeCourseView(message))
return 0
}
WritePracticeHost(PracticeApply(message))
return 0
}
+512
View File
@@ -0,0 +1,512 @@
// Practice's home: the chosen practice's banner fading into the page, its
// title and what its card says, the tabs for each kind of practice, arrows
// through the practices under the tab, and Start with the manual and the
// settings, or the button that installs, unlocks or cancels a practice that
// is not ready. Swipes and the arrow keys go to the next or previous
// practice. The host keeps the practices, their downloads and the route.
#import "session"
#import "geometry"
#import "vec"
#import "dpi"
#import "drawing_props"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "box_props"
#import "box_widget"
#import "image_props"
#import "image_widget"
#import "tab_bar_props"
#import "tab_bar_widget"
#import "swipe_props"
#import "swipe"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
using ArrowDirection;
using ButtonTone;
using ButtonEmphasis;
using ControlSize;
using ImageFit;
using SwipeDirection;
using TextAlign;
using TextWrap;
host_api :: #system_library "host_api";
ReadPracticeHomeHost :: () -> PracticeHomeFrame #foreign host_api;
WritePracticeHomeHost :: (frame: PracticeHomeFrame) #foreign host_api;
ReadPracticeHomeTabHost :: (index: s32) -> PracticeHomeTab #foreign host_api;
PracticeLocaleHost :: (key: string) -> string #foreign host_api;
home: PracticeHomeFrame;
HOME_TAB_MAX :: 8
HOME_CAROUSEL_ID :: 7090
HOME_TABS_ID :: 17470
HOME_TAB_KEY :: 17480
HOME_OFFER_ID :: 17410
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, home.scale)
}
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
return Rectangle.{cast(float32)x, cast(float32)y,
cast(float32)width, cast(float32)height}
}
Locale :: (key: string) -> string {
return PracticeLocaleHost(key)
}
Width :: (text: string, font: s32) -> s32 {
return TextWidth(home.session, TextProps.{.text = text, .font = font})
}
FitFont :: (text: string, max_width: s32, preferred: s32, minimum: s32) -> s32 {
font := preferred
if max_width <= 0 {
return font
}
while font > minimum && Width(text, font) > max_width {
font -= 1
}
return font
}
// The height of text wrapped in width, with a small gap between its lines.
ParagraphHeight :: (text: string, width: s32, font: s32) -> s32 {
return TextHeight(home.session, TextProps.{.text = text, .font = font,
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto,
.line_gap = Scale(3)})
}
Alpha :: (color: Color, opacity: float32) -> Color {
color.a = cast(u8)(255.0 * opacity)
return color
}
// ---- The title and the lines under it -----------------------------------------
TitleLayout :: struct {
title: TextProps
subtitle: TextProps
height: s32
}
// The centred heading, measured with room for accents and descenders, and
// the practice's description under it.
Title :: (x: s32, width: s32) -> TitleLayout {
layout: TitleLayout
preferred := ifx width >= Scale(600) then Scale(42) else Scale(34)
max_width := width - Scale(36)
if max_width < Scale(220) {
max_width = width
}
padding := Scale(4)
layout.title = TextProps.{.text = home.title, .bounds = Bounds(x, 0, width, 0),
.font = FitFont(home.title, max_width, preferred, home.font + Scale(4)),
.align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapAuto}
title_height := TextHeight(home.session, layout.title) + padding * 2
layout.title.bounds.height = cast(float32)title_height
layout.height = title_height
if home.subtitle.count > 0 {
layout.subtitle = TextProps.{.text = home.subtitle,
.bounds = Bounds(x, title_height + Scale(6), width, 0),
.font = FitFont(home.subtitle, max_width, home.font + Scale(1), Scale(14)),
.align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapAuto}
subtitle_height := TextHeight(home.session, layout.subtitle) + padding * 2
layout.subtitle.bounds.height = cast(float32)subtitle_height
layout.height += Scale(6) + subtitle_height
}
return layout
}
PriceRowHeight :: () -> s32 {
return home.small_font + Scale(12)
}
// The offer row, with what the price is worth under it once the node's
// rates are known.
PriceHeight :: () -> s32 {
height: s32 = 0
if home.regular_price.count > 0 {
height = PriceRowHeight()
}
if home.worth.count > 0 {
height += home.small_font + Scale(6)
}
return height
}
StatusHeight :: (width: s32) -> s32 {
height: s32 = 0
if home.status.count > 0 {
height += ParagraphHeight(home.status, width, home.small_font) + Scale(4)
}
if home.priced && PriceHeight() > 0 {
height += PriceHeight() + Scale(4)
}
if home.note.count > 0 {
height += ParagraphHeight(home.note, width, home.small_font) + Scale(4)
}
return height
}
CentredLine :: (text: string, x: s32, y: s32, width: s32) -> s32 {
height := ParagraphHeight(text, width, home.small_font)
Text(home.session, TextProps.{.bounds = Bounds(x, y + Scale(4), width, height),
.text = text, .font = home.small_font, .align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapAuto})
return height + Scale(4)
}
// During an offer the regular price is struck through beside its discount
// badge, such as -90%; what the price is worth follows under it.
Price :: (x: s32, y: s32, width: s32) {
font := home.small_font
height: s32 = 0
if home.regular_price.count > 0 {
height = PriceRowHeight()
regular_width := Width(home.regular_price, font)
Text(home.session, TextProps.{.bounds = Bounds(x, y, regular_width, height),
.text = home.regular_price, .font = font,
.vertical_align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapNone, .disabled = true, .strikethrough = true})
badge_height := font + Scale(8)
badge_width := Width(home.discount, font) + Scale(14)
badge := Bounds(x + regular_width + Scale(10), y + (height - badge_height) / 2,
badge_width, badge_height)
Box(home.session, BoxProps.{.bounds = badge, .fill = Alpha(home.accent_color, 64.0 / 255.0),
.radius = cast(float32)badge_height / 2.0})
Text(home.session, TextProps.{.bounds = badge, .text = home.discount, .font = font,
.align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone})
}
if home.worth.count > 0 {
Text(home.session, TextProps.{.bounds = Bounds(x, y + height, width, font + Scale(6)),
.text = home.worth, .font = font, .vertical_align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapNone})
}
}
// The download's progress or failure, a paid practice's price and why it
// cannot be unlocked yet.
Status :: (x: s32, y: s32, width: s32) {
if home.status.count > 0 {
y += CentredLine(home.status, x, y, width)
}
if home.priced && PriceHeight() > 0 {
price_width := width
if price_width > Scale(300) {
price_width = Scale(300)
}
Price(x + (width - price_width) / 2, y + Scale(4), price_width)
y += PriceHeight() + Scale(4)
}
if home.note.count > 0 {
unused CentredLine(home.note, x, y, width)
}
}
// ---- Tabs, arrows and buttons -------------------------------------------------------
// One tab for each kind with a practice to list. Choosing one asks the host
// for the practice that tab last showed.
Tabs :: (bounds: Rectangle) {
if home.tab_count <= 0 {
return
}
tabs: [HOME_TAB_MAX]Tab
count := home.tab_count
if count > HOME_TAB_MAX {
count = HOME_TAB_MAX
}
for index: cast(s32)0..count - 1 {
tab := ReadPracticeHomeTabHost(index)
tabs[index] = Tab.{.key = cast(u64)(HOME_TAB_KEY + tab.slot), .label = tab.label,
.disabled = home.modal_active}
}
Box(home.session, BoxProps.{.bounds = bounds, .fill = home.canvas_color})
bar := TabBar(home.session, TabBarProps.{.id = HOME_TABS_ID,
.bounds = Rectangle.{bounds.x + cast(float32)Scale(12), bounds.y + cast(float32)Scale(4),
bounds.width - cast(float32)Scale(24), bounds.height - cast(float32)Scale(8)},
.selected_index = home.tab_selected, .min_tab_width = Scale(72),
.max_tab_width = Scale(220), .content_sized = true,
.scroll_offset = home.tab_scroll, .scale = home.scale,
.focus_selected = home.tab_focus}, tabs[:count])
home.tab_scroll = bar.scroll_offset
if !home.modal_active && bar.selected_index >= 0 && bar.selected_index < count &&
bar.selected_index != home.tab_selected {
home.action = PRACTICE_HOME_TAB
home.value = bar.selected_index
}
}
// Arrows round the practices under the tab, with "2 / 5" between them.
Carousel :: (bounds: Rectangle) {
count := home.listed
selected := home.index
if count <= 1 || bounds.width <= 0 || bounds.height <= 0 {
return
}
button_size := cast(float32)Scale(48)
inset := bounds.width * 0.08
button_y := bounds.y + (bounds.height - button_size) / 2
picked: s32 = -1
if Button(home.session, ButtonProps.{
.bounds = Rectangle.{bounds.x + inset, button_y, button_size, button_size},
.id = HOME_CAROUSEL_ID + 1, .disabled = home.modal_active,
.arrow = true, .direction = cast(ArrowDirection)ArrowLeft,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
picked = ifx selected > 0 then selected - 1 else count - 1
}
if Button(home.session, ButtonProps.{
.bounds = Rectangle.{bounds.x + bounds.width - button_size - inset, button_y,
button_size, button_size},
.id = HOME_CAROUSEL_ID + 2, .disabled = home.modal_active,
.arrow = true, .direction = cast(ArrowDirection)ArrowRight,
.tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
picked = ifx selected < count - 1 then selected + 1 else 0
}
out: Vec(u8)
BuilderPrint(*out, "% / %", selected + 1, count)
Text(home.session, TextProps.{.text = BuilderFinish(out), .bounds = bounds,
.font = Scale(18), .align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone})
if picked >= 0 && picked != selected {
home.action = PRACTICE_HOME_PICK
home.value = picked
}
}
ActionGap :: (width: s32) -> s32 {
return ifx width < Scale(340) then Scale(8) else Scale(12)
}
// Whether Manual and Settings fit side by side in width, each wide enough
// for its label.
ActionsShareRow :: (width: s32) -> bool {
if !home.has_manual || !home.has_config {
return false
}
padding := Scale(20)
gap := ActionGap(width)
manual_min := Width(Locale("practice_manual_button"), home.font) + padding * 2
config_min := Width(Locale("practice_configure_button"), home.font) + padding * 2
if width < manual_min + config_min + gap {
return false
}
available := width - gap
half := available / 2
if half >= manual_min && available - half >= config_min {
return true
}
manual := manual_min
config := available - manual
if config < config_min {
config = config_min
manual = available - config
}
return manual >= manual_min && config >= config_min
}
// The button in place of Start for a practice that is not ready.
Offer :: (bounds: Rectangle) {
cancel := home.offer == PRACTICE_OFFER_CANCEL
if Button(home.session, ButtonProps.{.id = HOME_OFFER_ID + home.practice * 2,
.bounds = bounds, .pill = true, .label = home.offer_label,
.disabled = home.offer_disabled,
.tone = cast(ButtonTone)(ifx cancel then ButtonToneNeutral else ButtonToneAccent),
.emphasis = cast(ButtonEmphasis)(ifx cancel then ButtonEmphasisSoft else ButtonEmphasisFilled),
.size = cast(ControlSize)ControlSizeLarge}) != 0 {
home.action = PRACTICE_HOME_OFFER
}
}
SecondaryButton :: (bounds: Rectangle, label: string) -> bool {
return Button(home.session, ButtonProps.{.bounds = bounds, .label = label,
.disabled = home.modal_active, .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft, .pill = true}) != 0
}
// ---- The page ---------------------------------------------------------------------------
Page :: () {
view_x := home.left
view_width := home.view_width - home.left
if view_width < Scale(320) {
view_x = 0
view_width = home.view_width
}
content_width := view_width - Scale(80)
if content_width > Scale(940) {
content_width = Scale(940)
}
if content_width < Scale(520) {
content_width = view_width - Scale(32)
}
x := view_x + (view_width - content_width) / 2
hero_height := home.view_height - home.bottom
tabs_height := home.top
if hero_height <= tabs_height {
return
}
hero := Bounds(view_x, tabs_height, view_width, hero_height - tabs_height)
button_height := Scale(48)
action_gap := Scale(14)
total_width := content_width
if total_width > Scale(700) {
total_width = Scale(700)
}
if total_width > view_width - Scale(32) {
total_width = view_width - Scale(32)
}
if total_width < Scale(360) {
total_width = view_width - Scale(24)
}
secondary_count: s32 = 0
manual := home.ready && home.has_manual
config := home.ready && home.has_config
if manual {
secondary_count += 1
}
if config {
secondary_count += 1
}
button_count := 1 + secondary_count
wide := total_width >= Scale(600)
secondary_row := secondary_count < 2 || ActionsShareRow(total_width)
rows: s32 = 1
if !wide {
if secondary_row {
rows += ifx secondary_count > 0 then 1 else 0
} else {
rows += secondary_count
}
}
bottom_gap := ifx home.bottom > 0 then Scale(28) else Scale(20)
actions_height := rows * button_height + (rows - 1) * action_gap
button_y := hero_height - bottom_gap - actions_height
pager_height := ifx home.listed > 1 then Scale(48) else 0
pager_y := button_y - Scale(10) - pager_height
title := Title(x, content_width)
title_block := title.height + StatusHeight(content_width) + Scale(28)
if title_block < Scale(100) {
title_block = Scale(100)
}
title_y := pager_y - title_block
if title_y < tabs_height + Scale(8) {
title_y = tabs_height + Scale(8)
}
primary_width := total_width
if wide {
primary_width = (total_width - action_gap * (button_count - 1)) / button_count
}
secondary_width := total_width
if wide {
secondary_width = primary_width
} else if secondary_row && secondary_count > 0 {
secondary_width = (total_width - action_gap * (secondary_count - 1)) / secondary_count
}
action_x := view_x + (view_width - total_width) / 2
pager_width := ifx total_width < Scale(480) then total_width else Scale(480)
pager_x := view_x + (view_width - pager_width) / 2
home.card = hero
swipe := Swipe(SwipeSpec.{.bounds = hero, .directions = 3,
.min_distance = cast(float32)Scale(48), .axis_bias = 1.4, .max_duration = 1.2},
home.swipe, home.swipe_frame)
home.swipe = swipe.gesture
home.claim_pointer = swipe.claim_pointer
home.release_pointer = swipe.release_pointer
home.block_click = swipe.capture_input || swipe.consume_release
if home.choosing && (swipe.direction == cast(SwipeDirection)SwipeLeft || home.key_right) {
home.action = PRACTICE_HOME_STEP
home.value = 1
} else if home.choosing && (swipe.direction == cast(SwipeDirection)SwipeRight || home.key_left) {
home.action = PRACTICE_HOME_STEP
home.value = -1
}
if home.banner.count > 0 {
Image(home.session, ImageProps.{.asset_path = home.banner,
.bounds = Rectangle.{hero.x, hero.y, hero.width,
cast(float32)(title_y + Scale(8)) - hero.y},
.fit = cast(ImageFit)ImageFitCover})
} else {
Box(home.session, BoxProps.{.bounds = hero, .fill = home.surface_color})
}
// The banner fades into the page above the title.
fade_height := Scale(120)
Box(home.session, BoxProps.{
.bounds = Bounds(view_x, title_y - fade_height, view_width, fade_height),
.fill = Alpha(home.canvas_color, 0.0), .fill_bottom = home.canvas_color,
.has_fill_bottom = true})
Box(home.session, BoxProps.{.bounds = Bounds(view_x, title_y, view_width, hero_height - title_y),
.fill = home.canvas_color})
title.title.bounds.y += cast(float32)title_y
Text(home.session, title.title)
if title.subtitle.text.count > 0 {
title.subtitle.bounds.y += cast(float32)title_y
Text(home.session, title.subtitle)
}
Status(x, title_y + title.height, content_width)
Tabs(Bounds(view_x, 0, view_width, tabs_height))
Carousel(Bounds(pager_x, pager_y, pager_width, pager_height))
home.start = Bounds(action_x, button_y, primary_width, button_height)
if home.offer != PRACTICE_OFFER_NONE {
Offer(home.start)
} else if Button(home.session, ButtonProps.{.bounds = home.start,
.label = Locale("practice_start_button"), .disabled = home.modal_active,
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
.size = cast(ControlSize)ControlSizeLarge, .pill = true}) != 0 {
home.action = PRACTICE_HOME_START
}
if wide {
action_x += primary_width + action_gap
} else {
button_y += button_height + action_gap
}
if manual {
home.manual = Bounds(action_x, button_y, secondary_width, button_height)
if SecondaryButton(home.manual, Locale("practice_manual_button")) {
home.action = PRACTICE_HOME_MANUAL
}
if wide || secondary_row {
action_x += secondary_width + action_gap
} else {
button_y += button_height + action_gap
}
}
if config {
home.config = Bounds(action_x, button_y, secondary_width, button_height)
if SecondaryButton(home.config, Locale("practice_configure_button")) {
home.action = PRACTICE_HOME_CONFIG
}
}
}
PracticeHomeView :: (message: PracticeMessage) -> PracticeMessage {
home = ReadPracticeHomeHost()
home.action = PRACTICE_HOME_NONE
home.value = 0
home.card = Rectangle.{}
home.start = Rectangle.{}
home.manual = Rectangle.{}
home.config = Rectangle.{}
Page()
WritePracticeHomeHost(home)
message.succeeded = true
return message
}
+677
View File
@@ -0,0 +1,677 @@
// A finished practice's results: its name over a soft glow, Wim Hof's
// rounds with the best and average hold and a chart of every round, or the
// time, pattern and cycles of the other practices, whether the session was
// saved, the habit a practice's first session offers, a mood to pick, and
// Discard and Done. The host keeps the session's results, saves the mood
// and adds the habit.
#import "session"
#import "geometry"
#import "vec"
#import "dpi"
#import "layout"
#import "drawing_props"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "box_props"
#import "box_widget"
#import "shape_props"
#import "shape_widget"
#import "scroll_props"
#import "scroll_widget"
#import "tree"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
#import, file "../../src/app/exercise_types.zi";
using ButtonTone;
using ButtonEmphasis;
using ExerciseType;
using TextAlign;
using TextWrap;
host_api :: #system_library "host_api";
ReadPracticeResultsHost :: () -> PracticeResultsFrame #foreign host_api;
WritePracticeResultsHost :: (frame: PracticeResultsFrame) #foreign host_api;
ReadPracticeResultRoundHost :: (index: s32) -> PracticeResultRound #foreign host_api;
ResultsLocaleHost :: (key: string) -> string #foreign host_api;
results: PracticeResultsFrame;
RESULTS_MOODS :: 5
RESULTS_ROUND_MAX :: 64
results_rounds: [RESULTS_ROUND_MAX]s32;
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, results.scale)
}
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
return Rectangle.{cast(float32)x, cast(float32)y,
cast(float32)width, cast(float32)height}
}
Locale :: (key: string) -> string {
return ResultsLocaleHost(key)
}
Width :: (text: string, font: s32) -> s32 {
return TextWidth(results.session, TextProps.{.text = text, .font = font})
}
FitFont :: (text: string, max_width: s32, preferred: s32, minimum: s32) -> s32 {
font := preferred
if max_width <= 0 {
return font
}
while font > minimum && Width(text, font) > max_width {
font -= 1
}
return font
}
Alpha :: (color: Color, opacity: float32) -> Color {
color.a = cast(u8)(cast(float32)color.a * opacity)
return color
}
Padded :: (out: *Vec(u8), value: s32) {
if value < 10 {
BuilderPrint(out, "0")
}
BuilderPrint(out, "%", value)
}
// The template with each %d replaced by the next number, %s by the text and
// %% by a percent.
Filled :: (template: string, first: s32, second: s32, text: string) -> string {
out: Vec(u8)
values: [2]s32 = .[first, second]
used: s32 = 0
at: s64 = 0
while at < template.count {
if at + 1 < template.count && template[at] == cast(u8)37 {
next := template[at + 1]
if next == cast(u8)100 && used < 2 {
BuilderPrint(*out, "%", values[used])
used += 1
at += 2
continue
}
if next == cast(u8)115 {
BuilderPrint(*out, "%", text)
at += 2
continue
}
if next == cast(u8)37 {
BuilderPrint(*out, "%%")
at += 2
continue
}
}
BuilderPrint(*out, "%", template[at:at + 1])
at += 1
}
return BuilderFinish(out)
}
Number :: (key: string, value: s32) -> string {
return Filled(Locale(key), value, 0, "")
}
// "1h 05m", "4m 02s" or "35s".
Duration :: (seconds: s32) -> string {
if seconds < 0 {
seconds = 0
}
out: Vec(u8)
if seconds >= 3600 {
BuilderPrint(*out, "%h ", seconds / 3600)
Padded(*out, (seconds % 3600) / 60)
BuilderPrint(*out, "m")
} else if seconds >= 60 {
BuilderPrint(*out, "%m ", seconds / 60)
Padded(*out, seconds % 60)
BuilderPrint(*out, "s")
} else {
BuilderPrint(*out, "%s", seconds)
}
return BuilderFinish(out)
}
Label :: (text: string, x: s32, y: s32, width: s32, height: s32, font: s32, align: TextAlign) {
Text(results.session, TextProps.{.bounds = Bounds(x, y, width, height), .text = text,
.font = font, .align = align, .vertical_align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapNone})
}
// The corner radius that rounds off `roundness` of a box's shorter side.
Corner :: (roundness: float32, width: s32, height: s32) -> float32 {
shorter := ifx height < width then height else width
return roundness * cast(float32)shorter * 0.5
}
Card :: (x: s32, y: s32, width: s32, height: s32) {
Box(results.session, BoxProps.{.bounds = Bounds(x, y, width, height),
.fill = results.surface_color, .border = results.border_color,
.radius = Corner(0.12, width, height)})
}
// A deep blue on light themes and a soft violet on dark ones.
Accent :: () -> Color {
background := results.canvas_color
luma := cast(s32)background.r * 299 + cast(s32)background.g * 587 + cast(s32)background.b * 114
if luma >= 128000 {
return Color.{.r = 82, .g = 119, .b = 193, .a = 255}
}
return Color.{.r = 190, .g = 163, .b = 250, .a = 255}
}
Rounds :: () {
count := results.round_count
if count > RESULTS_ROUND_MAX {
count = RESULTS_ROUND_MAX
results.round_count = count
}
for index: cast(s32)0..count - 1 {
results_rounds[index] = ReadPracticeResultRoundHost(index).seconds
}
}
// The best and the average hold.
RoundStats :: (best: *s32, average: *s32) {
total: s32 = 0
best.* = 0
average.* = 0
for index: cast(s32)0..results.round_count - 1 {
seconds := results_rounds[index]
if seconds < 0 {
seconds = 0
}
total += seconds
if seconds > best.* {
best.* = seconds
}
}
if results.round_count > 0 {
average.* = total / results.round_count
}
}
// ---- Moods -----------------------------------------------------------------------------
MoodColor :: (mood: s32) -> Color {
if mood <= 1 { return Color.{.r = 226, .g = 83, .b = 78, .a = 255} }
if mood == 2 { return Color.{.r = 238, .g = 139, .b = 70, .a = 255} }
if mood == 3 { return Color.{.r = 235, .g = 202, .b = 77, .a = 255} }
if mood == 4 { return Color.{.r = 108, .g = 199, .b = 104, .a = 255} }
return Color.{.r = 73, .g = 194, .b = 192, .a = 255}
}
Pixel :: (x: s32, y: s32, width: s32, height: s32, color: Color) {
Box(results.session, BoxProps.{.bounds = Bounds(x, y, width, height), .fill = color})
}
// A pixel face, from frowning red at 1 to grinning teal at 5.
MoodFace :: (mood: s32, center_x: s32, center_y: s32, size: s32) {
u := size / 12
if u < 2 {
u = 2
}
face := u * 12
x := center_x - face / 2
y := center_y - face / 2
fill := MoodColor(mood)
stroke := DarkenColor(fill, 45)
detail := Color.{.r = 38, .g = 40, .b = 48, .a = 255}
shine := Color.{.r = 255, .g = 255, .b = 255, .a = 170}
Pixel(x + u * 3, y, u * 6, u, stroke)
Pixel(x + u * 2, y + u, u * 8, u, stroke)
Pixel(x + u, y + u * 2, u * 10, u, stroke)
Pixel(x, y + u * 3, u * 12, u * 6, stroke)
Pixel(x + u, y + u * 9, u * 10, u, stroke)
Pixel(x + u * 2, y + u * 10, u * 8, u, stroke)
Pixel(x + u * 3, y + u * 11, u * 6, u, stroke)
Pixel(x + u * 3, y + u, u * 6, u, fill)
Pixel(x + u * 2, y + u * 2, u * 8, u, fill)
Pixel(x + u, y + u * 3, u * 10, u * 6, fill)
Pixel(x + u * 2, y + u * 9, u * 8, u, fill)
Pixel(x + u * 3, y + u * 10, u * 6, u, fill)
Pixel(x + u * 3, y + u * 2, u * 2, u, shine)
if mood <= 1 {
Pixel(x + u * 2, y + u * 3, u * 3, u, detail)
Pixel(x + u * 7, y + u * 3, u * 3, u, detail)
Pixel(x + u * 3, y + u * 4, u, u, detail)
Pixel(x + u * 8, y + u * 4, u, u, detail)
Pixel(x + u * 3, y + u * 8, u, u, detail)
Pixel(x + u * 4, y + u * 7, u * 4, u, detail)
Pixel(x + u * 8, y + u * 8, u, u, detail)
return
}
Pixel(x + u * 3, y + u * 4, u * 2, u * 2, detail)
Pixel(x + u * 7, y + u * 4, u * 2, u * 2, detail)
if mood == 2 {
Pixel(x + u * 3, y + u * 8, u, u, detail)
Pixel(x + u * 4, y + u * 7, u * 4, u, detail)
Pixel(x + u * 8, y + u * 8, u, u, detail)
} else if mood == 3 {
Pixel(x + u * 3, y + u * 8, u * 6, u, detail)
} else if mood == 4 {
Pixel(x + u * 2, y + u * 7, u, u, detail)
Pixel(x + u * 3, y + u * 8, u * 6, u, detail)
Pixel(x + u * 9, y + u * 7, u, u, detail)
} else {
Pixel(x + u * 3, y + u * 7, u * 6, u * 3, detail)
Pixel(x + u * 4, y + u * 7, u * 4, u, Color.{.r = 255, .g = 255, .b = 255, .a = 255})
Pixel(x + u * 4, y + u * 9, u * 4, u, Color.{.r = 236, .g = 108, .b = 128, .a = 255})
}
}
MoodPicker :: (x: s32, y: s32, width: s32) {
padding := Scale(14)
gap := Scale(7)
item_width := (width - padding * 2 - gap * (RESULTS_MOODS - 1)) / RESULTS_MOODS
button_y := y + Scale(49)
button_height := Scale(60)
Card(x, y, width, Scale(124))
Label(Locale("results_mood_title"), x + padding, y + Scale(10), width - padding * 2, Scale(30),
Scale(18), cast(TextAlign)TextAlignStart)
for index: cast(s32)0..RESULTS_MOODS - 1 {
button_x := x + padding + index * (item_width + gap)
button_width := ifx index == RESULTS_MOODS - 1 then x + width - padding - button_x else item_width
selected := results.mood == index + 1
if Button(results.session, ButtonProps.{
.bounds = Bounds(button_x, button_y, button_width, button_height),
.id = 24800 + index,
.tone = cast(ButtonTone)(ifx selected then ButtonToneAccent else ButtonToneNeutral),
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft, .selected = selected}) != 0 {
results.action = PRACTICE_RESULTS_MOOD
results.value = index + 1
}
MoodFace(index + 1, button_x + button_width / 2, button_y + button_height / 2, Scale(28))
}
}
// ---- Wim Hof's rounds -------------------------------------------------------------------
Metrics :: (x: s32, y: s32, width: s32, best: s32, average: s32) {
titles: [3]string = .[Locale("results_metric_rounds"), Locale("results_metric_best"),
Locale("results_metric_average")]
out: Vec(u8)
BuilderPrint(*out, "%", results.round_count)
values: [3]string = .[BuilderFinish(out), Number("results_metric_seconds", best),
Number("results_metric_seconds", average)]
count: s32 = ifx results.round_count <= 1 then 2 else 3
gap := Scale(8)
cell_width := (width - gap * (count - 1)) / count
for index: cast(s32)0..count - 1 {
cell_x := x + index * (cell_width + gap)
actual := ifx index == count - 1 then x + width - cell_x else cell_width
Card(cell_x, y, actual, Scale(78))
Line(results.session, LineProps.{
.start = Vector2.{cast(float32)(cell_x + Scale(14)), cast(float32)(y + Scale(12))},
.end = Vector2.{cast(float32)(cell_x + actual - Scale(14)), cast(float32)(y + Scale(12))},
.color = Alpha(Accent(), ifx index == 1 then 0.72 else 0.34)})
Label(titles[index], cell_x + Scale(5), y + Scale(18), actual - Scale(10), Scale(22),
FitFont(titles[index], actual - Scale(12), Scale(17), Scale(12)), cast(TextAlign)TextAlignCenter)
Label(values[index], cell_x + Scale(5), y + Scale(38), actual - Scale(10), Scale(34),
FitFont(values[index], actual - Scale(12), Scale(28), Scale(20)), cast(TextAlign)TextAlignCenter)
}
}
ChartHeight :: () -> s32 {
return ifx results.round_count <= 1 then Scale(165) else Scale(220)
}
ChartX :: (index: s32, chart_x: s32, chart_width: s32) -> s32 {
if results.round_count > 1 {
return chart_x + index * chart_width / (results.round_count - 1)
}
return chart_x + chart_width / 2
}
ChartY :: (index: s32, baseline: s32, chart_height: s32, top: s32) -> s32 {
value := results_rounds[index]
if value < 0 {
value = 0
}
return baseline - value * chart_height / top
}
// Each round's hold as a point on a line, with guides and labels; a single
// round shows its hold large in a glowing ring.
Chart :: (x: s32, y: s32, width: s32, best: s32) {
chart_x := x + Scale(34)
chart_y := y + Scale(72)
chart_width := width - Scale(68)
chart_height := Scale(112)
baseline := chart_y + chart_height
top := ((best + 19) / 20) * 20
if top < 20 {
top = 20
}
step := (results.round_count + 5) / 6
if step < 1 {
step = 1
}
accent := Accent()
Card(x, y, width, ChartHeight())
// A single round's glow reaches under the title, so it comes first.
if results.round_count <= 1 {
glow := Vector2.{cast(float32)(x + width / 2), cast(float32)(y + Scale(91))}
Circle(results.session, CircleProps.{.center = glow, .radius = cast(float32)Scale(62),
.fill = Alpha(accent, 0.18), .edge = Alpha(results.surface_color, 0.0), .has_edge = true})
Ring(results.session, RingProps.{.center = glow, .inner_radius = cast(float32)Scale(46),
.outer_radius = cast(float32)Scale(48), .end_angle = 360.0, .color = Alpha(accent, 0.70)})
}
Label(Locale("round_times_title"), x + Scale(18), y + Scale(10), width - Scale(36), Scale(32),
Scale(18), cast(TextAlign)TextAlignStart)
if results.round_count <= 1 {
value := ifx results.round_count == 1 then results_rounds[0] else 0
if value < 0 {
value = 0
}
detail := Number("results_rounds", 0)
if results.round_count == 1 {
detail = Filled(Locale("round_result_label"), 1, value, "")
}
Label(Number("results_metric_seconds", value), x + Scale(45), y + Scale(57), width - Scale(90),
Scale(55), Scale(38), cast(TextAlign)TextAlignCenter)
Label(detail, x + Scale(20), y + Scale(127), width - Scale(40), Scale(25), Scale(14),
cast(TextAlign)TextAlignCenter)
return
}
for row: cast(s32)0..2 {
guide := cast(float32)(chart_y + row * chart_height / 2)
Line(results.session, LineProps.{.start = Vector2.{cast(float32)chart_x, guide},
.end = Vector2.{cast(float32)(chart_x + chart_width), guide},
.color = Alpha(results.border_color, 0.55)})
}
// The lines and points come before every label, so the labels stay
// above the lines that reach them.
for index: cast(s32)0..results.round_count - 1 {
point_x := ChartX(index, chart_x, chart_width)
point := Vector2.{cast(float32)point_x, cast(float32)ChartY(index, baseline, chart_height, top)}
Line(results.session, LineProps.{.start = point,
.end = Vector2.{cast(float32)point_x, cast(float32)baseline}, .color = Alpha(accent, 0.18)})
if index > 0 {
Line(results.session, LineProps.{
.start = Vector2.{cast(float32)ChartX(index - 1, chart_x, chart_width),
cast(float32)ChartY(index - 1, baseline, chart_height, top)},
.end = point, .thickness = cast(float32)Scale(3), .color = accent})
}
Circle(results.session, CircleProps.{.center = point, .radius = cast(float32)Scale(5),
.fill = results.text_color})
}
for index: cast(s32)0..results.round_count - 1 {
if index % step == 0 || index == results.round_count - 1 {
value := results_rounds[index]
if value < 0 {
value = 0
}
point_x := ChartX(index, chart_x, chart_width)
point_y := ChartY(index, baseline, chart_height, top)
out: Vec(u8)
BuilderPrint(*out, "%", index + 1)
Label(Number("results_metric_seconds", value), point_x - Scale(25), point_y - Scale(29),
Scale(50), Scale(22), Scale(14), cast(TextAlign)TextAlignCenter)
Label(BuilderFinish(out), point_x - Scale(15), baseline + Scale(7), Scale(30), Scale(20),
Scale(12), cast(TextAlign)TextAlignCenter)
}
}
}
RoundList :: (x: s32, y: s32, width: s32) {
rows := (results.round_count + 1) / 2
gap := Scale(8)
padding := Scale(14)
cell_width := (width - padding * 2 - gap) / 2
Card(x, y, width, Scale(50) + rows * Scale(40))
Label(Locale("round_times_title"), x + padding, y + Scale(8), width - padding * 2, Scale(30),
Scale(18), cast(TextAlign)TextAlignStart)
for index: cast(s32)0..results.round_count - 1 {
cell_x := x + padding + (index % 2) * (cell_width + gap)
cell_y := y + Scale(42) + (index / 2) * Scale(40)
label := Filled(Locale("round_result_label"), index + 1, results_rounds[index], "")
Box(results.session, BoxProps.{.bounds = Bounds(cell_x, cell_y, cell_width, Scale(32)),
.fill = Alpha(results.link_color, 0.08), .radius = Corner(0.16, cell_width, Scale(32))})
Label(label, cell_x + Scale(7), cell_y, cell_width - Scale(14), Scale(32),
FitFont(label, cell_width - Scale(14), Scale(14), Scale(10)), cast(TextAlign)TextAlignStart)
}
}
// ---- The other practices ---------------------------------------------------------------
OtherCount :: () -> s32 {
if results.activity == EXERCISE_PATTERNS {
return 1 + (ifx results.detail.count > 0 then 1 else 0) + (ifx results.secondary > 0 then 1 else 0)
}
return 1
}
OtherSummary :: (x: s32, y: s32, width: s32) {
lines: [3]string
count: s32 = 0
activity := results.activity
if activity == EXERCISE_MEDITATION || activity == EXERCISE_PATTERNS ||
activity == EXERCISE_TAI_CHI || activity == EXERCISE_ASTRAL_PROJECTION ||
activity == EXERCISE_WORKOUT {
lines[count] = Filled(Locale("results_duration"), 0, 0, Duration(results.primary))
count += 1
if activity == EXERCISE_PATTERNS && results.detail.count > 0 {
lines[count] = Filled(Locale("results_pattern"), 0, 0, results.detail)
count += 1
}
if activity == EXERCISE_PATTERNS && results.secondary > 0 {
lines[count] = Number("results_cycles", results.secondary)
count += 1
}
} else {
lines[count] = Number("results_repetitions", results.primary)
count += 1
}
Card(x, y, width, Scale(50) + count * Scale(38))
for index: cast(s32)0..count - 1 {
if index > 0 {
rule := cast(float32)(y + Scale(30 + index * 38))
Line(results.session, LineProps.{.start = Vector2.{cast(float32)(x + Scale(16)), rule},
.end = Vector2.{cast(float32)(x + width - Scale(16)), rule},
.color = Alpha(results.border_color, 0.70)})
}
Label(lines[index], x + Scale(18), y + Scale(30) + index * Scale(38), width - Scale(36), Scale(38),
Scale(17), cast(TextAlign)TextAlignStart)
}
}
// Saved, not saved, or failed to save.
Status :: (x: s32, y: s32, width: s32) {
key := "results_unsaved_status"
icon := results.link_color
if results.write_failed {
key = "results_write_failed"
icon = Color.{.r = 226, .g = 83, .b = 78, .a = 255}
} else if results.saved {
key = "results_saved_status"
icon = Color.{.r = 108, .g = 199, .b = 145, .a = 255}
}
status := Locale(key)
Card(x, y, width, Scale(50))
Box(results.session, BoxProps.{.bounds = Bounds(x, y, width, Scale(50)), .fill = Alpha(icon, 0.07),
.border = Alpha(icon, 0.34), .radius = Corner(0.12, width, Scale(50))})
center := Vector2.{cast(float32)(x + Scale(29)), cast(float32)(y + Scale(25))}
Circle(results.session, CircleProps.{.center = center, .radius = cast(float32)Scale(12),
.fill = Alpha(icon, 0.25)})
Circle(results.session, CircleProps.{.center = center, .radius = cast(float32)Scale(5), .fill = icon})
Label(status, x + Scale(52), y + Scale(7), width - Scale(68), Scale(36),
FitFont(status, width - Scale(68), Scale(16), Scale(12)), cast(TextAlign)TextAlignStart)
}
// The practice's first session, with no habit for it yet, asks whether to
// make it one; once added, it says so.
HabitOfferHeight :: () -> s32 {
if results.habit_offer == PRACTICE_HABIT_OFFER_ASK {
return Scale(130)
}
if results.habit_offer == PRACTICE_HABIT_OFFER_ADDED {
return Scale(50)
}
return 0
}
HabitOffer :: (x: s32, y: s32, width: s32) {
padding := Scale(16)
inner := width - padding * 2
if results.habit_offer == PRACTICE_HABIT_OFFER_ADDED {
added := Locale("results_habit_added")
icon := Color.{.r = 108, .g = 199, .b = 145, .a = 255}
Card(x, y, width, Scale(50))
center := Vector2.{cast(float32)(x + Scale(29)), cast(float32)(y + Scale(25))}
Circle(results.session, CircleProps.{.center = center, .radius = cast(float32)Scale(12),
.fill = Alpha(icon, 0.25)})
Circle(results.session, CircleProps.{.center = center, .radius = cast(float32)Scale(5), .fill = icon})
Label(added, x + Scale(52), y + Scale(7), width - Scale(68), Scale(36),
FitFont(added, width - Scale(68), Scale(16), Scale(12)), cast(TextAlign)TextAlignStart)
return
}
title := Filled(Locale("results_habit_offer"), 0, 0, results.name)
hint := Locale("results_habit_offer_hint")
Card(x, y, width, Scale(130))
Label(title, x + padding, y + Scale(10), inner, Scale(30), FitFont(title, inner, Scale(18), Scale(13)),
cast(TextAlign)TextAlignStart)
Text(results.session, TextProps.{.bounds = Bounds(x + padding, y + Scale(40), inner, Scale(24)),
.text = hint, .font = FitFont(hint, inner, Scale(14), Scale(11)),
.align = cast(TextAlign)TextAlignStart, .vertical_align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapNone, .disabled = true})
gap := Scale(10)
button_width := (inner - gap) / 2
button_y := y + Scale(76)
if Button(results.session, ButtonProps.{.bounds = Bounds(x + padding, button_y, button_width, Scale(40)),
.label = Locale("results_habit_not_now"), .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
results.action = PRACTICE_RESULTS_SKIP_HABIT
}
if Button(results.session, ButtonProps.{
.bounds = Bounds(x + padding + button_width + gap, button_y, inner - button_width - gap, Scale(40)),
.label = Locale("results_habit_add"), .tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
results.action = PRACTICE_RESULTS_ADD_HABIT
}
}
// ---- The page ---------------------------------------------------------------------------
ContentHeight :: () -> s32 {
height := Scale(20 + 86 + 14)
if results.activity == EXERCISE_WIM_HOF {
height += Scale(78 + 14 + 14) + ChartHeight()
} else {
height += Scale(50 + OtherCount() * 38 + 14)
}
if !results.temporary {
height += Scale(50 + 14 + 124 + 14)
}
if HabitOfferHeight() > 0 {
height += HabitOfferHeight() + Scale(14)
}
if results.activity == EXERCISE_WIM_HOF && results.round_count > 1 {
height += Scale(50 + ((results.round_count + 1) / 2) * 40 + 14)
}
return height + Scale(20)
}
Content :: (x: s32, width: s32, top: s32, best: s32, average: s32) {
y := top + Scale(20)
Circle(results.session, CircleProps.{
.center = Vector2.{cast(float32)results.center_x, cast(float32)(y + Scale(20))},
.radius = cast(float32)Scale(170), .fill = Alpha(Accent(), 0.17),
.edge = Alpha(results.canvas_color, 0.0), .has_edge = true})
Label(Locale("results_title"), x, y, width, Scale(25), Scale(14), cast(TextAlign)TextAlignStart)
Label(results.name, x, y + Scale(30), width, Scale(50), FitFont(results.name, width, Scale(34), Scale(20)),
cast(TextAlign)TextAlignStart)
y += Scale(86 + 14)
if results.activity == EXERCISE_WIM_HOF {
Metrics(x, y, width, best, average)
y += Scale(78 + 14)
Chart(x, y, width, best)
y += ChartHeight() + Scale(14)
} else {
OtherSummary(x, y, width)
y += Scale(50 + OtherCount() * 38 + 14)
}
// Temporary results are not kept, so there is no save status and no
// mood to record.
if !results.temporary {
Status(x, y, width)
y += Scale(50 + 14)
}
if HabitOfferHeight() > 0 {
HabitOffer(x, y, width)
y += HabitOfferHeight() + Scale(14)
}
if !results.temporary {
MoodPicker(x, y, width)
y += Scale(124 + 14)
}
if results.activity == EXERCISE_WIM_HOF && results.round_count > 1 {
RoundList(x, y, width)
}
}
Results :: () {
Rounds()
x := Scale(16)
width := results.view_width - Scale(16) * 2
if width > Scale(600) {
x += (width - Scale(600)) / 2
width = Scale(600)
}
button_height := Scale(48)
gap := Scale(12)
button_y := results.view_height - Scale(20) - button_height
if button_y < Scale(200) {
button_y = results.view_height - button_height
}
best: s32 = 0
average: s32 = 0
if results.activity == EXERCISE_WIM_HOF {
RoundStats(*best, *average)
}
scrolled := Scroll(results.session, ScrollProps.{.key = KeyHash("inbe/screens/session_results/scroll/1"),
.bounds = Bounds(0, 0, results.view_width, button_y - Scale(12)),
.content_height = ContentHeight(), .scroll_offset = results.scroll})
results.scroll = scrolled.scroll_offset
if scrolled.opened {
Content(x, width, cast(s32)scrolled.content.y, best, average)
unused End(results.session)
}
if results.saved {
button_width := (width - gap) / 2
if Button(results.session, ButtonProps.{.bounds = Bounds(x, button_y, button_width, button_height),
.label = Locale("discard_button"), .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
results.action = PRACTICE_RESULTS_DISCARD
}
if Button(results.session, ButtonProps.{
.bounds = Bounds(x + button_width + gap, button_y, width - button_width - gap, button_height),
.label = Locale("done_button"), .tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
results.action = PRACTICE_RESULTS_DONE
}
} else if Button(results.session, ButtonProps.{.bounds = Bounds(x, button_y, width, button_height),
.label = Locale("done_button"), .tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
results.action = PRACTICE_RESULTS_DONE
}
}
PracticeResultsView :: (message: PracticeMessage) -> PracticeMessage {
results = ReadPracticeResultsHost()
results.action = PRACTICE_RESULTS_NONE
results.value = 0
Results()
WritePracticeResultsHost(results)
message.succeeded = true
return message
}
File diff suppressed because it is too large. Load diff
+108
View File
@@ -0,0 +1,108 @@
// How the Sun Salutation figures look and where the camera stands.
#import, file "../../src/practices/tai_chi/tai_chi_flat.zi";
#import, file "../../src/practices/tai_chi/tai_chi_math.zi";
#import, file "../../src/practices/tai_chi/tai_chi_solve.zi";
#import, file "../../src/practices/tai_chi/tai_chi_rules.zi";
#import, file "../../src/practices/tai_chi/tai_chi_view.zi";
#import, file "../../src/practices/sun_salutation/sun_salutation_pose.zi";
#import, file "../../src/practices/sun_salutation/sun_salutation_rules.zi";
#import, file "workout_moves.zi";
// Camera turns in degrees, as the workout frames its figure: prayer a
// little from her right so her feet and hands show, every other pose from
// her right side, turned enough that her face shows too.
SUN_SALUTATION_PRAYER_YAW :: -25.0
SUN_SALUTATION_SIDE_YAW :: -80.0
SUN_SALUTATION_TILT :: 7.0
SUN_SALUTATION_STANDING_SPAN :: 1.3
SUN_SALUTATION_FLOOR_SPAN :: 2.2
SUN_SALUTATION_STANDING_CENTER :: 0.25
SUN_SALUTATION_FLOOR_CENTER :: -0.08
SunSalutationView :: struct {
yaw: float64
span: float64
center: float64
}
// The Jade woman of Tai Chi and the workout in the chosen Auburn Dawn
// colours (design/sun-salutation/face-redesign): fair skin, auburn hair and
// a natural face.
SunSalutationWomanLook :: () -> TaiChiFlatLook {
look := TaiChiFlatLookNamed("jadeWoman")
look.skin = 0xf7c4a3
look.hair = 0x7c3a24
look.features = 0x3a2119
look.mouth = 0xd9937c
look.blush = 0xf0a08a
look.blush_alpha = 0.3
// The band round her bun is a darker auburn, not a bright tie.
look.accent = 0x5a2818
// A slimmer top of the Jade woman's length over a seat inside it, as the
// studio's 3D figure wears them (design/tai-chi, the sunWoman look), and
// finer hands and feet than the cartoon figure's.
TaiChiFlatJacket(*look, 0.112, 0.106, 0.09, 0.097, 0.1, 0.075, 0.062, 0.071, 0.006)
look.jacket_from = look.jacket[0][0]
look.limbs = 0.92
look.seat[0] = 0.088
look.seat[1] = 0.058
look.seat[2] = 0.06
look.seat[3] = -0.03
look.seat[4] = -0.008
look.hand_size = 0.92
look.foot_length = 0.85
look.foot_depth = 0.8
return look
}
SunSalutationStepView :: (step: s32) -> SunSalutationView {
view := SunSalutationView.{.yaw = SUN_SALUTATION_SIDE_YAW, .span = SUN_SALUTATION_FLOOR_SPAN,
.center = SUN_SALUTATION_FLOOR_CENTER}
// The camera turns while she stands tall, never while she is bent and
// the inside of her top would show.
if step == 0 || step == SUN_SALUTATION_STEP_COUNT - 1 {
view.yaw = SUN_SALUTATION_PRAYER_YAW
}
if step <= 2 || step >= SUN_SALUTATION_STEP_COUNT - 3 {
view.span = SUN_SALUTATION_STANDING_SPAN
view.center = SUN_SALUTATION_STANDING_CENTER
}
return view
}
SunSalutationViewAt :: (state: SunSalutationPracticeState) -> SunSalutationView {
to := SunSalutationStepView(state.step)
if state.step <= 0 {
return to
}
from := SunSalutationStepView(state.step - 1)
amount := SunSalutationTransition(state)
return SunSalutationView.{.yaw = from.yaw + (to.yaw - from.yaw) * amount,
.span = from.span + (to.span - from.span) * amount,
.center = from.center + (to.center - from.center) * amount}
}
// The app and exported video use the same pose, illustration and camera.
SunSalutationPaintPose :: (frame: *TaiChiFlatFrame, character: s32, pose: WorkoutPose,
view: SunSalutationView, width: float64, height: float64) -> TaiChiFraming {
rig := WorkoutRig()
solved := WorkoutSolve(*pose, *rig)
look := TaiChiFlatLookNamed("indigoMan")
if character == SUN_SALUTATION_MAN {
look.plain_top = true
} else {
look = SunSalutationWomanLook()
}
framing: TaiChiFraming
framing.camera.yaw = view.yaw * TAI_CHI_DEGREE
framing.camera.tilt = SUN_SALUTATION_TILT * TAI_CHI_DEGREE
framing.camera.center = TaiChiV3(0.0, 0.0, view.center)
framing.view_height = 2.35
framing.view_center = 1.02
across := framing.view_height * width / height
if across < view.span {
framing.view_height *= view.span / across
}
TaiChiFlatPaintLook(frame, *solved, *rig, look, framing.camera)
return framing
}
+26
View File
@@ -0,0 +1,26 @@
#import, file "../../src/core/types.zi";
#import, file "../../src/core/breath_timing.zi";
// At the beginning, Back may leave the phase even while its fractional
// timer advances. This keeps a second press usable without pausing first.
WhmBackRestartsPhase :: (session: BreathSession) -> bool {
if session.phase == BreathPhaseStarting {
return session.sectick >= 60
}
if session.phase == BreathPhaseBreathe ||
session.phase == BreathPhaseHold ||
session.phase == BreathPhaseRecover {
return BreathCountValue(session) > 0
}
return false
}
WhmRestartPhase :: (session: BreathSession) -> BreathSession {
session.dir = 0
session.r = session.rmin
session.breath_frame = 0
session.breathtick = 0
session.sectick = 0
session.halftick = 0
return BreathResetCount(session)
}
+185
View File
@@ -0,0 +1,185 @@
// A running Wim Hof round: the breathing circle with a band of ticks
// showing the round's progress, counting down while waiting and recovering,
// the count inside it, and while the breath is held the Breath button or the
// hint to tap twice. The host keeps the round's clock, sounds and results,
// draws the title bar, the controls and the question on leaving, and does
// what was pressed.
#import "std/math"
#import "session"
#import "geometry"
#import "dpi"
#import "drawing_props"
#import "text_props"
#import "text_align"
#import "text_widget"
#import "text_measure"
#import "button_props"
#import "button_widget"
#import "control_props"
#import "shape_props"
#import "shape_widget"
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
using ButtonTone;
using ButtonEmphasis;
using TextAlign;
using TextWrap;
host_api :: #system_library "host_api";
ReadPracticeWhmHost :: () -> PracticeWhmFrame #foreign host_api;
WritePracticeWhmHost :: (frame: PracticeWhmFrame) #foreign host_api;
whm: PracticeWhmFrame;
WHM_PI :: 3.14159265358979
Scale :: (pixels: s32) -> s32 {
return ScalePixels(pixels, whm.scale)
}
Width :: (text: string, font: s32) -> s32 {
return TextWidth(whm.session, TextProps.{.text = text, .font = font})
}
WithAlpha :: (color: Color, alpha: s32) -> Color {
color.a = cast(u8)alpha
return color
}
// Black text on a light circle, white on a dark one.
Contrast :: (background: Color) -> Color {
luma := cast(s32)background.r * 299 + cast(s32)background.g * 587 + cast(s32)background.b * 114
if luma >= 128000 {
return Color.{0, 0, 0, 255}
}
return Color.{255, 255, 255, 255}
}
ThinRing :: (center: Vector2, radius: float32, color: Color) {
Ring(whm.session, RingProps.{.center = center, .inner_radius = radius - 0.75,
.outer_radius = radius + 0.75, .start_angle = 0.0, .end_angle = 360.0, .color = color})
}
// The circle, with the band inside its edge filling as the round goes on
// (emptying while it counts down) and a tick for each step.
ProgressCircle :: () {
gap := Scale(5)
band_width := Scale(10)
if band_width > whm.rmin - gap - 4 {
band_width = whm.rmin - gap - 4
}
if band_width < 1 {
band_width = 1
}
thickness := ifx whm.ticks <= 40 then Scale(3) else Scale(2)
if thickness < 1 {
thickness = 1
}
outer := whm.radius - cast(float32)gap
inner := outer - cast(float32)band_width
center := Vector2.{cast(float32)whm.center_x, cast(float32)whm.center_y}
Circle(whm.session, CircleProps.{.center = center, .radius = whm.radius, .fill = whm.accent_color})
if outer <= inner {
return
}
contrast := Contrast(whm.accent_color)
band := WithAlpha(contrast, 72)
Ring(whm.session, RingProps.{.center = center, .inner_radius = inner, .outer_radius = outer,
.start_angle = 0.0, .end_angle = 360.0, .color = WithAlpha(contrast, 30)})
progress := whm.progress
if whm.countdown {
if progress < 1.0 {
Ring(whm.session, RingProps.{.center = center, .inner_radius = inner,
.outer_radius = outer, .start_angle = -450.0,
.end_angle = -90.0 - 360.0 * progress, .color = band})
}
} else if progress > 0.0 {
Ring(whm.session, RingProps.{.center = center, .inner_radius = inner, .outer_radius = outer,
.start_angle = -90.0, .end_angle = -90.0 + 360.0 * progress, .color = band})
}
ring := WithAlpha(contrast, 175)
ThinRing(center, inner, ring)
ThinRing(center, outer, ring)
ticks := whm.ticks
if ticks < 1 {
ticks = 1
}
for index: cast(s32)0..ticks - 1 {
share := cast(float32)index / cast(float32)ticks
direction: float32 = ifx whm.countdown then -1.0 else 1.0
angle := -WHM_PI * 0.5 + cast(float64)(direction * share) * 2.0 * WHM_PI
if whm.countdown && index == 0 {
share = 1.0
}
done := share <= progress + 0.0001
if whm.countdown {
done = share > progress + 0.0001
}
c := cast(float32)Cos(angle)
s := cast(float32)Sin(angle)
Line(whm.session, LineProps.{
.start = Vector2.{center.x + c * inner, center.y + s * inner},
.end = Vector2.{center.x + c * outer, center.y + s * outer},
.thickness = cast(float32)thickness,
.color = WithAlpha(contrast, ifx done then 235 else 96)})
}
}
Count :: () {
radius := cast(s32)whm.radius
font: s32 = Text48
while font > Text24 && Width(whm.count, font) > cast(s32)(cast(float32)radius * 1.12) {
font -= 1
}
Text(whm.session, TextProps.{.text = whm.count,
.bounds = Rectangle.{cast(float32)(whm.center_x - radius), cast(float32)(whm.center_y - radius),
cast(float32)(radius * 2), cast(float32)(radius * 2)},
.font = font, .class_name = whm.ink_class, .wrap = cast(TextWrap)TextWrapNone,
.align = cast(TextAlign)TextAlignCenter, .vertical_align = cast(TextAlign)TextAlignCenter})
}
// The hint to tap twice under the circle, or the Breath button across its
// lower edge.
Hold :: () {
if whm.double_tap {
width := Width(whm.hint, whm.font)
y := whm.center_y + whm.rmax + Scale(12)
if y > whm.breath_max_y {
y = whm.breath_max_y
}
Text(whm.session, TextProps.{.text = whm.hint,
.bounds = Rectangle.{cast(float32)(whm.center_x - width / 2), cast(float32)y, 0, 0},
.wrap = cast(TextWrap)TextWrapNone})
return
}
width := Width(whm.breath_label, Text16) + Scale(72)
if width < Scale(184) {
width = Scale(184)
}
if width > whm.view_width - Scale(24) {
width = whm.view_width - Scale(24)
}
y := whm.center_y + whm.rmax - Scale(42)
if y > whm.breath_max_y {
y = whm.breath_max_y
}
if Button(whm.session, ButtonProps.{
.bounds = Rectangle.{cast(float32)(whm.center_x - width / 2), cast(float32)y,
cast(float32)width, cast(float32)(Text16 + Scale(28))},
.label = whm.breath_label, .tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
whm.action = PRACTICE_WHM_BREATH
}
}
PracticeWhmView :: (message: PracticeMessage) -> PracticeMessage {
whm = ReadPracticeWhmHost()
whm.action = PRACTICE_WHM_NONE
whm.value = 0
ProgressCircle()
Count()
if whm.hold {
Hold()
}
WritePracticeWhmHost(whm)
message.succeeded = true
return message
}
+27 -159
View File
@@ -1,3 +1,6 @@
#import, file "../../src/apps/practice_ui_types.zi";
#import, file "../../src/apps/practice_types.zi";
#import, file "../../src/practices/practice_movement_host.zi";
// The 7-Minute Workout owns its circuit, figure and session; the host
// supplies the existing audio, storage and platform lifecycle effects.
#import, file "workout_rules.zi";
@@ -235,27 +238,19 @@ WorkoutExerciseText :: (app: *InnerBreeze, prefix: string, exercise: s32) -> str
return WorkoutText(app, WorkoutKeyFor(prefix, exercise, key[:]))
}
// "Get ready", "Rest" or the exercise's name.
// The exercise being done, or the one to get into position for.
WorkoutHeading :: (app: *InnerBreeze, step: WorkoutStep) -> string {
if step.phase == WORKOUT_PHASE_PREPARE {
return LocaleText("workout_get_ready")
}
if step.phase == WORKOUT_PHASE_REST {
return LocaleText("workout_rest")
}
return WorkoutExerciseText(app, "workout_name_", step.exercise)
}
// "Next: Wall sit" while waiting, "Exercise 2 of 12" while working.
// "Get into position" while waiting, "Exercise 2 of 12" while working.
WorkoutSubheading :: (app: *InnerBreeze, step: WorkoutStep) -> string {
buffer: [160]u8
if step.phase == WORKOUT_PHASE_WORK {
args: [2]FormatArg = .[FormatArg.{.number = step.exercise + 1}, FormatArg.{.number = WORKOUT_EXERCISE_COUNT}]
unused FormatTemplate(LocaleText("workout_exercise_number"), args[:], buffer[:])
} else {
args: [1]FormatArg = .[FormatArg.{.text = WorkoutExerciseText(app, "workout_name_", step.exercise), .is_text = true}]
unused FormatTemplate(LocaleText("workout_next"), args[:], buffer[:])
if step.phase != WORKOUT_PHASE_WORK {
return LocaleText("workout_get_into_position")
}
buffer: [160]u8
args: [2]FormatArg = .[FormatArg.{.number = step.exercise + 1}, FormatArg.{.number = WORKOUT_EXERCISE_COUNT}]
unused FormatTemplate(LocaleText("workout_exercise_number"), args[:], buffer[:])
return FrameTextHold(*app.ui.frame_text, TextUntilNul(buffer[:]))
}
@@ -269,18 +264,6 @@ WorkoutTip :: (app: *InnerBreeze, step: WorkoutStep) -> string {
return WorkoutExerciseText(app, "workout_tip_", step.exercise)
}
WorkoutClockText :: (seconds: s32, output: []u8) -> string {
cursor: s32 = 0
output[0] = cast(u8)0
unused TextBufferAppendNumber(output, *cursor, seconds / 60)
unused TextBufferAppendByte(output, *cursor, cast(u8)58)
if seconds % 60 < 10 {
unused TextBufferAppendByte(output, *cursor, cast(u8)48)
}
unused TextBufferAppendNumber(output, *cursor, seconds % 60)
return TextUntilNul(output)
}
// --- Drawing ---------------------------------------------------------------------
WorkoutDark :: (app: *InnerBreeze) -> bool {
@@ -315,65 +298,6 @@ WorkoutDrawFigure :: (app: *InnerBreeze, step: WorkoutStep, area: Rectangle, key
alt_text, WORKOUT_EDGE_PATH)
}
// Twelve short bars across the top, one per exercise, filling as each is
// done.
WorkoutDrawProgress :: (app: *InnerBreeze, step: WorkoutStep, x: s32, y: s32, width: s32) {
gap := AppScale(4)
bar_w := (width - gap * (WORKOUT_EXERCISE_COUNT - 1)) / WORKOUT_EXERCISE_COUNT
bar_h := AppScale(6)
track := color_with_alpha(StyleTokenColor("text"), 0.14)
fill := StyleTokenColor("accent")
for index: cast(s32)0..WORKOUT_EXERCISE_COUNT - 1 {
bar := Rectangle.{cast(float32)(x + index * (bar_w + gap)), cast(float32)y,
cast(float32)bar_w, cast(float32)bar_h}
Box(app.ui.session, BoxProps.{.bounds = bar, .fill = track, .radius = cast(float32)bar_h / 2.0})
share: float32 = 0.0
if index < step.exercise || step.phase == WORKOUT_PHASE_DONE {
share = 1.0
} else if index == step.exercise && step.phase == WORKOUT_PHASE_WORK {
share = cast(float32)step.elapsed_ms / cast(float32)step.length_ms
}
if share > 0.0 {
done := bar
done.width = bar.width * share
if done.width < cast(float32)bar_h {
done.width = cast(float32)bar_h
}
Box(app.ui.session, BoxProps.{.bounds = done, .fill = fill, .radius = cast(float32)bar_h / 2.0})
}
}
}
// The seconds left in the step inside a ring that empties as they pass.
WorkoutDrawCountdown :: (app: *InnerBreeze, step: WorkoutStep, center: Vector2, radius: float32) {
thickness := cast(float32)AppScale(6)
Ring(app.ui.session, RingProps.{.center = center, .inner_radius = radius - thickness,
.outer_radius = radius, .start_angle = 0.0, .end_angle = 360.0,
.color = color_with_alpha(StyleTokenColor("text"), 0.12)})
left: float32 = 1.0
if step.length_ms > 0 {
left = 1.0 - cast(float32)step.elapsed_ms / cast(float32)step.length_ms
}
color := color_with_alpha(StyleTokenColor("text"), 0.55)
if step.phase == WORKOUT_PHASE_WORK {
color = StyleTokenColor("accent")
}
if left > 0.0 {
Ring(app.ui.session, RingProps.{.center = center, .inner_radius = radius - thickness,
.outer_radius = radius, .start_angle = -90.0, .end_angle = -90.0 + 360.0 * left,
.color = color})
}
number: [16]u8
cursor: s32 = 0
unused TextBufferAppendNumber(number[:], *cursor, WorkoutStepSecondsLeft(step))
font := AppScale(30)
Text(app.ui.session, TextProps.{
.text = FrameTextHold(*app.ui.frame_text, TextUntilNul(number[:])),
.bounds = Rectangle.{center.x - radius, center.y - radius, radius * 2.0, radius * 2.0},
.font = font, .align = cast(TextAlign)TextAlignCenter,
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone})
}
WorkoutDrawWindow :: (app: *InnerBreeze, picture: Rectangle, output: []u8) -> string {
step := WorkoutStepAt(workout_elapsed_ms)
WorkoutDrawFigure(app, step, picture, KeyHash("workout/window/figure"), "")
@@ -388,9 +312,11 @@ WorkoutDrawWindow :: (app: *InnerBreeze, picture: Rectangle, output: []u8) -> st
return TextUntilNul(output)
}
WorkoutSessionFigure :: (app: *InnerBreeze, request: PracticeFigureRequest) {
WorkoutDrawFigure(app, WorkoutStepAt(workout_elapsed_ms), request.bounds, request.key, request.alt_text)
}
WorkoutDraw :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
unused center_x
unused center_y
top := PracticeTitleBarHeight()
if PracticeTitleBar(app, LocaleText("exercise_workout"), top) {
WorkoutRequestExit(app)
@@ -400,77 +326,17 @@ WorkoutDraw :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
}
practice_draw_audio_controls(app)
step := WorkoutStepAt(workout_elapsed_ms)
pad := AppScale(20)
view_w := app.ui.view_width
view_h := app.ui.view_height
// Side by side when there is room: the figure on the left, the words,
// the countdown and Pause on the right.
wide := view_w >= AppScale(760) && view_w * 10 >= view_h * 12
panel_w := ifx wide then view_w * 2 / 5 else view_w - pad * 2
if panel_w > AppScale(560) {
panel_w = AppScale(560)
}
panel_x := ifx wide then view_w - pad - panel_w else pad
progress_y := top + AppScale(10)
WorkoutDrawProgress(app, step, pad, progress_y, view_w - pad * 2)
button_h := AppScale(48)
ring_r := AppScale(44)
heading_font := AppScale(26)
small_font := AppFontSize()
heading := WorkoutHeading(app, step)
subheading := WorkoutSubheading(app, step)
tip := WorkoutTip(app, step)
heading_h := AppParagraphHeight(heading, panel_w, heading_font, 0)
sub_h := AppParagraphHeight(subheading, panel_w, small_font, 0)
tip_h := AppParagraphHeight(tip, panel_w, small_font, AppScale(3))
content_top := progress_y + AppScale(20)
words_h := heading_h + AppScale(4) + sub_h
lower_h := tip_h + AppScale(16) + ring_r * 2 + AppScale(16) + button_h + AppScale(20)
stage: Rectangle
panel_top := content_top
if wide {
stage = Rectangle.{cast(float32)pad, cast(float32)content_top,
cast(float32)(panel_x - pad * 2), cast(float32)(view_h - content_top - pad)}
panel_top = content_top + (view_h - content_top - pad - words_h - AppScale(24) - lower_h) / 2
if panel_top < content_top {
panel_top = content_top
}
} else {
stage_h := view_h - content_top - words_h - AppScale(12) - lower_h
stage = Rectangle.{cast(float32)pad, cast(float32)(content_top + words_h + AppScale(8)),
cast(float32)(view_w - pad * 2), cast(float32)stage_h}
}
emphasis := StrongWhole(heading)
Text(app.ui.session, TextProps.{.text = heading,
.bounds = Rectangle.{cast(float32)panel_x, cast(float32)panel_top, cast(float32)panel_w, cast(float32)heading_h},
.font = heading_font, .align = cast(TextAlign)TextAlignCenter, .strong = emphasis[:1]})
Text(app.ui.session, TextProps.{.text = subheading,
.bounds = Rectangle.{cast(float32)panel_x, cast(float32)(panel_top + heading_h + AppScale(4)),
cast(float32)panel_w, cast(float32)sub_h},
.font = small_font, .align = cast(TextAlign)TextAlignCenter, .disabled = true})
if stage.height > cast(float32)AppScale(60) {
alt: [192]u8
unused AppCopyText(heading, alt[:])
WorkoutDrawFigure(app, step, stage, KeyHash("workout/figure"), TextUntilNul(alt[:]))
}
lower_y := ifx wide then panel_top + words_h + AppScale(24) else view_h - lower_h
Text(app.ui.session, TextProps.{.text = tip,
.bounds = Rectangle.{cast(float32)panel_x, cast(float32)lower_y, cast(float32)panel_w, cast(float32)tip_h},
.font = small_font, .align = cast(TextAlign)TextAlignCenter})
ring_center := Vector2.{cast(float32)(panel_x + panel_w / 2),
cast(float32)(lower_y + tip_h + AppScale(16) + ring_r)}
WorkoutDrawCountdown(app, step, ring_center, cast(float32)ring_r)
button_w := AppScale(220)
if button_w > panel_w {
button_w = panel_w
}
button_y := lower_y + tip_h + AppScale(16) + ring_r * 2 + AppScale(16)
if Button(app.ui.session, ButtonProps.{.key = KeyHash("workout/pause"),
.label = LocaleText(ifx app.session_paused != 0 then "patterns_resume_button" else "pause_button"),
.bounds = Rectangle.{cast(float32)(panel_x + (panel_w - button_w) / 2), cast(float32)button_y,
cast(float32)button_w, cast(float32)button_h},
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
frame := PracticeMovementFrameFor(app, EXERCISE_WORKOUT, top)
frame.heading = WorkoutHeading(app, step)
frame.subtitle = WorkoutSubheading(app, step)
frame.cue = WorkoutTip(app, step)
frame.exercise = step.exercise
frame.phase = step.phase
frame.elapsed_ms = step.elapsed_ms
frame.length_ms = step.length_ms
frame.seconds_left = WorkoutStepSecondsLeft(step)
frame = PracticeMovementRun(app, frame, WorkoutSessionFigure)
if frame.action == PRACTICE_MOVEMENT_PAUSE {
app.session_paused = ifx app.session_paused != 0 then 0 else 1
}
if app.backgrounded == 0 {
@@ -479,4 +345,6 @@ WorkoutDraw :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
workout_frame_carry = total - cast(float64)milliseconds
WorkoutAdvanceElapsed(app, milliseconds)
}
unused center_x
unused center_y
}
+53 -1
View File
@@ -32,6 +32,9 @@ WorkoutHand :: struct {
pole: TaiChiVector3
// 1 lays the hand flat on what it rests on, fingers ahead.
flat: float64
// 1 stands the hand upright, fingers up and the palm toward her middle,
// as when the palms press together in prayer.
upright: float64
}
WorkoutPose :: struct {
@@ -52,6 +55,41 @@ WorkoutPose :: struct {
knees: [2]TaiChiVector3
}
// A digest of every measure the solver reads from a pose.
WorkoutPoseDigest :: (pose: *WorkoutPose, digest: u64) -> u64 {
digest = TaiChiDigest(digest, pose.pelvis.x)
digest = TaiChiDigest(digest, pose.pelvis.y)
digest = TaiChiDigest(digest, pose.pelvis.z)
digest = TaiChiDigest(digest, pose.yaw)
digest = TaiChiDigest(digest, pose.lean)
digest = TaiChiDigest(digest, pose.bend)
digest = TaiChiDigest(digest, pose.twist)
digest = TaiChiDigest(digest, pose.curl)
digest = TaiChiDigest(digest, pose.head)
for side: cast(s32)0..1 {
hand := *pose.hands[side]
digest = TaiChiDigest(digest, cast(float64)hand.mode)
digest = TaiChiDigest(digest, hand.at.x)
digest = TaiChiDigest(digest, hand.at.y)
digest = TaiChiDigest(digest, hand.at.z)
digest = TaiChiDigest(digest, hand.pole.x)
digest = TaiChiDigest(digest, hand.pole.y)
digest = TaiChiDigest(digest, hand.pole.z)
digest = TaiChiDigest(digest, hand.flat)
digest = TaiChiDigest(digest, hand.upright)
foot := *pose.feet[side]
digest = TaiChiDigest(digest, foot.x)
digest = TaiChiDigest(digest, foot.z)
digest = TaiChiDigest(digest, foot.yaw)
digest = TaiChiDigest(digest, foot.pitch)
digest = TaiChiDigest(digest, foot.lift)
digest = TaiChiDigest(digest, pose.knees[side].x)
digest = TaiChiDigest(digest, pose.knees[side].y)
digest = TaiChiDigest(digest, pose.knees[side].z)
}
return digest
}
WorkoutKey :: struct {
pose: WorkoutPose
hold_ms: s32
@@ -266,9 +304,16 @@ WorkoutKeyframe :: (exercise: s32, index: s32) -> WorkoutKey {
return WorkoutKeyOf(pose, 120, 520)
}
if exercise == WORKOUT_SQUATS {
// Straight arms reach ahead at shoulder height for balance, standing
// and at the bottom. Aims are in the chest's frame, so the bottom's
// raise adds her lean and curl (38 + 6 degrees) to stay level. The
// solver draws the shoulder toward a long reach, so aiming past the
// arm's length keeps the elbows straight.
WorkoutHandsAt(*pose, WORKOUT_AT_ARM, 90.0, 2.0, 1.12)
WorkoutElbows(*pose, 0.3, -1.0, 0.0)
if index == 1 {
WorkoutBody(*pose, 0.0, 0.5, -0.22, 0.0, 38.0, 0.0, 0.0, 6.0, -26.0)
WorkoutHandsAt(*pose, WORKOUT_AT_ARM, 82.0, 8.0, 0.97)
WorkoutHandsAt(*pose, WORKOUT_AT_ARM, 134.0, 2.0, 1.12)
WorkoutKnees(*pose, 0.25, 0.0, 1.0)
}
WorkoutFeet(*pose, 0.13, 0.0, 10.0, 0.0, 0.0)
@@ -492,6 +537,7 @@ WorkoutBlend :: (a: *WorkoutPose, b: *WorkoutPose, u: float64, rig: *TaiChiRig)
to := b.hands[side]
pose.hands[side].pole = TaiChiLerp3(from.pole, to.pole, u)
pose.hands[side].flat = from.flat + (to.flat - from.flat) * u
pose.hands[side].upright = from.upright + (to.upright - from.upright) * u
if from.mode == to.mode {
pose.hands[side].at = TaiChiLerp3(from.at, to.at, u)
} else {
@@ -657,6 +703,12 @@ WorkoutSolve :: (pose: *WorkoutPose, rig: *TaiChiRig) -> TaiChiSolved {
ahead := TaiChiForwardOf(pose.yaw * TAI_CHI_DEGREE)
fingers := TaiChiNormalize3(TaiChiLerp3(along, ahead, hand.flat))
palm := TaiChiNormalize3(TaiChiLerp3(inward, TaiChiV3(0.0, -1.0, 0.0), hand.flat))
if hand.upright > 0.0 {
up := TaiChiAxis(trunk.chest_quat, 0.0, 1.0, 0.0)
middle := TaiChiRotate(TaiChiV3(-sign, 0.0, 0.0), trunk.chest_quat)
fingers = TaiChiNormalize3(TaiChiLerp3(fingers, up, hand.upright))
palm = TaiChiNormalize3(TaiChiLerp3(palm, middle, hand.upright))
}
hand_quat := TaiChiFrameQuat(TaiChiScale3(fingers, -1.0), palm, inward, true)
solved.hand_quats[side] = hand_quat
solved.palms[side] = TaiChiAddScaled3(TaiChiAddScaled3(arm.end, fingers, rig.palm_offset), palm, 0.008 * rig.height)
+32 -8
View File
@@ -143,21 +143,45 @@ WorkoutKeyFor :: (prefix: string, exercise: s32, output: []u8) -> string {
return TextFromBytes(output[:count])
}
// The narrated line for the step: what is coming while getting ready or
// resting, the exercise as it starts, and the switch halfway through the
// side plank.
WorkoutCueKey :: (step: WorkoutStep, output: []u8) -> string {
if step.phase == WORKOUT_PHASE_PREPARE {
return "workout_say_start"
// The countdown into each exercise: the seconds left while getting ready or
// resting, then "Go" for a moment as the exercise starts.
WORKOUT_COUNT_NONE :: -1
WORKOUT_COUNT_GO :: 0
WORKOUT_GO_MS :: 800
// The last seconds before an exercise are spoken one by one.
WORKOUT_SPOKEN_COUNT :: 3
WorkoutCountdownAt :: (step: WorkoutStep) -> s32 {
if step.phase == WORKOUT_PHASE_PREPARE || step.phase == WORKOUT_PHASE_REST {
return WorkoutStepSecondsLeft(step)
}
if step.phase == WORKOUT_PHASE_REST {
if step.phase == WORKOUT_PHASE_WORK && step.elapsed_ms < WORKOUT_GO_MS {
return WORKOUT_COUNT_GO
}
return WORKOUT_COUNT_NONE
}
// The narrated line for the step: what is coming while getting ready or
// resting, three, two, one as it ends, "Go" as the exercise starts, and
// the switch halfway through the side plank.
WorkoutCueKey :: (step: WorkoutStep, output: []u8) -> string {
if step.phase == WORKOUT_PHASE_PREPARE || step.phase == WORKOUT_PHASE_REST {
left := WorkoutStepSecondsLeft(step)
if left >= 1 && left <= WORKOUT_SPOKEN_COUNT {
counts: [WORKOUT_SPOKEN_COUNT]string = .["workout_say_count_1", "workout_say_count_2",
"workout_say_count_3"]
return counts[left - 1]
}
if step.phase == WORKOUT_PHASE_PREPARE {
return "workout_say_start"
}
return WorkoutKeyFor("workout_say_next_", step.exercise, output)
}
if step.phase == WORKOUT_PHASE_WORK {
if step.exercise == WORKOUT_SIDE_PLANK && step.elapsed_ms >= WORKOUT_SIDE_SWITCH_MS {
return "workout_say_switch"
}
return WorkoutKeyFor("workout_say_", step.exercise, output)
return "workout_say_go"
}
return ""
}
+4
View File
@@ -1,5 +1,9 @@
# Radio
## [1.0.3] - 2026-10-24
- Download on the current Inner Breeze, which only runs the new app format.
## [1.0.2] - 2026-10-22
- Give Radio its own icon in Apps and the sidebar.
+1 -1
View File
@@ -1,6 +1,6 @@
# Radio
Radio is an optional installable app built as `build/node-apps/radio.zib`.
Radio is an optional installable app built as `build/node-apps/radio.zx`.
It requires host API 18, which adds owner-scoped `AudioStartHost`,
`AudioStopHost`, `AudioStateHost` and `AudioVolumeHost` effects. A package
can start an HTTPS audio stream, observe its state, set volume and stop its
+1 -1
View File
@@ -13,7 +13,7 @@
#import "scroll_widget"
#import "tree"
#import "apps/node_types"
#import, file "../../src/cells/module_types.zi";
#import, file "../../src/apps/module_types.zi";
#import, file "stations.zi";
host_api :: #system_library "host_api";
+1 -1
View File
@@ -5,7 +5,7 @@
#import, file "../../src/storage/achievements.zi";
#import, file "../../src/storage/storage_core.zi";
#import, file "../../src/storage/db.zi";
#import, file "../../src/cells/package_files.zi";
#import, file "../../src/apps/package_files.zi";
c :: #system_library "c";
AchievementRadioTime :: () -> float64 #foreign c "GetTime";
+35 -32
View File
@@ -1,85 +1,88 @@
{
"host_api": 27,
"host_api": 39,
"oldest_host_api": 12,
"package_format": "zx",
"module_api": 2,
"apps": {
"inbe": {
"id": "inbe",
"version": "2.1.43",
"sequence": 40,
"version": "2.1.55",
"sequence": 52,
"bundled": true,
"host_api": 27,
"release": "2.1.43"
"host_api": 39,
"release": "2.1.55"
},
"habits": {
"id": "inbe.habits",
"version": "1.2.8",
"sequence": 20,
"version": "1.3.10",
"sequence": 33,
"bundled": true,
"host_api": 26,
"release": "2.1.43"
"host_api": 38,
"oldest_host_api": 30,
"release": "2.1.55"
},
"practices": {
"id": "inbe.practices",
"version": "1.3.8",
"sequence": 19,
"version": "1.6.4",
"sequence": 33,
"bundled": true,
"host_api": 23,
"release": "2.1.43"
"host_api": 37,
"oldest_host_api": 31,
"release": "2.1.55"
},
"lists": {
"id": "inbe.lists",
"version": "1.1.10",
"sequence": 18,
"version": "1.1.23",
"sequence": 31,
"bundled": true,
"host_api": 27,
"release": "2.1.43"
"release": "2.1.55"
},
"diary": {
"id": "inbe.diary",
"version": "1.3.7",
"sequence": 24,
"version": "1.3.19",
"sequence": 36,
"bundled": true,
"host_api": 21,
"release": "2.1.43"
"release": "2.1.55"
},
"lumi": {
"id": "inbe.lumi",
"version": "1.5.9",
"sequence": 27,
"version": "1.5.22",
"sequence": 40,
"bundled": true,
"host_api": 20,
"release": "2.1.43"
"release": "2.1.55"
},
"leaderboard": {
"id": "inbe.leaderboard",
"version": "1.0.12",
"sequence": 13,
"version": "1.0.24",
"sequence": 25,
"bundled": true,
"host_api": 25,
"release": "2.1.43"
"release": "2.1.55"
}
},
"node_apps": {
"photos": {
"id": "inbe.photos",
"title": "Photos",
"version": "1.0.3",
"sequence": 4,
"version": "1.0.4",
"sequence": 5,
"host_api": 15
},
"library": {
"id": "inbe.library",
"title": "Library",
"version": "1.0.2",
"sequence": 3,
"host_api": 26
"version": "1.0.4",
"sequence": 5,
"host_api": 29
},
"radio": {
"id": "inbe.radio",
"title": "Radio",
"version": "1.0.2",
"sequence": 3,
"version": "1.0.3",
"sequence": 4,
"host_api": 18
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+94
View File
@@ -0,0 +1,94 @@
Copyright 2022 The Noto Project Authors (https://github.com/notofonts/)
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
Generated with the built-in image_gen tool.
Use case: illustration-story. Asset type: portrait front cover artwork for Tao Te Ching, a clickable book in the calm Breeze reading app. Create a beautiful quiet literary book cover, full bleed flat front cover only, portrait aspect ratio 2:3. A graceful ink-wash mountain landscape with a winding river fading into luminous mist, a tiny warm sun, tranquil sage green, muted teal, warm ivory handmade paper and restrained gold accents. Sophisticated contemporary book design with a subtle linen/paper grain and a fine understated border, spacious and contemplative. Artwork should remain clear at thumbnail size. No words, no letters, no calligraphy, no author/title, no logos or watermark. No mockup scene, no perspective, no surrounding desk, no extra objects.
Delivery asset: tao-te-ching.png, resized to 384 x 576, optimized PNG with 128 colors.
Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

@@ -1,86 +0,0 @@
{
"schema": 1,
"duration": 2400,
"cues": [
{
"second": 0,
"key": "astral_text_1"
},
{
"second": 40,
"key": "astral_text_2"
},
{
"second": 90,
"key": "astral_text_3"
},
{
"second": 140,
"key": "astral_text_4"
},
{
"second": 195,
"key": "astral_text_5"
},
{
"second": 255,
"key": "astral_text_6"
},
{
"second": 330,
"key": "astral_text_7"
},
{
"second": 410,
"key": "astral_text_8"
},
{
"second": 500,
"key": "astral_text_9"
},
{
"second": 600,
"key": "astral_text_10"
},
{
"second": 720,
"key": "astral_text_11"
},
{
"second": 840,
"key": "astral_text_12"
},
{
"second": 960,
"key": "astral_text_13"
},
{
"second": 1090,
"key": "astral_text_14"
},
{
"second": 1230,
"key": "astral_text_15"
},
{
"second": 1380,
"key": "astral_text_16"
},
{
"second": 1560,
"key": "astral_text_17"
},
{
"second": 1770,
"key": "astral_text_18"
},
{
"second": 2010,
"key": "astral_text_19"
},
{
"second": 2280,
"key": "astral_text_20"
}
]
}
@@ -1,60 +0,0 @@
[astral_text_1]
Vítej. Lehni si a nech postel nést celou tvou váhu. Hudba bude hrát, dokud ji nezastavíš, takže nikam nemusíš. Pokud kdykoli usneš, je to úplně v pořádku.
---
[astral_text_2]
Pomalu se nadechni nosem a vydechni dlouhým, jemným povzdechem. Ještě jednou se nadechni a všechno pusť. Teď nech svůj dech najít vlastní klidný rytmus.
---
[astral_text_3]
Přenes pozornost na obličej. Nech čelo, ať se vyhladí. Nech víčka ztěžknout a znehybnět. Uvolni čelist a nech jazyk jemně odpočívat.
---
[astral_text_4]
Nech ramena klesnout, dál od uší. Vnímej, jak teplá tíha proudí dolů pažemi, přes lokty a zápěstí, až do konečků prstů.
---
[astral_text_5]
Všimni si, jak se tvůj hrudník sám zvedá a klesá. Nech břicho změknout. S každým výdechem se tělo usadí o kousek hlouběji do postele.
---
[astral_text_6]
Nech tíhu sestoupit boky a nohama, přes kolena a kotníky, až do chodidel. Celé tvé tělo je těžké, teplé a úplně podepřené.
---
[astral_text_7]
Teď si představ široké, mírné schodiště, které vede dolů do tiché, šeré místnosti. Každý schod dolů ti dovolí uvolnit se o něco hlouběji.
---
[astral_text_8]
Krok dolů, a klesni hlouběji. Krok dolů, a pusť o trochu víc. Tvé tělo se blíží spánku, zatímco malá část tvé mysli zůstává jemně bdělá.
---
[astral_text_9]
Na konci schodiště je všechno klidné. Tvé tělo je teď tak těžké, že jako by usínalo samo. Tvá mysl odpočívá, tichá a jemně vnímavá.
---
[astral_text_10]
Možná ucítíš brnění, tiché bzučení, vlny tepla nebo pocit vznášení. Jsou to jen známky hlubokého odpočinku. Nech je přicházet a odcházet a zůstaň uvolněný.
---
[astral_text_11]
Teď si představ druhé tělo z jemného modrého světla, které odpočívá uvnitř tvého fyzického těla. S každým výdechem je o něco lehčí.
---
[astral_text_12]
Nech toto světelné tělo pomalu se začít vznášet, jako pírko nesené teplým vzduchem. Tvé fyzické tělo zůstává v bezpečí, těžké, ve tvé posteli.
---
[astral_text_13]
Představ si, jak stoupáš ke stropu. Jemně se podívej dolů na místnost, jako ve snu. Není co dělat. Jen se vznášej.
---
[astral_text_14]
Jestli chceš, pluj dál skrz strop ven do klidné noční oblohy. Vnímej kolem sebe chladný, jemný vzduch a hvězdy vysoko nad sebou.
---
[astral_text_15]
Zamiř tam, kde se cítíš v klidu: nad tiché zelené kopce, podél jezera ve svitu měsíce, nebo jen odpočívej na otevřené obloze. Nech cestu, ať se odvíjí sama.
---
[astral_text_16]
Jsi vždy v bezpečí. Tvé tělo odpočívá v posteli, pomalu dýchá, a kdykoli se k němu můžeš vrátit jedinou myšlenkou.
---
[astral_text_17]
Můj hlas teď ztichne. Vznášej se dál, objevuj, nebo se nech vklouznout do hlubokého spánku. Cokoli se stane dál, je správně.
---
[astral_text_18]
Lehký, volný a v bezpečí.
---
[astral_text_19]
Pusť to, ještě trochu.
---
[astral_text_20]
Teď odpočívej. Krásně se vyspi.
---
@@ -1,60 +0,0 @@
[astral_text_1]
Willkommen. Leg dich hin und lass dein Bett dein ganzes Gewicht tragen. Die Musik spielt weiter, bis du sie beendest, du musst also nirgendwohin. Wenn du irgendwann einschläfst, ist das völlig in Ordnung.
---
[astral_text_2]
Atme langsam durch die Nase ein und lass den Atem mit einem langen, sanften Seufzer los. Noch einmal: einatmen, und alles loslassen. Lass deinen Atem jetzt seinen eigenen, leichten Rhythmus finden.
---
[astral_text_3]
Richte deine Aufmerksamkeit auf dein Gesicht. Lass deine Stirn glatt werden. Lass deine Augenlider schwer und ruhig werden. Löse deinen Kiefer und lass deine Zunge weich ruhen.
---
[astral_text_4]
Lass deine Schultern sinken, weg von den Ohren. Spüre, wie eine warme Schwere durch deine Arme fließt, durch Ellbogen und Handgelenke bis in die Fingerspitzen.
---
[astral_text_5]
Spüre, wie sich dein Brustkorb von selbst hebt und senkt. Lass deinen Bauch weich werden. Mit jedem Ausatmen sinkt dein Körper ein wenig tiefer ins Bett.
---
[astral_text_6]
Lass die Schwere durch deine Hüften und Beine wandern, an Knien und Knöcheln vorbei bis in die Füße. Dein ganzer Körper ist schwer, warm und vollkommen getragen.
---
[astral_text_7]
Stell dir jetzt eine breite, sanfte Treppe vor, die hinunter in einen stillen, gedämpft beleuchteten Raum führt. Jede Stufe nach unten lässt dich noch ein wenig tiefer entspannen.
---
[astral_text_8]
Eine Stufe hinunter, und tiefer sinken. Eine Stufe hinunter, und noch etwas mehr loslassen. Dein Körper gleitet dem Schlaf entgegen, während ein kleiner Teil deines Geistes sanft wach bleibt.
---
[astral_text_9]
Am Fuß der Treppe ist alles ruhig. Dein Körper ist jetzt so schwer, dass er wie von selbst einzuschlafen scheint. Dein Geist ruht, still und leise aufmerksam.
---
[astral_text_10]
Vielleicht spürst du ein Kribbeln, ein leises Summen, Wellen von Wärme oder ein Gefühl des Schwebens. Das sind einfach Zeichen tiefer Ruhe. Lass sie kommen und gehen und bleib entspannt.
---
[astral_text_11]
Stell dir jetzt einen zweiten Körper aus sanftem blauem Licht vor, der in deinem physischen Körper ruht. Mit jedem Ausatmen fühlt er sich ein wenig leichter an.
---
[astral_text_12]
Lass diesen Lichtkörper langsam zu schweben beginnen, wie eine Feder, die warme Luft emporträgt. Dein physischer Körper bleibt sicher und schwer in deinem Bett.
---
[astral_text_13]
Stell dir vor, wie du zur Zimmerdecke hinaufschwebst. Schau sanft auf den Raum hinunter, wie in einem Traum. Es gibt nichts zu tun. Schwebe einfach.
---
[astral_text_14]
Wenn du magst, schwebe weiter durch die Decke hinaus in einen ruhigen Nachthimmel. Spüre die kühle, sanfte Luft um dich herum und die Sterne hoch über dir.
---
[astral_text_15]
Geh dorthin, wo es sich friedlich anfühlt: über stille grüne Hügel, an einem mondbeschienenen See entlang, oder ruhe einfach im offenen Himmel. Lass die Reise sich von selbst entfalten.
---
[astral_text_16]
Du bist immer sicher. Dein Körper ruht in deinem Bett, atmet langsam, und du kannst jederzeit mit einem einzigen Gedanken zu ihm zurückkehren.
---
[astral_text_17]
Meine Stimme wird jetzt leiser. Schwebe weiter, erkunde, oder lass dich in tiefen Schlaf gleiten. Was auch immer jetzt geschieht, ist genau richtig.
---
[astral_text_18]
Leicht, frei und sicher.
---
[astral_text_19]
Lass los, noch ein wenig mehr.
---
[astral_text_20]
Ruh dich jetzt aus. Schlaf gut.
---
Loaded 100 of 14183 files, more files were not shown because too many files have changed in this diff. Show more