added cloud backup and other stuff

This commit is contained in:
Shane Harris
2022-01-28 10:33:57 +01:00
parent 877fb5a320
commit dc8a1d147a
8 changed files with 122 additions and 42 deletions
+14 -3
View File
@@ -50,6 +50,11 @@ export class AdbClientService {
deviceName: string; deviceName: string;
connectionCss: any; connectionCss: any;
obbRegex = /[a-z]{4,5}.[0-9]{1,}.([A-z0-9.]{1,}).obb/; obbRegex = /[a-z]{4,5}.[0-9]{1,}.([A-z0-9.]{1,}).obb/;
freespace = {
available: '',
total: '',
percent: '',
};
constructor( constructor(
public appService: AppService, public appService: AppService,
private spinnerService: LoadingSpinnerService, private spinnerService: LoadingSpinnerService,
@@ -265,7 +270,7 @@ export class AdbClientService {
this.deviceStatusMessage = this.deviceStatusMessage =
this.deviceName + this.deviceName +
' <i mz-tooltip class="material-icons white-text top-menu-bar-icon vertical-align"' + ' <i mz-tooltip class="material-icons white-text top-menu-bar-icon vertical-align"' +
' position="bottom" tooltip="Battery">' + ' position="bottom" tooltip="Wifi">' +
' wifi' + ' wifi' +
' </i> ' + ' </i> ' +
(this.deviceIp || 'Not found...') + (this.deviceIp || 'Not found...') +
@@ -276,7 +281,6 @@ export class AdbClientService {
' </i>' + ' </i>' +
this.batteryLevel + this.batteryLevel +
'% '; '% ';
// this.beatonService.checkIsBeatOnRunning(this);
} catch (e) { } catch (e) {
const isBadConnection = e && e.message === "Failure: 'closed'" && e.name === 'FailError'; const isBadConnection = e && e.message === "Failure: 'closed'" && e.name === 'FailError';
if (isBadConnection) { if (isBadConnection) {
@@ -1054,7 +1058,14 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
return perms; 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() { async getBatteryLevel() {
return this.adbCommand('shell', { serial: this.deviceSerial, command: 'dumpsys battery' }).then(data => { return this.adbCommand('shell', { serial: this.deviceSerial, command: 'dumpsys battery' }).then(data => {
let batteryObject = {}; let batteryObject = {};
@@ -12,7 +12,9 @@
line-height: 3rem; line-height: 3rem;
vertical-align: middle; vertical-align: middle;
} }
.filename-padding-top{
padding-top: 10px;
}
.selected{ .selected{
background: #e93c96; background: #e93c96;
border-radius: 10px; border-radius: 10px;
@@ -23,7 +23,7 @@
<div class="grey-text">{{this.currentPath}}</div> <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="cursor"
[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'}">
<div class="file" (click)="selectFile($event, file); $event.stopPropagation()"> <div class="file" (click)="selectFile($event, file); $event.stopPropagation()">
<div class="right"> <div class="right">
@@ -37,10 +37,12 @@
(click)="filesToBeDeleted = [file]; confirmModal.openModal()">close</i> (click)="filesToBeDeleted = [file]; confirmModal.openModal()">close</i>
</div> </div>
<div> <div>
<i class="material-icons medium vertical-align" <i class="material-icons medium left "
[ngClass]="{'text-dark-theme':appService.currentTheme === 'dark','text-light-theme':appService.currentTheme === 'light'}">{{file.icon}}</i>{{file.name}} [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> </div>
<div class="clearfix"></div>
</div> </div>
</div> </div>
<br><br> <br><br>
+12 -3
View File
@@ -300,7 +300,7 @@ export class FilesComponent implements OnInit {
} }
getCrumb(path: string) { getCrumb(path: string) {
const parts = path.split('/'); const parts = path.split('/');
const name = parts.pop(); let name = parts.pop();
const parentPath = parts.join('/'); const parentPath = parts.join('/');
if (parts.length > 0) { if (parts.length > 0) {
this.getCrumb(parentPath); this.getCrumb(parentPath);
@@ -318,14 +318,23 @@ export class FilesComponent implements OnInit {
this.breadcrumbs = []; this.breadcrumbs = [];
this.selectedFiles.length = 0; this.selectedFiles.length = 0;
this.files.length = 0; this.files.length = 0;
if (!this.isConnected()) {
return Promise.resolve();
}
this.getCrumb( this.getCrumb(
this.currentPath this.currentPath
.split('/') .split('/')
.filter(d => d) .filter(d => d)
.join('/') .join('/')
); );
if (!this.isConnected()) { if (this.breadcrumbs.length === 1) {
return Promise.resolve(); 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.readdir(path).then(dirContents => {
this.files = dirContents; this.files = dirContents;
@@ -21,7 +21,9 @@
</div> </div>
</div> </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> Backup/Restore All</div>
<div class="right waves-effect waves-light btn pink-button small-button margin-right" mzTooltip <div class="right waves-effect waves-light btn pink-button small-button margin-right" mzTooltip
[tooltip]="'Current backup location: ' + appService.backupPath" position="bottom" [tooltip]="'Current backup location: ' + appService.backupPath" position="bottom"
@@ -196,6 +198,33 @@
</mz-modal> </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 #pickLocation [fixedFooter]="true">
<mz-modal-header> <mz-modal-header>
<h4>Set the save location for backup data.</h4> <h4>Set the save location for backup data.</h4>
@@ -29,6 +29,9 @@ export class PackagesComponent implements OnInit {
search: string; search: string;
savePath: string; savePath: string;
perms: any; perms: any;
cloudBackupLoading: boolean;
cloudBackupDone: boolean;
cloudBackupStatus: string;
constructor( constructor(
public adbService: AdbClientService, public adbService: AdbClientService,
public appService: AppService, 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() { backupAll() {
this.myApps this.myApps
.filter(d => d.backupAll) .filter(d => d.backupAll)
+27 -28
View File
@@ -26,6 +26,16 @@
</div> </div>
</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" <div class="section-title"
[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'}">
Experimental Mode</div> 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}" [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> (click)="setRR(RR._120)">120Hz</div>
</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>&nbsp;&nbsp;&nbsp;&nbsp;
<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>&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div class="section-title" <div class="section-title"
[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'}">
Chromatic Aberration</div> Chromatic Aberration</div>
@@ -285,22 +284,22 @@
</div> </div>
<mz-modal #changePavlov [fixedFooter]="true"> <!--<mz-modal #changePavlov [fixedFooter]="true">-->
<mz-modal-header> <!-- <mz-modal-header>-->
<h4>Change Pavlov Name</h4> <!-- <h4>Change Pavlov Name</h4>-->
</mz-modal-header> <!-- </mz-modal-header>-->
<mz-modal-content> <!-- <mz-modal-content>-->
Enter a name to set in Pavlov <!-- Enter a name to set in Pavlov-->
<br /> <!-- <br />-->
<div class="input-field repo-url"> <!-- <div class="input-field repo-url">-->
<input id="repoUrl" type="text" [(ngModel)]="pavlovName" /> <!-- <input id="repoUrl" type="text" [(ngModel)]="pavlovName" />-->
<label for="repoUrl">Name</label> <!-- <label for="repoUrl">Name</label>-->
</div> <!-- </div>-->
</mz-modal-content> <!-- </mz-modal-content>-->
<mz-modal-footer> <!-- <mz-modal-footer>-->
<button mz-button [flat]="true" mz-modal-close>Close</button> <!-- <button mz-button [flat]="true" mz-modal-close>Close</button>-->
<button mz-button class="pink-button" mz-modal-close (click)="setPavlovName()">Save</button> <!-- <button mz-button class="pink-button" mz-modal-close (click)="setPavlovName()">Save</button>-->
</mz-modal-footer> <!-- </mz-modal-footer>-->
</mz-modal> <!--</mz-modal>-->
@@ -123,6 +123,15 @@ export class ToolsComponent implements OnInit {
this.statusService.showStatus(e, true); 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) { runAdbCommand(command: string) {
return this.adbService.runAdbCommand(command); return this.adbService.runAdbCommand(command);
} }