For AI agents: the complete documentation index is available at ../../../llms.txt, the full documentation bundle is available at ../../../llms-full.txt, and this page is available as Markdown at ../../../quality/scripts/subflows/launch-paywall.md.

subflows/launch-paywall.yaml

Source

appId: ${APP_ID}
---
# The paywall a cold launch owes (`paywall.launch_paywall`, from the 2nd session): a clean install past
# the first run is session 1; a cold restart is session 2 and opens the offer over the song list.
#   ${EXPECT_PAYWALL}  "1": it opens; anything else: it does not, however long the song list stays up
- runFlow: launch-app-clean.yaml
- extendedWaitUntil:
    visible:
      id: "songs-search-input"
    timeout: 120000
# Session 1 owes none: close one if this install happens to meet a paywall, so session 2 starts clean.
- runFlow:
    when:
      visible:
        id: "paywall-close"
    commands:
      - tapOn:
          id: "paywall-close"
- runFlow: launch-app.yaml
- runFlow:
    when:
      true: ${EXPECT_PAYWALL == '1'}
    commands:
      - extendedWaitUntil:
          visible:
            id: "paywall-cta"
          timeout: 60000
      - tapOn:
          id: "paywall-close"
- runFlow:
    when:
      true: ${EXPECT_PAYWALL != '1'}
    commands:
      - extendedWaitUntil:
          visible:
            id: "songs-search-input"
          timeout: 120000
      # The offer, when owed, opens within seconds of the list: wait longer than that, then look.
      - runFlow:
          file: sleep.yaml
          env:
            MS: "20000"
      - assertNotVisible:
          id: "paywall-cta"