MaestroOverlay
Overview
The Maestro SDK provides tools for enhancing user experiences in betting apps, including the MaestroOverlay()
composable for displaying celebratory overlays when users win bets. This document outlines the current implementation, planned dynamic overlay functionality using the MaestroEventDelegate
interface.
MaestroOverlay Feature
Current Implementation
The MaestroOverlay()
composable allows manual display of a celebratory overlay when a user wins a bet.
Usage
- Initialize the Maestro SDK with a delegate conforming to
MaestroEventDelegate
. - Use the
MaestroOverlay()
composable in your Jetpack Compose UI.
Example:
@Composable
fun Screen() {
// Obtain the event from the SDK upon the invocation of shouldShowOverlay.
// Ensure to nullify the event upon the invocation of shouldHideOverlay.
val overlayEvent: MaestroOverlayEvent? = null
if (overlayEvent != null) {
val overlayVM = viewModel(
modelClass = MaestroOverlayViewModel::class.java,
factory = MaestroOverlayViewModelFactory(sdk = sdk),
)
MaestroOverlay(
viewModel = overlayVM,
onDismissed = {
dismissOverlay()
},
event = overlayEvent,
)
}
}
Limitations
- Requires manual invocation.
- No dynamic triggering or dismissal logic.
Future Implementation (Planned)
The SDK will dynamically trigger the overlay using shouldShowOverlay(event: MaestroOverlayEvent)
and shouldHideOverlay()
methods in the MaestroEventDelegate
interface.
Delegate Methods
shouldShowOverlay(event: MaestroOverlayEvent)
: Notifies the client app to display the overlay for a specificevent
.shouldHideOverlay()
: Notifies the client app to dismiss the overlay.
Workflow
- SDK detects a bet win or a fantasy event
- SDK calls
shouldShowOverlay(event)
on the client delegate. - Client app shows maintains a state of this event (e.g. with a mutable state or a
StateFlow
) - Client app passes the event to the
MaestroOverlay
composable - SDK calls
shouldHideOverlay()
after a certain duration/event. - Client app hides the overlay (e.g. by nullifying the mutable state or a
StateFlow
)