fixed the popup when you unplug the cable
This commit is contained in:
@@ -169,7 +169,7 @@ export class AdbClientService {
|
||||
let extention = this.appService.path.extname(filepath);
|
||||
switch (extention) {
|
||||
case '.apk':
|
||||
return this.installAPK(filepath, true, false, 0, 0, false, this.appService.path.basename(filepath));
|
||||
return this.installAPK(filepath, true, false, 0, 0, false, this.appService.path.basename(filepath) + ': ');
|
||||
case '.obb':
|
||||
return this.processService.addItem('file_install', async task => {
|
||||
task.status = 'Transferring OBB file...';
|
||||
@@ -605,12 +605,12 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
||||
return this.processService.addItem(
|
||||
'apk_install',
|
||||
task => {
|
||||
name = name ? name + ': ' : '';
|
||||
if (this.deviceStatus !== ConnectionStatus.CONNECTED) {
|
||||
return Promise.reject(name + 'Apk install failed - No device connected!');
|
||||
}
|
||||
const showTotal = number && total ? '(' + number + '/' + total + ') ' : '';
|
||||
task.app_name = name;
|
||||
task.show_total = showTotal;
|
||||
task.app_name = name || '';
|
||||
task.status = name + showTotal + 'Installing Apk... ';
|
||||
return this.adbCommand('install', { serial: this.deviceSerial, path: filePath, isLocal: !!isLocal }, status => {
|
||||
if (status.percent && status.size && status.time) {
|
||||
@@ -619,10 +619,11 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
||||
? name + showTotal + 'Installing Apk...'
|
||||
: name + showTotal + 'Downloading APK... ' + Math.round(status.percent * 100) + '% ';
|
||||
} else {
|
||||
task.status =
|
||||
status === 'Checking APK against blacklist...'
|
||||
? name + showTotal + status
|
||||
: name + showTotal + 'Installing Apk...';
|
||||
if (status === 'Checking APK against blacklist...') {
|
||||
task.status = name + showTotal + status;
|
||||
} else {
|
||||
task.status = name + showTotal + 'Installing Apk...';
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(r => {
|
||||
@@ -638,7 +639,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
||||
if (deleteAfter) {
|
||||
this.appService.fs.unlink(filePath, err => {});
|
||||
}
|
||||
let er = e.message ? e.message : e.code ? e.code : e.reason ? e.reason : JSON.stringify(e);
|
||||
let er = e.message ? e.message : e.code ? e.code : e.reason ? e.reason : e.toString();
|
||||
if (
|
||||
er.indexOf('INSTALL_FAILED_UPDATE_INCOMPATIBLE') > -1 &&
|
||||
er.indexOf('com.oculus.environment.prod.') > -1
|
||||
@@ -648,9 +649,13 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
||||
this.installAPK(filePath, isLocal, shouldUninstall, number, total, deleteAfter, name);
|
||||
return Promise.reject('Install failed, uninstalling and trying again...');
|
||||
}
|
||||
if (er === 'SAFESIDE') {
|
||||
if (er.includes('SAFESIDE')) {
|
||||
this.appService.headerComponent.safeModal.openModal();
|
||||
}
|
||||
console.log('app failed', er);
|
||||
task.status =
|
||||
(task.app_name ? task.app_name + ': ' : '') +
|
||||
(e.message ? e.message : e.code ? e.code : e.reason ? e.reason : e.toString());
|
||||
return Promise.reject(er);
|
||||
});
|
||||
},
|
||||
@@ -1031,7 +1036,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
|
||||
async installLocalZip(filepath, dontCatchError, cb, task?, deleteAfter?) {
|
||||
const typeBasedActions = {
|
||||
'.apk': filepath => {
|
||||
this.installAPK(filepath, true, false, 0, 0, deleteAfter);
|
||||
this.installAPK(filepath, true, false, 0, 0, deleteAfter, this.appService.path.basename(filepath));
|
||||
},
|
||||
'.obb': filepath => {
|
||||
if (this.appService.path.basename(filepath).match(this.obbRegex)) {
|
||||
|
||||
@@ -99,29 +99,34 @@ export class AppService {
|
||||
}
|
||||
this.versionName = 'v' + this.remote.app.getVersion();
|
||||
this.electron.ipcRenderer.on('extract-file', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.extractResolves[data.token]) {
|
||||
this.extractResolves[data.token].resolve();
|
||||
delete this.extractResolves[data.token];
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('extract-progress', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.extractResolves[data.token]) {
|
||||
this.extractResolves[data.token].scb(data.stats);
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('download-url-fail', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.downloadResolves[data.token]) {
|
||||
this.downloadResolves[data.token].reject(data.e);
|
||||
delete this.downloadResolves[data.token];
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('download-url', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.downloadResolves[data.token]) {
|
||||
this.downloadResolves[data.token].resolve();
|
||||
delete this.downloadResolves[data.token];
|
||||
}
|
||||
});
|
||||
this.electron.ipcRenderer.on('download-progress', (event, data) => {
|
||||
console.log('download-url-progress');
|
||||
if (!!this.downloadResolves[data.token]) {
|
||||
this.downloadResolves[data.token].scb(data.stats);
|
||||
}
|
||||
|
||||
@@ -65,14 +65,13 @@ export class ElectronService {
|
||||
|
||||
async installFromToken(token) {
|
||||
let res = await this.adbService.adbCommand('installFromToken', { token });
|
||||
console.log(res);
|
||||
res.forEach((l, i) => {
|
||||
switch (l.type) {
|
||||
case 'Mod':
|
||||
this.beatonService.downloadSong(l.url, this.adbService);
|
||||
break;
|
||||
case 'APK':
|
||||
this.adbService.installAPK(l.url, false, false, i + 1, res.length, false, l.name);
|
||||
this.adbService.installAPK(l.url, false, false, i + 1, res.length, false, l.name + ': ');
|
||||
break;
|
||||
case 'OBB':
|
||||
this.adbService.installObb(l.url, i + 1, res.length, l.name);
|
||||
@@ -95,7 +94,7 @@ export class ElectronService {
|
||||
this.adbService.installObb(data.url, 0, 0, data.name);
|
||||
break;
|
||||
case '.apk':
|
||||
this.adbService.installAPK(data.url, false, false, 0, 0, true, data.name);
|
||||
this.adbService.installAPK(data.url, false, false, 0, 0, true, data.name + ': ');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -290,23 +290,6 @@ export class HeaderComponent implements OnInit {
|
||||
}
|
||||
);
|
||||
}
|
||||
closeApp() {
|
||||
this.appService.remote.getCurrentWindow().close();
|
||||
}
|
||||
pingHeadset() {
|
||||
this.isAlive = true;
|
||||
}
|
||||
minimizeApp() {
|
||||
this.appService.remote.getCurrentWindow().minimize();
|
||||
}
|
||||
maximizeApp() {
|
||||
const win = this.appService.remote.getCurrentWindow();
|
||||
if (win.isMaximized()) {
|
||||
win.unmaximize();
|
||||
} else {
|
||||
win.maximize();
|
||||
}
|
||||
}
|
||||
async selectAppToInstall() {
|
||||
let files = await this.appService.remote.dialog.showOpenDialog({
|
||||
properties: ['openFile', 'multiSelections'],
|
||||
@@ -322,20 +305,4 @@ export class HeaderComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
confirmRestore() {
|
||||
this.spinnerService.showLoader();
|
||||
this.spinnerService.setMessage('Restoring BMBF<br>Please Wait...');
|
||||
this.beatonService.confirmRestore(this.adbService).then(r => {
|
||||
this.spinnerService.hideLoader();
|
||||
this.statusService.showStatus('BMBF Restored Successfully!!');
|
||||
this.beatOnModal.openModal();
|
||||
this.beatonService.checkHasRestore(this.adbService);
|
||||
});
|
||||
}
|
||||
installAPK(name: string) {
|
||||
return this.adbService.installAPK(this.appService.path.join(this.appService.appData, name), true, true);
|
||||
}
|
||||
removeText(text) {
|
||||
this.replaceText = this.replaceText.filter(d => d !== text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,14 @@ export class ProcessTask {
|
||||
key: string;
|
||||
name: string;
|
||||
app_name?: string;
|
||||
show_total?: string;
|
||||
icon: string;
|
||||
private _status?;
|
||||
get status(): string {
|
||||
return this._status;
|
||||
}
|
||||
set status(d) {
|
||||
this.statusService.showStatus(d, false, true);
|
||||
this.statusService.showStatus(d.replace(/:\s+/g, ': '), false, true);
|
||||
this._status = d;
|
||||
}
|
||||
running?: boolean;
|
||||
@@ -87,7 +88,7 @@ export class ProcessBucketService {
|
||||
|
||||
async processBucket() {
|
||||
const objects = this.tasks.filter(t => !t.failed && !t.running && !t.cancelled && !t.succeeded);
|
||||
const timeout = new Promise(resolve => setTimeout(() => resolve(), 1000));
|
||||
const timeout = () => new Promise(resolve => setTimeout(() => resolve(), 500));
|
||||
this.left_length = objects.length;
|
||||
if (objects.length) {
|
||||
this.is_running = true;
|
||||
@@ -101,18 +102,22 @@ export class ProcessBucketService {
|
||||
task.succeeded = true;
|
||||
this.currentTask = null;
|
||||
if (!task.cancelled) {
|
||||
return timeout.then(() => this.processBucket());
|
||||
return timeout().then(() => this.processBucket());
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
task.running = false;
|
||||
task.status =
|
||||
(task.app_name ? task.app_name + ': ' : '') + (e.message ? e.message : e.code ? e.code : e.toString());
|
||||
(task.app_name || '') + (e.message ? e.message : e.code ? e.code : e.reason ? e.reason : e.toString());
|
||||
task.failed = true;
|
||||
this.currentTask = null;
|
||||
this.statusService.showStatus(task.status, true);
|
||||
if (!task.cancelled) {
|
||||
return timeout.then(() => this.processBucket());
|
||||
console.log('h1');
|
||||
return timeout().then(async () => {
|
||||
console.log('h2');
|
||||
await this.processBucket();
|
||||
});
|
||||
}
|
||||
});
|
||||
this.tasks = this.tasks.filter(t => t !== task);
|
||||
@@ -132,7 +137,7 @@ export class ProcessBucketService {
|
||||
);
|
||||
}
|
||||
this.is_running = false;
|
||||
await timeout.then(() => this.processBucket());
|
||||
await timeout().then(() => this.processBucket());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ export class StatusBarService {
|
||||
this.status = status;
|
||||
}
|
||||
showStatus(message: string, isError?: boolean, isInfo?: boolean) {
|
||||
console.warn('here');
|
||||
this.status.showStatus(message, isError, isInfo);
|
||||
}
|
||||
hideStatus() {
|
||||
|
||||
Reference in New Issue
Block a user