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
@@ -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)