1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Chore: Refactor sync target code to allow labels and descriptions to be translated

This commit is contained in:
Laurent Cozic
2023-12-23 14:19:06 +00:00
parent 5341501d53
commit 7345cd4678
2 changed files with 37 additions and 27 deletions

View File

@@ -5,6 +5,11 @@ import shim from './shim';
import ResourceService from './services/ResourceService';
import ShareService from './services/share/ShareService';
interface CheckConfigResult {
ok: boolean;
errorMessage: string;
}
export default class BaseSyncTarget {
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
@@ -73,17 +78,17 @@ export default class BaseSyncTarget {
return null;
}
public static id() {
public static id(): number {
throw new Error('id() not implemented');
}
// Note: it cannot be called just "name()" because that's a reserved keyword and
// it would throw an obscure error in React Native.
public static targetName() {
public static targetName(): string {
throw new Error('targetName() not implemented');
}
public static label() {
public static label(): string {
throw new Error('label() not implemented');
}
@@ -144,6 +149,10 @@ export default class BaseSyncTarget {
}
}
public static async checkConfig(_options: any): Promise<CheckConfigResult> {
throw new Error('Not implemented');
}
public async syncStarted() {
if (!this.synchronizer_) return false;
if (!(await this.isAuthenticated())) return false;