You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Desktop, Mobile: Fixes #10645: Show notification in case Joplin Cloud credential is not valid anymore (#10649)
This commit is contained in:
@@ -2,6 +2,7 @@ import Logger from '@joplin/utils/Logger';
|
||||
import Setting from './models/Setting';
|
||||
import shim from './shim';
|
||||
import SyncTargetRegistry from './SyncTargetRegistry';
|
||||
import { AnyAction, Dispatch } from 'redux';
|
||||
|
||||
class Registry {
|
||||
|
||||
@@ -21,6 +22,7 @@ class Registry {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
private db_: any;
|
||||
private isOnMobileData_ = false;
|
||||
private dispatch_: Dispatch = (() => {}) as Dispatch;
|
||||
|
||||
public logger() {
|
||||
if (!this.logger_) {
|
||||
@@ -45,6 +47,14 @@ class Registry {
|
||||
this.showErrorMessageBoxHandler_(message);
|
||||
}
|
||||
|
||||
public setDispatch(dispatch: Dispatch) {
|
||||
this.dispatch_ = dispatch;
|
||||
}
|
||||
|
||||
private dispatch(action: AnyAction) {
|
||||
return this.dispatch_(action);
|
||||
}
|
||||
|
||||
// If isOnMobileData is true, the doWifiConnectionCheck is not set
|
||||
// and the sync.mobileWifiOnly setting is true it will cancel the sync.
|
||||
public setIsOnMobileData(isOnMobileData: boolean) {
|
||||
@@ -139,10 +149,18 @@ class Registry {
|
||||
}
|
||||
|
||||
if (!(await this.syncTarget(syncTargetId).isAuthenticated())) {
|
||||
this.dispatch({
|
||||
type: 'MUST_AUTHENTICATE',
|
||||
value: true,
|
||||
});
|
||||
this.logger().info('Synchroniser is missing credentials - manual sync required to authenticate.');
|
||||
promiseResolve();
|
||||
return;
|
||||
}
|
||||
this.dispatch({
|
||||
type: 'MUST_AUTHENTICATE',
|
||||
value: false,
|
||||
});
|
||||
|
||||
try {
|
||||
const sync = await this.syncTarget(syncTargetId).synchronizer();
|
||||
|
||||
Reference in New Issue
Block a user