Files
breeze/apps/inbe/inbe.zi
T
waozi f25b4dfd5e Build Apps and Crypto as locked packages and take the node-app ABI from Apps
Apps and Crypto are now ordinary Ziran dependencies, pinned in ziran.lock
and linked by scripts/packages.sh, instead of local checkouts handed to the
build. Every dependency and the toolchain are on their latest revisions.

scripts/package-paths.sh is the one list of NAME=DIR package paths; the
native, web, Windows and Android builds, the source check, the bundle
scripts and the tests all use it, so they resolve packages the same way.
The shared Apps controller bundle is built from the locked Apps package,
and its reviewed digest matches that build.

Node apps, the feature cells and the host import the module ABI and the
node-app types and codec from the Apps package. Inner Breeze no longer
keeps its own copies, its codec generator, or the unused protocol module.

Test hosts include zir_string.h for the string helpers they call.
2026-10-18 23:20:13 -03:00

123 lines
4.0 KiB
Ziran

// The portable root owns app selection and unified navigation policy.
// Its assets contain Lumi, Habits and Practices as recommended cells, and
// Lists, Diary and Leaderboard as optional ones.
#import, file "../../src/cells/inbe_types.zi";
#import, file "inbe_view.zi";
#import, file "../../src/cells/module_types.zi";
#import "apps/node_types"
#import, file "../../src/core/types.zi";
host_api :: #system_library "host_api";
ReadInbeHost :: () -> InbeMessage #foreign host_api;
WriteInbeHost :: (message: InbeMessage) #foreign host_api;
RouteFeatureHost :: (app: s32, screen: s32) -> bool #foreign host_api;
InbeAppForScreen :: (screen: s32) -> s32 {
if screen == ScreenLumi {
return APP_LUMI
}
if screen == ScreenDiary {
return APP_DIARY
}
if screen == ScreenLeaderboard {
return APP_LEADERBOARD
}
if screen == ScreenEList {
return APP_LISTS
}
if screen == ScreenHabits || screen == ScreenHabitEdit ||
screen == ScreenHabitSessionEdit {
return APP_HABITS
}
if screen == ScreenStart || screen == ScreenSession ||
screen == ScreenMeditation || screen == ScreenSunSalutation ||
screen == ScreenPatterns || screen == ScreenTaiChi || screen == ScreenAstralProjection ||
screen == ScreenResults || screen == ScreenPracticeConfig ||
screen == ScreenManual {
return APP_PRACTICE
}
return 0
}
InbeHome :: (apps: s32) -> s32 {
if (apps & APP_LUMI) != 0 {
return ScreenLumi
}
if (apps & APP_PRACTICE) != 0 {
return ScreenStart
}
if (apps & APP_HABITS) != 0 {
return ScreenHabits
}
if (apps & APP_LISTS) != 0 {
return ScreenEList
}
if (apps & APP_DIARY) != 0 {
return ScreenDiary
}
return ScreenSettings
}
InbeApply :: (message: InbeMessage) -> InbeMessage {
message.enabled_apps &= APP_ALL
message.succeeded = true
if message.action == INBE_MINI_CONFIGURE {
// An explicit mini launch is a temporary practice session. It does
// not replace the profile's saved selection for the full app.
message.enabled_apps = APP_PRACTICE
message.screen = ScreenStart
}
if message.action == INBE_TOGGLE_APP {
if message.app != APP_LISTS && message.app != APP_HABITS &&
message.app != APP_PRACTICE && message.app != APP_DIARY && message.app != APP_LUMI &&
message.app != APP_LEADERBOARD {
message.succeeded = false
return message
}
if message.checked {
message.enabled_apps |= message.app
} else {
message.enabled_apps &= ~message.app
}
}
if message.action == INBE_CONFIGURE || message.action == INBE_TOGGLE_APP ||
message.action == INBE_MINI_CONFIGURE {
message.screen = InbeHome(message.enabled_apps)
} else if message.action == INBE_INITIAL_SCREEN {
if !message.language_selected {
message.screen = ScreenLanguage
} else if !message.apps_selected {
message.screen = ScreenAppSelection
} else {
app := InbeAppForScreen(message.screen)
if app != 0 && (message.enabled_apps & app) == 0 {
message.screen = InbeHome(message.enabled_apps)
}
}
} else if message.action != INBE_ROUTE {
message.succeeded = false
}
app := InbeAppForScreen(message.screen)
message.allowed = app == 0 || (message.enabled_apps & app) != 0
if message.action == INBE_ROUTE && message.allowed && app != 0 {
message.succeeded = RouteFeatureHost(app, message.screen)
}
return message
}
#program_export "InnerBreezeMain"
Main :: () -> s32 {
message := ReadInbeHost()
if message.abi != MODULE_ABI {
return -1
}
if message.action == MODULE_IDENTIFY {
return MODULE_INBE
}
if message.action == INBE_FRAME {
WriteInbeHost(InbePickerView(message))
} else {
WriteInbeHost(InbeApply(message))
}
return 0
}