Add "Disable synchronisation" to Joplin Cloud invalid credentials warning.

pull/11705/head
Amine Zouaoui 2025-01-22 15:54:40 +01:00
parent 64d1da9773
commit 5bb0179661
1 changed files with 21 additions and 14 deletions

View File

@ -305,8 +305,8 @@ class MainScreenComponent extends React.Component<Props, State> {
public componentDidUpdate(prevProps: Props, prevState: State) {
if (prevProps.style.width !== this.props.style.width ||
prevProps.style.height !== this.props.style.height ||
this.messageBoxVisible(prevProps) !== this.messageBoxVisible(this.props)
prevProps.style.height !== this.props.style.height ||
this.messageBoxVisible(prevProps) !== this.messageBoxVisible(this.props)
) {
this.updateRootLayoutSize();
}
@ -465,6 +465,11 @@ class MainScreenComponent extends React.Component<Props, State> {
});
};
const onViewJoplinCloudDisableSync = async () => {
Setting.setValue('sync.target', null);
await Setting.saveAll();
};
const onViewSyncSettingsScreen = () => {
this.props.dispatch({
type: 'NAV_GO',
@ -560,8 +565,10 @@ class MainScreenComponent extends React.Component<Props, State> {
} else if (this.props.showInvalidJoplinCloudCredential) {
msg = this.renderNotificationMessage(
_('Your Joplin Cloud credentials are invalid, please login.'),
_('Login to Joplin Cloud.'),
_('Login to Joplin Cloud'),
onViewJoplinCloudLoginScreen,
_('Disable synchronisation'),
onViewJoplinCloudDisableSync,
);
}
@ -575,17 +582,17 @@ class MainScreenComponent extends React.Component<Props, State> {
public messageBoxVisible(props: Props = null) {
if (!props) props = this.props;
return props.hasDisabledSyncItems ||
props.showMissingMasterKeyMessage ||
props.hasMissingSyncCredentials ||
props.showNeedUpgradingMasterKeyMessage ||
props.showShouldReencryptMessage ||
props.hasDisabledEncryptionItems ||
this.props.shouldUpgradeSyncTarget ||
props.isSafeMode ||
this.showShareInvitationNotification(props) ||
this.props.needApiAuth ||
!!this.props.mustUpgradeAppMessage ||
props.showInvalidJoplinCloudCredential;
props.showMissingMasterKeyMessage ||
props.hasMissingSyncCredentials ||
props.showNeedUpgradingMasterKeyMessage ||
props.showShouldReencryptMessage ||
props.hasDisabledEncryptionItems ||
this.props.shouldUpgradeSyncTarget ||
props.isSafeMode ||
this.showShareInvitationNotification(props) ||
this.props.needApiAuth ||
!!this.props.mustUpgradeAppMessage ||
props.showInvalidJoplinCloudCredential;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied