Reset mlSearchEnabled on first login
This commit is contained in:
parent
69cdf5179f
commit
55b896ab81
|
@ -565,7 +565,7 @@ export default function App({ Component, err }) {
|
|||
mlWorkManager.setMlSearchEnabled(mlSearchConfig.enabled);
|
||||
eventBus.emit(Events.APP_START);
|
||||
} catch (e) {
|
||||
logError(e, 'Error in appStart handlers');
|
||||
logError(e, 'Error while loading mlSearchEnabled');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -627,11 +627,15 @@ export default function App({ Component, err }) {
|
|||
setTimeout(() => setFlashMessage(null), 5000);
|
||||
};
|
||||
const updateMlSearchEnabled = async (enabled: boolean) => {
|
||||
try {
|
||||
const mlSearchConfig = await getMLSearchConfig();
|
||||
mlSearchConfig.enabled = enabled;
|
||||
await updateMLSearchConfig(mlSearchConfig);
|
||||
setMlSearchEnabled(enabled);
|
||||
mlWorkManager.setMlSearchEnabled(enabled);
|
||||
} catch (e) {
|
||||
logError(e, 'Error while updating mlSearchEnabled');
|
||||
}
|
||||
};
|
||||
// ho ja yaar
|
||||
return (
|
||||
|
|
|
@ -73,6 +73,8 @@ export default function Credentials() {
|
|||
keyAttributes,
|
||||
key
|
||||
);
|
||||
// TODO: not required after reseting appContext on first login
|
||||
appContext.updateMlSearchEnabled(false);
|
||||
}
|
||||
await SaveKeyInSessionStore(SESSION_KEYS.ENCRYPTION_KEY, key);
|
||||
await decryptAndStoreToken(key);
|
||||
|
|
|
@ -242,7 +242,7 @@ class MLWorkManager {
|
|||
public stopSyncJob(terminateWorker: boolean = true) {
|
||||
try {
|
||||
console.log('MLWorkManager.stopSyncJob');
|
||||
this.mlSyncJob.stop();
|
||||
this.mlSyncJob?.stop();
|
||||
terminateWorker && this.terminateSyncJobWorker();
|
||||
} catch (e) {
|
||||
logError(e, 'Failed to stop MLSync Job');
|
||||
|
|
Loading…
Reference in a new issue