From 2ed693d245eafa79e8e3d80f69c3fbe484ed0859 Mon Sep 17 00:00:00 2001 From: Shane Harris Date: Mon, 19 Oct 2020 08:55:44 +0100 Subject: [PATCH] fixed uploading files and setting backup locations --- desktop-app/src/app/files/files.component.ts | 38 ++++++++----------- .../src/app/header/header.component.ts | 20 ++++------ .../src/app/packages/packages.component.ts | 22 +++++------ package.json | 2 +- 4 files changed, 34 insertions(+), 48 deletions(-) diff --git a/desktop-app/src/app/files/files.component.ts b/desktop-app/src/app/files/files.component.ts index 238420c..9be7e51 100644 --- a/desktop-app/src/app/files/files.component.ts +++ b/desktop-app/src/app/files/files.component.ts @@ -56,7 +56,7 @@ export class FilesComponent implements OnInit { } async makeFolder() { if ( - ~this.files + !!~this.files .filter(f => f.icon === 'folder') .map(f => f.name) .indexOf(this.folderName) @@ -173,14 +173,12 @@ export class FilesComponent implements OnInit { }); } } - uploadFiles() { - this.appService.electron.remote.dialog.showOpenDialog( - { - properties: ['openFile', 'multiSelections'], - defaultPath: this.adbService.savePath, - }, - files => this.uploadFilesFromList(files) - ); + async uploadFiles() { + let res = await this.appService.electron.remote.dialog.showOpenDialog({ + properties: ['openFile', 'multiSelections'], + defaultPath: this.adbService.savePath, + }); + this.uploadFilesFromList(res.filePaths); } quickSaveSupported() { return this.quickSaveModels.includes(this.adbService.deviceModel); @@ -268,19 +266,15 @@ export class FilesComponent implements OnInit { .then(() => this.statusService.showStatus('Folder Saved OK!')); }); } - pickLocation() { - this.appService.electron.remote.dialog.showOpenDialog( - { - properties: ['openDirectory'], - defaultPath: this.adbService.savePath, - }, - files => { - if (files !== undefined && files.length === 1) { - this.adbService.savePath = files[0]; - this.adbService.setSavePath(); - } - } - ); + async pickLocation() { + let res = await this.appService.electron.remote.dialog.showOpenDialog({ + properties: ['openDirectory'], + defaultPath: this.adbService.savePath, + }); + if (res && res.filePaths && res.filePaths.length === 1) { + this.adbService.savePath = res.filePaths[0]; + this.adbService.setSavePath(); + } } isConnected() { const isConnected = this.adbService.deviceStatus === ConnectionStatus.CONNECTED; diff --git a/desktop-app/src/app/header/header.component.ts b/desktop-app/src/app/header/header.component.ts index da69946..de3e178 100644 --- a/desktop-app/src/app/header/header.component.ts +++ b/desktop-app/src/app/header/header.component.ts @@ -209,18 +209,14 @@ export class HeaderComponent implements OnInit { cancelLogcatOutput() { this.saveLogcatPath = null; } - selectLogcatOutput() { - this.appService.electron.remote.dialog.showOpenDialog( - { - properties: ['openDirectory'], - defaultPath: this.adbService.savePath, - }, - files => { - files.forEach(filepath => { - this.saveLogcatPath = filepath; - }); - } - ); + async selectLogcatOutput() { + const res = await this.appService.electron.remote.dialog.showOpenDialog({ + properties: ['openDirectory'], + defaultPath: this.adbService.savePath, + }); + res.filePaths.forEach(filepath => { + this.saveLogcatPath = filepath; + }); } clearLogcatFile() { if (this.saveLogcatPath) { diff --git a/desktop-app/src/app/packages/packages.component.ts b/desktop-app/src/app/packages/packages.component.ts index 5c72eec..04323b1 100644 --- a/desktop-app/src/app/packages/packages.component.ts +++ b/desktop-app/src/app/packages/packages.component.ts @@ -79,19 +79,15 @@ export class PackagesComponent implements OnInit { this.adbService.setPermission(this.currentPackage.package.packageName, perm.permission, !perm.enabled); } - pickBackupLocation() { - this.appService.electron.remote.dialog.showOpenDialog( - { - properties: ['openDirectory'], - defaultPath: this.appService.backupPath, - }, - files => { - if (files !== undefined && files.length === 1) { - this.appService.backupPath = files[0]; - localStorage.setItem('backup-path', this.appService.backupPath); - } - } - ); + async pickBackupLocation() { + const res = await this.appService.electron.remote.dialog.showOpenDialog({ + properties: ['openDirectory'], + defaultPath: this.appService.backupPath, + }); + if (res && res.filePaths && res.filePaths.length === 1) { + this.appService.backupPath = res.filePaths[0]; + localStorage.setItem('backup-path', this.appService.backupPath); + } } backupAll() { diff --git a/package.json b/package.json index eb59f30..0f37605 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "SideQuest", "productName": "SideQuest", - "version": "0.10.16", + "version": "0.10.17", "description": "A open app store for mobile android based VR devices such as the Levovo Mirage, Oculus Go, Oculus Quest, Vive Focus.", "repository": "https://github.com/SideQuestVR/SideQuest.git", "license": "UNLICENCED",