@@ -169,7 +169,7 @@ function parseJS(storageFile, options, app) {
169169 return Promise . resolve ( storageFile ) ;
170170}
171171
172- var AppInfo = {
172+ let AppInfo = {
173173 /* Get a list of commands needed to upload the file */
174174 getFileUploadCommands : ( filename , data ) => {
175175 const CHUNKSIZE = Const . UPLOAD_CHUNKSIZE ;
@@ -189,7 +189,6 @@ var AppInfo = {
189189 /* Get a list of commands needed to upload a storage file */
190190 getStorageFileUploadCommands : ( filename , data ) => {
191191 const CHUNKSIZE = Const . UPLOAD_CHUNKSIZE ;
192- var cmd = "" ;
193192 // write code in chunks, in case it is too big to fit in RAM (fix #157)
194193 function getWriteData ( offset ) {
195194 return asJSExpr ( data . substr ( offset , CHUNKSIZE ) , { noHeatshrink :true } ) ;
@@ -198,7 +197,7 @@ var AppInfo = {
198197 // so we must ensure we always return a String
199198 // We could use E.toString but https://github.com/espruino/BangleApps/issues/2068#issuecomment-1211717749
200199 }
201- var cmd = `\x10f=require('Storage').open(${ JSON . stringify ( filename ) } ,'w');f.write(${ getWriteData ( 0 ) } );` ;
200+ let cmd = `\x10f=require('Storage').open(${ JSON . stringify ( filename ) } ,'w');f.write(${ getWriteData ( 0 ) } );` ;
202201 for ( let i = CHUNKSIZE ; i < data . length ; i += CHUNKSIZE )
203202 cmd += `\n\x10f.write(${ getWriteData ( i ) } );` ;
204203 return cmd ;
@@ -436,7 +435,7 @@ var AppInfo = {
436435 // Check for apps which we may need to install
437436 if ( app . dependencies ) {
438437 Object . keys ( app . dependencies ) . forEach ( dependency => {
439- var dependencyType = app . dependencies [ dependency ] ;
438+ let dependencyType = app . dependencies [ dependency ] ;
440439 function handleDependency ( dependencyChecker ) {
441440 // now see if we can find one matching our dependency
442441 let found = appJSONInstalled . find ( dependencyChecker ) ;
@@ -455,11 +454,11 @@ var AppInfo = {
455454 promise = promise . then ( ( ) => new Promise ( ( resolve , reject ) => {
456455 console . log ( `Install dependency '${ dependency } ':'${ found . id } '` ) ;
457456 return AppInfo . checkDependencies ( found , device , uploadOptions )
458- . then ( ( ) => uploadOptions . needsApp ( found , uploadOptions ) )
459- . then ( appJSON => {
460- if ( appJSON ) device . appsInstalled . push ( appJSON ) ;
461- resolve ( ) ;
462- } ) ;
457+ . then ( ( ) => uploadOptions . needsApp ( found , uploadOptions ) )
458+ . then ( appJSON => {
459+ if ( appJSON ) device . appsInstalled . push ( appJSON ) ;
460+ resolve ( ) ;
461+ } , reject ) ;
463462 } ) ) ;
464463 }
465464 }
0 commit comments