Keep the generated src/main.rs and replace the shared files below. The view is side-effect-free; the explicit button queues one request, binds both unit completion actions and decodes the actual typed response. Neither the normal launcher nor the preview installs a memory provider.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/app/state.rs","value":"src-app-state-rs"},{"index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"},{"index":3,"label":"src/i18n.rs","value":"src-i18n-rs"},{"index":4,"label":"src/lib.rs","value":"src-lib-rs"},{"index":5,"label":"preview/lib.rs","value":"preview-lib-rs"},{"index":6,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":7,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
mod screen;
pub mod state;
pub use screen::VolumeDiagnosticScreen;
pub use state::VolumeDiagnosticState;
{"id":"fission-tabs-1","index":1,"label":"src/app/state.rs","value":"src-app-state-rs"}
use fission::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct VolumeDiagnosticState {
pub locale: Locale,
pub pending: bool,
pub message_key: String,
pub diagnostic: Option<String>,
}
impl Default for VolumeDiagnosticState {
fn default() -> Self {
Self {
locale: Locale::from("en-US"),
pending: false,
message_key: "check.ready".into(),
diagnostic: None,
}
}
}
impl GlobalState for VolumeDiagnosticState {}
pub fn check_host(
state: &mut VolumeDiagnosticState,
cx: &mut ReducerContext<VolumeDiagnosticState>,
) {
if state.pending {
return;
}
state.pending = true;
state.message_key = "check.pending".into();
state.diagnostic = None;
let ok = cx.effects.bind(HostChecked, reduce_with!(host_checked));
let err = cx
.effects
.bind(HostCheckFailed, reduce_with!(host_check_failed));
cx.effects
.volume()
.get_level(VolumeStream::Media)
.on_ok(ok)
.on_err(err);
}
#[fission_reducer(HostChecked)]
fn host_checked(state: &mut VolumeDiagnosticState, cx: &mut ReducerContext<VolumeDiagnosticState>) {
state.pending = false;
match cx.input.capability_ok(GET_VOLUME_LEVEL) {
Some(value) => {
state.message_key = if true {
"check.available"
} else {
"check.unavailable"
}
.into();
state.diagnostic = Some(format!("{value:?}"));
}
None => state.message_key = "check.invalid".into(),
}
}
#[fission_reducer(HostCheckFailed)]
fn host_check_failed(
state: &mut VolumeDiagnosticState,
cx: &mut ReducerContext<VolumeDiagnosticState>,
) {
state.pending = false;
match cx.input.capability_error(GET_VOLUME_LEVEL) {
Some(error) => {
state.message_key = if error.code == "unsupported" {
"check.unavailable"
} else {
"check.failed"
}
.into();
state.diagnostic = Some(format!("{}: {}", error.code, error.message));
}
None => state.message_key = "check.invalid".into(),
}
}
{"id":"fission-tabs-1","index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"}
use super::state::{check_host, VolumeDiagnosticState};
use fission::prelude::*;
fission_component! {
pub VolumeDiagnosticScreen<VolumeDiagnosticState> {}
view(_screen, state, cx) {
let tokens = &cx.view.env().theme.tokens;
} => SafeArea(child: Scroll(child: Container(
Column(gap: tokens.spacing.m, children: [
Text(cx.tr("check.heading")).size(tokens.typography.heading2_size),
Text(cx.tr("check.blocked")).color(tokens.colors.text_secondary),
Row(gap: tokens.spacing.s, children: [
Button(child: Text(cx.tr("language.english")), key: "english",
on_press: reduce { state.locale = Locale::from("en-US"); }),
Button(child: Text(cx.tr("language.spanish")), key: "spanish",
on_press: reduce { state.locale = Locale::from("es-ES"); }),
]),
Button(child: Text(cx.tr("check.request")), key: "check-host", disabled: state.pending,
on_press: reduce { check_host(state, cx); })
.semantics_identifier("host.check"),
if state.pending {
Spinner(motion: Some(SpinnerMotion::Default), label: Some(cx.tr("check.pending")))
},
Text(cx.tr(&state.message_key)),
if let Some(details) = &state.diagnostic { Code(text: details.clone()) },
Text(cx.tr("check.scope")).color(tokens.colors.text_secondary),
])
).padding_all(tokens.spacing.l)))
}
{"id":"fission-tabs-1","index":3,"label":"src/i18n.rs","value":"src-i18n-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;
pub fn create_env() -> Env {
let mut env = Env::default();
env.locale = Locale::from("en-US");
for (locale, source) in [
("en-US", include_str!("../i18n/en-US.yaml")),
("es-ES", include_str!("../i18n/es-ES.yaml")),
] {
let messages: HashMap<String, String> =
serde_yaml::from_str(source).expect("valid task translations");
env.i18n.add_bundle(TranslationBundle {
locale: Locale::from(locale),
messages,
});
}
env
}
pub fn sync_env(state: &crate::app::VolumeDiagnosticState, env: &mut Env) {
env.locale = state.locale.clone();
}
{"id":"fission-tabs-1","index":4,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod i18n;
use app::{VolumeDiagnosticScreen, VolumeDiagnosticState};
use fission::prelude::*;
#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
DesktopApp::<VolumeDiagnosticState, _>::new(VolumeDiagnosticScreen)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.run()
}
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> {
MobileApp::<VolumeDiagnosticState, _>::new(VolumeDiagnosticScreen)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.run()
}
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
let _ = MobileApp::<VolumeDiagnosticState, _>::new(VolumeDiagnosticScreen)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.run_with_android_app(app_handle);
}
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
console_error_panic_hook::set_once();
WebApp::<VolumeDiagnosticState, _>::new(VolumeDiagnosticScreen)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.run()
.map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":5,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod i18n;
use fission::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
console_error_panic_hook::set_once();
WebApp::<app::VolumeDiagnosticState, _>::new(app::VolumeDiagnosticScreen)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.mount("#fission-web-mount")
.run()
.map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":6,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
check.heading: "Check the active volume provider"
check.blocked: "The native iOS tutorial goal is blocked. This screen checks a prerequisite; it does not implement the promised feature."
check.request: "Check the active host"
check.ready: "No host check has been requested."
check.pending: "Waiting for the host…"
check.available: "A provider returned a volume reading. This does not establish iOS support."
check.unavailable: "The active host cannot provide this prerequisite or operation."
check.failed: "The host check failed. Inspect the diagnostic details."
check.invalid: "The host returned no usable typed result."
check.scope: "This is an integration diagnostic, not a completed native workflow."
language.english: "English"
language.spanish: "Español"
{"id":"fission-tabs-1","index":7,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
check.heading: "Comprueba el proveedor de volumen"
check.blocked: "El objetivo nativo de iOS está bloqueado. Esta pantalla comprueba un requisito; no implementa la función prometida."
check.request: "Comprobar el host activo"
check.ready: "No se ha solicitado ninguna comprobación."
check.pending: "Esperando al host…"
check.available: "Un proveedor devolvió un nivel de volumen. Esto no demuestra compatibilidad con iOS."
check.unavailable: "El host activo no puede proporcionar este requisito u operación."
check.failed: "La comprobación falló. Revisa los detalles de diagnóstico."
check.invalid: "El host no devolvió un resultado tipado utilizable."
check.scope: "Es un diagnóstico de integración, no un flujo nativo completo."
language.english: "Inglés"
language.spanish: "Español"
{"id":"fission-tabs-1"}