Skip to content

Stories v3: parity with the web SDK - #251

Merged
Xyzcancer merged 33 commits into
masterfrom
feat/stories-v3-parity
Nov 24, 2026
Merged

Xyzcancer merged 33 commits into
masterfrom
feat/stories-v3-parity

Conversation

@Xyzcancer

@Xyzcancer Xyzcancer commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Stories over API v3 (behind the v3 gate) now behave as in the web SDK: the requests carry sid, segment, stream and testmode, poll answers are kept on the device with their source, NPS/CSAT/CES ask the band's follow-up question, and slides render and behave as on the web in the kit's look. A slide with no media type and no product is skipped, as on the web.

Stories share links (API v3)

Behind the v3 gate: opt in with @OptIn(InternalPersonalizationV3Api::class). This API may change in any release.

The "Share" button of a stories slide hands out a link to the shop's site:
https://<shop domain>/<path>?r46_stories=<block code>&r46_story=<story id>[&r46_slide=<slide id>].
To open such a link in the app instead of the browser:

  1. Verify App Links for the shop's domain: an intent filter with android:autoVerify="true" and
    https://<shop domain>/.well-known/assetlinks.json with the app's package and its signing certificate's SHA-256.

    <activity android:name=".MainActivity" android:exported="true">
        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" android:host="shop.example" />
        </intent-filter>
    </activity>
  2. Pass the opened URL to handleLink. It opens the story at the slide of the link and returns true; any other link
    gives false and is yours to handle. It needs the API v3 host: PersonalizationStories.apiV3Domain or its own
    apiV3Domain argument.

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        intent?.data?.let { PersonalizationStories.handleLink(this, it.toString()) }
    }
    
    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        intent.data?.let { PersonalizationStories.handleLink(this, it.toString()) }
    }

…s send sid, segment, stream and testmode as the web SDK, the poll answers sid, stream and testmode, and a slide started again sends view again
…r the did, the feed's answer first, and is sent with its source; an NPS, CSAT or CES rate whose band has a question asks it and sends the comment with the same rate; the card shows what the web SDK shows, the scale in the kit's semantic colours
…n the web SDK, 16 from its sides and no wider than 420, and is lifted to stay 16 above the slide's bottom, never above the header
…link as the server sent it, as the web SDK, without adding r46_slide to the campaign's link
… in the web SDK in the kit's look: media by type, its background_color, the header, text blocks by one rule, a button without a link opens nothing and no More info button, copying a promo code sends no click, a story opens at its start_position and is viewed when left forward, the mute choice is kept on the device and the sound button shows only for a video with audio
…or of the web SDK: detractors 0–6, passives 7–8, promoters 9–10; other scales and an NPS with its own range by position
…web SDK keeps it per site; a shop that has not chosen opens without sound
…eb SDK and may go under the header; the progress, close and share are drawn over it and stay tappable
…ement is skipped, as the web SDK skips it; start_position moves to the next shown slide and a story with none is left out of the feed
…y in it in English and Russian, unused, as an app may still reference them
…ries v3 viewer, as the web SDK; the legacy feed starts that slide again without a second view, as before
… segment and the viewer passes it, as the web SDK: forward past it, back over it, start_position on it opens the next shown slide or finishes the story; a story with nothing to show stays in the feed, opening it views it and goes on, and an empty viewer is never shown
…e shop's saved choice, and leaves the process-wide choice of the legacy viewers as it was; only the sound button is saved, volume up is not; the button shows until the video is known to have no audio, and a row left empty takes no space
…frame of the text blocks, not above the top system bar, and is lifted to stay 16 above the sound and products row while it is shown, else above the bottom system bar
… again, as when the navigation stood first in the column, though its row now lies over the polls
…rk text by the higher WCAG contrast against its background_color, the light one in a dark host theme too; its colours are read by one rule: #RGB, #RRGGBB, #RRGGBBAA, rgb() and rgba()
…ad as calculateOpacity of the web SDK: a number is a percent, so 0.5 is half a percent; a colour without an opacity or with an invalid one is painted opaque, and the legacy #FFFFFF and 0% defaults no longer apply
…re a rate is a number and a string is none; a saved answer that does not parse is deleted on read
…con of 40 and its texts, title SM and subtitle XS of the kit, under the navigation row
…t does not ask it for the constructors of the layout tools
…r false has no opacity and its colour is opaque, as !opacity in calculateOpacity of the web SDK; only the strings 0 and 0% are transparent
…r, as hasAnswer of the web SDK, even when no entry is an option: the card shows the answered state with no option chosen, and the saved record keeps it
… over backward is viewed, as when it is passed forward; with nothing to open before it the viewer closes
… own alpha of its #RRGGBBAA or rgba() colour; without one the colour keeps its alpha
…wer, as the web SDK closes it; a link to a story with nothing to show sends shared_open and shows nothing
… stories v3 viewer, and a swipe up closes it, as the web SDK; a swipe up on a poll card that scrolls stays the card's, a swipe down drags the viewer away as before
… only, as the web SDK: longer than 100 dp up or down and more vertical than sideways, a short fling no longer; the legacy viewer keeps down 120 dp or a fling
…es v3 viewer by distance only, as the web SDK: longer than 100 dp and more sideways than vertical, a short fling no longer; paging by fling stays the pager's
…ies poll are the English texts of the web SDK in any language, replaced by the host's texts, the poll's labels and submit_label; their shipped resources stay, unused
@Xyzcancer
Xyzcancer merged commit f681910 into master Nov 24, 2026
1 check passed
@Xyzcancer
Xyzcancer deleted the feat/stories-v3-parity branch November 24, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant