Skip to main content

Embedded widgets

An embed is a Flyy surface inside your own layout: a milestone strip on your home screen, an offer card in checkout. Embeds have a transparent background, no chrome, and size themselves to their content.

WidgetWhat it shows
TRAILProgress trail across the user's active campaigns
MILESTONESAll milestone programs
MILESTONEThe user's current milestone, compact
OFFEROffer cards; or one offer with loadOffer(id)

Any full screen can be embedded too.

Views and UIKit​

val embed = FlyyEmbedView(context).apply {
onCta = FlyyEmbedView.OnCtaListener { target, _ ->
Flyy.open(context, deepPath = target) // you route taps
}
onState = FlyyEmbedStateListener { state ->
section.isVisible = state == "ready" // hide empty sections
}
load(FlyyWidget.TRAIL)
}
container.addView(embed)

// when the screen is gone for good:
embed.release()

For a page-sized embed that scrolls inside itself, set fillHeight = true and load a screen: embed.load(FlyyScreen.REWARDS).

Compose and SwiftUI​

Needs com.theflyy:flyy-compose.

FlyyEmbed(
widget = FlyyWidget.MILESTONE,
onStatus = { if (it.isBlank) sectionVisible = false },
onCta = { route -> nav.push(route) },
placeholder = { status -> MyShimmer(status) },
)

// a full screen filling a tab
FlyyEmbed(FlyyScreen.REWARDS, modifier = Modifier.weight(1f))

FlyyEmbed releases the WebView on dispose and shows your placeholder until the content is ready, so loading and empty states stay in your design.

Navigation inside your own chrome. A tap can open another Flyy surface under your own top bar instead of the full-screen SDK:

val nav = rememberFlyyEmbedNavigator()
val route = nav.current
if (route != null) {
MyBackHeader(route.title, onBack = { nav.pop() })
FlyyEmbed(route, onCta = nav::push, modifier = Modifier.weight(1f))
} else {
MyHomeTabs(onRewards = { nav.push(FlyyScreen.REWARDS) })
}

Embed states​

StateMeaningWhat to do
loadingContent is on its wayShow a placeholder
readyContent paintedShow the section
emptyNothing to show for this userHide the section, title included
errorCouldn't loadHide the section or show a retry

:::caution Memory Each embed is a WebView (30–80 MB). Keep one or two per screen and never one per list row. Release embeds you no longer need. :::