Purpose
Create and present Encore offers using a fluent builder API. Fetches available offers for the current user and presents them in a native offer sheet.show() returns the complete PresentationResult record and never throws.
Signature
Encore.placement(id) is the one way to create a placement. The instance form Encore.shared.placement(id) is deprecated and is removed in the next major release.
Methods
show() never throws: every failure is a value on the result, including calling before configure() (NotPresented(NotConfigured)). The suspending forms are safe to call from any thread or scope; the body runs on a background dispatcher and UI work is hopped to Main internally.Use cases
A use case selects which template the backend resolves and which funnel the presentation is counted in. It is a different axis from the placement ID: one use case holds many placements.
Each case carries a fixed wire value (
"churn-intervention" and "post-action-reward") that the backend stores and that analytics splits the funnel on. The constant names are the API surface; the wire values are the contract.
Moment
logLevel = LogLevel.DEBUG, a placement shown with no moment logs one warning per placement. How to choose a moment type: Tell Encore the Moment.
Location and trigger
embedded when your launcher sits inside a screen, popup or sheet that shows other content (a button in a celebration popup), and standalone when the launcher is the whole UI that appears (a toast, a drop-down notice, a floating badge). Trigger components report their own trigger values. See Describe your placement in code.
Usage
Suspend (recommended)
Callback form
Reward surface
Reward for trying
From 2.3.0,publisherReward() describes a prize your app pays for trying an offer. When the user says they finished and Encore’s server grants the prize, result.claim?.userConfirmedCompletion is true on the result show() returns (or passes to show(onResult:)), and your app grants the prize from that result only (the outcomes stream carries the same result, so granting from both pays twice). The server keys the prize on the ID you pass to identify(), so only identified users are promised one. Setup, the daily limit, and when the flag stays false: Reward for Trying.
With named placements for analytics
Appearance
The sheet renders in light, dark, or automatic appearance, following the appearance mode configured for your app in the Encore dashboard. Automatic is the default: the sheet follows your host app’s theme, falling back to the device setting when that theme can’t be read. The sheet runs in its own Activity, so this is what keeps it visually part of the app it presents over rather than following the device past a host that pins its own style.fun appearance(config: AppearanceConfig): PlacementBuilder styles this presentation. Its sheet: SheetAppearance? field gives the reward sheet your fonts, colors, corners, and images per component; see Sheet Appearance.
SheetAppearance
AppearanceConfig.sheet styles a served reward sheet per component, and a value set in the Style editor (when it is on for your app) wins over app code per property. Fonts come from app code only. How to use it: Sheet Appearance.
Structure
Field reference
SheetAppearance
SheetComponentStyle: every field is optional. The element the variant draws decides which fields apply; a field that does not apply, or a value out of range, is dropped with a warning in the SDK log.
animation
enter and loop: both are skipped or held still when the device asks for reduced motion.
Claim CTA toggle
Encore.shared.isClaimEnabled controls whether the claim CTA on offer cards is tappable. It is runtime-mutable by design: flip it to false to gray out and disable the claim button, and back to true to re-enable it.
Related
- PresentationResult: the returned record and its fact readers
- Encore.outcomes: every resolution also lands on the passive stream
- Integration Patterns: choosing between the suspend and callback forms