Fix morescreen (which shows the custom themes now), remove invalid themes automatically
This commit is contained in:
parent
f771695c0b
commit
1e0a1fdf97
5 changed files with 31 additions and 11 deletions
11
State.ts
11
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;
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue