Skip to content

Commit

Permalink
More bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanaelA committed Apr 25, 2024
1 parent f35f630 commit d5c6d08
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 4,339 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ tmp
.DS_Store
**/.DS_Store

/build/experimental.apk
41 changes: 29 additions & 12 deletions desktop-app/src/app/adb-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,10 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
deleteAfter?: boolean,
name?: string
) {
console.log("Starting install of APK", filePath, isLocal, shouldUninstall, number, total, deleteAfter, name)
// console.log("Starting install of APK", filePath, isLocal, shouldUninstall, number, total, deleteAfter, name)
return this.processService.addItem(
'apk_install',
task => {
console.log("Task APK", filePath, isLocal, shouldUninstall, number, total, deleteAfter, name)

if (this.deviceStatus !== ConnectionStatus.CONNECTED) {
return Promise.reject(name + 'Apk install failed - No device connected!');
Expand All @@ -666,7 +665,6 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
task.show_total = showTotal;
task.app_name = name || '';
task.status = name + showTotal + 'Installing Apk... ';
console.log('Installing filePath', filePath, 'Name', name);
return this.adbCommand('install', { serial: this.deviceSerial, path: filePath, isLocal: !!isLocal }, status => {
if (status.percent && status.size && status.time) {
task.status =
Expand All @@ -682,17 +680,19 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
}
})
.then(r => {
task.status = name + 'APK installed ok!!';
if (deleteAfter) {
this.appService.fs.unlink(filePath, err => {});
}
if (filePath.indexOf('com.weloveoculus.BMBF') > -1) {
return this.beatonService.setBeatOnPermission(this);
}
if (filePath.indexOf('quest.side.vr') > -1) {
if (filePath.indexOf('quest.side.vr') > -1 || filePath.toLowerCase().indexOf("/sidequestvr-") > -1) {
return this.addVRPermissions();
}
})
//console.log("APK Installed", filePath)
}).then(() => {
task.status = name + 'APK installed ok!!';
})
.catch(async e => {
if (deleteAfter) {
this.appService.fs.unlink(filePath, err => {});
Expand Down Expand Up @@ -1283,8 +1283,16 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
}

private async addVRPermissions() {
await this.adbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"', { serial: this.deviceSerial });
await this.adbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"', { serial: this.deviceSerial });
console.log("Adding VR Permissions");

await this.adbCommand('shell', {
serial: this.deviceSerial,
command: "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"
});
await this.adbCommand('shell', {
command: "pm grant quest.side.vr android.permission.READ_LOGS",
serial: this.deviceSerial });

try {
const homedir = process.env.USERPROFILE || process.env.HOME;
if (this.appService.fs.existsSync(homedir + '/.android/adbkey')) {
Expand All @@ -1299,8 +1307,9 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u

if (rawCertificate && rawCertificate.length) {
await this.adbCommand(
[

'shell',
{ command: [
'am',
'start',
'-a',
Expand All @@ -1310,7 +1319,7 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
'--es',
'CERTIFICATE',
rawCertificate,
].join(' '), { serial: this.deviceSerial }
].join(' '), serial: this.deviceSerial }
);
}
}
Expand All @@ -1319,7 +1328,15 @@ This can sometimes be caused by changes to your hosts file. Don't make changes u
}

this.skipStatusUpdates = true;
await this.adbCommand('tcpip 5555', { serial: this.deviceSerial });
setTimeout(() => { this.skipStatusUpdates = false; }, 3000);
await this.adbCommand('tcpip', {command: '5555', serial: this.deviceSerial });

await this.sleep(5000);
this.skipStatusUpdates = false;
return true;
}

private sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

}
2 changes: 0 additions & 2 deletions desktop-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { LoadingSpinnerService } from './loading-spinner.service';
import { StatusBarService } from './status-bar.service';
import { WebviewService } from './webview.service';
import { DragAndDropService } from './drag-and-drop.service';
import { ElectronService } from './electron.service';
import { AdbClientService } from './adb-client.service';
import { environment } from '../environments/environment';

Expand All @@ -29,7 +28,6 @@ export class AppComponent implements OnInit, AfterViewInit {
public appService: AppService,
public webService: WebviewService,
public dragService: DragAndDropService,
private electronService: ElectronService
) {
this.devMode = isDevMode();
}
Expand Down
8 changes: 8 additions & 0 deletions desktop-app/src/app/header-banner/header-banner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class HeaderBannerComponent implements OnInit {
// the latest available version of the in-headset app
private latestAppVersion: string | null = null;
private appId: string | null = null;
private addedPerms = false;
constructor(public appService: AppService, public adb: AdbClientService) {}

ngOnInit() {
Expand All @@ -44,6 +45,12 @@ export class HeaderBannerComponent implements OnInit {
this.isOutOfDate = true;
return;
}
if (!this.addedPerms) {
this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"', true).then(() => {
this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"', true);
});
this.addedPerms = true;
}
}
this.isOutOfDate = false;
}
Expand Down Expand Up @@ -116,6 +123,7 @@ export class HeaderBannerComponent implements OnInit {
// this.toast.show('SideQuest installed to headset!');
// this.showConfetti = true;
this.adb.appVersionCode = await this.adb.getAppVersion(true);

await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.WRITE_SECURE_SETTINGS"', true);
await this.adb.runAdbCommand('shell "pm grant quest.side.vr android.permission.READ_LOGS"', true);
try {
Expand Down
4 changes: 2 additions & 2 deletions desktop-app/src/app/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ export class HeaderComponent implements OnInit {
private router: Router
) {
this.osPlatform = this.appService.os.platform();
console.log('Platform: ' + this.osPlatform);
//console.log('Platform: ' + this.osPlatform);
this.resetFavourites('browserFavourites');
this.resetFavourites('fileFavourites');
this.resetFavourites('commandFavourites');
this.appService.headerComponent = this;
this.headerClass = environment.header?.color || "";
this.headerText = environment.header?.text || "";
console.log('Header: ' + this.headerClass + ' ' + this.headerText);
//console.log('Header: ' + this.headerClass + ' ' + this.headerText);
}
doBack() {
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ <h5 class="section-title">Default Texture Size</h5>
<span>Default - Quest 2</span>
</label>
</p>
<p>
<label>
<input name="textureSize" type="radio" value="1680-1760" [(ngModel)]="textureSize" (click)="setSSO(SSO._Quest3)"/>
<span>Default - Quest 3</span>
</label>
</p>
<p>
<label>
<input name="textureSize" type="radio" value="512-563" [(ngModel)]="textureSize" (click)="setSSO(SSO._512)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum SSO {
_Go,
_Quest1,
_Quest2,
_Quest3,
}
enum CR {
_480,
Expand Down Expand Up @@ -430,6 +431,11 @@ export class HeadsetSettingsComponent implements OnInit {
value = 1440;
hvalue = 1584;
break;
case SSO._Quest3:
value = 1680;
hvalue = 1760;
break;

}

this.runAdbCommand('setprop debug.oculus.textureWidth ' + value)
Expand Down
3 changes: 1 addition & 2 deletions desktop-app/src/app/status-bar.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { AppService } from './app.service';
import { Notification, StatusBarComponent, StatusType } from './status-bar/status-bar.component';
import { StatusBarComponent } from './status-bar/status-bar.component';

@Injectable({
providedIn: 'root',
Expand Down
23 changes: 8 additions & 15 deletions desktop-app/src/app/status-bar/status-bar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,28 @@
color: white;
width: 100%;
}
.status-bar-inner{
padding: 10px;
padding-left: 15px;
padding-right: 80px;
.status-bar-inner {
padding: 10px 80px 10px 15px;
}
.status-bar-warning {
background-color: #ff9800;
}
.status{
.status {
background-color: #E51253;
position: fixed;
z-index: 9999;
bottom: -45px;
bottom: 0;
display: none;
left: 0;
color: white;
width: 100%;
transition: bottom 350ms;
}
.status-open{
bottom: 0px;
.status-open {
display: block;
}








$info-icon-background-color: rgba(114, 137, 218, 1);
$success-icon-background-color: rgba(97, 185, 72, 1);
$warning-icon-background-color: rgba(251, 176, 59, 1);
Expand Down Expand Up @@ -77,7 +70,7 @@ $error-shadow-color: rgba(229, 18, 83, 0.4);

.sq-toast--top-right {
bottom: -4px;
right: 0px;
right: 0;
}

.sq-toast__message {
Expand Down
2 changes: 1 addition & 1 deletion desktop-app/src/app/status-bar/status-bar.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { StatusBarService } from '../status-bar.service';
import { animate, sequence, style, transition, trigger } from '@angular/animations';

Expand Down
12 changes: 6 additions & 6 deletions electron/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ class ADB {
async install(serial, apkpath, isLocal, cb, scb, ecb) {
await this._clientSetup.promise;

console.log('installapk', apkpath, isLocal);
// console.log('installapk', apkpath, isLocal);
let stopUpdate;

installErrorCallback = e => {
stopUpdate = true;
ecb(e);
console.log(e, stopUpdate);
console.error(e, stopUpdate);
};

if (!this.client) return ecb('Not connected.');
Expand Down Expand Up @@ -307,7 +307,7 @@ class ADB {
); */
}
} catch (e) {
console.error(e)
console.error("Error", e);
const isInvalidURI = e && typeof e.message === 'string' && e.message.startsWith('Invalid URI "');
if (isInvalidURI) {
return ecb("Can't download file. Invalid URL:");
Expand All @@ -322,6 +322,7 @@ class ADB {
.then(cb)
.catch(e => { console.error("error installing", e); ecb(e) });
}

uninstall(serial, packageName, cb, ecb) {
this._clientSetup.promise.then(() => {
if (!this.client) return ecb('Not connected.');
Expand Down Expand Up @@ -822,9 +823,9 @@ function setupApp() {
});
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', function() {
/* app.on('window-all-closed', function() {
if (process.platform !== 'darwin') app.quit();
});
}); */

// Kill the adb client when the app is definitely quitting, regardless of how it quit.
app.on('will-quit', () => {
Expand Down Expand Up @@ -960,7 +961,6 @@ function setupApp() {
try {
switch (arg.command) {
case 'installFromToken':
console.log("E-IFT", arg.settings.token)
adb.installFromToken(arg.settings.token, success, reject);
break;
case 'setupAdb':
Expand Down
1 change: 0 additions & 1 deletion electron/env-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require('./config');

export function getEnvCfg() {
const cfg = process.env['SQ_ENV_CFG'] || global.SQ_ENV_CFG;
console.log('SQ_ENV_CFG:', cfg);
switch (cfg) {
case 'test':
return {
Expand Down
Loading

0 comments on commit d5c6d08

Please sign in to comment.