The shell draws the switch; the app owns what it means. A tap calls onToggle and
changes nothing on its own — the switch shows whatever the app last reported, so an app
that refuses a tap simply does not call setToggleActive.
What the shell holds a switch to, checked on the phone's side of the seam (a sandboxed
add-on's arguments are whatever its script sent):
id is 1-32 letters, digits, - or _, unique within this app. Registering an id
again replaces that switch.
label is 1-32 characters after trimming.
icon is the export name of an icon in @mica/sdk, such as 'MoonIcon'.
An app holds at most 3 switches at once; a fourth is refused, not rotated in.
appId is this app's own id. For a core: false add-on the shell replaces it with the
frame's own, so a frame cannot put a switch up under another app's name or reach another
app's switches.
Switches live as long as the component that registered them, like useSearchProvider:
unmount takes them down, and an add-on's frame going away takes down every switch it
holds whether or not its code got to run first. Apps are resident, so a switch registered
from an app's root component stays up for the session — but only once the app has been
opened; declare a preload if a switch must exist before that.
A refused registration throws in-process and is logged from a sandboxed add-on, where the
shell answers after this function has returned.
Contribute this app's own switches to the control center (MICA-247). Requires the
control-centerpermission.The shell draws the switch; the app owns what it means. A tap calls
onToggleand changes nothing on its own — the switch shows whatever the app last reported, so an app that refuses a tap simply does not callsetToggleActive.What the shell holds a switch to, checked on the phone's side of the seam (a sandboxed add-on's arguments are whatever its script sent):
idis 1-32 letters, digits,-or_, unique within this app. Registering an id again replaces that switch.labelis 1-32 characters after trimming.iconis the export name of an icon in@mica/sdk, such as'MoonIcon'.appIdis this app's own id. For acore: falseadd-on the shell replaces it with the frame's own, so a frame cannot put a switch up under another app's name or reach another app's switches.Switches live as long as the component that registered them, like
useSearchProvider: unmount takes them down, and an add-on's frame going away takes down every switch it holds whether or not its code got to run first. Apps are resident, so a switch registered from an app's root component stays up for the session — but only once the app has been opened; declare apreloadif a switch must exist before that.A refused registration throws in-process and is logged from a sandboxed add-on, where the shell answers after this function has returned.