From b18f5bf7b5cfa1186b35b08f59755fdf61b9c22c Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 22 May 2021 23:15:48 +0100 Subject: [PATCH] Added the Open Mobile app to the navbar when on small devices (mobile) --- src/Ombi/ClientApp/src/app/app.component.html | 12 +++++++- src/Ombi/ClientApp/src/app/app.component.ts | 2 ++ .../src/app/my-nav/my-nav.component.html | 7 +++++ .../src/app/my-nav/my-nav.component.scss | 11 +++++++ .../src/app/my-nav/my-nav.component.ts | 29 +++++++++++++------ 5 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/app.component.html b/src/Ombi/ClientApp/src/app/app.component.html index a8e527a6b..351b8ef49 100644 --- a/src/Ombi/ClientApp/src/app/app.component.html +++ b/src/Ombi/ClientApp/src/app/app.component.html @@ -170,7 +170,17 @@
- + diff --git a/src/Ombi/ClientApp/src/app/app.component.ts b/src/Ombi/ClientApp/src/app/app.component.ts index 356107039..038fcc7d7 100644 --- a/src/Ombi/ClientApp/src/app/app.component.ts +++ b/src/Ombi/ClientApp/src/app/app.component.ts @@ -33,6 +33,7 @@ export class AppComponent implements OnInit { public applicationName: string = "Ombi" public isAdmin: boolean; public username: string; + public accessToken: string; private hubConnected: boolean; @@ -55,6 +56,7 @@ export class AppComponent implements OnInit { if (this.authService.loggedIn()) { this.user = this.authService.claims(); this.username = this.user.name; + this.identity.getAccessToken().subscribe(x => this.accessToken = x); if (!this.hubConnected) { this.signalrNotification.initialize(); this.hubConnected = true; diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html index f73c9bbc8..95f31198b 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html @@ -28,6 +28,13 @@
+ + + +  {{ 'NavigationBar.OpenMobileApp' | translate }} + + diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss index 753759af1..f76109b96 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss @@ -107,10 +107,21 @@ margin-right:5px; } +#nav-openMobile { + display: none; +} + @media (max-width: 600px) { .profile-username{ display:none; } + +} + +@media (max-width: 950px) { + #nav-openMobile { + display: block; + } } .profile-img img { diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts index d65307bdb..57bfaca91 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts @@ -1,16 +1,17 @@ -import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { INavBar } from '../interfaces/ICommon'; -import { StorageService } from '../shared/storage/storage-service'; -import { SettingsService, SettingsStateService } from '../services'; -import { MatSlideToggleChange } from '@angular/material/slide-toggle'; -import { SearchFilter } from './SearchFilter'; -import { Md5 } from 'ts-md5/dist/md5'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { IUser, RequestType, UserType } from '../interfaces'; +import { SettingsService, SettingsStateService } from '../services'; + import { FilterService } from '../discover/services/filter-service'; import { ILocalUser } from '../auth/IUserLogin'; +import { INavBar } from '../interfaces/ICommon'; +import { MatSlideToggleChange } from '@angular/material/slide-toggle'; +import { Md5 } from 'ts-md5/dist/md5'; +import { Observable } from 'rxjs'; +import { SearchFilter } from './SearchFilter'; +import { StorageService } from '../shared/storage/storage-service'; +import { map } from 'rxjs/operators'; export enum SearchFilterType { Movie = 1, @@ -34,6 +35,8 @@ export class MyNavComponent implements OnInit { @Input() public showNav: boolean; @Input() public applicationName: string; @Input() public applicationLogo: string; + @Input() public applicationUrl: string; + @Input() public accessToken: string; @Input() public username: string; @Input() public isAdmin: string; @Input() public email: string; @@ -122,4 +125,12 @@ export class MyNavComponent implements OnInit { var fallback = this.applicationLogo ? this.applicationLogo : 'https://raw.githubusercontent.com/Ombi-app/Ombi/gh-pages/img/android-chrome-512x512.png'; return `https://www.gravatar.com/avatar/${this.emailHash}?d=${fallback}`; } + + public openMobileApp(event: any) { + event.preventDefault(); + + const url = `ombi://${this.applicationUrl}|${this.accessToken}`; + window.location.assign(url); +} + }