1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Desktop, Mobile: Resolves #9263: Do not allow switching the sync target if not all resources are downloaded

This commit is contained in:
Laurent Cozic
2024-01-27 18:20:51 +00:00
parent 8abd9b401b
commit 07b4117aa1
6 changed files with 85 additions and 11 deletions

View File

@ -68,7 +68,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
public componentDidMount() {
if (this.props.defaultSection) {
this.setState({ selectedSectionName: this.props.defaultSection }, () => {
this.switchSection(this.props.defaultSection);
void this.switchSection(this.props.defaultSection);
});
}
}
@ -112,7 +112,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
throw new Error(`Invalid screen name: ${screenName}`);
}
public switchSection(name: string) {
public async switchSection(name: string) {
const section = this.sectionByName(name);
let screenName = '';
if (section.isScreen) {
@ -120,7 +120,9 @@ class ConfigScreenComponent extends React.Component<any, any> {
if (this.hasChanges()) {
const ok = confirm(_('This will open a new screen. Save your current changes?'));
if (ok) shared.saveSettings(this);
if (ok) {
await shared.saveSettings(this);
}
}
}
@ -128,7 +130,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
}
private sidebar_selectionChange(event: any) {
this.switchSection(event.section.name);
void this.switchSection(event.section.name);
}
public renderSectionDescription(section: any) {
@ -655,12 +657,15 @@ class ConfigScreenComponent extends React.Component<any, any> {
}
public async onApplyClick() {
shared.saveSettings(this);
const done = await shared.saveSettings(this);
if (!done) return;
await this.checkNeedRestart();
}
public async onSaveClick() {
shared.saveSettings(this);
const done = await shared.saveSettings(this);
if (!done) return;
await this.checkNeedRestart();
this.props.dispatch({ type: 'NAV_BACK' });
}