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;
deviceStatus: ConnectionStatus = ConnectionStatus.UNAUTHORIZED;
deviceStatusMessage: string = 'Connecting...';
pollInterval: number = 1000 * 5;
pollInterval: number = 1000 * 2;
savePath: string;
isTransferring: boolean;
adbResolves: any;
+9 -9
View File
@@ -197,31 +197,31 @@ export class AppService {
openFolder(folder: FolderType, packageName?: string) {
switch (folder) {
case FolderType.MAIN:
this.electron.shell.openPath(this.appData);
this.electron.shell.openItem(this.appData);
break;
case FolderType.BSABER:
this.electron.shell.openPath(this.path.join(this.appData, 'bsaber'));
this.electron.shell.openItem(this.path.join(this.appData, 'bsaber'));
break;
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;
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;
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;
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;
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;
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;
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;
}
}
@@ -12,7 +12,7 @@
<div *ngIf="!isConnected()">
<h4
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
No device connected...</h4>
No device connected yet...</h4>
</div>
<div *ngIf="isConnected()">
@@ -20,6 +20,7 @@
<h4
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
No files here...</h4>
<div class="grey-text">{{this.currentPath}}</div>
</div>
<div *ngFor="let file of files" class="vertical-align cursor"
@@ -74,7 +75,7 @@
<mz-modal-content>
Please enter a folder name.
<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>
</div>
</mz-modal-content>
+9 -2
View File
@@ -25,6 +25,7 @@ export class FilesComponent implements OnInit {
@ViewChild('filesModal', { static: false }) filesModal;
@ViewChild('fixedAction', { static: false }) fixedAction;
@ViewChild('downloadMediaModal', { static: false }) downloadMediaModal;
@ViewChild('mkDirModal', { static: true }) mkDirModal;
files: FileFolderListing[] = [];
selectedFiles: FileFolderListing[] = [];
filesToBeSaved: FileFolderListing[];
@@ -64,8 +65,8 @@ export class FilesComponent implements OnInit {
return this.statusService.showStatus('A folder already exists with that name!!', true);
} else {
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.open(this.currentPath);
});
}
}
@@ -298,6 +299,12 @@ export class FilesComponent implements OnInit {
}
this.breadcrumbs.push({ path, name });
}
autoReturn(event, callback) {
if (event.keyCode === 13) {
callback();
this.mkDirModal.closeModal();
}
}
open(path: string) {
this.currentPath = path;
this.breadcrumbs = [];
@@ -323,7 +330,7 @@ export class FilesComponent implements OnInit {
});
}
openSaveLocation() {
this.appService.electron.remote.shell.openPath(this.adbService.savePath);
this.appService.electron.remote.shell.openItem(this.adbService.savePath);
}
async readdir(path: string) {
let dirContents: FileFolderListing[];
+1 -1
View File
@@ -490,7 +490,7 @@ function createWindow() {
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) => {
let url = item.getURL();
let urls = item.getURLChain();
+4 -4
View File
@@ -1009,10 +1009,10 @@ electron-updater@^4.1.2:
pako "^1.0.10"
semver "^6.2.0"
electron@9.4.0:
version "9.4.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-9.4.0.tgz#c3c607e3598226ddbaaff8babcdffa8bb2210936"
integrity sha512-hOC4q0jkb+UDYZRy8vrZ1IANnq+jznZnbkD62OEo06nU+hIbp2IrwDRBNuSLmQ3cwZMVir0WSIA1qEVK0PkzGA==
electron@7.2.4:
version "7.2.4"
resolved "https://registry.yarnpkg.com/electron/-/electron-7.2.4.tgz#9fc0446dae23ead897af8742470cb18da55c6ce9"
integrity sha512-Z+R692uTzXgP8AHrabE+kkrMlQJ6pnAYoINenwj9QSqaD2YbO8IuXU9DMCcUY0+VpA91ee09wFZJNUKYPMnCKg==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^12.0.12"