diff --git a/InitUiElements.ts b/InitUiElements.ts index 7c5a2ea..729b509 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -282,12 +282,7 @@ export class InitUiElements { tabs.push({ header: ``, - content: new VariableUiElement(State.state.osmConnection.userDetails.map(userdetails => { - if(userdetails.csCount < State.userJourney.moreScreenUnlock){ - return ""; - } - return new MoreScreen().Render() - }, [Locale.language])) + content: new MoreScreen() }); } diff --git a/Logic/Osm/OsmPreferences.ts b/Logic/Osm/OsmPreferences.ts index 8ff413a..7a00639 100644 --- a/Logic/Osm/OsmPreferences.ts +++ b/Logic/Osm/OsmPreferences.ts @@ -41,7 +41,19 @@ export class OsmPreferences { const self = this; source.addCallback(str => { if (str === undefined || str === "") { - return + return; + } + if(str === null){ + console.error("Deleting "+allStartWith); + let count = parseInt(length.data); + for (let i = 0; i < count; i++) { + // Delete all the preferences + self.GetPreference(allStartWith + "-" + i, "") + .setData(""); + } + self.GetPreference(allStartWith + "-length", "") + .setData(""); + return } let i = 0; @@ -75,7 +87,6 @@ export class OsmPreferences { } source.setData(str); - console.log("Long preference", key, "has", str.length, "chars"); } length.addCallback(l => { diff --git a/State.ts b/State.ts index 0d5e8c3..bbe2f57 100644 --- a/State.ts +++ b/State.ts @@ -205,6 +205,7 @@ export default class State { if (allPreferences === undefined) { return installedThemes; } + const invalidThemes = [] for (const allPreferencesKey in allPreferences) { const themename = allPreferencesKey.match(/^mapcomplete-installed-theme-(.*)-combined-length$/); if (themename && themename[1] !== "") { @@ -226,11 +227,19 @@ export default class State { definition: customLayout.data }); } catch (e) { - console.warn("Could not parse custom layout from preferences: ", allPreferencesKey, e, customLayout.data); + console.warn("Could not parse custom layout from preferences - deleting: ", allPreferencesKey, e, customLayout.data); + invalidThemes.push(themename[1]) } } } + for (const invalid of invalidThemes) { + console.error("Attempting to remove ", invalid) + this.osmConnection.GetLongPreference( + "installed-theme-" + invalid + ).setData(null); + } + return installedThemes; }); diff --git a/UI/Base/TabbedComponent.ts b/UI/Base/TabbedComponent.ts index e7204db..a0c36ef 100644 --- a/UI/Base/TabbedComponent.ts +++ b/UI/Base/TabbedComponent.ts @@ -14,7 +14,6 @@ export class TabbedComponent extends UIElement { let element = elements[i]; this.headers.push(Translations.W(element.header).onClick(() => self._source.setData(i))); const content = Translations.W(element.content) - this.ListenTo(content) this.content.push(content); } } @@ -34,6 +33,7 @@ export class TabbedComponent extends UIElement { headerBar = "
" const content = this.content[this._source.data]; + console.log("Rendering tab", this._source.data); return headerBar + "