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