@@ -39,7 +39,6 @@ import {
3939 type InteractionSurfaceChange ,
4040} from '../interaction-outcome-policy.ts' ;
4141import {
42- capturePostGestureStabilizedSnapshot ,
4342 capturePostGestureStabilizedResult ,
4443} from '../post-gesture-stabilization.ts' ;
4544import { findNodeByLabel , pruneGroupNodes , resolveRefLabel } from '../snapshot-processing.ts' ;
@@ -91,12 +90,7 @@ export async function captureSnapshot(params: CaptureSnapshotParams): Promise<{
9190 ( params . device . platform === 'ios' || params . device . platform === 'android' ) &&
9291 params . session ?. postGestureStabilization
9392 ) {
94- return {
95- snapshot : await capturePostGestureStabilizedSnapshot ( {
96- session : params . session ,
97- capture : async ( ) => ( await captureSnapshotAttempt ( params ) ) . snapshot ,
98- } ) ,
99- } ;
93+ return await capturePostGestureAwareSnapshot ( { ...params , session : params . session } ) ;
10094 }
10195 const freshness = getActiveAndroidSnapshotFreshness ( params . session ) ;
10296 if ( freshness && params . device . platform === 'android' ) {
@@ -127,7 +121,7 @@ async function captureInteractionOutcomeAwareSnapshot(
127121 let settled = await waitForDelayedInteractionSurfaceChange (
128122 params ,
129123 pending ,
130- await captureSnapshotAttemptForInteractionOutcome ( params ) ,
124+ await capturePostActionSnapshotAttempt ( params ) ,
131125 ) ;
132126 let latest = settled . latest ;
133127 let outcome = await retryPendingInteractionOutcome ( {
@@ -142,7 +136,7 @@ async function captureInteractionOutcomeAwareSnapshot(
142136 settled = await waitForDelayedInteractionSurfaceChange (
143137 params ,
144138 pending ,
145- await captureSnapshotAttemptForInteractionOutcome ( params ) ,
139+ await capturePostActionSnapshotAttempt ( params ) ,
146140 ) ;
147141 latest = settled . latest ;
148142 outcome = await retryPendingInteractionOutcome ( {
@@ -157,7 +151,7 @@ async function captureInteractionOutcomeAwareSnapshot(
157151 latest = await capturePostGestureStabilizedResult ( {
158152 session,
159153 initial : latest ,
160- capture : async ( ) => await captureSnapshotAttemptForInteractionOutcome ( params ) ,
154+ capture : async ( ) => await capturePostActionSnapshotAttempt ( params ) ,
161155 readSnapshot : ( attempt ) => attempt . snapshot ,
162156 } ) ;
163157 if ( outcome . change !== 'ambiguous' && latest . freshness ?. staleAfterRetries !== true ) {
@@ -195,7 +189,7 @@ async function waitForDelayedInteractionSurfaceChange(
195189 if ( change !== 'unchanged' ) return { latest, change } ;
196190
197191 await sleep ( INTERACTION_CHANGE_RECHECK_DELAY_MS ) ;
198- latest = await captureSnapshotAttemptForInteractionOutcome ( params ) ;
192+ latest = await capturePostActionSnapshotAttempt ( params ) ;
199193 change = classifyInteractionSurfaceChange (
200194 pending . preSignature ,
201195 buildInteractionSurfaceSignature ( latest . snapshot . nodes ) ,
@@ -292,7 +286,28 @@ async function captureAndroidFreshnessAwareAttempt(
292286 } ;
293287}
294288
295- async function captureSnapshotAttemptForInteractionOutcome (
289+ async function capturePostGestureAwareSnapshot (
290+ params : CaptureSnapshotParams & { session : SessionState } ,
291+ ) : Promise < {
292+ snapshot : SnapshotState ;
293+ analysis ?: AndroidSnapshotAnalysis ;
294+ androidSnapshot ?: AndroidSnapshotBackendMetadata ;
295+ freshness ?: AndroidFreshnessCaptureMeta ;
296+ } > {
297+ const latest = await capturePostGestureStabilizedResult ( {
298+ session : params . session ,
299+ capture : async ( ) => await capturePostActionSnapshotAttempt ( params ) ,
300+ readSnapshot : ( attempt ) => attempt . snapshot ,
301+ } ) ;
302+ return {
303+ snapshot : latest . snapshot ,
304+ analysis : latest . data . analysis ,
305+ androidSnapshot : latest . data . androidSnapshot ,
306+ freshness : latest . freshness ,
307+ } ;
308+ }
309+
310+ async function capturePostActionSnapshotAttempt (
296311 params : CaptureSnapshotParams & { session : SessionState } ,
297312) : Promise < SnapshotAttempt > {
298313 const freshness = getActiveAndroidSnapshotFreshness ( params . session ) ;
0 commit comments