fixes #125 now hitting return will make the folder for you

This commit is contained in:
Shane Harris
2021-08-12 12:28:16 +02:00
parent 3661e1fcb6
commit 0e679f5cbc
6 changed files with 27 additions and 19 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ export class AdbClientService {
lastConnectionCheck: number; lastConnectionCheck: number;
deviceStatus: ConnectionStatus = ConnectionStatus.UNAUTHORIZED; deviceStatus: ConnectionStatus = ConnectionStatus.UNAUTHORIZED;
deviceStatusMessage: string = 'Connecting...'; deviceStatusMessage: string = 'Connecting...';
pollInterval: number = 1000 * 5; pollInterval: number = 1000 * 2;
savePath: string; savePath: string;
isTransferring: boolean; isTransferring: boolean;
adbResolves: any; adbResolves: any;
+9 -9
View File
@@ -197,31 +197,31 @@ export class AppService {
openFolder(folder: FolderType, packageName?: string) { openFolder(folder: FolderType, packageName?: string) {
switch (folder) { switch (folder) {
case FolderType.MAIN: case FolderType.MAIN:
this.electron.shell.openPath(this.appData); this.electron.shell.openItem(this.appData);
break; break;
case FolderType.BSABER: case FolderType.BSABER:
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber')); this.electron.shell.openItem(this.path.join(this.appData, 'bsaber'));
break; break;
case FolderType.BSABER_BACKUPS: case FolderType.BSABER_BACKUPS:
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber-backups')); this.electron.shell.openItem(this.path.join(this.appData, 'bsaber-backups'));
break; break;
case FolderType.ADB: case FolderType.ADB:
this.electron.shell.openPath(this.path.join(this.appData, 'platform-tools')); this.electron.shell.openItem(this.path.join(this.appData, 'platform-tools'));
break; break;
case FolderType.APK_BACKUPS: case FolderType.APK_BACKUPS:
this.electron.shell.openPath(this.path.join(this.appData, 'backups')); this.electron.shell.openItem(this.path.join(this.appData, 'backups'));
break; break;
case FolderType.DATA_BACKUPS: case FolderType.DATA_BACKUPS:
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber-data-backups')); this.electron.shell.openItem(this.path.join(this.appData, 'bsaber-data-backups'));
break; break;
case FolderType.QUEST_SABER_PATCH: case FolderType.QUEST_SABER_PATCH:
this.electron.shell.openPath(this.path.join(this.appData, 'saber-quest-patch', 'questsaberpatch')); this.electron.shell.openItem(this.path.join(this.appData, 'saber-quest-patch', 'questsaberpatch'));
break; break;
case FolderType.APP_BACKUP: case FolderType.APP_BACKUP:
this.electron.shell.openPath(this.path.join(this.backupPath, packageName)); this.electron.shell.openItem(this.path.join(this.backupPath, packageName));
break; break;
case FolderType.SONG_FOLDER: case FolderType.SONG_FOLDER:
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber', packageName)); this.electron.shell.openItem(this.path.join(this.appData, 'bsaber', packageName));
break; break;
} }
} }
@@ -12,7 +12,7 @@
<div *ngIf="!isConnected()"> <div *ngIf="!isConnected()">
<h4 <h4
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}"> [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
No device connected...</h4> No device connected yet...</h4>
</div> </div>
<div *ngIf="isConnected()"> <div *ngIf="isConnected()">
@@ -20,6 +20,7 @@
<h4 <h4
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}"> [ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
No files here...</h4> No files here...</h4>
<div class="grey-text">{{this.currentPath}}</div>
</div> </div>
<div *ngFor="let file of files" class="vertical-align cursor" <div *ngFor="let file of files" class="vertical-align cursor"
@@ -74,7 +75,7 @@
<mz-modal-content> <mz-modal-content>
Please enter a folder name. Please enter a folder name.
<div class="input-field "> <div class="input-field ">
<input id="devicePaste" type="text" [(ngModel)]="folderName" autofocus /> <input id="devicePaste" type="text" [(ngModel)]="folderName" autofocus (keyup)="autoReturn($event, makeFolder.bind(this))"/>
<label for="devicePaste">Folder Name</label> <label for="devicePaste">Folder Name</label>
</div> </div>
</mz-modal-content> </mz-modal-content>
+9 -2
View File
@@ -25,6 +25,7 @@ export class FilesComponent implements OnInit {
@ViewChild('filesModal', { static: false }) filesModal; @ViewChild('filesModal', { static: false }) filesModal;
@ViewChild('fixedAction', { static: false }) fixedAction; @ViewChild('fixedAction', { static: false }) fixedAction;
@ViewChild('downloadMediaModal', { static: false }) downloadMediaModal; @ViewChild('downloadMediaModal', { static: false }) downloadMediaModal;
@ViewChild('mkDirModal', { static: true }) mkDirModal;
files: FileFolderListing[] = []; files: FileFolderListing[] = [];
selectedFiles: FileFolderListing[] = []; selectedFiles: FileFolderListing[] = [];
filesToBeSaved: FileFolderListing[]; filesToBeSaved: FileFolderListing[];
@@ -64,8 +65,8 @@ export class FilesComponent implements OnInit {
return this.statusService.showStatus('A folder already exists with that name!!', true); return this.statusService.showStatus('A folder already exists with that name!!', true);
} else { } else {
await this.adbService.makeDirectory(this.appService.path.posix.join(this.currentPath, this.folderName)).then(r => { await this.adbService.makeDirectory(this.appService.path.posix.join(this.currentPath, this.folderName)).then(r => {
this.open(this.appService.path.posix.join(this.currentPath, this.folderName));
this.folderName = ''; this.folderName = '';
this.open(this.currentPath);
}); });
} }
} }
@@ -298,6 +299,12 @@ export class FilesComponent implements OnInit {
} }
this.breadcrumbs.push({ path, name }); this.breadcrumbs.push({ path, name });
} }
autoReturn(event, callback) {
if (event.keyCode === 13) {
callback();
this.mkDirModal.closeModal();
}
}
open(path: string) { open(path: string) {
this.currentPath = path; this.currentPath = path;
this.breadcrumbs = []; this.breadcrumbs = [];
@@ -323,7 +330,7 @@ export class FilesComponent implements OnInit {
}); });
} }
openSaveLocation() { openSaveLocation() {
this.appService.electron.remote.shell.openPath(this.adbService.savePath); this.appService.electron.remote.shell.openItem(this.adbService.savePath);
} }
async readdir(path: string) { async readdir(path: string) {
let dirContents: FileFolderListing[]; let dirContents: FileFolderListing[];
+1 -1
View File
@@ -490,7 +490,7 @@ function createWindow() {
if (error) console.error('Failed to register protocol'); if (error) console.error('Failed to register protocol');
} }
); );
mainWindow.webContents.on('did-fail-load', () => mainWindow.loadURL(mainWindow.webContents.getURL()));
mainWindow.webContents.session.on('will-download', (_evt, item, _webContents) => { mainWindow.webContents.session.on('will-download', (_evt, item, _webContents) => {
let url = item.getURL(); let url = item.getURL();
let urls = item.getURLChain(); let urls = item.getURLChain();
+4 -4
View File
@@ -1009,10 +1009,10 @@ electron-updater@^4.1.2:
pako "^1.0.10" pako "^1.0.10"
semver "^6.2.0" semver "^6.2.0"
electron@9.4.0: electron@7.2.4:
version "9.4.0" version "7.2.4"
resolved "https://registry.yarnpkg.com/electron/-/electron-9.4.0.tgz#c3c607e3598226ddbaaff8babcdffa8bb2210936" resolved "https://registry.yarnpkg.com/electron/-/electron-7.2.4.tgz#9fc0446dae23ead897af8742470cb18da55c6ce9"
integrity sha512-hOC4q0jkb+UDYZRy8vrZ1IANnq+jznZnbkD62OEo06nU+hIbp2IrwDRBNuSLmQ3cwZMVir0WSIA1qEVK0PkzGA== integrity sha512-Z+R692uTzXgP8AHrabE+kkrMlQJ6pnAYoINenwj9QSqaD2YbO8IuXU9DMCcUY0+VpA91ee09wFZJNUKYPMnCKg==
dependencies: dependencies:
"@electron/get" "^1.0.1" "@electron/get" "^1.0.1"
"@types/node" "^12.0.12" "@types/node" "^12.0.12"