> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Show gifts over the screen

> Reward users at moments with no slot: present() shows Encore's gifts as a popup, half sheet or full-screen cover, and says why when it doesn't.

> [!NOTE]
>
> **Requires SDK 2.8.0+.** This page covers the iOS, Android and web SDKs. On iOS, presented looks need iOS 17 or later, as every trigger look does.

Some moments have no spot on screen for a gifts button: a level just ended, a streak was just reached, a workout was just saved. `present()` on a [claim handle](https://docs.encorekit.com/publishers/triggers/custom-ui.md) asks Encore to show its look for that placement over your screen instead. Encore draws it as a popup, a half sheet or a full-screen cover. A tap opens the reward sheet exactly as a tap on your own view does.

Your own view, the handle's `state` and `tap()` don't change. `present()` is one more way to use the same handle.

## When to use it

* **Use `present()`** at a moment with no slot, right after something worth rewarding happened.
* **Use [Gifts Button](https://docs.encorekit.com/publishers/triggers/gifts-button.md) or [Claim Reminder](https://docs.encorekit.com/publishers/triggers/claim-reminder.md)** where your screen has a slot. Those components already show presented looks by themselves when Encore serves one, so there's nothing to call.
* **Use your [own button](https://docs.encorekit.com/publishers/triggers/custom-ui.md)** when you want to draw the entry in your own style.

## The three presentation modes

Encore picks the mode per look on its side, so modes are tested like any other look. Your app has no setting for it.

| Mode | iOS | Android | Web | On screen |
| - | - | - | - | - |
| Popup | `.popup` | `PresentedMode.POPUP` | `'popup'` | The screen dims and the look sits on a centered card |
| Half sheet | `.halfSheet` | `PresentedMode.HALF_SHEET` | `'halfSheet'` | The screen dims and the look sits on a card at the bottom, closed by swiping it down |
| Full screen | `.fullScreen` | `PresentedMode.FULL_SCREEN` | `'fullScreen'` | An opaque cover over the whole screen, the look centered inside it |

Every container has a close button and a small "Gifts from our partners" label, translated with the rest of the SDK's text, and keeps screen reader focus inside while it's up. To close it, the user taps the close button. They can also swipe the half sheet down, press back on Android, or press Escape on the web. On iOS and the web, the container also follows the system's reduced motion setting.

## Call it

`present()` returns once the look is on screen, or once it's clear nothing can show. It never throws or rejects.

```swift iOS theme={null}
@StateObject private var claim = Encore.claim(placement: "level_complete")

func levelFinished() {
  Task {
    switch await claim.present() {
    case .shown(let mode):
      print("Shown as \(mode)")
    case .suppressed(let reason):
      print("Not shown: \(reason.rawValue)")
    }
  }
}
```

```kotlin Android theme={null}
val claim = rememberEncoreClaim(placement = "level_complete")

LaunchedEffect(levelDone) {
  if (levelDone) when (val outcome = claim.present()) {
    is PresentOutcome.Shown -> Log.d("App", "Shown as ${outcome.mode}")
    is PresentOutcome.Suppressed -> Log.d("App", "Not shown: ${outcome.reason.wire}")
  }
}
```

```javascript Web SDK theme={null}
const claim = Encore.claim({ placement: 'level_complete' });

async function levelFinished() {
  const outcome = await claim.present?.();
  if (outcome && 'shown' in outcome) console.log('Shown as', outcome.shown);
  else if (outcome) console.log('Not shown:', outcome.suppressed);
}
```

```tsx Web SDK (React) theme={null}
const { present } = useEncoreClaim({ placement: 'level_complete' });

async function onLevelFinished() {
  const outcome = await present();
  // { shown: 'popup' } or { suppressed: 'placementDay' }, and so on
}
```

* **iOS:** `present()` is `async` on the main actor and returns a `PresentOutcome`: `.shown(PresentedMode)` or `.suppressed(PresentSuppressedReason)`. A `switch` over `PresentSuppressedReason` needs an `@unknown default`, since a later SDK may add a reason.
* **Android:** `present()` is a `suspend` function that returns `PresentOutcome.Shown(mode)` or `PresentOutcome.Suppressed(reason)`. From Views or Java, `claim.present { outcome -> }` calls back once on the main thread. A `when` over `PresentSuppressedReason` needs an `else` branch, since a later SDK may add a reason. `reason.wire` is the shared name every SDK uses, which suits logs and bridges.
* **Web:** `present()` resolves `{ shown: PresentedMode }` or `{ suppressed: PresentSuppressedReason }`. In React, `useEncoreClaim()` returns the same `present()`, which resolves `{ suppressed: 'unavailable' }` before the handle exists.

The look Encore asks for follows the handle's state: the gifts button, or the claim reminder while the state is `reminder`. A tap opens the reward sheet with the handle's `publisherReward`, sheet text and moment. Then `onResult` gets its result.

## Results

`present()` comes back with one of two outcomes:

| Outcome | iOS | Android | Web |
| - | - | - | - |
| The look is on screen | `.shown(mode)` | `PresentOutcome.Shown(mode)` | `{ shown: mode }` |
| Nothing showed | `.suppressed(reason)` | `PresentOutcome.Suppressed(reason)` | `{ suppressed: reason }` |

A suppressed outcome is normal. Looks are limited per device, so expect a limit's reason often, and carry on with your screen as if you never called it.

## Suppressed reasons

The reasons have the same names on every platform. iOS and the web use them as written; Android's enum constants are the same names in upper snake case, and `reason.wire` gives the shared name.

### Not shown: nothing to show

| Reason | iOS | Android | Web | When |
| - | - | - | - | - |
| `noLook` | `.noLook` | `NO_LOOK` | `'noLook'` | Encore has no presented look for this placement and user right now, for example none is set up or a test holds this user out. On Android, also a handle you closed. Nothing is sent |
| `unavailable` | `.unavailable` | `UNAVAILABLE` | `'unavailable'` | Nothing could be shown. See the per-platform causes below |
| `unrenderable` | `.unrenderable` | `UNRENDERABLE` | `'unrenderable'` | Encore served a look this SDK version can't draw |
| `disabled` | `.disabled` | `DISABLED` | `'disabled'` | The SDK is turned off (see [Turning the SDK off](#turning-the-sdk-off)) |
| `unsupportedOS` | `.unsupportedOS` | `UNSUPPORTED_OS` | `'unsupportedOS'` | iOS below 17. Android and the web never return it |

The causes of `unavailable` per platform:

* **iOS:** no offers for this user, no answer from Encore, the look went away while it waited, the user changed or no screen to show it on.
* **Android:** the SDK isn't configured, no user yet, a network or server error, no offers for this user or the look went away during its delay.
* **Web:** no offers for this user, a failed request, storage that can't keep the device limits or a handle that was destroyed. A new user or a language change while it waits also answers `unavailable`.

### Not shown: a device limit held it

| Reason | iOS | Android | Web | When |
| - | - | - | - | - |
| `background` | `.background` | `BACKGROUND` | `'background'` | Your app isn't active, or the browser tab is hidden |
| `sheetUp` | `.sheetUp` | `SHEET_UP` | `'sheetUp'` | Another Encore sheet or presented look is up, including one this handle's own `present()` is still showing or waiting to show. On Android, also a system alert |
| `firstSession` | `.firstSession` | `FIRST_SESSION` | `'firstSession'` | The first 30 seconds of the first session on this device |
| `dismissBackoff` | `.dismissBackoff` | `DISMISS_BACKOFF` | `'dismissBackoff'` | The user closed a presented look at this placement twice in a row recently |
| `placementDay` | `.placementDay` | `PLACEMENT_DAY` | `'placementDay'` | This placement's presented looks for today are used up, or the days between two shows at it haven't passed |
| `session` | `.session` | `SESSION` | `'session'` | This app session's presented looks are used up (this page session on the web) |
| `day` | `.day` | `DAY` | `'day'` | Today's presented looks across placements are used up |

## Delay and timing

1. `present()` asks Encore for a presented look for the placement, on its own request.
2. If the look has a delay, the SDK waits it out before showing anything. Encore sets the delay per look, from 0 to 3 seconds.
3. Then every device limit is checked, live. `present()` has no slot to wait in, so when your app is in the background or another sheet is up, it returns `background` or `sheetUp` right away instead of waiting for them to clear.
4. If no limit holds, the container shows and `present()` returns `shown`.

If the look Encore served changes or goes away during the delay, nothing opens after it. On iOS and Android, `present()` returns `unavailable`.

## Device limits

The same limits apply to `present()` and to Gifts Button and Claim Reminder when they show a presented look. By default:

* At most one presented look per app session (per page session on the web).
* At most two presented looks per local day, across placements.
* At most one per placement per local day.
* None in the first 30 seconds of the first session on the device.
* After the user closes a presented look twice in a row at a placement, none at that placement for 3 days. A tap resets the count.
* Never while your app is in the background or the tab is hidden, and never over another Encore sheet.

Encore can change some of these per look on its side:

| Per look | Default | Range | Effect |
| - | - | - | - |
| Shows per placement per day | 1 | 1 to 10 | Raises the placement's daily count. The daily count across placements rises with it, so the look can reach its count |
| Shows per session | 1 | 1 to 3 | Raises the session count |
| Days between two shows at a placement | 1 | 1 to 30 | Lengthens the gap. It can't shorten it |
| Pause after two closes in a row | 3 days | 3 to 30 days | Lengthens the pause. It can't shorten it |

The first-session quiet period, the background and the other-sheet rules never change. When several limits hold, `present()` reports the first one, in the order of the [device limit reasons](#not-shown-a-device-limit-held-it).

## A second call while one is up

`present()` shows one look at a time per handle. A second call while a `present()` is still waiting or its look is on screen returns `sheetUp` and shows nothing. Call it again after the first one is closed.

## Turning the SDK off

When the SDK is turned off (`Encore.shared.isEnabled = false` on iOS and Android, `Encore.isEnabled = false` on the web), `present()` returns `disabled` right away, with no request and nothing on screen.

Turning it off while a look is up closes it, and that close doesn't count as a dismissal. Turning it off while a `present()` is still waiting answers that call with `disabled`.

On iOS and the web, `identify()`, `reset()` or a language change also take down a presented look this handle shows, since it belonged to the previous user.

## Analytics

Encore reports the presented look's view, tap and close as it does for its trigger components, each with the mode it was shown in. When a device limit other than `background` or `sheetUp` holds a look back, Encore records that too, once per placement and reason per day. `noLook` sends nothing. You don't send any events.

## Related

* [Build your own button](https://docs.encorekit.com/publishers/triggers/custom-ui.md): the claim handle `present()` belongs to.
* [Gifts Button](https://docs.encorekit.com/publishers/triggers/gifts-button.md): Encore's own gifts entry, which shows presented looks in its slot by itself.
* [Trigger components](https://docs.encorekit.com/publishers/triggers/overview.md): what every trigger component shares.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.