BlazeFetchedContentPolicy - iOS

BlazeFetchedContentPolicy

BlazeFetchedContentPolicy tells the SDK what to do with content it already fetched when the viewer token changes. It is passed to setExternalUserToken.

A token change does not say by itself what happened. Signing in, switching to a different account, and refreshing an expiring token all arrive through the same setter and call for different behavior. The host is the only side that knows which one it is, so it selects the policy. There is deliberately no default.

public enum BlazeFetchedContentPolicy {
    case evict
    case keep
}
ValueWhen to use
evictThe viewer identity itself changed (sign-in, switching accounts). The SDK clears the content prepared with prepareStories, prepareMoments and prepareVideos, and widgets on screen blank and fetch again for this viewer. An open full-screen player is not reloaded, so dismiss and reopen it if the switch has to show there too.
keepThe viewer stayed the same and only the token was replaced (a routine refresh of an expiring token). Content already fetched is kept and widgets are not reloaded.

With either policy, an item in an open player that has no playback URL yet, or that was refused, is checked again under the new token. Neither policy interrupts an item that is already playing.

// Signing in or switching accounts:
Blaze.shared.setExternalUserToken(newToken, cachedContentPolicy: .evict)

// Refreshing an expiring token for the same viewer:
Blaze.shared.setExternalUserToken(refreshedToken, cachedContentPolicy: .keep)

Did this page help you?