From 5dc740ce8c527900a96fa5bf5948830281fd330b Mon Sep 17 00:00:00 2001 From: Shane Harris Date: Mon, 1 Aug 2022 09:44:46 +0100 Subject: [PATCH] completed new status bar --- desktop-app/src/app/adb-client.service.ts | 10 +- desktop-app/src/app/app.component.html | 23 +-- desktop-app/src/app/app.component.ts | 2 - desktop-app/src/app/app.module.ts | 2 - desktop-app/src/app/app.service.ts | 1 - .../current-tasks/current-tasks.component.ts | 2 - .../src/app/header/header.component.html | 33 +--- .../loading-spinner.component.html | 4 +- .../src/app/packages/packages.component.html | 16 +- desktop-app/src/app/process-bucket.service.ts | 12 +- .../app/setup-guide/setup-guide.component.ts | 11 +- .../src/app/setup/setup.component.html | 167 ------------------ .../src/app/setup/setup.component.scss | 6 - .../src/app/setup/setup.component.spec.ts | 25 --- desktop-app/src/app/setup/setup.component.ts | 51 ------ desktop-app/src/app/status-bar.service.ts | 31 ++-- .../app/status-bar/status-bar.component.html | 39 +++- .../app/status-bar/status-bar.component.scss | 127 ++++++++++++- .../app/status-bar/status-bar.component.ts | 80 ++++++++- .../stream-options.component.ts | 10 +- .../wireless-connection.component.ts | 8 +- desktop-app/src/styles.scss | 21 +++ 22 files changed, 316 insertions(+), 365 deletions(-) delete mode 100644 desktop-app/src/app/setup/setup.component.html delete mode 100644 desktop-app/src/app/setup/setup.component.scss delete mode 100644 desktop-app/src/app/setup/setup.component.spec.ts delete mode 100644 desktop-app/src/app/setup/setup.component.ts diff --git a/desktop-app/src/app/adb-client.service.ts b/desktop-app/src/app/adb-client.service.ts index 102bfe3..55dea4a 100644 --- a/desktop-app/src/app/adb-client.service.ts +++ b/desktop-app/src/app/adb-client.service.ts @@ -333,10 +333,12 @@ export class AdbClientService { this.diagBegin(); this.deviceStatus = this.getConnectedStatus(); this.setConnectionCssClass(); - for (let i = 0; i < this.devices.length; i++) { - this.getDeviceName(this.devices[i]); - } - this.displayDevices = this.devices; + (async () => { + for (let i = 0; i < this.devices.length; i++) { + await this.getDeviceName(this.devices[i]); + } + this.displayDevices = this.devices; + })(); document.getElementById('connection-status').className = 'connection-status-' + status; switch (this.deviceStatus) { case ConnectionStatus.LINUX_PERMS: diff --git a/desktop-app/src/app/app.component.html b/desktop-app/src/app/app.component.html index 639151a..3e9bf8b 100644 --- a/desktop-app/src/app/app.component.html +++ b/desktop-app/src/app/app.component.html @@ -5,28 +5,7 @@ - + - - -

Get Help

-
- - We have a great community and we have already faced most problems and found solutions. Please check out our Service Desk for info on the following error.

-
- {{helpStatus}} -
-
-
-

-
-
Copy To Clipboard


-
Open Service Desk


-
-
- - - -
diff --git a/desktop-app/src/app/app.component.ts b/desktop-app/src/app/app.component.ts index 98dc265..046b0a2 100644 --- a/desktop-app/src/app/app.component.ts +++ b/desktop-app/src/app/app.component.ts @@ -49,8 +49,6 @@ export class AppComponent implements OnInit, AfterViewInit { }); } ngAfterViewInit() { - this.spinnerService.setSpinner(this.spinner); - this.statusService.setStatus(this.status); this.webService.setWebView(this.webview.nativeElement); } setExterHelp() { diff --git a/desktop-app/src/app/app.module.ts b/desktop-app/src/app/app.module.ts index 92b8268..38f4bb2 100644 --- a/desktop-app/src/app/app.module.ts +++ b/desktop-app/src/app/app.module.ts @@ -9,7 +9,6 @@ import { HeaderComponent } from './header/header.component'; import { StatusBarComponent } from './status-bar/status-bar.component'; import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component'; import { RouterModule } from '@angular/router'; -import { SetupComponent } from './setup/setup.component'; import { AppRoutes } from './app.routes'; import { LoadingSpinnerSmallComponent } from './loading-spinner-small/loading-spinner-small.component'; import { PackagesComponent } from './packages/packages.component'; @@ -37,7 +36,6 @@ import { StreamOptionsComponent } from './stream-options/stream-options.componen HeaderComponent, StatusBarComponent, LoadingSpinnerComponent, - SetupComponent, LoadingSpinnerSmallComponent, PackagesComponent, PackageItemComponent, diff --git a/desktop-app/src/app/app.service.ts b/desktop-app/src/app/app.service.ts index 8bd8ae9..1368cdc 100644 --- a/desktop-app/src/app/app.service.ts +++ b/desktop-app/src/app/app.service.ts @@ -198,7 +198,6 @@ export class AppService { } } resetTop() { - this.showSearch = false; this.showBrowserBar = false; this.showCustomActions = false; this.showTaskActions = false; diff --git a/desktop-app/src/app/current-tasks/current-tasks.component.ts b/desktop-app/src/app/current-tasks/current-tasks.component.ts index 04e080e..45ea740 100644 --- a/desktop-app/src/app/current-tasks/current-tasks.component.ts +++ b/desktop-app/src/app/current-tasks/current-tasks.component.ts @@ -12,8 +12,6 @@ export class CurrentTasksComponent implements OnInit { constructor(public processService: ProcessBucketService, public appService: AppService) { this.appService.resetTop(); appService.webService.isWebviewOpen = false; - this.appService.showTaskActions = true; - // appService.isTasksOpen = true; } ngOnInit() { diff --git a/desktop-app/src/app/header/header.component.html b/desktop-app/src/app/header/header.component.html index e70500a..5b48c76 100644 --- a/desktop-app/src/app/header/header.component.html +++ b/desktop-app/src/app/header/header.component.html @@ -50,10 +50,11 @@ routerLink="/webview">{{favourite.name}}
+
Update Available
- + + + arrow_back @@ -159,26 +160,6 @@ (click)="webService.loadUrl('https://synthriderz.com/beatmaps/recent')">     -
- - -
@@ -196,7 +177,7 @@ Address - Open

@@ -263,7 +244,9 @@ -
+
+ +
diff --git a/desktop-app/src/app/loading-spinner/loading-spinner.component.html b/desktop-app/src/app/loading-spinner/loading-spinner.component.html index f18ea8b..d13bd8e 100644 --- a/desktop-app/src/app/loading-spinner/loading-spinner.component.html +++ b/desktop-app/src/app/loading-spinner/loading-spinner.component.html @@ -6,8 +6,8 @@


- Cancel       - Continue +
Cancel
       +
Continue
diff --git a/desktop-app/src/app/packages/packages.component.html b/desktop-app/src/app/packages/packages.component.html index 78efe97..6847529 100644 --- a/desktop-app/src/app/packages/packages.component.html +++ b/desktop-app/src/app/packages/packages.component.html @@ -70,8 +70,8 @@

Game Data Backups

Backup data files from your SD Card for this app/game. This will attempt to save game data and OBB files for the game from the SD Card and not the internal storage. Does not work for all games.

- Backup Game Data

+
Backup Game Data



APK Backups

Backup your APK file from your device.

- Backup APK File

@@ -108,11 +108,11 @@

Manage App

- Launch App

- Force Close App

- Clear App Data

- Uninstall App

- Launch App

+ Force Close App

+ Clear App Data

+ Uninstall App

+ Open Backups



diff --git a/desktop-app/src/app/process-bucket.service.ts b/desktop-app/src/app/process-bucket.service.ts index 1fc483c..a3ffb9e 100644 --- a/desktop-app/src/app/process-bucket.service.ts +++ b/desktop-app/src/app/process-bucket.service.ts @@ -1,11 +1,19 @@ import { Injectable } from '@angular/core'; import { StatusBarService } from './status-bar.service'; -export interface ProcessTask { +export class ProcessTask { + constructor(private statusService?: StatusBarService) {} key: string; name: string; app_name?: string; icon: string; - status?: string; + private _status?; + get status(): string { + return this._status; + } + set status(d) { + this.statusService.showStatus(d, false, true); + this._status = d; + } running?: boolean; fail_once?: boolean; percent?: string; diff --git a/desktop-app/src/app/setup-guide/setup-guide.component.ts b/desktop-app/src/app/setup-guide/setup-guide.component.ts index 99ba731..c85f366 100644 --- a/desktop-app/src/app/setup-guide/setup-guide.component.ts +++ b/desktop-app/src/app/setup-guide/setup-guide.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { AdbClientService } from '../adb-client.service'; import { AppService } from '../app.service'; +import { StatusBarService } from '../status-bar.service'; @Component({ selector: 'app-setup-guide', @@ -15,7 +16,7 @@ export class SetupGuideComponent implements OnInit { isSupport: boolean; link; logFailed: boolean; - constructor(public adb: AdbClientService, public appService: AppService) { + constructor(public adb: AdbClientService, public appService: AppService, private statusService: StatusBarService) { appService.resetTop(); appService.webService.isWebviewOpen = false; } @@ -35,7 +36,7 @@ export class SetupGuideComponent implements OnInit { copyToClipboard() { this.adb.copyToClipboard(this.link); - // this.toast.show('Copied to clipboard: ' + this.link); + this.statusService.showStatus('Copied to clipboard: ' + this.link); } async uploadLogs() { @@ -62,11 +63,11 @@ export class SetupGuideComponent implements OnInit { link = (await resp.json()).result.url; this.link = link; - // this.toast.show('Logs Uploaded! Copy the Url to your support ticket.'); - // this.scrollTo('thankYou'); + + this.statusService.showStatus('Logs Uploaded! Copy the Url to your support ticket.'); } catch (e) { console.log(e); - alert('Unable to upload logs, please try again later.'); + this.statusService.showStatus('Unable to upload logs, please try again later.', true); } // this.telemetry.telemetry({ event: 'log-upload', logData: this.adb.diagnostics.usb.log, logLink: link }); } diff --git a/desktop-app/src/app/setup/setup.component.html b/desktop-app/src/app/setup/setup.component.html deleted file mode 100644 index 28840b1..0000000 --- a/desktop-app/src/app/setup/setup.component.html +++ /dev/null @@ -1,167 +0,0 @@ -
-
-
-
- Step 1: Create Organisation -
-
- Put the Oculus Headset in developer mode to be able to sideload to the Headset. To do this, - you have to be a registered "developer". This process is free. Go to - - on your PC and create an 'organization'. You'll be asked to accept the developer agreement. -
-

- - -
-
-
-
-
- Step 2: Install Drivers ( Windows Only - skip this on Mac / Linux ) -
-
- Install the driver software for your device. Go to - - on your PC and download the drivers for your headset. The Oculus Go drivers work for the - quest also. To install the drivers extract the zip folder, right click the -
android_winusb.inf
- file and click install. -
-

- -
-
-
-
-
-
-
-
- Step 3: Enable Developer Mode and Reboot -
-

- Now that you’re a "developer", open the Oculus app on your smartphone or tablet. In the - Settings tab, tap on the Go headset and tap 'More settings'. In the list, you should now see - Developer Mode. Once you have enabled developer mode it is a good idea to reboot your headset - to be able to see it on the device. -

-

- -
-
-
-
-
- Step 4: Connect USB Cable and Allow USB Debugging -
-
- Now its time to connect the USB cable. Once you are connected you will have to allow USB - debugging access on your headset. If you put your headset on at this point you will see - something like the below. You should also select 'Always allow from this computer' to prevent - this message from coming up every time you connect. -
-

- -
-
-
-
-
-
-
-
- Step 5: Install App Launcher -
-
- Install a launcher to make finding apps easier on your headset. This launcher will be found in - the library under 'Unknown Sources' on the menu on the left. Open it to find all the apps that - have been installed on your device. -

- SideQuest Launcher Installed! - -
- Install App Launcher -
-

-
- You will then be able to install apps to your headset and open them from the launcher. You can - find it in the side menu of the library under the Unknown Sources section called - SideQuest - TV and SideQuest - Home. This will show you all the apps on the device even hidden - ones you would otherwise not see. -

- The Expanse VR Installed! - -
- Install Your First App - The Expanse -


-
- If you want to install your own APK files just drag and drop them over this window. -
-
- Check your antivirus hasn't blocked some parts of the ADB download - this has happened for some - with Avast antivirus in particular.
If you have any problems or want to say hi drop us a - line on discord - . -
-
-
-
-
- diff --git a/desktop-app/src/app/setup/setup.component.scss b/desktop-app/src/app/setup/setup.component.scss deleted file mode 100644 index 1270409..0000000 --- a/desktop-app/src/app/setup/setup.component.scss +++ /dev/null @@ -1,6 +0,0 @@ -.setup-content{ - padding: 2em; -} -.setup-image { - width: 100%; -} diff --git a/desktop-app/src/app/setup/setup.component.spec.ts b/desktop-app/src/app/setup/setup.component.spec.ts deleted file mode 100644 index ccad374..0000000 --- a/desktop-app/src/app/setup/setup.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SetupComponent } from './setup.component'; - -describe('SetupComponent', () => { - let component: SetupComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SetupComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SetupComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/desktop-app/src/app/setup/setup.component.ts b/desktop-app/src/app/setup/setup.component.ts deleted file mode 100644 index eefb954..0000000 --- a/desktop-app/src/app/setup/setup.component.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { AppService } from '../app.service'; -import { AdbClientService } from '../adb-client.service'; - -@Component({ - selector: 'app-setup', - templateUrl: './setup.component.html', - styleUrls: ['./setup.component.scss'], -}) -export class SetupComponent implements OnInit { - isInstallingLauncher: boolean; - isInstalledLauncher: boolean; - isInstallingExpanse: boolean; - isInstalledExpanse: boolean; - constructor(public appService: AppService, private adbService: AdbClientService) { - appService.webService.isWebviewOpen = false; - this.appService.resetTop(); - } - - ngOnInit() { - this.appService.setTitle('Setup for Sideloading'); - } - - isExpanseInstalled() { - this.isInstalledExpanse = !!~this.adbService.devicePackages.indexOf('app.theexpanse.app'); - return this.isInstalledExpanse; - } - - isLauncherInstalled() { - this.isInstalledLauncher = - !!~this.adbService.devicePackages.indexOf('com.sidequest.wrapper2') && - !!~this.adbService.devicePackages.indexOf('com.sidequest.wrapper') && - !!~this.adbService.devicePackages.indexOf('com.sidequest.launcher'); - return this.isInstalledLauncher; - } - - installLauncher() { - this.isInstallingLauncher = true; - this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestWrapper.apk'); - this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestWrapper2.apk'); - this.adbService.installAPK('https://cdn.theexpanse.app/SideQuestLauncher.apk'); - this.isInstallingLauncher = false; - this.isInstalledLauncher = true; - } - installExpanse() { - this.isInstallingExpanse = true; - this.adbService.installAPK('https://cdn.theexpanse.app/TheExpanse.apk'); - this.isInstallingExpanse = false; - this.isInstalledExpanse = true; - } -} diff --git a/desktop-app/src/app/status-bar.service.ts b/desktop-app/src/app/status-bar.service.ts index 38ddb19..353fbcc 100644 --- a/desktop-app/src/app/status-bar.service.ts +++ b/desktop-app/src/app/status-bar.service.ts @@ -1,36 +1,27 @@ import { Injectable } from '@angular/core'; import { AppService } from './app.service'; -import { StatusBarComponent } from './status-bar/status-bar.component'; +import { Notification, StatusBarComponent, StatusType } from './status-bar/status-bar.component'; @Injectable({ providedIn: 'root', }) export class StatusBarService { status: StatusBarComponent; - hideTimeout: any; - constructor(private appService: AppService) {} - setStatus(status: StatusBarComponent) { + constructor() {} + setStatusComponent(status: StatusBarComponent) { this.status = status; } - showStatus(message: string, isWarning?: boolean) { - clearTimeout(this.hideTimeout); - this.status.statusMessage = message; - this.status.isWarning = isWarning; - this.status.isActive = true; - if (!isWarning) { - this.hideTimeout = setTimeout(() => { - this.status.isActive = false; - }, 5000); - } + showStatus(message: string, isError?: boolean, isInfo?: boolean) { + this.status.showStatus(message, isError, isInfo); } hideStatus() { - this.status.isActive = this.status.showDiscord = false; + this.status.isActive = false; } copyStatus() { - this.appService.electron.clipboard.writeText(this.status.statusMessage); - this.status.showDiscord = true; - this.showStatus( - 'Copied to your clipboard! Please post this in our discord server in the #general channel: https://discord.gg/r38T5rR' - ); + // this.appService.electron.clipboard.writeText(this.status.statusMessage); + // // this.status.showDiscord = true; + // this.showStatus( + // 'Copied to your clipboard! Please post this in our discord server in the #general channel: https://discord.gg/r38T5rR' + // ); } } diff --git a/desktop-app/src/app/status-bar/status-bar.component.html b/desktop-app/src/app/status-bar/status-bar.component.html index 322131f..9b665ef 100644 --- a/desktop-app/src/app/status-bar/status-bar.component.html +++ b/desktop-app/src/app/status-bar/status-bar.component.html @@ -1,8 +1,33 @@ -
- close -
Get Help
- - - +
+
+
+
+
+
+ + + + + + + + + +
+
+
+ {{notification.isSuccess ? 'Success' : notification.isError ? 'Error' : ''}} +
+
+
+
+
diff --git a/desktop-app/src/app/status-bar/status-bar.component.scss b/desktop-app/src/app/status-bar/status-bar.component.scss index 6f4baaa..f8b78e0 100644 --- a/desktop-app/src/app/status-bar/status-bar.component.scss +++ b/desktop-app/src/app/status-bar/status-bar.component.scss @@ -7,9 +7,132 @@ left: 0; color: white; width: 100%; - padding: 5px; - padding-left: 10px; +} +.status-bar-inner{ + padding: 10px; + padding-left: 15px; + padding-right: 80px; } .status-bar-warning { background-color: #ff9800; } +.status{ + background-color: #E51253; + position: fixed; + z-index: 9999; + bottom: -45px; + left: 0; + color: white; + width: 100%; + transition: bottom 350ms; +} +.status-open{ + bottom: 0px; +} + + + + + + + + +$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); +$error-icon-background-color: rgba(229, 18, 83, 1); + +$toast-text-color: rgba(255, 255, 255, 1); + +$info-background-color: rgba(71, 98, 195, 1); +$success-background-color: rgba(58, 137, 36, 1); +$warning-background-color: rgba(211, 135, 15, 1); +$error-background-color: rgba(155, 10, 54, 1); + +$info-shadow-color: rgba(114, 137, 218, 0.4); +$success-shadow-color: rgba(97, 185, 72, 0.4); +$warning-shadow-color: rgba(251, 176, 59, 0.4); +$error-shadow-color: rgba(229, 18, 83, 0.4); + + +.sq-toast { + position: fixed; + min-width: 6rem; + opacity: 0.9; + font-family: Roboto, sans-serif; + font-size: 12px; + font-style: normal; + font-weight: 400; + line-height: 14px; + letter-spacing: 0; + z-index: 9999; + text-align: right; +} +@media (max-width: 1024px) +{ + .sq-toast{ + width: 90%; + } +} + +.sq-toast--top-right { + bottom: -4px; + right: 0px; +} + +.sq-toast__message { + display: inline-block; + color: $toast-text-color; + min-height: 42px; + margin-left: 1em; + margin-top: 1em; +} + +.sq-toast__message--info { + background-color: $info-background-color; + box-shadow: 0 4px 10px $info-shadow-color; +} +.sq-toast__message--success { + background-color: $success-background-color; + box-shadow: 0 4px 10px $success-shadow-color; +} +.sq-toast__message--warning { + background-color: $warning-background-color; + box-shadow: 0 4px 10px $warning-shadow-color; +} +.sq-toast__message--error { + background-color: $error-background-color; + box-shadow: 0 4px 10px $error-shadow-color; +} + +.sq-toast__message__icon-box { + width: 42px; + height: 42px; + float: left; +} + +.sq-toast__message__text-box { + padding: 1.2em; + margin-left: 3em; + overflow: hidden; + text-overflow: ellipsis; +} + +.sq-toast__message__icon-box--info { + background-color: $info-icon-background-color; +} +.sq-toast__message__icon-box--success { + background-color: $success-icon-background-color; +} +.sq-toast__message__icon-box--warning { + background-color: $warning-icon-background-color; +} +.sq-toast__message__icon-box--error { + background-color: $error-icon-background-color; +} + +.sq-toast__message__icon-box__icon { + font-size: 2rem; + margin: .5rem; + text-align: center; +} diff --git a/desktop-app/src/app/status-bar/status-bar.component.ts b/desktop-app/src/app/status-bar/status-bar.component.ts index 64072ca..45d05a2 100644 --- a/desktop-app/src/app/status-bar/status-bar.component.ts +++ b/desktop-app/src/app/status-bar/status-bar.component.ts @@ -1,18 +1,86 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { StatusBarService } from '../status-bar.service'; +import { animate, sequence, style, transition, trigger } from '@angular/animations'; + +export enum StatusType { + INFO, + ERROR, + SUCCESS, +} +export class Notification { + type: StatusType; + message: string; + get isError() { + return this.type === StatusType.ERROR; + } + get isSuccess() { + return this.type === StatusType.SUCCESS; + } + get isInfo() { + return this.type === StatusType.INFO; + } +} @Component({ selector: 'app-status-bar', templateUrl: './status-bar.component.html', styleUrls: ['./status-bar.component.scss'], + animations: [ + trigger('anim', [ + transition(':leave', [ + style({ + height: '*', + opacity: '1', + transform: 'translateX(0)', + }), + sequence([ + animate( + '.1s ease', + style({ + height: '*', + opacity: '.2', + transform: 'translateX(20px)', + }) + ), + animate('.1s ease', style({ height: '0', opacity: 0, transform: 'translateX(20px)' })), + ]), + ]), + transition(':enter', [ + style({ height: '0', opacity: '0', transform: 'translateX(20px)' }), + sequence([ + animate( + '.35s ease', + style({ + height: '*', + opacity: 1, + transform: 'translateX(0)', + }) + ), + ]), + ]), + ]), + ], }) export class StatusBarComponent implements OnInit { - isWarning: boolean; - isActive: boolean; - showDiscord: boolean; - statusMessage: string; - @Output() getHelp = new EventEmitter(); - constructor(public statusService: StatusBarService) {} + isActive = false; + private timeout; + notification: Notification = new Notification(); + constructor(public statusService: StatusBarService) { + statusService.setStatusComponent(this); + } ngOnInit() {} + + showStatus(message: string, isError?: boolean, isInfo?: boolean) { + clearTimeout(this.timeout); + this.notification.message = message; + this.notification.type = isError ? StatusType.ERROR : isInfo ? StatusType.INFO : StatusType.SUCCESS; + this.isActive = true; + this.timeout = setTimeout( + () => { + this.isActive = false; + }, + this.notification.isError ? 7500 : 3500 + ); + } } diff --git a/desktop-app/src/app/stream-options/stream-options.component.ts b/desktop-app/src/app/stream-options/stream-options.component.ts index fc4f434..11fbaad 100644 --- a/desktop-app/src/app/stream-options/stream-options.component.ts +++ b/desktop-app/src/app/stream-options/stream-options.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { AppService } from '../app.service'; import { AdbClientService } from '../adb-client.service'; +import { StatusBarService } from '../status-bar.service'; @Component({ selector: 'app-stream-options', @@ -19,7 +20,7 @@ export class StreamOptionsComponent implements OnInit { device: '', }; osPlatform: string; - constructor(public appService: AppService, private adbService: AdbClientService) { + constructor(public appService: AppService, private adbService: AdbClientService, private statusService: StatusBarService) { appService.webService.isWebviewOpen = false; appService.resetTop(); this.osPlatform = this.appService.os.platform(); @@ -29,8 +30,9 @@ export class StreamOptionsComponent implements OnInit { runscrcpy() { this.scrcpy_options.device = this.adbService.deviceSerial; - this.appService.runScrCpy(this.scrcpy_options); - // .then(() => this.statusService.showStatus('Stream closed.')) - // .catch(e => this.statusService.showStatus('ScrCpy Error: ' + JSON.stringify(e), true)); + this.appService + .runScrCpy(this.scrcpy_options) + .then(() => this.statusService.showStatus('Stream closed.')) + .catch(e => this.statusService.showStatus('ScrCpy Error: ' + JSON.stringify(e), true)); } } diff --git a/desktop-app/src/app/wireless-connection/wireless-connection.component.ts b/desktop-app/src/app/wireless-connection/wireless-connection.component.ts index 6b70ac6..93f8fc3 100644 --- a/desktop-app/src/app/wireless-connection/wireless-connection.component.ts +++ b/desktop-app/src/app/wireless-connection/wireless-connection.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { AdbClientService, ConnectionStatus } from '../adb-client.service'; import { AppService } from '../app.service'; +import { StatusBarService } from '../status-bar.service'; @Component({ selector: 'app-wireless-connection', @@ -8,7 +9,7 @@ import { AppService } from '../app.service'; styleUrls: ['./wireless-connection.component.scss'], }) export class WirelessConnectionComponent implements OnInit { - constructor(public adbService: AdbClientService, appService: AppService) { + constructor(public adbService: AdbClientService, appService: AppService, private statusService: StatusBarService) { appService.webService.isWebviewOpen = false; appService.resetTop(); } @@ -16,7 +17,9 @@ export class WirelessConnectionComponent implements OnInit { ngOnInit() {} connectWifi() { - this.adbService.deviceStatusMessage = 'Attempting wifi connection...'; + let status = 'Attempting wifi connection...'; + this.statusService.showStatus(status, false, true); + this.adbService.deviceStatusMessage = status; ((this.adbService.isReady ? this.adbService.runAdbCommand('adb tcpip 5555') : Promise.resolve()) as any).then(() => { setTimeout(() => { this.adbService.runAdbCommand('adb connect ' + this.adbService.deviceIp + ':5555'); @@ -26,6 +29,7 @@ export class WirelessConnectionComponent implements OnInit { reset() { this.adbService.runAdbCommand('adb disconnect'); + this.statusService.showStatus('Resetting ADB connection...', false, true); } isConnected() { diff --git a/desktop-app/src/styles.scss b/desktop-app/src/styles.scss index 6dc0426..a810e53 100644 --- a/desktop-app/src/styles.scss +++ b/desktop-app/src/styles.scss @@ -818,3 +818,24 @@ input[type=checkbox]:not(:disabled).tabbed:focus ~ .lever::before { background-color: #afafaf; border-color: #8f8f8f; } + +$switch-bg-color: #E51253 !default; +$switch-checked-lever-bg: desaturate(lighten($switch-bg-color, 25%), 25%) !default; + +.switch label input[type=checkbox] { + opacity: 0; + width: 0; + height: 0; + + &:checked + .lever { + background-color: $switch-checked-lever-bg!important; + + &:before, &:after { + left: 18px; + } + + &:after { + background-color: $switch-bg-color!important; + } + } +}