Group Manage practices into Installed, Meditation, Yoga and Martial arts tabs
Manage practices now opens on Installed, every practice on this device: on Practice, kept on the device, or coming with the app. Meditation (with Wim Hof breathing, Breathing Patterns and Astral Projection), Yoga (Sun Salutation) and Martial arts (Tai Chi) list each kind whether it is installed or not, with the same Install, Buy, Cancel or Uninstall button and Uninstall question. Dragging a practice within any tab moves it in the same Practice order. The chosen tab lasts while the dialog is open; opened for a practice that is not on this device, the dialog shows that practice's tab. Each practice's kind is `kind` in its PracticeDefinition; a practice without one is listed only under Installed. A kind's tab with nothing to list, such as Martial arts where paid practices are hidden on Google Play, is left out. The tabs use Kryon's TabBar and are translated in every locale; the font subsets gain the new CJK glyphs. make practice-downloads-ui-test covers each tab's practices, Installed listing only practices on this device, reordering within a tab, Uninstall from Yoga, a locked Tai Chi only under Martial arts and reopening on Installed.
This commit is contained in:
1 parent
1b943554b4
commit
672adc7bf2
23 files changed
+499
-29
No files matched your search
@@ -3,6 +3,8 @@
|
||||
## [2.1.36] - 2026-10-18
|
||||
|
||||
- Download Astral Projection for a 15-minute guided visualization, with offline text and optional narration.
|
||||
- Manage practices opens on Installed, the practices on this device, with
|
||||
tabs for Meditation (breathing practices included), Yoga and Martial arts.
|
||||
- Leaderboard lists every practice you have installed, including Tai Chi and
|
||||
Astral Projection, in your Practice order, and leaves out the others.
|
||||
- Lumi shares a few changelog highlights in chat after an update, once per version.
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
- Download Astral Projection and follow a 15-minute guided visualization, from relaxation and imagined floating to a gentle return.
|
||||
- Keep its guidance offline and use narration when its language pack is installed.
|
||||
- Keep your saved practice order when Astral Projection is added.
|
||||
- Manage practices opens on Installed, the practices on this device, with
|
||||
tabs for Meditation (breathing practices included), Yoga and Martial arts.
|
||||
Dragging a practice in any tab changes your Practice order.
|
||||
- Requires Inner Breeze 2.1.36 or later.
|
||||
|
||||
## [1.2.2] - 2026-10-18
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Practice download management, rendered by the current supervising host.
|
||||
// One list of practices. Each row has one button for what it needs: Install,
|
||||
// Buy for a paid practice, Cancel while it downloads, or Uninstall once it is
|
||||
// on Practice. A row's handle drags it to another place in the order.
|
||||
// Tabs list the practices on this device first, then each kind of practice.
|
||||
// Each row has one button for what it needs: Install, Buy for a paid
|
||||
// practice, Cancel while it downloads, or Uninstall once it is on Practice.
|
||||
// A row's handle drags it to another place in the order.
|
||||
#import, file "../../src/app/app_types.zi";
|
||||
#import, file "../../src/app/app_modal_state.zi";
|
||||
#import, file "../../src/app/app_settings.zi";
|
||||
@@ -31,6 +32,8 @@
|
||||
#import "reorder_widget"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "tab_bar_props"
|
||||
#import "tab_bar_widget"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
@@ -61,6 +64,22 @@ PRACTICE_ACTION_BUY :: 2
|
||||
PRACTICE_ACTION_CANCEL :: 3
|
||||
PRACTICE_ACTION_UNINSTALL :: 4
|
||||
|
||||
// The tabs, in order: every practice on this device, then each kind of
|
||||
// practice, on this device or not.
|
||||
PRACTICE_MANAGE_TAB_INSTALLED :: 0
|
||||
PRACTICE_MANAGE_TAB_MEDITATION :: 1
|
||||
PRACTICE_MANAGE_TAB_YOGA :: 2
|
||||
PRACTICE_MANAGE_TAB_MARTIAL_ARTS :: 3
|
||||
PRACTICE_MANAGE_TAB_COUNT :: 4
|
||||
PRACTICE_MANAGE_TAB_HEIGHT :: 44
|
||||
|
||||
// The selected tab and how far the tab bar is scrolled, kept while the
|
||||
// dialog stays open. It opens on Installed again.
|
||||
practice_manage_tab: s32 = PRACTICE_MANAGE_TAB_INSTALLED;
|
||||
practice_manage_tab_scroll: s32;
|
||||
// The frame the dialog was last drawn in, so a new opening is seen.
|
||||
practice_manage_drawn_frame: s32 = -2;
|
||||
|
||||
// The practice whose row asks whether to delete its downloaded copy, or -1.
|
||||
practice_delete_asked: s32 = -1;
|
||||
// The practice dragged by its handle, or -1: its row where it was grabbed,
|
||||
@@ -332,6 +351,103 @@ PracticeDownloadAct :: (app: *InnerBreeze, practice: s32, action: s32) {
|
||||
}
|
||||
}
|
||||
|
||||
// On this device: on Practice, on its way there, or kept here off Practice,
|
||||
// as a practice that ships with the app always is. A paid practice this
|
||||
// account has not unlocked is not, even with its pack here.
|
||||
PracticeDownloadOnDevice :: (practice: s32) -> bool {
|
||||
if PracticeDownloadLocked(practice) {
|
||||
return false
|
||||
}
|
||||
if PracticeDownloadOnPractice(practice) {
|
||||
return true
|
||||
}
|
||||
if PracticeShipped(practice) {
|
||||
return true
|
||||
}
|
||||
return PracticeContentStatus(practice) == 2
|
||||
}
|
||||
|
||||
PracticeDownloadTabLabel :: (tab: s32) -> string {
|
||||
if tab == PRACTICE_MANAGE_TAB_MEDITATION {
|
||||
return LocaleText("practice_manage_meditation")
|
||||
}
|
||||
if tab == PRACTICE_MANAGE_TAB_YOGA {
|
||||
return LocaleText("practice_manage_yoga")
|
||||
}
|
||||
if tab == PRACTICE_MANAGE_TAB_MARTIAL_ARTS {
|
||||
return LocaleText("practice_manage_martial_arts")
|
||||
}
|
||||
return LocaleText("practice_manage_installed")
|
||||
}
|
||||
|
||||
// The kind of practice a tab lists. Installed lists by where a practice is
|
||||
// instead.
|
||||
PracticeDownloadTabKind :: (tab: s32) -> s32 {
|
||||
if tab == PRACTICE_MANAGE_TAB_MEDITATION {
|
||||
return PRACTICE_KIND_MEDITATION
|
||||
}
|
||||
if tab == PRACTICE_MANAGE_TAB_YOGA {
|
||||
return PRACTICE_KIND_YOGA
|
||||
}
|
||||
if tab == PRACTICE_MANAGE_TAB_MARTIAL_ARTS {
|
||||
return PRACTICE_KIND_MARTIAL_ARTS
|
||||
}
|
||||
return PRACTICE_KIND_NONE
|
||||
}
|
||||
|
||||
// Installed lists every practice on this device; each other tab lists the
|
||||
// practices of its kind, from the practice's own definition.
|
||||
PracticeDownloadListed :: (practice: s32, tab: s32) -> bool {
|
||||
if PracticeHidden(practice) {
|
||||
return false
|
||||
}
|
||||
if tab == PRACTICE_MANAGE_TAB_INSTALLED {
|
||||
return PracticeDownloadOnDevice(practice)
|
||||
}
|
||||
return practice_get(practice).kind == PracticeDownloadTabKind(tab)
|
||||
}
|
||||
|
||||
// Installed is always offered. A kind's tab is left out while it has no
|
||||
// practice to list, such as Martial arts where paid practices are not
|
||||
// offered.
|
||||
PracticeDownloadTabOffered :: (tab: s32) -> bool {
|
||||
if tab == PRACTICE_MANAGE_TAB_INSTALLED {
|
||||
return true
|
||||
}
|
||||
for index: cast(s32)0..practice_count() - 1 {
|
||||
if PracticeDownloadListed(practice_ordered_id(index), tab) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// The tab to show a practice in: the selected one when it lists the
|
||||
// practice, otherwise the first one that does.
|
||||
PracticeDownloadTabFor :: (practice: s32, selected: s32) -> s32 {
|
||||
if PracticeDownloadListed(practice, selected) {
|
||||
return selected
|
||||
}
|
||||
for tab: cast(s32)0..PRACTICE_MANAGE_TAB_COUNT - 1 {
|
||||
if PracticeDownloadListed(practice, tab) {
|
||||
return tab
|
||||
}
|
||||
}
|
||||
return selected
|
||||
}
|
||||
|
||||
// Another tab starts its list at the top, with no question or drag left
|
||||
// over from the one before.
|
||||
PracticeDownloadSelectTab :: (app: *InnerBreeze, tab: s32) {
|
||||
if tab == practice_manage_tab {
|
||||
return
|
||||
}
|
||||
practice_manage_tab = tab
|
||||
practice_delete_asked = -1
|
||||
PracticeDownloadEndDrag()
|
||||
app.practice_downloads_scroll = 0
|
||||
}
|
||||
|
||||
// Rows drag to another place unless a practice is running.
|
||||
PracticeDownloadMovable :: (app: *InnerBreeze) -> bool {
|
||||
return practice_active(app) == null
|
||||
@@ -580,7 +696,7 @@ PracticeDownloadAreas :: struct {
|
||||
focus_y: s32
|
||||
}
|
||||
|
||||
// Every practice in order, measured or drawn.
|
||||
// The selected tab's practices in order, measured or drawn.
|
||||
PracticeDownloadsContent :: (app: *InnerBreeze, x: s32, y: *s32, width: s32, draw: bool,
|
||||
focus: s32) -> PracticeDownloadAreas {
|
||||
areas: PracticeDownloadAreas
|
||||
@@ -588,7 +704,7 @@ PracticeDownloadsContent :: (app: *InnerBreeze, x: s32, y: *s32, width: s32, dra
|
||||
line := color_with_alpha(StyleTokenColor("text"), 0.12)
|
||||
for index: cast(s32)0..practice_count() - 1 {
|
||||
practice := practice_ordered_id(index)
|
||||
if PracticeHidden(practice) {
|
||||
if !PracticeDownloadListed(practice, practice_manage_tab) {
|
||||
continue
|
||||
}
|
||||
if draw && y.* > top {
|
||||
@@ -616,7 +732,7 @@ PracticeDownloadsContent :: (app: *InnerBreeze, x: s32, y: *s32, width: s32, dra
|
||||
|
||||
// While a practice is dragged it follows the pointer, and the practice whose
|
||||
// place it would take is outlined; releasing it there moves it in the order
|
||||
// Practice follows.
|
||||
// Practice follows. Within a tab, it moves among that tab's practices.
|
||||
PracticeDownloadDrop :: (app: *InnerBreeze, scroll: ScrollResult, areas: PracticeDownloadAreas, width: s32) {
|
||||
if practice_drag < 0 {
|
||||
return
|
||||
@@ -720,19 +836,59 @@ PracticeDownloadsModalDraw :: (app: *InnerBreeze) {
|
||||
if !frame.opened {
|
||||
return
|
||||
}
|
||||
// Opened for one practice, its row is in view.
|
||||
// Each opening starts on Installed.
|
||||
if app.breathing.frame - practice_manage_drawn_frame > 1 {
|
||||
practice_manage_tab = PRACTICE_MANAGE_TAB_INSTALLED
|
||||
practice_manage_tab_scroll = 0
|
||||
}
|
||||
practice_manage_drawn_frame = app.breathing.frame
|
||||
// Opened for one practice, its row is in view, in its kind's tab when
|
||||
// it is not on this device.
|
||||
focus: s32 = -1
|
||||
if app.practice_downloads_scroll < 0 {
|
||||
focus = -app.practice_downloads_scroll - 1
|
||||
practice_manage_tab = PracticeDownloadTabFor(focus, practice_manage_tab)
|
||||
}
|
||||
row_width := cast(s32)frame.layout.content.width - AppScale(10)
|
||||
content := frame.layout.content
|
||||
tab_h := AppScale(PRACTICE_MANAGE_TAB_HEIGHT)
|
||||
tabs: [PRACTICE_MANAGE_TAB_COUNT]Tab
|
||||
tab_ids: [PRACTICE_MANAGE_TAB_COUNT]s32
|
||||
tab_count: s32 = 0
|
||||
// A selected tab that is no longer offered gives way to Installed.
|
||||
selected_index: s32 = 0
|
||||
for tab: cast(s32)0..PRACTICE_MANAGE_TAB_COUNT - 1 {
|
||||
if !PracticeDownloadTabOffered(tab) {
|
||||
continue
|
||||
}
|
||||
if tab == practice_manage_tab {
|
||||
selected_index = tab_count
|
||||
}
|
||||
tab_ids[tab_count] = tab
|
||||
tabs[tab_count] = Tab.{.label = PracticeDownloadTabLabel(tab)}
|
||||
tab_count += 1
|
||||
}
|
||||
bar := TabBar(app.ui.session, TabBarProps.{
|
||||
.key = KeyHash("practices/downloads/tabs"),
|
||||
.bounds = Rectangle.{content.x, content.y, content.width, cast(float32)tab_h},
|
||||
.selected_index = selected_index, .min_tab_width = AppScale(44),
|
||||
.max_tab_width = AppScale(220), .content_sized = true,
|
||||
.scroll_offset = practice_manage_tab_scroll, .scale = MetricsScale(),
|
||||
.focus_selected = practice_manage_tab_scroll == 0}, tabs[:tab_count])
|
||||
practice_manage_tab_scroll = bar.scroll_offset
|
||||
if bar.selected_index >= 0 && bar.selected_index < tab_count {
|
||||
PracticeDownloadSelectTab(app, tab_ids[bar.selected_index])
|
||||
}
|
||||
list_top := tab_h + AppScale(8)
|
||||
list := Rectangle.{content.x, content.y + cast(float32)list_top, content.width,
|
||||
content.height - cast(float32)list_top}
|
||||
row_width := cast(s32)content.width - AppScale(10)
|
||||
content_h: s32 = 0
|
||||
measured := PracticeDownloadsContent(app, 0, *content_h, row_width, false, focus)
|
||||
if app.practice_downloads_scroll < 0 {
|
||||
app.practice_downloads_scroll = measured.focus_y
|
||||
}
|
||||
scroll := Scroll(app.ui.session, ScrollProps.{
|
||||
.key = KeyHash("practices/downloads/scroll"), .bounds = frame.layout.content,
|
||||
.key = KeyHash("practices/downloads/scroll"), .bounds = list,
|
||||
.content_height = content_h, .scroll_offset = app.practice_downloads_scroll})
|
||||
app.practice_downloads_scroll = scroll.scroll_offset
|
||||
areas: PracticeDownloadAreas
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
-4
@@ -249,13 +249,19 @@ after them. The list shows icons, names and controls without status paragraphs.
|
||||
## Practice content and narration
|
||||
|
||||
`build/practice-content/*.zib` contains the separate practice data and language
|
||||
packs. Practice → Manage practices opens one scrolling list of practices in the
|
||||
order Practice shows them. Each row shows the practice's size (or how its
|
||||
packs. Practice → Manage practices has four tabs and opens on the first,
|
||||
Installed, which lists every practice on this device. Meditation (breathing
|
||||
practices included), Yoga and Martial arts list each kind of practice whether
|
||||
it is installed or not. A practice's kind is `kind` in its
|
||||
`PracticeDefinition`; one without a kind is listed only under Installed. Each
|
||||
tab lists its practices in the order Practice shows them. Each row shows the
|
||||
practice's size (or how its
|
||||
download is going) and one button: Install, Buy for a paid practice, Cancel
|
||||
while it downloads, or Uninstall once it is on Practice. Its six-dot handle
|
||||
drags it onto another practice to take that one's place in the order Practice
|
||||
and every practice list follow (saved as `practice_order`). Start opens the
|
||||
manager scrolled to its practice when the practice needs content. Downloads
|
||||
and every practice list follow (saved as `practice_order`), also within a
|
||||
tab. Start opens the manager scrolled to its practice, in a tab that lists it,
|
||||
when the practice needs content. Downloads
|
||||
continue inside the modal without changing the selected practice, and
|
||||
unselected downloads are verified and saved without mounting their artwork.
|
||||
Uninstall asks once and then deletes a downloaded copy and its narration while
|
||||
|
||||
@@ -5406,6 +5406,22 @@ Stažení selhalo. Uložený pokrok je v bezpečí.
|
||||
Správa cvičení
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Nainstalovaná
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Meditace
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Jóga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Bojová umění
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Stahování: %s…
|
||||
---
|
||||
|
||||
@@ -5400,6 +5400,22 @@ Download fehlgeschlagen. Dein Fortschritt bleibt erhalten.
|
||||
Übungen verwalten
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Installiert
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Meditation
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Yoga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Kampfkunst
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
%s wird geladen…
|
||||
---
|
||||
|
||||
@@ -5424,6 +5424,22 @@ Download failed. Your saved progress is safe.
|
||||
Manage practices
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Installed
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Meditation
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Yoga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Martial arts
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Downloading %s…
|
||||
---
|
||||
|
||||
@@ -5400,6 +5400,22 @@ La descarga falló. Tu progreso está a salvo.
|
||||
Administrar prácticas
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Instaladas
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Meditación
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Yoga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Artes marciales
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Descargando %s…
|
||||
---
|
||||
|
||||
@@ -5388,6 +5388,22 @@ Dew insuffisant. Ajoutez du Dew dans Profil.
|
||||
Gérer les pratiques
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Installées
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Méditation
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Yoga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Arts martiaux
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Téléchargement : %s…
|
||||
---
|
||||
|
||||
@@ -5389,6 +5389,22 @@ Unduhan gagal. Kemajuan tersimpan tetap aman.
|
||||
Kelola latihan
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Terpasang
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Meditasi
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Yoga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Bela diri
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Mengunduh %s…
|
||||
---
|
||||
|
||||
@@ -5389,6 +5389,22 @@ Download non riuscito. I progressi sono al sicuro.
|
||||
Gestisci pratiche
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Installate
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Meditazione
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Yoga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Arti marziali
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Download in corso: %s…
|
||||
---
|
||||
|
||||
@@ -5385,6 +5385,22 @@ Dewが不足しています。プロフィールでDewを追加してくださ
|
||||
練習を管理
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
インストール済み
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
瞑想
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
ヨガ
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
武術
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
%sをダウンロード中…
|
||||
---
|
||||
|
||||
@@ -5395,6 +5395,22 @@ Dew가 부족합니다. 프로필에서 Dew를 추가하세요.
|
||||
수련 관리
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
설치됨
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
명상
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
요가
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
무술
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
%s 다운로드 중…
|
||||
---
|
||||
|
||||
@@ -5398,6 +5398,22 @@ Falha no download. Seu progresso está salvo.
|
||||
Gerenciar práticas
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Instaladas
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Meditação
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Yoga
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Artes marciais
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Baixando: %s…
|
||||
---
|
||||
|
||||
@@ -5394,6 +5394,22 @@ Lumi остаётся без сети, пока вы не примете её у
|
||||
Управление практиками
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
Установленные
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
Медитация
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
Йога
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
Боевые искусства
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
Скачивание: %s…
|
||||
---
|
||||
|
||||
@@ -5400,6 +5400,22 @@ Dew不足,请在个人资料中添加Dew。
|
||||
管理练习
|
||||
---
|
||||
|
||||
[practice_manage_installed]
|
||||
已安装
|
||||
---
|
||||
|
||||
[practice_manage_meditation]
|
||||
冥想
|
||||
---
|
||||
|
||||
[practice_manage_yoga]
|
||||
瑜伽
|
||||
---
|
||||
|
||||
[practice_manage_martial_arts]
|
||||
武术
|
||||
---
|
||||
|
||||
[practice_narration_busy]
|
||||
正在下载%s…
|
||||
---
|
||||
|
||||
@@ -60,9 +60,18 @@ PracticeCanBreatheFn :: #type (app: *InnerBreeze) -> s32;
|
||||
// the floating window, 0 while it runs.
|
||||
PracticeWindowResultFn :: #type (app: *InnerBreeze, result: *SessionResult) -> s32;
|
||||
|
||||
// The kind of practice, which Manage practices lists under its own tab.
|
||||
// Breathing practices count as meditation. A practice without a kind is
|
||||
// listed only under Installed.
|
||||
PRACTICE_KIND_NONE :: 0
|
||||
PRACTICE_KIND_MEDITATION :: 1
|
||||
PRACTICE_KIND_YOGA :: 2
|
||||
PRACTICE_KIND_MARTIAL_ARTS :: 3
|
||||
|
||||
PracticeDefinition :: struct {
|
||||
id: ExerciseType
|
||||
label_key: string
|
||||
kind: s32
|
||||
init: PracticeVoidFn
|
||||
destroy: PracticeVoidFn
|
||||
start: PracticeVoidFn
|
||||
@@ -102,6 +111,7 @@ practice_initialize_definitions :: () {
|
||||
whm: PracticeDefinition
|
||||
whm.id = cast(ExerciseType)EXERCISE_WIM_HOF
|
||||
whm.label_key = "exercise_wim_hof"
|
||||
whm.kind = PRACTICE_KIND_MEDITATION
|
||||
whm.start = whm_practice_start
|
||||
whm.draw_manual = whm_manual_draw
|
||||
whm.close_manual = whm_manual_close
|
||||
@@ -121,6 +131,7 @@ practice_initialize_definitions :: () {
|
||||
meditation: PracticeDefinition
|
||||
meditation.id = cast(ExerciseType)EXERCISE_MEDITATION
|
||||
meditation.label_key = "exercise_meditation"
|
||||
meditation.kind = PRACTICE_KIND_MEDITATION
|
||||
meditation.init = meditation_practice_init
|
||||
meditation.destroy = meditation_practice_destroy
|
||||
meditation.start = meditation_practice_start
|
||||
@@ -143,6 +154,7 @@ practice_initialize_definitions :: () {
|
||||
sun: PracticeDefinition
|
||||
sun.id = cast(ExerciseType)EXERCISE_SUN_SALUTATION
|
||||
sun.label_key = "exercise_sun_salutation"
|
||||
sun.kind = PRACTICE_KIND_YOGA
|
||||
sun.init = sun_salutation_practice_init
|
||||
sun.start = sun_salutation_practice_start
|
||||
sun.draw_manual = sun_manual_draw
|
||||
@@ -160,6 +172,7 @@ practice_initialize_definitions :: () {
|
||||
patterns: PracticeDefinition
|
||||
patterns.id = cast(ExerciseType)EXERCISE_PATTERNS
|
||||
patterns.label_key = "exercise_patterns"
|
||||
patterns.kind = PRACTICE_KIND_MEDITATION
|
||||
patterns.init = patterns_practice_init
|
||||
patterns.destroy = patterns_practice_destroy
|
||||
patterns.start = patterns_practice_start
|
||||
@@ -179,6 +192,7 @@ practice_initialize_definitions :: () {
|
||||
tai_chi: PracticeDefinition
|
||||
tai_chi.id = cast(ExerciseType)EXERCISE_TAI_CHI
|
||||
tai_chi.label_key = "exercise_tai_chi"
|
||||
tai_chi.kind = PRACTICE_KIND_MARTIAL_ARTS
|
||||
tai_chi.start = tai_chi_practice_start
|
||||
tai_chi.draw_config = tai_chi_modal_draw
|
||||
tai_chi.config_on_start = false
|
||||
@@ -194,6 +208,7 @@ practice_initialize_definitions :: () {
|
||||
astral: PracticeDefinition
|
||||
astral.id = cast(ExerciseType)EXERCISE_ASTRAL_PROJECTION
|
||||
astral.label_key = "exercise_astral_projection"
|
||||
astral.kind = PRACTICE_KIND_MEDITATION
|
||||
astral.start = AstralStart
|
||||
astral.update = AstralUpdate
|
||||
astral.draw_active_session = AstralDraw
|
||||
|
||||
@@ -244,3 +244,12 @@ es app_name_arcade
|
||||
fr app_name_arcade
|
||||
it app_name_arcade
|
||||
pt app_name_arcade
|
||||
|
||||
# Manage practices tabs: Meditation and Yoga, loanwords as in each practice's name.
|
||||
de practice_manage_meditation
|
||||
de practice_manage_yoga
|
||||
es practice_manage_yoga
|
||||
fr practice_manage_yoga
|
||||
id practice_manage_yoga
|
||||
it practice_manage_yoga
|
||||
pt practice_manage_yoga
|
||||
@@ -111,6 +111,35 @@ def row_text(row):
|
||||
return '\n'.join(node['label'] for node in row['nodes'] if node['label'])
|
||||
|
||||
|
||||
def row_names():
|
||||
return [row['name'] for row in manager_rows()]
|
||||
|
||||
|
||||
# Installed comes first and is selected on opening; breathing practices are
|
||||
# under Meditation.
|
||||
TABS = ['Installed', 'Meditation', 'Yoga', 'Martial arts']
|
||||
|
||||
|
||||
def manager_tabs():
|
||||
"""The dialog's tabs in order, as label and whether it is selected."""
|
||||
return [(node['label'], node['selected']) for node in manager_nodes() if node['role'] == 'tab']
|
||||
|
||||
|
||||
def selected_tab():
|
||||
selected = [label for label, chosen in manager_tabs() if chosen]
|
||||
assert len(selected) == 1, manager_tabs()
|
||||
return selected[0]
|
||||
|
||||
|
||||
def select_tab(label):
|
||||
"""Show one tab's practices."""
|
||||
tabs = [node for node in manager_nodes() if node['role'] == 'tab' and node['label'] == label]
|
||||
assert tabs, f'No {label} tab: ' + manager_text()
|
||||
driver.press(key=tabs[0]['key'])
|
||||
driver.wait_idle(frames=2)
|
||||
assert selected_tab() == label, manager_tabs()
|
||||
|
||||
|
||||
def act(name, label):
|
||||
"""Press the button of a practice's row."""
|
||||
# Install and Uninstall carry the size, such as "Install · 449 KB".
|
||||
@@ -189,24 +218,43 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
driver.wait(label='Start Practice', role='button')
|
||||
assert not any(re.fullmatch(r'\d+ / \d+', label) for label in driver.labels()), screen_text()
|
||||
open_manager()
|
||||
# Manage practices opens on Installed: Wim Hof, which ships
|
||||
# installed, and Breathing Patterns and Meditation, which come with
|
||||
# the app. Sun Salutation, Tai Chi and Astral Projection are not on
|
||||
# this device, so only their own tabs list them.
|
||||
assert manager_tabs() == [(label, label == 'Installed') for label in TABS], manager_tabs()
|
||||
assert row_names() == ['Wim Hof Breathing', 'Breathing Patterns', 'Meditation'], row_names()
|
||||
text = manager_text()
|
||||
whm_kb = (sizes['whm'] + 1023) // 1024
|
||||
meditation_kb = (sizes['meditation'] + 1023) // 1024
|
||||
sun_mb = (sizes['sunsalutation'] + 512 * 1024) // (1024 * 1024)
|
||||
# One list: Wim Hof is on Practice, so its button uninstalls it;
|
||||
# Meditation, Breathing Patterns and Sun Salutation install. Each row
|
||||
# has its size and one button, and no menu.
|
||||
# Wim Hof is on Practice, so its button uninstalls it; Meditation and
|
||||
# Breathing Patterns install. Each row has its size and one button,
|
||||
# and no menu.
|
||||
assert 'Uninstall' in row_text(manager_row('Wim')), text
|
||||
assert 'On Practice' not in text and 'On device' not in text, text
|
||||
assert str(whm_kb) + ' KB' in row_text(manager_row('Wim')) and 'Comes with' not in text, text
|
||||
assert str(meditation_kb) + ' KB' in row_text(manager_row('Meditation')), text
|
||||
assert str(sun_mb) + 'MB' in row_text(manager_row('Sun')).replace(' ', ''), text
|
||||
for row in manager_rows():
|
||||
buttons = [node for node in row['nodes'] if node['kind'] == 'button']
|
||||
assert len(buttons) == 1, (row['name'], 'has more than one button', buttons)
|
||||
# Every practice has a row, also the last one in the order.
|
||||
assert 'Install' in row_text(manager_row('Astral Projection')), text
|
||||
assert 'Remove' not in text and 'Included in this version' not in text, text
|
||||
# Each kind's tab lists its practices in order, on this device or
|
||||
# not; breathing practices are under Meditation.
|
||||
kinds = {'Meditation': ['Wim Hof Breathing', 'Breathing Patterns', 'Meditation', 'Astral Projection'],
|
||||
'Yoga': ['Sun Salutation'], 'Martial arts': ['Tai Chi']}
|
||||
for label, names in kinds.items():
|
||||
select_tab(label)
|
||||
assert row_names() == names, (label, row_names())
|
||||
for row in manager_rows():
|
||||
buttons = [node for node in row['nodes'] if node['kind'] == 'button']
|
||||
assert len(buttons) == 1, (label, row['name'], 'has more than one button', buttons)
|
||||
if label == 'Meditation':
|
||||
# Every practice has a row, also the last one in the order.
|
||||
assert 'Install' in row_text(manager_row('Astral Projection')), manager_text()
|
||||
if label == 'Yoga':
|
||||
assert str(sun_mb) + 'MB' in row_text(manager_row('Sun')).replace(' ', ''), manager_text()
|
||||
select_tab('Installed')
|
||||
assert not (cache / 'practice-meditation.zib').exists()
|
||||
# Install adds Meditation from the app's own copy at once, without a
|
||||
# copy of its own.
|
||||
@@ -224,11 +272,26 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
driver.wait_idle(frames=3)
|
||||
names = [row['name'] for row in manager_rows()]
|
||||
assert names.index('Meditation') < names.index('Wim Hof Breathing'), names
|
||||
# Within the Meditation tab, Astral Projection dropped on Breathing
|
||||
# Patterns takes its place in the same order, also while it is not
|
||||
# installed; Installed keeps its own practices in that order.
|
||||
select_tab('Meditation')
|
||||
assert row_names() == ['Meditation', 'Wim Hof Breathing', 'Breathing Patterns', 'Astral Projection'], \
|
||||
row_names()
|
||||
astral = manager_row('Astral Projection')
|
||||
patterns = next(node for node in manager_row('Breathing')['nodes'] if node['label'].startswith('Breathing'))
|
||||
driver.drag(UiDriver.center(astral['handle']), UiDriver.center(patterns), steps=12)
|
||||
driver.wait_idle(frames=3)
|
||||
assert row_names() == ['Meditation', 'Wim Hof Breathing', 'Astral Projection', 'Breathing Patterns'], \
|
||||
row_names()
|
||||
select_tab('Installed')
|
||||
assert row_names() == ['Meditation', 'Wim Hof Breathing', 'Breathing Patterns'], row_names()
|
||||
# Uninstall takes both off Practice; they come with the app, so
|
||||
# nothing is deleted and nothing asks.
|
||||
# nothing is deleted, nothing asks and both stay under Installed.
|
||||
act('Meditation', 'Uninstall')
|
||||
wait_file(cache / 'practice-meditation.removed')
|
||||
act('Wim', 'Uninstall')
|
||||
assert row_names() == ['Meditation', 'Wim Hof Breathing', 'Breathing Patterns'], row_names()
|
||||
text = manager_text()
|
||||
assert 'Uninstall' not in text and str(whm_kb) + ' KB' in text, text
|
||||
assert 'Remove' not in text and 'Included in this version' not in text, text
|
||||
@@ -240,11 +303,12 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
finally:
|
||||
stop(process)
|
||||
assert (cache / 'practice-whm.removed').exists()
|
||||
# The order is saved: Meditation, Wim Hof, then the default order.
|
||||
# The order is saved: Meditation, Wim Hof, Astral Projection, then the
|
||||
# default order.
|
||||
with sqlite3.connect(profile / 'inbe.db') as database:
|
||||
order = database.execute('SELECT value FROM settings WHERE user_id=? AND key=?',
|
||||
(user, 'practice_order')).fetchone()
|
||||
assert order and order[0] == '1103245', order
|
||||
assert order and order[0] == '1105324', order
|
||||
process, window = launch(profile, 'still-removed')
|
||||
try:
|
||||
driver.wait(contains='No practices installed')
|
||||
@@ -257,6 +321,12 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
act('Wim', 'Install')
|
||||
text = manager_text()
|
||||
assert 'Uninstall' in row_text(manager_row('Wim')) and str(whm_kb) + ' KB' in text, text
|
||||
# The chosen tab lasts while the dialog is open; it opens on
|
||||
# Installed again.
|
||||
select_tab('Yoga')
|
||||
close_manager()
|
||||
open_manager()
|
||||
assert selected_tab() == 'Installed', manager_tabs()
|
||||
close_manager()
|
||||
driver.wait(label='Start Practice', role='button')
|
||||
assert not visible_label('No practices installed'), screen_text()
|
||||
@@ -287,9 +357,12 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
driver.wait(label='Manage practices', role='button')
|
||||
driver.wait(label='Start Practice', role='button')
|
||||
open_manager()
|
||||
driver.wait(label='Meditation')
|
||||
# In a narrow dialog a tab's last row scrolls into view.
|
||||
select_tab('Meditation')
|
||||
scroll_manager(10)
|
||||
driver.wait(label='Tai Chi')
|
||||
driver.wait(label='Astral Projection')
|
||||
select_tab('Yoga')
|
||||
driver.wait(label='Sun Salutation')
|
||||
finally:
|
||||
stop(process)
|
||||
with sqlite3.connect(profile / 'inbe.db') as database:
|
||||
@@ -306,10 +379,15 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
driver.wait(label='Start Practice', role='button')
|
||||
assert not visible_label('Tai Chi'), screen_text()
|
||||
open_manager()
|
||||
scroll_manager(16)
|
||||
# Locked, it is not installed even with its pack here; Martial arts
|
||||
# offers it.
|
||||
assert 'Tai Chi' not in row_names(), row_names()
|
||||
select_tab('Martial arts')
|
||||
driver.wait(label='Tai Chi')
|
||||
# Its Unlock button says the price. Its row shows no size: the old
|
||||
# single list passed a size check only through other rows' buttons.
|
||||
text = row_text(manager_row('Tai Chi'))
|
||||
assert 'Dew' in text and 'MB' in manager_text(), manager_text()
|
||||
assert 'Dew' in text, manager_text()
|
||||
# Narration is chosen in each practice's Customize, never here.
|
||||
text = manager_text()
|
||||
assert 'Voice narration' not in text and 'Female voice' not in text, text
|
||||
@@ -339,7 +417,8 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
# The account's purchase is known from the first frame: Tai Chi stays selected.
|
||||
driver.wait(label='Tai Chi')
|
||||
open_manager()
|
||||
# The whole list, also the rows scrolled out of the dialog.
|
||||
# Bought and on this device, Tai Chi is under Installed, also
|
||||
# when its row is scrolled out of the dialog.
|
||||
text = manager_text()
|
||||
assert 'Tai Chi' in [row['name'] for row in manager_rows()], text
|
||||
# Bought: no Dew price or unlock button is left.
|
||||
@@ -395,6 +474,10 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
process, window = launch(profile, 'sun-delete', 1280, 900)
|
||||
try:
|
||||
open_manager()
|
||||
# Downloaded, Sun Salutation is under Installed; its row in Yoga has
|
||||
# the same button and question.
|
||||
assert 'Sun Salutation' in row_names(), row_names()
|
||||
select_tab('Yoga')
|
||||
text = row_text(manager_row('Sun'))
|
||||
assert 'Sun Salutation' in text and str(sun_mb) + 'MB' in text.replace(' ', ''), text
|
||||
act('Sun', 'Uninstall')
|
||||
@@ -424,9 +507,13 @@ with tempfile.TemporaryDirectory(prefix='inbe-downloads-ui-') as temporary:
|
||||
assert not (cache / 'practice-sunsalutation.removed').exists()
|
||||
# Its button installs again: Uninstall left the row.
|
||||
assert 'Uninstall' not in text and 'Install' in text, text
|
||||
# No longer on this device, it left Installed.
|
||||
select_tab('Installed')
|
||||
assert 'Sun Salutation' not in row_names(), row_names()
|
||||
finally:
|
||||
stop(process)
|
||||
print('Private Practices modal: one Install, Buy, Cancel or Uninstall button per practice, real sizes, '
|
||||
'reorder that Practice follows, removal that stays, '
|
||||
print('Private Practices modal: Installed, Meditation, Yoga and Martial arts tabs, '
|
||||
'one Install, Buy, Cancel or Uninstall button per practice, real sizes, '
|
||||
'reorder that Practice follows within a tab, removal that stays, '
|
||||
'restore without download, installed-only home, saved progress, owned Tai Chi without a price, '
|
||||
'narration languages, narrow layout, Sun Salutation narration and delete passed')
|
||||
Reference in new issue
Block a user