@@ -120,53 +120,67 @@ export const fetchUpdateInfo = async () => {
120120 }
121121
122122 setTimeout ( async ( ) => {
123- const { updateInfo, version, skipUpdate, skippedUpdateVersion } =
124- useAppState . getState ( ) ;
123+ const {
124+ updateInfo,
125+ version,
126+ skipUpdate,
127+ skippedUpdateVersion,
128+ setUpdateInfo,
129+ } = useAppState . getState ( ) ;
125130 const { showMessageBox, hideMessageBox } = useMessageBox . getState ( ) ;
126131
127- if (
128- updateInfo &&
129- updateInfo . version != version &&
130- skippedUpdateVersion != updateInfo . version
131- ) {
132- const versionInfo = updateInfo . versions [ updateInfo . version ] ;
133- if ( versionInfo ) {
134- updateInfo . download = versionInfo . download ;
135- updateInfo . ompPluginChecksum = versionInfo . ompPluginChecksum ;
136- updateInfo . ompPluginDownload = versionInfo . ompPluginDownload ;
137- }
132+ if ( updateInfo ) {
133+ if (
134+ updateInfo . version != version &&
135+ skippedUpdateVersion != updateInfo . version
136+ ) {
137+ const versionInfo = updateInfo . versions [ updateInfo . version ] ;
138+ if ( versionInfo ) {
139+ updateInfo . download = versionInfo . download ;
140+ updateInfo . ompPluginChecksum = versionInfo . ompPluginChecksum ;
141+ updateInfo . ompPluginDownload = versionInfo . ompPluginDownload ;
142+ }
138143
139- showMessageBox ( {
140- title : t ( "update_modal_update_available_title" ) ,
141- description : t ( "update_modal_update_available_description" , {
142- version,
143- newVersion : updateInfo . version ,
144- } ) ,
145- boxWidth : 640 ,
146- buttonWidth : 200 ,
147- buttons : [
148- {
149- title : t ( "download" ) ,
150- onPress : ( ) => {
151- shell . open ( updateInfo . download ) ;
152- hideMessageBox ( ) ;
144+ showMessageBox ( {
145+ title : t ( "update_modal_update_available_title" ) ,
146+ description : t ( "update_modal_update_available_description" , {
147+ version,
148+ newVersion : updateInfo . version ,
149+ } ) ,
150+ boxWidth : 640 ,
151+ buttonWidth : 200 ,
152+ buttons : [
153+ {
154+ title : t ( "download" ) ,
155+ onPress : ( ) => {
156+ shell . open ( updateInfo . download ) ;
157+ hideMessageBox ( ) ;
158+ } ,
153159 } ,
154- } ,
155- {
156- title : t ( "update_modal_remind_me_next_time" ) ,
157- onPress : ( ) => {
158- hideMessageBox ( ) ;
160+ {
161+ title : t ( "update_modal_remind_me_next_time" ) ,
162+ onPress : ( ) => {
163+ hideMessageBox ( ) ;
164+ } ,
159165 } ,
160- } ,
161- {
162- title : t ( "update_modal_skip_this_update" ) ,
163- onPress : ( ) => {
164- skipUpdate ( updateInfo . version ) ;
165- hideMessageBox ( ) ;
166+ {
167+ title : t ( "update_modal_skip_this_update" ) ,
168+ onPress : ( ) => {
169+ skipUpdate ( updateInfo . version ) ;
170+ hideMessageBox ( ) ;
171+ } ,
166172 } ,
167- } ,
168- ] ,
169- } ) ;
173+ ] ,
174+ } ) ;
175+ } else {
176+ const versionInfo = updateInfo . versions [ updateInfo . version ] ;
177+ if ( versionInfo ) {
178+ updateInfo . download = versionInfo . download ;
179+ updateInfo . ompPluginChecksum = versionInfo . ompPluginChecksum ;
180+ updateInfo . ompPluginDownload = versionInfo . ompPluginDownload ;
181+ }
182+ setUpdateInfo ( updateInfo ) ;
183+ }
170184 }
171185 } , 1000 ) ;
172186 Log . debug ( response ) ;
0 commit comments