mirror of
https://github.com/standardnotes/mobile.git
synced 2026-04-19 21:58:51 -04:00
Restore isMobileActive, component url handling
This commit is contained in:
@@ -28,7 +28,7 @@ export default class GlobalStyles {
|
||||
return Storage.getItem("activeTheme").then(function(theme) {
|
||||
let runDefaultTheme = () => {
|
||||
var theme = this.systemTheme();
|
||||
theme.active = true;
|
||||
theme.setMobileActive(true);
|
||||
this.activeTheme = theme;
|
||||
var constants = this.defaultConstants();
|
||||
this.setStyles(this.defaultRules(constants), constants, theme.getMobileRules().statusBar);
|
||||
@@ -62,9 +62,12 @@ export default class GlobalStyles {
|
||||
|
||||
ModelManager.getInstance().addItemSyncObserver("themes", "SN|Theme", function(items){
|
||||
if(this.activeTheme && this.activeTheme.isSwapIn) {
|
||||
this.activeTheme.isSwapIn = false;
|
||||
this.activeTheme = _.find(this.themes(), {uuid: this.activeTheme.uuid});
|
||||
this.activeTheme.active = true;
|
||||
var matchingTheme = _.find(this.themes(), {uuid: this.activeTheme.uuid});
|
||||
if(matchingTheme) {
|
||||
this.activeTheme = matchingTheme;
|
||||
this.activeTheme.isSwapIn = false;
|
||||
this.activeTheme.setMobileActive(true);
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
@@ -137,16 +140,18 @@ export default class GlobalStyles {
|
||||
|
||||
activateTheme(theme, writeToStorage = true) {
|
||||
if(this.activeTheme) {
|
||||
this.activeTheme.active = false;
|
||||
this.activeTheme.setMobileActive(false);
|
||||
}
|
||||
|
||||
console.log("Activating theme", JSON.stringify(theme));
|
||||
|
||||
var run = () => {
|
||||
var constants = _.merge(this.defaultConstants(), theme.getMobileRules().constants);
|
||||
var rules = _.merge(this.defaultRules(constants), theme.getMobileRules().rules);
|
||||
this.setStyles(rules, constants, theme.getMobileRules().statusBar);
|
||||
|
||||
this.activeTheme = theme;
|
||||
theme.active = true;
|
||||
theme.setMobileActive(true);
|
||||
|
||||
if(theme.default) {
|
||||
Storage.removeItem("activeTheme");
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class ThemesSection extends Component {
|
||||
text={theme.name}
|
||||
key={theme.uuid}
|
||||
first={i == 0}
|
||||
selected={() => {return theme.active}}
|
||||
selected={() => {return theme.isMobileActive()}}
|
||||
dimmed={theme.getNotAvailOnMobile()}
|
||||
last={i == this.props.themes.length - 1 && this.props.themes.length > 1}
|
||||
/>
|
||||
|
||||
@@ -22,10 +22,10 @@ export default class Component extends Item {
|
||||
mapContentToLocalProperties(content) {
|
||||
super.mapContentToLocalProperties(content)
|
||||
/* Legacy */
|
||||
this.url = content.url;
|
||||
this.url = content.url || content.hosted_url;
|
||||
/* New */
|
||||
this.local_url = content.local_url;
|
||||
this.hosted_url = content.hosted_url;
|
||||
this.hosted_url = content.hosted_url || content.url;
|
||||
this.offlineOnly = content.offlineOnly;
|
||||
|
||||
if(content.valid_until) {
|
||||
|
||||
@@ -35,4 +35,13 @@ export default class Theme extends Component {
|
||||
getNotAvailOnMobile() {
|
||||
return this.getAppDataItem("notAvailableOnMobile");
|
||||
}
|
||||
|
||||
/* We must not use .active because if you set that to true, it will also activate that theme on desktop/web */
|
||||
setMobileActive(active) {
|
||||
this.setAppDataItem("mobileActive", active);
|
||||
}
|
||||
|
||||
isMobileActive() {
|
||||
return this.getAppDataItem("mobileActive");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,9 @@ export default class Notes extends Abstract {
|
||||
Sync.getInstance().removeSyncObserver(this.syncObserver);
|
||||
Sync.getInstance().removeSyncStatusObserver(this.syncStatusObserver);
|
||||
Auth.getInstance().removeEventObserver(this.signoutObserver);
|
||||
this.options.removeChangeObserver(this.optionsObserver);
|
||||
if(this.options) {
|
||||
this.options.removeChangeObserver(this.optionsObserver);
|
||||
}
|
||||
clearInterval(this.syncTimer);
|
||||
}
|
||||
|
||||
|
||||
2
vendor/react-native-navigation
vendored
2
vendor/react-native-navigation
vendored
Submodule vendor/react-native-navigation updated: 1929e1ee82...ee16d43513
Reference in New Issue
Block a user