Built-in capabilities
Built-in capabilities ship in every app made by mobiler new. Your core calls them through cx; each shell (Android, iOS, web) fulfils the call natively and sends the answer back as one of your messages.
| Capability | API | Since | Notes |
|---|---|---|---|
| HTTP | cx.get / cx.post / cx.put / cx.patch / cx.delete / cx.request (builder) / cx.upload / cx.download (streaming) |
0.4.0 | headers + byte body/response; streaming upload/download with progress + cancel (cx.upload / cx.download: on Android and iOS add the transfer plugin, the web has it built in); multipart upload via cx.upload().multipart() (all shells); an upload’s Done carries the server’s reply (up to 64 KB) |
| Storage | cx.save (+ restore on launch) |
0.3.0 | persist the model |
| Clipboard | cx.copy(text) · cx.copy_with(text, CopyOptions, then) · cx.copy_sensitive(text, then) |
0.7.0 | copy text; copy_with: sensitive (Android 13+ hides the preview), expires_after (iOS; best effort on Android), local_only (iOS); the web copies plainly; a shell without clipboard_with answers ok:false; ok:true carries what was applied (CopyApplied) |
| Share | cx.share(text) |
0.7.0 | system share sheet |
| Browser | cx.open_url(url) |
0.7.0 | open a link externally |
| Toast | cx.toast(text) |
0.7.0 | transient message / snackbar |
| Snackbar | cx.snackbar(Snackbar::new(text).action(label), then) |
0.40.0 | message + optional action (undo) above the nav and FAB |
| Device | cx.device_model(then) · cx.device_info(then) |
0.7.0 | device/model string; device_info: a typed DeviceInfo (OS version, API level, manufacturer, model; None on web) |
| App info | cx.app_info() |
0.39.0 | sync, set by the shell before init: AppInfo { version, build, platform, bundle_id } — the store’s version/build number |
| Appearance | cx.system_appearance(then) · cx.subscribe_appearance(key, on_event) |
0.40.0 | “light” / “dark” — the OS value even when the app forces one; the stream sends the current value, then each change. Pair with with_appearance(Light/Dark/System) |
| Haptics | cx.haptic(style) |
0.7.0 | light / medium / heavy |
| Confirm | cx.confirm(title, message, then) · cx.confirm_with(Confirm::new(t, m).confirm_label(…).cancel_label(…).destructive(), then) |
0.7.0 | native dialog; app labels + destructive style; defaults from the scaffold’s ShellLabels |
| Photo | cx.pick_photo(then) · cx.pick_photo_with(PhotoOptions, then) |
0.8.0 | system photo picker → local image URI (no permission); _with: re-encoded to a format/size, upright, metadata stripped (ADR-0045) → typed Photo, a short-lived handle (24 h native, 32 most recent on web; ADR-0049) |
| Camera | cx.capture_photo(then) · cx.capture_photo_with(PhotoOptions, then) |
0.9.0 | system camera → local image URI; _with: re-encoded to a format/size, upright, metadata stripped (ADR-0045) → typed Photo, a short-lived handle (24 h native, 32 most recent on web; ADR-0049) |
| Current time | cx.now(then) |
0.31.0 | the local date-time as YYYY-MM-DD HH:MM:SS (sortable; the date is its first 10 characters), no UI; the web shell answers it from mobiler-web 0.49.1 |
| Date picker | cx.pick_date(then) · cx.pick_date_with(Picker::new().title(…).confirm_label(…).cancel_label(…), then) |
0.12.0 | native date picker → ISO YYYY-MM-DD string; title shown on iOS only, button labels on iOS/Android, web uses the browser picker |
| Time picker | cx.pick_time(then) · cx.pick_time_with(Picker::new().title(…).confirm_label(…).cancel_label(…), then) |
0.12.0 | native time picker → 24-hour HH:MM string; title shown on iOS only, button labels on iOS/Android, web uses the browser picker |
More device features come as plugins.