1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-20 18:48:28 +02:00

Chore: Refactoring: Prefer empty array to KeychainServiceDriverDummy (#11216)

This commit is contained in:
Henry Heino 2024-10-26 13:02:34 -07:00 committed by GitHub
parent c6d319e333
commit 4e7d74e49a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 3 additions and 30 deletions

View File

@ -1142,7 +1142,6 @@ packages/lib/services/keychain/KeychainService.test.js
packages/lib/services/keychain/KeychainService.js
packages/lib/services/keychain/KeychainServiceDriver.dummy.js
packages/lib/services/keychain/KeychainServiceDriver.electron.js
packages/lib/services/keychain/KeychainServiceDriver.mobile.js
packages/lib/services/keychain/KeychainServiceDriver.node.js
packages/lib/services/keychain/KeychainServiceDriverBase.js
packages/lib/services/noteList/defaultLeftToRightListRenderer.js

1
.gitignore vendored
View File

@ -1119,7 +1119,6 @@ packages/lib/services/keychain/KeychainService.test.js
packages/lib/services/keychain/KeychainService.js
packages/lib/services/keychain/KeychainServiceDriver.dummy.js
packages/lib/services/keychain/KeychainServiceDriver.electron.js
packages/lib/services/keychain/KeychainServiceDriver.mobile.js
packages/lib/services/keychain/KeychainServiceDriver.node.js
packages/lib/services/keychain/KeychainServiceDriverBase.js
packages/lib/services/noteList/defaultLeftToRightListRenderer.js

View File

@ -21,7 +21,6 @@ import ShareExtension from './utils/ShareExtension';
import handleShared from './utils/shareHandler';
import uuid from '@joplin/lib/uuid';
import { loadKeychainServiceAndSettings } from '@joplin/lib/services/SettingUtils';
import KeychainServiceDriverMobile from '@joplin/lib/services/keychain/KeychainServiceDriver.mobile';
import { _, setLocale } from '@joplin/lib/locale';
import SyncTargetJoplinServer from '@joplin/lib/SyncTargetJoplinServer';
import SyncTargetJoplinCloud from '@joplin/lib/SyncTargetJoplinCloud';
@ -596,7 +595,7 @@ async function initialize(dispatch: Dispatch) {
reg.logger().info('Database is ready.');
reg.logger().info('Loading settings...');
await loadKeychainServiceAndSettings([KeychainServiceDriverMobile]);
await loadKeychainServiceAndSettings([]);
await migrateMasterPassword();
if (!Setting.value('clientId')) Setting.setValue('clientId', uuid.create());

View File

@ -1,24 +0,0 @@
import KeychainServiceDriverBase from './KeychainServiceDriverBase';
export default class KeychainServiceDriver extends KeychainServiceDriverBase {
public override readonly driverId: string = 'mobile-unknown';
public async supported(): Promise<boolean> {
return false;
}
public async setPassword(/* name:string, password:string*/): Promise<boolean> {
return false;
}
public async password(/* name:string*/): Promise<string> {
return null;
}
public async deletePassword(/* name:string*/): Promise<void> {
}
public async upgradeStorageBackend(_secureKeys: string[], _newDatabaseVersion: number): Promise<void> {
}
}

View File

@ -298,7 +298,7 @@ async function switchClient(id: number, options: any = null) {
Setting.setConstant('pluginDir', pluginDir(id));
Setting.setConstant('isSubProfile', false);
await loadKeychainServiceAndSettings([options.keychainEnabled ? KeychainServiceDriverNode : KeychainServiceDriverDummy]);
await loadKeychainServiceAndSettings(options.keychainEnabled ? [KeychainServiceDriverNode] : []);
Setting.setValue('sync.target', syncTargetId());
Setting.setValue('sync.wipeOutFailSafe', false); // To keep things simple, always disable fail-safe unless explicitly set in the test itself
@ -362,7 +362,7 @@ async function setupDatabase(id: number = null, options: any = null) {
if (databases_[id]) {
BaseModel.setDb(databases_[id]);
await clearDatabase(id);
await loadKeychainServiceAndSettings([options.keychainEnabled ? KeychainServiceDriverNode : KeychainServiceDriverDummy]);
await loadKeychainServiceAndSettings(options.keychainEnabled ? [KeychainServiceDriverNode] : []);
Setting.setValue('sync.target', syncTargetId());
return;
}