mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SEARCH-444
- Implemented a function to delete the index folder
This commit is contained in:
parent
384b114670
commit
222e52cbdf
@ -18,7 +18,7 @@ const protocolHandler = require('./protocolHandler');
|
||||
const getCmdLineArg = require('./utils/getCmdLineArg.js');
|
||||
const log = require('./log.js');
|
||||
const logLevels = require('./enums/logLevels.js');
|
||||
const { clearIndexFolder } = require('./search/search');
|
||||
const { deleteIndexFolder } = require('./search/search.js');
|
||||
|
||||
require('electron-dl')();
|
||||
|
||||
@ -131,7 +131,7 @@ app.on('activate', function() {
|
||||
|
||||
app.on('will-quit', function (e) {
|
||||
e.preventDefault();
|
||||
clearIndexFolder();
|
||||
deleteIndexFolder();
|
||||
app.exit();
|
||||
});
|
||||
|
||||
|
@ -139,7 +139,7 @@ function createAPI() {
|
||||
/**
|
||||
* Function to clear the user index data
|
||||
*/
|
||||
clearIndexFolder: remote.require('./search/search.js').clearIndexFolder,
|
||||
deleteIndexFolder: remote.require('./search/search.js').deleteIndexFolder,
|
||||
|
||||
/**
|
||||
* Brings window forward and gives focus.
|
||||
|
@ -538,9 +538,9 @@ class Search {
|
||||
|
||||
/**
|
||||
* Deleting the data index folder
|
||||
* when the app is closed
|
||||
* when the app is closed/signed-out/navigates
|
||||
*/
|
||||
function clearIndexFolder() {
|
||||
function deleteIndexFolder() {
|
||||
Search.deleteFolderRecursive(INDEX_DATA_FOLDER);
|
||||
}
|
||||
|
||||
@ -550,5 +550,5 @@ function clearIndexFolder() {
|
||||
*/
|
||||
module.exports = {
|
||||
Search: Search,
|
||||
clearIndexFolder: clearIndexFolder
|
||||
deleteIndexFolder: deleteIndexFolder
|
||||
};
|
||||
|
@ -20,6 +20,7 @@ const eventEmitter = require('./eventEmitter');
|
||||
const throttle = require('./utils/throttle.js');
|
||||
const { getConfigField, updateConfigField } = require('./config.js');
|
||||
const { isMac, isNodeEnv } = require('./utils/misc');
|
||||
const { deleteIndexFolder } = require('./search/search.js');
|
||||
|
||||
// show dialog when certificate errors occur
|
||||
require('./dialogs/showCertError.js');
|
||||
@ -256,6 +257,11 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
||||
});
|
||||
});
|
||||
|
||||
// To delete the user index data folder on navigation
|
||||
mainWindow.webContents.on('will-navigate', () => {
|
||||
deleteIndexFolder();
|
||||
});
|
||||
|
||||
getConfigField('url')
|
||||
.then(initializeCrashReporter)
|
||||
.catch(app.quit);
|
||||
|
Loading…
Reference in New Issue
Block a user