added fixes for connecting issues including restoring the adb files if any are missing and better handling of errors.
This commit is contained in:
@@ -275,7 +275,7 @@ export class AdbClientService {
|
|||||||
' </i>' +
|
' </i>' +
|
||||||
this.batteryLevel +
|
this.batteryLevel +
|
||||||
'% ';
|
'% ';
|
||||||
this.beatonService.checkIsBeatOnRunning(this);
|
// 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) {
|
||||||
@@ -336,7 +336,13 @@ export class AdbClientService {
|
|||||||
requestAnimationFrame(this.connectedStatus.bind(this));
|
requestAnimationFrame(this.connectedStatus.bind(this));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
requestAnimationFrame(this.connectedStatus.bind(this));
|
alert(
|
||||||
|
this.appService.os.platform() === 'win32'
|
||||||
|
? `It looks like there is something wrong with your install.
|
||||||
|
Uninstall SideQuest and select "yes" when asked to delete app data and then install again. You may need to move your backup apks.`
|
||||||
|
: `It looks like something went wrong, try uninstalling SideQuest and reinstalling.
|
||||||
|
This can sometimes be caused by changes to your hosts file. Don't make changes unless you know what you are doing.`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
adbCommand(command: string, settings?, callback?) {
|
adbCommand(command: string, settings?, callback?) {
|
||||||
@@ -366,19 +372,18 @@ export class AdbClientService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
isAdbDownloaded() {
|
isAdbDownloaded() {
|
||||||
// let command = 'which adb';
|
let downloaded = true;
|
||||||
// if (process.platform == 'win32') {
|
if (!this.doesFileExist(this.adbPath)) {
|
||||||
// command = 'where adb';
|
return false;
|
||||||
// }
|
}
|
||||||
// try{
|
let source_files = this.appService.fs.readdirSync(this.appService.path.join(process.cwd(), 'build', 'platform-tools'));
|
||||||
//
|
let dest_files = this.appService.fs.readdirSync(this.adbPath);
|
||||||
// let stdout = this.appService.execSync(command);
|
source_files.forEach(d => {
|
||||||
// if (this.doesFileExist(stdout)) {
|
if (dest_files.indexOf(d) === -1) {
|
||||||
// this.adbPath = this.appService.path.dirname(stdout);
|
downloaded = false;
|
||||||
// return true;
|
}
|
||||||
// }
|
});
|
||||||
// }catch(e){}
|
return downloaded; // this.doesFileExist(this.appService.path.join(this.adbPath, this.getAdbBinary()));
|
||||||
return this.doesFileExist(this.adbPath);
|
|
||||||
}
|
}
|
||||||
setPermission(packageName: string, permission: string, isRevoke?: boolean) {
|
setPermission(packageName: string, permission: string, isRevoke?: boolean) {
|
||||||
return this.adbCommand('shell', {
|
return this.adbCommand('shell', {
|
||||||
|
|||||||
@@ -227,30 +227,27 @@ export class AppService {
|
|||||||
}
|
}
|
||||||
seedPlatformTools() {
|
seedPlatformTools() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
if (!this.fs.existsSync(this.path.join(this.appData, 'platform-tools'))) {
|
let sourcesPath = this.path.join(__dirname, '..', 'platform-tools');
|
||||||
let sourcesPath = this.path.join(__dirname, '..', 'platform-tools');
|
if (!this.fs.existsSync(sourcesPath)) {
|
||||||
if (!this.fs.existsSync(sourcesPath)) {
|
sourcesPath = this.path.join(process.cwd(), 'build', 'platform-tools');
|
||||||
sourcesPath = this.path.join(process.cwd(), 'build', 'platform-tools');
|
|
||||||
}
|
|
||||||
// console.log(this.path.join(__dirname, '..', 'platform-tools'), process.cwd(), __dirname);
|
|
||||||
await this.mkdir(this.path.join(this.appData, 'platform-tools'));
|
|
||||||
try {
|
|
||||||
let files = this.fs.readdirSync(sourcesPath);
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
|
||||||
this.fs.copyFileSync(
|
|
||||||
this.path.join(sourcesPath, files[i]),
|
|
||||||
this.path.join(this.appData, 'platform-tools', files[i])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (this.os.platform() === 'darwin' || this.os.platform() === 'linux') {
|
|
||||||
this.setExecutable(this.path.join(this.appData, 'platform-tools', 'adb')).then(() =>
|
|
||||||
setTimeout(() => resolve(), 5000)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
setTimeout(() => resolve(), 5000);
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
}
|
||||||
|
await this.mkdir(this.path.join(this.appData, 'platform-tools'));
|
||||||
|
try {
|
||||||
|
let files = this.fs.readdirSync(sourcesPath);
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
this.fs.copyFileSync(
|
||||||
|
this.path.join(sourcesPath, files[i]),
|
||||||
|
this.path.join(this.appData, 'platform-tools', files[i])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (this.os.platform() === 'darwin' || this.os.platform() === 'linux') {
|
||||||
|
this.setExecutable(this.path.join(this.appData, 'platform-tools', 'adb')).then(() =>
|
||||||
|
setTimeout(() => resolve(), 5000)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => resolve(), 5000);
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
makeFolders() {
|
makeFolders() {
|
||||||
|
|||||||
+1
-1
@@ -327,7 +327,7 @@ class ADB {
|
|||||||
if (!this.client) return ecb('Not connected.');
|
if (!this.client) return ecb('Not connected.');
|
||||||
this.client
|
this.client
|
||||||
.listDevices()
|
.listDevices()
|
||||||
.then(cb)
|
.then(d => cb(d))
|
||||||
.catch(e => ecb(e));
|
.catch(e => ecb(e));
|
||||||
}
|
}
|
||||||
setProperties(serial, command, cb, ecb) {
|
setProperties(serial, command, cb, ecb) {
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SideQuest",
|
"name": "SideQuest",
|
||||||
"productName": "SideQuest",
|
"productName": "SideQuest",
|
||||||
"version": "0.10.24",
|
"version": "0.10.25",
|
||||||
"description": "A open app store for mobile android based VR devices such as the Levovo Mirage, Oculus Go, Oculus Quest, Vive Focus.",
|
"description": "A open app store for mobile android based VR devices such as the Levovo Mirage, Oculus Go, Oculus Quest, Vive Focus.",
|
||||||
"repository": "https://github.com/SideQuestVR/SideQuest.git",
|
"repository": "https://github.com/SideQuestVR/SideQuest.git",
|
||||||
"license": "UNLICENCED",
|
"license": "UNLICENCED",
|
||||||
|
|||||||
Reference in New Issue
Block a user