added cloud backup and other stuff
This commit is contained in:
@@ -50,6 +50,11 @@ export class AdbClientService {
|
||||
deviceName: string;
|
||||
connectionCss: any;
|
||||
obbRegex = /[a-z]{4,5}.[0-9]{1,}.([A-z0-9.]{1,}).obb/;
|
||||
freespace = {
|
||||
available: '',
|
||||
total: '',
|
||||
percent: '',
|
||||
};
|
||||
constructor(
|
||||
public appService: AppService,
|
||||
private spinnerService: LoadingSpinnerService,
|
||||
@@ -265,7 +270,7 @@ export class AdbClientService {
|
||||
this.deviceStatusMessage =
|
||||
this.deviceName +
|
||||
' <i mz-tooltip class="material-icons white-text top-menu-bar-icon vertical-align"' +
|
||||
' position="bottom" tooltip="Battery">' +
|
||||
' position="bottom" tooltip="Wifi">' +
|
||||
' wifi' +
|
||||
' </i> ' +
|
||||
(this.deviceIp || 'Not found...') +
|
||||
@@ -276,7 +281,6 @@ export class AdbClientService {
|
||||
' </i>' +
|
||||
this.batteryLevel +
|
||||
'% ';
|
||||
// this.beatonService.checkIsBeatOnRunning(this);
|
||||
} catch (e) {
|
||||
const isBadConnection = e && e.message === "Failure: 'closed'" && e.name === 'FailError';
|
||||
if (isBadConnection) {
|
||||
@@ -1054,7 +1058,14 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
||||
return perms;
|
||||
});
|
||||
}
|
||||
|
||||
async getFreeSpace() {
|
||||
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'df -h' }).then(data => {
|
||||
data = data.split(' ').filter(d => d);
|
||||
this.freespace.available = data[data.length - 3];
|
||||
this.freespace.total = data[data.length - 5];
|
||||
this.freespace.percent = data[data.length - 2];
|
||||
});
|
||||
}
|
||||
async getBatteryLevel() {
|
||||
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'dumpsys battery' }).then(data => {
|
||||
let batteryObject = {};
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
line-height: 3rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.filename-padding-top{
|
||||
padding-top: 10px;
|
||||
}
|
||||
.selected{
|
||||
background: #e93c96;
|
||||
border-radius: 10px;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div *ngIf="isConnected()" class="top-bar">
|
||||
<nav class="pink lighten-2 breadcrumb-wrapper ">
|
||||
<div class="nav-wrapper container">
|
||||
<nav class="pink lighten-2 breadcrumb-wrapper ">
|
||||
<div class="nav-wrapper container">
|
||||
<div class="col s12 truncate">
|
||||
<a *ngFor="let breadcrumb of breadcrumbs; let i = index" href="javascript:void(0)" class="breadcrumb"
|
||||
(click)="open('/'+breadcrumb.path)">{{breadcrumb.name}}<span *ngIf="i === breadcrumbs.length-1 && folderSize"> ({{folderSize}})</span> </a>
|
||||
@@ -23,10 +23,10 @@
|
||||
<div class="grey-text">{{this.currentPath}}</div>
|
||||
|
||||
</div>
|
||||
<div *ngFor="let file of files" class="vertical-align cursor"
|
||||
<div *ngFor="let file of files" class="cursor"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
<div class="file" (click)="selectFile($event, file); $event.stopPropagation()">
|
||||
<div class="right">
|
||||
<div class="right">
|
||||
<span *ngIf="file.icon !== 'folder'">{{file.size|number:'1.2-2'}}MB | </span>{{file.time|date:'short'}}
|
||||
|
||||
<i class="material-icons cursor white-text drag-indicator save-icon"
|
||||
@@ -37,10 +37,12 @@
|
||||
(click)="filesToBeDeleted = [file]; confirmModal.openModal()">close</i>
|
||||
</div>
|
||||
<div>
|
||||
<i class="material-icons medium vertical-align"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">{{file.icon}}</i>{{file.name}}
|
||||
<i class="material-icons medium left "
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">{{file.icon}}</i>
|
||||
<div class="filename-padding-top">{{file.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br>
|
||||
|
||||
@@ -300,7 +300,7 @@ export class FilesComponent implements OnInit {
|
||||
}
|
||||
getCrumb(path: string) {
|
||||
const parts = path.split('/');
|
||||
const name = parts.pop();
|
||||
let name = parts.pop();
|
||||
const parentPath = parts.join('/');
|
||||
if (parts.length > 0) {
|
||||
this.getCrumb(parentPath);
|
||||
@@ -318,14 +318,23 @@ export class FilesComponent implements OnInit {
|
||||
this.breadcrumbs = [];
|
||||
this.selectedFiles.length = 0;
|
||||
this.files.length = 0;
|
||||
if (!this.isConnected()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
this.getCrumb(
|
||||
this.currentPath
|
||||
.split('/')
|
||||
.filter(d => d)
|
||||
.join('/')
|
||||
);
|
||||
if (!this.isConnected()) {
|
||||
return Promise.resolve();
|
||||
if (this.breadcrumbs.length === 1) {
|
||||
this.adbService.getFreeSpace().then(() => {
|
||||
if (this.breadcrumbs[0].path == 'sdcard' && this.breadcrumbs[0].name == 'sdcard') {
|
||||
this.breadcrumbs[0].name +=
|
||||
' (' + this.adbService.freespace.available + 'b of ' + this.adbService.freespace.total + 'b free)';
|
||||
}
|
||||
});
|
||||
}
|
||||
this.readdir(path).then(dirContents => {
|
||||
this.files = dirContents;
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right waves-effect waves-light btn pink-button small-button" (click)="backupEverything.openModal()">
|
||||
<div class="right waves-effect waves-light btn pink-button small-button" (click)="cloudBackup.openModal()">
|
||||
Cloud Backup</div>
|
||||
<div class="right waves-effect waves-light btn pink-button small-button margin-right" (click)="backupEverything.openModal()">
|
||||
Backup/Restore All</div>
|
||||
<div class="right waves-effect waves-light btn pink-button small-button margin-right" mzTooltip
|
||||
[tooltip]="'Current backup location: ' + appService.backupPath" position="bottom"
|
||||
@@ -196,6 +198,33 @@
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #cloudBackup [fixedFooter]="true" (close)="cloudBackupDone = false">
|
||||
<mz-modal-header>
|
||||
<h4>Cloud Backup</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
<div class="center-align"><br><br>
|
||||
<ng-container *ngIf="!cloudBackupLoading&&!cloudBackupDone">
|
||||
Trigger apps on your headset to run a cloud backup now in-case you want to do a factory reset.<br><br>
|
||||
WARNING: Not all apps support cloud backup - this is not guaranteed to work for all apps.<br><br>
|
||||
<button mz-button class="pink-button" (click)="triggerCloudBackup()">Trigger Cloud Backup</button><br><br>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!cloudBackupLoading&&cloudBackupDone">
|
||||
Cloud backup complete. <br><br>Check cloud backup status here: https://secure.oculus.com/my/cloud-backup/<br><br>
|
||||
<button mz-button class="pink-button" (click)="appService.opn('https://secure.oculus.com/my/cloud-backup/')">View On Oculus</button><br><br>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="cloudBackupLoading">
|
||||
{{cloudBackupStatus}}<br><br>
|
||||
<app-loading-spinner-small></app-loading-spinner-small>
|
||||
</ng-container>
|
||||
</div>
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Done</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
|
||||
|
||||
<mz-modal #pickLocation [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Set the save location for backup data.</h4>
|
||||
|
||||
@@ -29,6 +29,9 @@ export class PackagesComponent implements OnInit {
|
||||
search: string;
|
||||
savePath: string;
|
||||
perms: any;
|
||||
cloudBackupLoading: boolean;
|
||||
cloudBackupDone: boolean;
|
||||
cloudBackupStatus: string;
|
||||
constructor(
|
||||
public adbService: AdbClientService,
|
||||
public appService: AppService,
|
||||
@@ -90,6 +93,22 @@ export class PackagesComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async triggerCloudBackup() {
|
||||
this.cloudBackupLoading = true;
|
||||
this.cloudBackupStatus = 'Starting backup...';
|
||||
await this.adbService.runAdbCommand('adb shell bmgr backup @pm@');
|
||||
await this.adbService.runAdbCommand('adb shell bmgr run');
|
||||
await this.adbService.runAdbCommand('adb shell cmd package list packages');
|
||||
let packages: any = this.adbService.adbResponse;
|
||||
packages = packages.split('\n').map(line => line.replace(/^package:/, ''));
|
||||
for (let i = 0; i < packages.length; i++) {
|
||||
this.cloudBackupStatus = `Backing up ${Math.round(((i + 1) / packages.length) * 100)}%`;
|
||||
await this.adbService.runAdbCommand('adb shell bmgr fullbackup ' + packages[i]).then(o => console.log(o));
|
||||
}
|
||||
this.cloudBackupLoading = false;
|
||||
this.cloudBackupDone = true;
|
||||
}
|
||||
|
||||
backupAll() {
|
||||
this.myApps
|
||||
.filter(d => d.backupAll)
|
||||
|
||||
@@ -26,6 +26,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Proximity Sensor</div>
|
||||
This disables the proximity sensor effectively keeping your quest awake when not on your head ( requires restart to disable ).
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn set-ca margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="disableProximity()">Disable</div>
|
||||
</div>
|
||||
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Experimental Mode</div>
|
||||
@@ -60,17 +70,6 @@
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setRR(RR._120)">120Hz</div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Pavlov Settings</div>
|
||||
<div class="button-section">
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="setPavlovPermission()">Grant Pavlov Permissions</div>
|
||||
<div class="waves-effect waves-light btn margin-bottom margin-right pink-button"
|
||||
[ngClass]="{'button-dark-theme':appService.currentTheme === 'dark','button-light-theme':appService.currentTheme === 'light','waves-dark':true,'waves-light':false}"
|
||||
(click)="changePavlov.openModal()">Change Pavlov Name </div>
|
||||
</div>
|
||||
<div class="section-title"
|
||||
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">
|
||||
Chromatic Aberration</div>
|
||||
@@ -285,22 +284,22 @@
|
||||
</div>
|
||||
|
||||
|
||||
<mz-modal #changePavlov [fixedFooter]="true">
|
||||
<mz-modal-header>
|
||||
<h4>Change Pavlov Name</h4>
|
||||
</mz-modal-header>
|
||||
<mz-modal-content>
|
||||
Enter a name to set in Pavlov
|
||||
<br />
|
||||
<div class="input-field repo-url">
|
||||
<input id="repoUrl" type="text" [(ngModel)]="pavlovName" />
|
||||
<label for="repoUrl">Name</label>
|
||||
</div>
|
||||
<!--<mz-modal #changePavlov [fixedFooter]="true">-->
|
||||
<!-- <mz-modal-header>-->
|
||||
<!-- <h4>Change Pavlov Name</h4>-->
|
||||
<!-- </mz-modal-header>-->
|
||||
<!-- <mz-modal-content>-->
|
||||
<!-- Enter a name to set in Pavlov-->
|
||||
<!-- <br />-->
|
||||
<!-- <div class="input-field repo-url">-->
|
||||
<!-- <input id="repoUrl" type="text" [(ngModel)]="pavlovName" />-->
|
||||
<!-- <label for="repoUrl">Name</label>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
</mz-modal-content>
|
||||
<mz-modal-footer>
|
||||
<button mz-button [flat]="true" mz-modal-close>Close</button>
|
||||
<button mz-button class="pink-button" mz-modal-close (click)="setPavlovName()">Save</button>
|
||||
</mz-modal-footer>
|
||||
</mz-modal>
|
||||
<!-- </mz-modal-content>-->
|
||||
<!-- <mz-modal-footer>-->
|
||||
<!-- <button mz-button [flat]="true" mz-modal-close>Close</button>-->
|
||||
<!-- <button mz-button class="pink-button" mz-modal-close (click)="setPavlovName()">Save</button>-->
|
||||
<!-- </mz-modal-footer>-->
|
||||
<!--</mz-modal>-->
|
||||
|
||||
@@ -123,6 +123,15 @@ export class ToolsComponent implements OnInit {
|
||||
this.statusService.showStatus(e, true);
|
||||
});
|
||||
}
|
||||
disableProximity() {
|
||||
this.runAdbCommand('adb shell am broadcast -a com.oculus.vrpowermanager.prox_close')
|
||||
.then(() => {
|
||||
this.statusService.showStatus('Disable proximity message sent OK!!');
|
||||
})
|
||||
.catch(e => {
|
||||
this.statusService.showStatus(e, true);
|
||||
});
|
||||
}
|
||||
runAdbCommand(command: string) {
|
||||
return this.adbService.runAdbCommand(command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user