@@ -11,11 +11,7 @@ let eventListener:
1111 | ( ( type : string , data ?: Record < string , unknown > ) => void )
1212 | null = null ;
1313let checkStateListener :
14- | ( ( state : {
15- status : string ;
16- resultKind : string ;
17- hash ?: string ;
18- } ) => void )
14+ | ( ( state : { status : string ; resultKind : string ; hash ?: string } ) => void )
1915 | null = null ;
2016type UpdateStrategyMode = 'silentAndNow' | 'silentAndLater' ;
2117const updatePlatform = Platform . OS === 'android' ? 'android' : 'ios' ;
@@ -36,9 +32,8 @@ function App() {
3632 const [ lastEventVersion , setLastEventVersion ] = useState ( '(none)' ) ;
3733 const [ lastCheckStatus , setLastCheckStatus ] = useState ( '(none)' ) ;
3834 const [ lastCheckResult , setLastCheckResult ] = useState ( '(none)' ) ;
39- const [ selectedStrategy , setSelectedStrategy ] = useState < UpdateStrategyMode > (
40- 'silentAndNow' ,
41- ) ;
35+ const [ selectedStrategy , setSelectedStrategy ] =
36+ useState < UpdateStrategyMode > ( 'silentAndNow' ) ;
4237 const bundleLabelGlobal = globalThis as typeof globalThis & {
4338 __RNU_E2E_BUNDLE_LABEL ?: string ;
4439 } ;
@@ -66,9 +61,7 @@ function App() {
6661 } ) => {
6762 setLastCheckStatus ( state . status ) ;
6863 setLastCheckResult (
69- state . hash
70- ? `${ state . resultKind } :${ state . hash } `
71- : state . resultKind ,
64+ state . hash ? `${ state . resultKind } :${ state . hash } ` : state . resultKind ,
7265 ) ;
7366 } ;
7467 eventListener = listener ;
@@ -88,24 +81,7 @@ function App() {
8881 < Text style = { styles . welcome } > react-native-update e2etest</ Text >
8982 < Text testID = "bundle-label" > bundleLabel: { bundleLabel } </ Text >
9083 < Text testID = "current-hash" > currentHash: { currentHash || '(empty)' } </ Text >
91- < Text testID = "package-version" > packageVersion: { packageVersion } </ Text >
92- < Text testID = "client-version" > clientVersion: { client ?. version } </ Text >
9384 < Text testID = "update-strategy" > updateStrategy: { selectedStrategy } </ Text >
94- < Text testID = "endpoint" >
95- endpoint: { getLocalUpdateEndpoint ( updatePlatform ) }
96- </ Text >
97- < Text testID = "progress" >
98- progress: { received || 0 } / { total || 0 }
99- </ Text >
100- < Text testID = "last-event" > lastEvent: { lastEvent } </ Text >
101- < Text testID = "last-event-data" > lastEventData: { lastEventData } </ Text >
102- < Text testID = "last-event-version" > lastEventVersion: { lastEventVersion } </ Text >
103- < Text testID = "last-check-status" > lastCheckStatus: { lastCheckStatus } </ Text >
104- < Text testID = "last-check-result" > lastCheckResult: { lastCheckResult } </ Text >
105- < Text testID = "last-error" > lastError: { lastError ?. message || '(none)' } </ Text >
106- < Text testID = "version-info" >
107- currentVersionInfo: { JSON . stringify ( currentVersionInfo ) || '(empty)' }
108- </ Text >
10985
11086 < View style = { styles . buttonRow } >
11187 < Pressable
@@ -141,6 +117,38 @@ function App() {
141117 >
142118 < Text style = { styles . buttonText } > Check Update</ Text >
143119 </ Pressable >
120+
121+ < Text testID = "package-version" > packageVersion: { packageVersion } </ Text >
122+ < Text testID = "client-version" > clientVersion: { client ?. version } </ Text >
123+ < Text testID = "endpoint" style = { styles . diagnosticText } numberOfLines = { 1 } >
124+ endpoint: { getLocalUpdateEndpoint ( updatePlatform ) }
125+ </ Text >
126+ < Text testID = "progress" >
127+ progress: { received || 0 } / { total || 0 }
128+ </ Text >
129+ < Text testID = "last-event" > lastEvent: { lastEvent } </ Text >
130+ < Text
131+ testID = "last-event-data"
132+ style = { styles . diagnosticText }
133+ numberOfLines = { 1 }
134+ >
135+ lastEventData: { lastEventData }
136+ </ Text >
137+ < Text testID = "last-event-version" >
138+ lastEventVersion: { lastEventVersion }
139+ </ Text >
140+ < Text testID = "last-check-status" > lastCheckStatus: { lastCheckStatus } </ Text >
141+ < Text testID = "last-check-result" > lastCheckResult: { lastCheckResult } </ Text >
142+ < Text testID = "last-error" style = { styles . diagnosticText } numberOfLines = { 1 } >
143+ lastError: { lastError ?. message || '(none)' }
144+ </ Text >
145+ < Text
146+ testID = "version-info"
147+ style = { styles . diagnosticText }
148+ numberOfLines = { 1 }
149+ >
150+ currentVersionInfo: { JSON . stringify ( currentVersionInfo ) || '(empty)' }
151+ </ Text >
144152 </ View >
145153 ) ;
146154}
@@ -150,7 +158,7 @@ const styles = StyleSheet.create({
150158 flex : 1 ,
151159 justifyContent : 'center' ,
152160 alignItems : 'center' ,
153- gap : 8 ,
161+ gap : 6 ,
154162 paddingHorizontal : 24 ,
155163 backgroundColor : '#F5FCFF' ,
156164 } ,
@@ -166,7 +174,7 @@ const styles = StyleSheet.create({
166174 gap : 8 ,
167175 } ,
168176 button : {
169- marginTop : 16 ,
177+ marginTop : 8 ,
170178 borderRadius : 8 ,
171179 backgroundColor : '#0a84ff' ,
172180 paddingHorizontal : 16 ,
@@ -177,6 +185,9 @@ const styles = StyleSheet.create({
177185 color : '#ffffff' ,
178186 fontWeight : '600' ,
179187 } ,
188+ diagnosticText : {
189+ maxWidth : '100%' ,
190+ } ,
180191} ) ;
181192
182193const updateClient = new Pushy ( {
@@ -193,12 +204,12 @@ const updateClient = new Pushy({
193204 const resultKind = result ?. update
194205 ? 'update'
195206 : result ?. upToDate
196- ? 'upToDate'
197- : result ?. expired
198- ? 'expired'
199- : result ?. paused
200- ? `paused:${ result . paused } `
201- : '(none)' ;
207+ ? 'upToDate'
208+ : result ?. expired
209+ ? 'expired'
210+ : result ?. paused
211+ ? `paused:${ result . paused } `
212+ : '(none)' ;
202213 checkStateListener ?.( {
203214 status : state . status ,
204215 resultKind,
0 commit comments