Fixing issues

This commit is contained in:
Nathanael Anderson
2024-03-07 10:40:43 -06:00
parent 4652909222
commit d4dcf5e6ec
22 changed files with 247 additions and 1303 deletions
+2 -2
View File
@@ -733,7 +733,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
return recurse();
});
}
async getLocalFoldersRecursive(root: string) {
async getLocalFoldersRecursive(root: string) : Promise<void> {
return new Promise(resolve => {
this.appService.fs.readdir(root, async (err, entries) => {
entries = entries.map(f => {
@@ -1053,7 +1053,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
}
return p;
}
async installLocalZip(filepath, dontCatchError, cb, task?, deleteAfter?) {
async installLocalZip(filepath, dontCatchError, cb, task?, deleteAfter?) : Promise<void> {
const typeBasedActions = {
'.apk': filepath => {
this.installAPK(filepath, true, false, 0, 0, deleteAfter, this.appService.path.basename(filepath) + ': ');
+8 -6
View File
@@ -3,7 +3,8 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MzButtonModule, MzCheckboxModule, MzModalModule, MzTooltipModule } from 'ngx-materialize';
// import { MzButtonModule, MzCheckboxModule, MzModalModule, MzTooltipModule } from '@steinv/ngx-materialize';
import { NgxMaterialize } from '@steinv/ngx-materialize';
import { DragulaModule } from 'ng2-dragula';
import { HeaderComponent } from './header/header.component';
import { StatusBarComponent } from './status-bar/status-bar.component';
@@ -23,7 +24,7 @@ import { ColorPickerModule } from 'ngx-color-picker';
import { HttpClientModule } from '@angular/common/http';
import { CurrentTasksComponent } from './current-tasks/current-tasks.component';
import { CurrentTaskItemComponent } from './current-task-item/current-task-item.component';
import { VirtualScrollerModule } from 'ngx-virtual-scroller';
import { VirtualScrollerModule } from '@iharbeck/ngx-virtual-scroller';
import { HeadsetSettingsComponent } from './headset-settings/headset-settings.component';
import { SetupGuideComponent } from './setup-guide/setup-guide.component';
import { ConnectionStatusComponent } from './connection-status/connection-status.component';
@@ -58,11 +59,12 @@ import { StreamOptionsComponent } from './stream-options/stream-options.componen
DragulaModule.forRoot(),
FormsModule,
RouterModule.forRoot(AppRoutes, { useHash: true }),
MzTooltipModule,
MzModalModule,
MzButtonModule,
// MzTooltipModule,
// MzModalModule,
// MzButtonModule,
HttpClientModule,
MzCheckboxModule,
// MzCheckboxModule,
NgxMaterialize,
ColorPickerModule,
BrowserAnimationsModule,
VirtualScrollerModule,
+1 -1
View File
@@ -18,7 +18,7 @@ export class AudicaService {
) {}
downloadSong(downloadUrl, adbService) {
return this.processService.addItem('song_download', async task => {
return this.processService.addItem('song_download', async (task) : Promise<void> => {
let parts = downloadUrl.split('/');
let zipPath = this.appService.path.join(this.appService.appData, this.appService.path.basename(downloadUrl));
let ws = this.appService.fs.createWriteStream(zipPath);
+1 -1
View File
@@ -208,7 +208,7 @@ export class BeatOnService {
}
downloadSong(downloadUrl, adbService) {
return this.processService.addItem('song_download', async task => {
return this.processService.addItem('song_download', async (task) : Promise<void> => {
let parts = downloadUrl.split('/');
let zipPath = this.appService.path.join(this.appService.appData, this.appService.uuidv4() + '.zip');
const requestOptions = {
+4 -3
View File
@@ -135,21 +135,22 @@ export class FilesComponent implements OnInit {
.then(() => setTimeout(() => this.uploadFile(files, task), 500));
}
}
uploadFile(files, task): Promise<any> {
uploadFile(files, task): Promise<void> {
if (!files.length) {
return Promise.resolve();
}
const f = files.shift();
const savePath = f.save; // this.appService.path.posix.join(this.currentPath, this.appService.path.basename(f));
if (!this.appService.fs.existsSync(f.file)) {
return Promise.resolve().then(() => setTimeout(() => this.uploadFile(files, task), 500));
Promise.resolve().then(() => setTimeout(() => this.uploadFile(files, task), 500));
return;
}
if (this.appService.fs.lstatSync(f.file).isDirectory()) {
return new Promise(async resolve => {
this.folderName = this.appService.path.basename(f.file);
await this.makeFolder();
await this.uploadFolder(f.file, files, task);
resolve();
resolve(null);
});
}
task.status = 'Transferring ' + this.appService.path.basename(f.file) + ' to ' + f.save;
@@ -8,7 +8,7 @@ import { BeatOnService } from '../beat-on.service';
import { DragAndDropService } from '../drag-and-drop.service';
import { Router } from '@angular/router';
import { ProcessBucketService } from '../process-bucket.service';
import { Subscription } from 'rxjs/Subscription';
import { Subscription } from 'rxjs';
import { environment } from '../../environments/environment';
interface ReplaceText {
@@ -36,7 +36,7 @@ export class LoadingSpinnerService {
this.spinner.loadingTask = null;
}
}
setupConfirm() {
setupConfirm() : Promise<void> {
return new Promise((resolve, reject) => {
this.spinner.isConfirm = true;
this.spinner.confirmResolve = resolve;
@@ -10,7 +10,7 @@ export class LoadingSpinnerComponent implements OnInit {
isActive: boolean;
isConfirm: boolean;
isLoading: boolean;
loadingMessage: string;
loadingMessage: string ;
loadingTask: any;
confirmResolve: () => void;
confirmReject: () => void;
@@ -23,7 +23,7 @@ export class PackageService {
this.allApps[packageName] = body[packageName];
this.allApps[packageName].icon = this.indexUrl + this.allApps[packageName].icon;
});
resolve();
resolve(true);
} catch (e) {
return reject('JSON parse Error');
}
@@ -4,7 +4,7 @@ import { AppService, FolderType } from '../app.service';
import { LoadingSpinnerService } from '../loading-spinner.service';
import { StatusBarService } from '../status-bar.service';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { Subscription } from 'rxjs';
import { PackageService } from './package.service';
@Component({
@@ -86,9 +86,9 @@ export class ProcessBucketService {
this.left_length = this.tasks.filter(t => !t.failed && !t.running && !t.cancelled && !t.succeeded).length;
}
async processBucket() {
async processBucket() : Promise<void> {
const objects = this.tasks.filter(t => !t.failed && !t.running && !t.cancelled && !t.succeeded);
const timeout = () => new Promise(resolve => setTimeout(() => resolve(), 500));
const timeout = () => new Promise<void>(resolve => setTimeout(() => resolve(), 500));
this.left_length = objects.length;
if (objects.length) {
this.is_running = true;
@@ -143,7 +143,7 @@ export class ProcessBucketService {
if (!task.succeeded) {
task.cancelled = true;
this.tasks = this.tasks.filter(t => t !== task);
const timeout = new Promise(resolve => setTimeout(() => resolve(), 1000));
const timeout = new Promise<void>(resolve => setTimeout(() => resolve(), 1000));
await timeout.then(() => this.processBucket());
}
}
+1 -1
View File
@@ -58,7 +58,7 @@ export class SongBeaterService {
timeout: 30000,
'User-Agent': this.appService.getUserAgent(),
};
return this.processService.addItem('song_download', async task => {
return this.processService.addItem('song_download', async (task) : Promise<void> => {
return new Promise((resolve, reject) => {
this.appService
.progress(this.appService.request(downloadUrl, requestOptions), { throttle: 300 })
+1 -1
View File
@@ -18,7 +18,7 @@ export class SynthriderService {
) {}
downloadSong(downloadUrl, adbService) {
return this.processService.addItem('song_download', async task => {
return this.processService.addItem('song_download', async (task) : Promise<void> => {
let parts = downloadUrl.split('/');
let zipPath = this.appService.path.join(this.appService.appData, this.appService.path.basename(downloadUrl));
let ws = this.appService.fs.createWriteStream(zipPath);
@@ -1,8 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { WebviewService } from '../webview.service';
import { AppService } from '../app.service';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { ActivatedRoute, Router } from '@angular/router';
@Component({
selector: 'app-webview',
+5 -5
View File
@@ -40,7 +40,7 @@
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
// import 'core-js/es7/reflect';
/**
* By default, zone.js will patch all possible macroTask and DomEvents
@@ -69,7 +69,7 @@ import 'zone.js'; // Included with Angular CLI.
*/
(window as any).global = window;
import * as Hammer from "hammerjs";
import * as $ from 'jquery';
window['$'] = window['jQuery'] = $;
window['Hammer'] = Hammer;
// import * as Hammer from 'hammerjs';
// import * as $ from 'jquery';
// window['$'] = window['jQuery'] = $;
// window['Hammer'] = Hammer;