diff --git a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html index 402c683f1..0b0016c98 100644 --- a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html +++ b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html @@ -25,7 +25,8 @@
- +
diff --git a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts index 3e4163ea0..7969bdd45 100644 --- a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts +++ b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.ts @@ -4,7 +4,7 @@ import { TranslateService } from "@ngx-translate/core"; import { AvailableLanguages, ILanguage } from "./user-preference.constants"; import { StorageService } from "../../../shared/storage/storage-service"; import { IdentityService, NotificationService, SettingsService } from "../../../services"; -import { IUser } from "../../../interfaces"; +import { ICustomizationSettings, IUser } from "../../../interfaces"; @Component({ templateUrl: "./user-preference.component.html", @@ -19,6 +19,7 @@ export class UserPreferenceComponent implements OnInit { public qrCodeEnabled: boolean; public countries: string[]; public selectedCountry: string; + public customizationSettings: ICustomizationSettings; private user: IUser; @@ -33,14 +34,14 @@ export class UserPreferenceComponent implements OnInit { if (user.name) { this.username = user.name; } - const customization = await this.settingsService.getCustomization().toPromise(); + this.customizationSettings = await this.settingsService.getCustomization().toPromise(); this.selectedLang = this.translate.currentLang; const accessToken = await this.identityService.getAccessToken().toPromise(); - this.qrCode = `${customization.applicationUrl}|${accessToken}`; + this.qrCode = `${this.customizationSettings.applicationUrl}|${accessToken}`; - if(!customization.applicationUrl) { + if(!this.customizationSettings.applicationUrl) { this.qrCodeEnabled = false; } else { this.qrCodeEnabled = true; @@ -49,6 +50,7 @@ export class UserPreferenceComponent implements OnInit { this.user = await this.identityService.getUser().toPromise(); this.selectedCountry = this.user.streamingCountry; this.identityService.getSupportedStreamingCountries().subscribe(x => this.countries = x); + this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); } @@ -61,4 +63,12 @@ export class UserPreferenceComponent implements OnInit { this.identityService.updateStreamingCountry(this.selectedCountry).subscribe(x => this.notification.success(this.translate.instant("UserPreferences.Updated"))); } + public openMobileApp(event: any) { + event.preventDefault(); + + this.identityService.getAccessToken().subscribe(x => { + const url = `ombi://${this.customizationSettings.applicationUrl}_${x}`; + window.location.assign(url); + }); + } } diff --git a/src/Ombi/wwwroot/translations/en.json b/src/Ombi/wwwroot/translations/en.json index 015a65a00..4ae2ade0b 100644 --- a/src/Ombi/wwwroot/translations/en.json +++ b/src/Ombi/wwwroot/translations/en.json @@ -306,6 +306,7 @@ "StreamingCountry":"Streaming Country", "StreamingCountryDescription": "This is the country code that we will display streaming information for. If you are in the US please select US and you will have US related streaming information.", "LanguageDescription": "This is the language you would like the Ombi interface to be displayed in.", - "MobileQRCode":"Mobile QR Code" + "MobileQRCode":"Mobile QR Code", + "LegacyApp":"Launch Legacy App" } } \ No newline at end of file