emitScreenView

Records name as the current screen and emits a Screen Viewed for it, carrying the screen it replaced as previous_screen. The one place that couples recording with emitting, so every native screen-capture caller — the iOS UIKit swizzle, the iOS explicit SwiftUI path, and the Android Activity/Fragment lifecycle capture — cannot drift on the order or on the self-previous guard.

previous == name when this same screen is re-entered with nothing capturable recorded in between — leaving a screen for an excluded one (a SwiftUI tab, a system/Compose modal, a SwiftUI screen with no .autographScreen, or on Android a Compose-hosted or excluded Activity) and coming back. The intermediate screen is genuinely unknown, so the honest previous_screen is none, not the screen naming itself — hence the takeIf. The Compose path never hits this (its LaunchedEffect is keyed on the name, so it cannot re-record an unchanged one); the native callers are the first that can, so the guard lives here rather than in ScreenHistory.record.

Callers push the screen frame first (see their call sites): this only records and emits, so a throwing tracker leaves an already-removable frame behind.

@AutographInternalApi: public only so Autograph's own native modules can share this across the module boundary — Kotlin internal would not reach them. Not a supported API for library users.