Fix file transfers of larger files, and action button not working.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<ng-container *ngFor="let favourite of appService.headerComponent.favourites.fileFavourites">
|
||||
<a href="javascript:void(0)" class="waves-effect waves-light synthrideerz margin-right"
|
||||
(click)="appService.filesComponent.open(favourite.uri)"
|
||||
mTooltip="{{favourite.name}}">
|
||||
mTooltip [attr.data-tooltip]="favourite.name">
|
||||
<img *ngIf="favourite.icon" src="{{favourite.icon}}" class="responsive-img" /></a>
|
||||
</ng-container>
|
||||
<div class="divider divider-margin-top margin-bottom"></div>
|
||||
@@ -55,32 +55,34 @@
|
||||
</div>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<div class="fixed-action-btn" #fixedAction *ngIf="isConnected()">
|
||||
<a class="btn-floating btn-large pink lightn-2" data-position="left" mTooltip data-tooltip="Add a file.">
|
||||
<a class="dropdown-trigger btn-floating btn-large pink lightn-2" data-position="left" mTooltip data-tooltip="Add a file." >
|
||||
<i class="large material-icons">add</i>
|
||||
</a>
|
||||
<ul>
|
||||
<li data-position="left" mTooltip data-tooltip="Manage favourite folders"
|
||||
(click)="appService.headerComponent.favoriteType = 'fileFavourites';appService.headerComponent.manageFavs.openModal(); appService.headerComponent.favouriteMax = 10; appService.headerComponent.favoritePathType = 'Path';"
|
||||
><a class="btn-floating red"><i class="material-icons">favorite</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Upload file to this folder" (click)="uploadFiles()"><a
|
||||
class="btn-floating purple"><i class="material-icons">file_upload</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Make new folder in this folder" (click)="mkDirModal.openModal()"><a
|
||||
class="btn-floating blue"><i class="material-icons">create_new_folder</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Open current save location" (click)="openSaveLocation()"><a
|
||||
class="btn-floating yellow darken-2"><i class="material-icons">open_in_new</i></a></li>
|
||||
<li *ngIf="quickSaveSupported()" data-position="left" mTooltip data-tooltip="Save screenshots and recordings"
|
||||
(click)="downloadMediaModal.openModal()"><a class="btn-floating green"><i class="material-icons">get_app</i></a>
|
||||
</li>
|
||||
<li *ngIf="selectedFiles.length > 0" class="divider"></li>
|
||||
<li *ngIf="selectedFiles.length > 0" data-position="left" mTooltip data-tooltip="Delete selected items"
|
||||
(click)="filesToBeDeleted = selectedFiles; confirmModal.openModal()"><a class="btn-floating red darken-2"><i
|
||||
class="material-icons">delete</i></a></li>
|
||||
<li *ngIf="selectedFiles.length > 0" data-position="left" mTooltip data-tooltip="Save selected items to computer"
|
||||
(click)="filesToBeSaved = selectedFiles; filesModal.openModal()">
|
||||
<a class="btn-floating orange"><i class="material-icons">get_app</i></a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li data-position="left" mTooltip data-tooltip="Manage favourite folders"
|
||||
(click)="appService.headerComponent.favoriteType = 'fileFavourites';appService.headerComponent.manageFavs.openModal(); appService.headerComponent.favouriteMax = 10; appService.headerComponent.favoritePathType = 'Path';"
|
||||
><a class="btn-floating red"><i class="material-icons">favorite</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Upload file to this folder" (click)="uploadFiles()"><a
|
||||
class="btn-floating purple"><i class="material-icons">file_upload</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Make new folder in this folder" (click)="mkDirModal.openModal()"><a
|
||||
class="btn-floating blue"><i class="material-icons">create_new_folder</i></a></li>
|
||||
<li data-position="left" mTooltip data-tooltip="Open current save location" (click)="openSaveLocation()"><a
|
||||
class="btn-floating yellow darken-2"><i class="material-icons">open_in_new</i></a></li>
|
||||
<li *ngIf="quickSaveSupported()" data-position="left" mTooltip data-tooltip="Save screenshots and recordings"
|
||||
(click)="downloadMediaModal.openModal()"><a class="btn-floating green"><i class="material-icons">get_app</i></a>
|
||||
</li>
|
||||
<li *ngIf="selectedFiles.length > 0" class="divider"></li>
|
||||
<li *ngIf="selectedFiles.length > 0" data-position="left" mTooltip data-tooltip="Delete selected items"
|
||||
(click)="filesToBeDeleted = selectedFiles; confirmModal.openModal()"><a class="btn-floating red darken-2"><i
|
||||
class="material-icons">delete</i></a></li>
|
||||
<li *ngIf="selectedFiles.length > 0" data-position="left" mTooltip data-tooltip="Save selected items to computer"
|
||||
(click)="filesToBeSaved = selectedFiles; filesModal.openModal()">
|
||||
<a class="btn-floating orange"><i class="material-icons">get_app</i></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<mz-modal #mkDirModal [fixedFooter]="true">
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import {
|
||||
afterNextRender,
|
||||
AfterRenderPhase,
|
||||
AfterViewInit,
|
||||
Component,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
ViewChild,
|
||||
} from '@angular/core';
|
||||
import { AdbClientService, ConnectionStatus } from '../adb-client.service';
|
||||
import { AppService } from '../app.service';
|
||||
import { LoadingSpinnerService } from '../loading-spinner.service';
|
||||
@@ -21,7 +29,7 @@ declare let M;
|
||||
templateUrl: './files.component.html',
|
||||
styleUrls: ['./files.component.scss'],
|
||||
})
|
||||
export class FilesComponent implements OnInit {
|
||||
export class FilesComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('filesModal') filesModal;
|
||||
@ViewChild('fixedAction') fixedAction;
|
||||
@ViewChild('downloadMediaModal') downloadMediaModal;
|
||||
@@ -49,9 +57,20 @@ export class FilesComponent implements OnInit {
|
||||
// appService.isFilesOpen = true;
|
||||
appService.webService.isWebviewOpen = false;
|
||||
}
|
||||
ngOnAfterViewInit() {
|
||||
M.FloatingActionButton.init(this.fixedAction.nativeElement, {});
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.setupActionButton();
|
||||
}
|
||||
|
||||
private setupActionButton() {
|
||||
// We have to wait until it is actually ready, this component isn't ready even afterViewInit, so we have to loop wait
|
||||
if (this.fixedAction == null) {
|
||||
setTimeout(() => this.setupActionButton(), 100);
|
||||
return;
|
||||
}
|
||||
M.FloatingActionButton.init(this.fixedAction.nativeElement, {});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.appService.setTitle('Headset Files');
|
||||
}
|
||||
@@ -411,4 +430,5 @@ export class FilesComponent implements OnInit {
|
||||
});
|
||||
return dirContents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,11 +13,10 @@ export class PackageService {
|
||||
}
|
||||
async getAppIndex() {
|
||||
const request = await fetch(this.indexUrl, {
|
||||
method: 'GET',
|
||||
headers: { "Content-Type": "application/json" }
|
||||
method: 'GET'
|
||||
});
|
||||
|
||||
let json = await request.json();
|
||||
let blob = await request.blob();
|
||||
const request2 = await fetch(this.indexUrl + 'app-index.json', {
|
||||
method: 'GET',
|
||||
headers: { "Content-Type": "application/json" }
|
||||
|
||||
+13
-9
@@ -457,24 +457,28 @@ class ADB {
|
||||
|
||||
if (!this.client) return ecb('Not connected.');
|
||||
const device = this.client.getDevice(serial);
|
||||
// TODO: See if we can pipe this thru a stream to get progress
|
||||
device
|
||||
.push(fs.createReadStream(path), savePath)
|
||||
.then(transfer => {
|
||||
let _stats, autoCancel;
|
||||
let _stats = {bytesTransferred: 0}, counter=0;
|
||||
let lastNumber = 0;
|
||||
const interval = setInterval(() => {
|
||||
scb(_stats);
|
||||
// We are cheating here, frequently the progress event will just stop firing but still will be transferring
|
||||
// We are faking it at a slower pace so that the user still sees something is happening
|
||||
if (lastNumber === _stats.bytesTransferred) {
|
||||
counter += 1024;
|
||||
scb({bytesTransferred: _stats.bytesTransferred + counter * 10240})
|
||||
} else {
|
||||
counter = 0;
|
||||
scb(_stats);
|
||||
lastNumber = _stats.bytesTransferred;
|
||||
}
|
||||
}, 1000);
|
||||
transfer.on('progress', stats => {
|
||||
// clearTimeout(autoCancel);
|
||||
console.log("Progress", stats, Date.now());
|
||||
_stats = stats;
|
||||
/* autoCancel = setTimeout(() => {
|
||||
clearInterval(interval);
|
||||
cb();
|
||||
}, 90000); */
|
||||
});
|
||||
transfer.on('end', () => {
|
||||
// clearTimeout(autoCancel);
|
||||
clearInterval(interval);
|
||||
cb();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user