mirror of
https://github.com/standardnotes/mobile.git
synced 2026-02-05 21:41:23 -05:00
Merge pull request #232 from standardnotes/theme-fix
Deactivate themes that have been uninstalled
This commit is contained in:
@@ -131,7 +131,7 @@ export default class ComponentManager extends SNComponentManager {
|
||||
}
|
||||
|
||||
if (editor) {
|
||||
if (note.content.mobilePrefersPlainEditor == true) {
|
||||
if (note.content.mobilePrefersPlainEditor === true) {
|
||||
note.content.mobilePrefersPlainEditor = false;
|
||||
note.setDirty(true);
|
||||
}
|
||||
|
||||
@@ -49,12 +49,20 @@ export default class StyleKit {
|
||||
this.activeTheme.isSwapIn = false;
|
||||
}
|
||||
}
|
||||
|
||||
const activeUuid = this.activeTheme.uuid;
|
||||
for (const theme of deletedItems) {
|
||||
if (activeUuid === theme.uuid) {
|
||||
this.resetToSystemTheme();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.signoutObserver = Auth.get().addEventHandler(event => {
|
||||
if (event === SFAuthManager.DidSignOutEvent) {
|
||||
this.activateTheme(this.systemThemes[0]);
|
||||
this.resetToSystemTheme();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -92,10 +100,10 @@ export default class StyleKit {
|
||||
|
||||
/**
|
||||
* If we're changing the theme for a specific mode and we're currently on
|
||||
* that mode, then set this theme as active
|
||||
* that mode, then activate this theme.
|
||||
*/
|
||||
if (this.currentDarkMode === mode && this.activeTheme.uuid !== theme.uuid) {
|
||||
this.setActiveTheme(theme);
|
||||
this.activateTheme(theme);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +157,13 @@ export default class StyleKit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
resetToSystemTheme() {
|
||||
this.activateTheme(this.systemThemes[0]);
|
||||
}
|
||||
|
||||
async resolveInitialTheme() {
|
||||
const currentMode = this.currentDarkMode;
|
||||
const runDefaultTheme = () => {
|
||||
@@ -275,6 +290,7 @@ export default class StyleKit {
|
||||
|
||||
activateTheme(theme) {
|
||||
const performActivation = () => {
|
||||
this.setActiveTheme(theme);
|
||||
this.assignThemeForMode({ theme: theme, mode: this.currentDarkMode });
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user