From 522cc8b704aa9a3d88ee63317cb5d2f430e6d5fa Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 2 Feb 2021 23:17:42 -0600 Subject: [PATCH] Move native apps to top --- helpers/app-files-scanner.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/helpers/app-files-scanner.js b/helpers/app-files-scanner.js index 98c3d35..a6b6132 100644 --- a/helpers/app-files-scanner.js +++ b/helpers/app-files-scanner.js @@ -286,7 +286,7 @@ export default class AppFilesScanner { async scan ( fileList ) { // Push files to our files array - Array.from(fileList).forEach( (fileInstance, index) => { + Array.from(fileList).forEach( (fileInstance, scanIndex) => { this.files.unshift( { status: 'loaded', displayName: null, @@ -296,15 +296,15 @@ export default class AppFilesScanner { name: fileInstance.name, size: fileInstance.size, - type: fileList.item( index ).type, + type: fileList.item( scanIndex ).type, lastModifiedDate: fileInstance.lastModifiedDate, instance: fileInstance, - item: fileList.item( index ) + item: fileList.item( scanIndex ) } ) }) // Scan for archives - await Promise.all( this.files.map( async (file, index) => { + await Promise.all( this.files.map( async (file, scanIndex) => { if ( !this.isApp( file ) ) { file.statusMessage = '⏭ Skipped. Not app or archive' @@ -315,7 +315,7 @@ export default class AppFilesScanner { // console.log('file', file) - await new Promise(r => setTimeout(r, 1500 * index)) + await new Promise(r => setTimeout(r, 1500 * scanIndex)) file.statusMessage = '🗃 Decompressing file' @@ -499,6 +499,9 @@ export default class AppFilesScanner { file.statusMessage = `🔶 This app is not natively compatible with Apple Silicon and may only run via Rosetta 2 translation, however, software vendors will sometimes will ship separate install files for Intel and ARM instead of a single one. ` } else if ( supportedBinaries !== 0 ) { file.statusMessage = '✅ This app is natively compatible with Apple Silicon!' + + // Shift this scan to the top + this.files.unshift( this.files.splice( scanIndex, 1 )[0] ) } file.status = 'finished'