mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Added a button for users running the legacy app to launch like they did in V3, this button is in the user preferences area of the site
This commit is contained in:
parent
39680792e9
commit
b6d67b2e24
3 changed files with 18 additions and 6 deletions
|
@ -25,7 +25,8 @@
|
|||
<div class="col-7">
|
||||
<mat-label [translate]="'UserPreferences.MobileQRCode'"></mat-label>
|
||||
<qrcode *ngIf="qrCodeEnabled" [qrdata]="qrCode" [size]="256" [level]="'L'"></qrcode>
|
||||
|
||||
<button mat-raised-button (click)="openMobileApp($event)" *ngIf="customizationSettings.applicationUrl"> {{
|
||||
'UserPreferences.LegacyApp' | translate }}</button>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue