Fix bug with user badge that is not appearing

This commit is contained in:
Pieter Vander Vennet 2020-09-05 23:44:33 +02:00
parent 38f2242426
commit 1ee921b089
2 changed files with 7 additions and 7 deletions

View file

@ -19,7 +19,7 @@ export class MoreScreen extends UIElement {
} }
private static createLinkButton(layout: Layout, customThemeDefinition: string = undefined) { private createLinkButton(layout: Layout, customThemeDefinition: string = undefined) {
if (layout === undefined) { if (layout === undefined) {
return undefined; return undefined;
} }
@ -28,7 +28,9 @@ export class MoreScreen extends UIElement {
return undefined; return undefined;
} }
if (layout.hideFromOverview) { if (layout.hideFromOverview) {
if (State.state.osmConnection.GetPreference("hidden-theme-" + layout.id + "-enabled").data !== "true") { const pref = State.state.osmConnection.GetPreference("hidden-theme-" + layout.id + "-enabled");
this.ListenTo(pref);
if (pref.data !== "true") {
return undefined; return undefined;
} }
} }
@ -93,7 +95,7 @@ export class MoreScreen extends UIElement {
if (layout.id !== k) { if (layout.id !== k) {
continue; // This layout was added multiple time due to an uppercase continue; // This layout was added multiple time due to an uppercase
} }
els.push(MoreScreen.createLinkButton(layout)); els.push(this.createLinkButton(layout));
} }
@ -102,7 +104,7 @@ export class MoreScreen extends UIElement {
els.push(Translations.t.general.customThemeIntro) els.push(Translations.t.general.customThemeIntro)
for (const installed of State.state.installedThemes.data) { for (const installed of State.state.installedThemes.data) {
els.push(MoreScreen.createLinkButton(installed.layout, installed.definition)); els.push(this.createLinkButton(installed.layout, installed.definition));
} }
} }

View file

@ -5,9 +5,7 @@ import {VariableUiElement} from "./Base/VariableUIElement";
import Translations from "./i18n/Translations"; import Translations from "./i18n/Translations";
import {UserDetails} from "../Logic/Osm/OsmConnection"; import {UserDetails} from "../Logic/Osm/OsmConnection";
import {State} from "../State"; import {State} from "../State";
import {Utils} from "../Utils";
import {UIEventSource} from "../Logic/UIEventSource"; import {UIEventSource} from "../Logic/UIEventSource";
import {SubtleButton} from "./Base/SubtleButton";
import {InitUiElements} from "../InitUiElements"; import {InitUiElements} from "../InitUiElements";
import Combine from "./Base/Combine"; import Combine from "./Base/Combine";
@ -25,7 +23,7 @@ export class UserBadge extends UIElement {
constructor() { constructor() {
super(State.state.osmConnection.userDetails); super(State.state.osmConnection.userDetails);
this._userDetails = State.state.osmConnection.userDetails; this._userDetails = State.state.osmConnection.userDetails;
this._languagePicker = InitUiElements.CreateLanguagePicker(); this._languagePicker = InitUiElements.CreateLanguagePicker() ?? new FixedUiElement("");
this._loginButton = Translations.t.general.loginWithOpenStreetMap this._loginButton = Translations.t.general.loginWithOpenStreetMap
.Clone() .Clone()
.SetClass("userbadge-login") .SetClass("userbadge-login")