didShowPanel
Notifies the SDK that the MaestroPanel was displayed.
Overview
Call this method after your app displays the Maestro panel to inform the SDK that the panel is now visible. This allows the SDK to track panel visibility state and adjust its behavior accordingly.
Syntax
abstract fun didShowPanel(maestroPanelType: MaestroPanelType)
Parameters
| Parameter | Type | Description |
|---|---|---|
maestroPanelType | MaestroPanelType | The type of panel that was shown |
Example
@Composable
fun MaestroScreen(sdk: MaestroSDK.Instance, isPanelVisible: Boolean) {
val viewModel = maestroEventViewModel(sdk)
Box(modifier = Modifier.fillMaxSize()) {
VideoPlayer()
if (isPanelVisible) {
MaestroPanel(
maestroEventViewModel = viewModel,
modifier = Modifier.fillMaxSize(),
)
// Notify SDK that panel is visible
LaunchedEffect(Unit) {
viewModel.didShowPanel(MaestroPanelType.Chat)
}
}
}
}
// When showing panel programmatically
fun showPanel(panelType: MaestroPanelType) {
// Update UI state
_isPanelVisible.value = true
// Notify SDK
viewModel.didShowPanel(panelType)
}
// In response to shouldShowPanel delegate method
override fun shouldShowPanel() {
_isPanelVisible.value = true
lifecycleScope.launch {
// Determine current panel type or default to Chat
viewModel.didShowPanel(MaestroPanelType.Chat)
}
}
Notes
- Call this method after the panel becomes visible
- The panel type should match the currently displayed panel
- This helps the SDK track panel state and usage
- Use
LaunchedEffectin Compose to call this when panel appears
Related Methods
- didHidePanel() - Notify SDK when panel is hidden
- shouldShowPanel() - SDK requests panel be shown