Skip to main content

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

ParameterTypeDescription
maestroPanelTypeMaestroPanelTypeThe 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 LaunchedEffect in Compose to call this when panel appears