decideAfterClose static method

CloseDecision decideAfterClose(
  1. ChanceStateResult state, [
  2. bool dismissAfterPlayed = true
])

Maps a floating entry's state answer about its own chance after its game closed. playable keeps the entry with that chance; a failed call keeps the stored one, so a network blip never dismisses it; any other answer hides it. A played answer hides only when dismissAfterPlayed is true (the default): with it false the played entry stays, keeping its stored chance, so a tap reopens the skin showing the reward already won. expired/none/refused always hide: only the played case is gated by the flag. Inline entries never consult this flag. Port of Android/iOS PlaySession.decideAfterClose (floating-only).

Implementation

static CloseDecision decideAfterClose(
  ChanceStateResult state, [
  bool dismissAfterPlayed = true,
]) =>
    switch (state) {
      ChancePlayable(:final chanceId, :final expiresAt) =>
        CloseKeep(ChanceGranted(chanceId, expiresAt, show: true)),
      ChanceStateFailed() => const CloseKeep(null),
      ChancePlayed() =>
        dismissAfterPlayed ? const CloseHide() : const CloseKeep(null),
      _ => const CloseHide(),
    };