Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve clear cache #2869

Merged
merged 164 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
7545169
change snapcraft login
jeanfbrito Nov 25, 2022
e5371bc
fix lint
jeanfbrito Nov 25, 2022
f775d61
export SNAPCRAFT_STORE_CREDENTIALS
jeanfbrito Nov 25, 2022
f8b303b
install gnome-keyring
jeanfbrito Nov 26, 2022
16aabba
try another thing
jeanfbrito Nov 26, 2022
87a3fd7
Merge branch 'master' into develop
jeanfbrito Dec 5, 2022
9bc5af4
Merge branch 'master' into develop
jeanfbrito Jan 11, 2023
9c10028
chore/pexip window picker (#2577)
jeanfbrito Jan 11, 2023
ec69a52
change allowJitsiCaptureScreen to allowVideoCallCaptureScreen
jeanfbrito Jan 11, 2023
e4cc194
move to version 3.9.0 and update electron
jeanfbrito Jan 11, 2023
66ee0ff
resize video call window
jeanfbrito Jan 11, 2023
af43e57
fix: screen share picker not working after close
jeanfbrito Jan 17, 2023
6b1cb96
remove devTools on video call window
jeanfbrito Jan 17, 2023
d093beb
remove devTools
jeanfbrito Jan 17, 2023
09dbd71
increase dev version
jeanfbrito Jan 18, 2023
be84f26
update to Electron v22.1.0
jeanfbrito Jan 30, 2023
81c9bae
fix: Copy link not working on Electron v22 (#2602)
jeanfbrito Feb 8, 2023
7925ea7
Chore: use electron-builder informations for AppId (#2606)
jeanfbrito Feb 13, 2023
6e7da2c
fix Jitsi screen sharing
jeanfbrito Feb 16, 2023
6218176
fix m1 running yarn
jeanfbrito Feb 16, 2023
f2d6054
make only jitsiMeetElectron need permission
jeanfbrito Feb 16, 2023
4ce2472
fix: pexip dual screen mode
jeanfbrito Feb 24, 2023
426570b
fix lint
jeanfbrito Feb 24, 2023
bd3c223
chore: Add clear screen capture permissions button
jeanfbrito Feb 27, 2023
5749a17
fix: Open video call window on the actual screen
jeanfbrito Feb 27, 2023
d7c8af8
bump dev version to 3.9.2
jeanfbrito Feb 27, 2023
2f3bb1d
update to electron 22.3.1
jeanfbrito Feb 28, 2023
5f318ef
fix fetchSources repeating on every draw
jeanfbrito Mar 1, 2023
d9219e4
fix getting the screen of the application window position
jeanfbrito Mar 1, 2023
4175695
bump to version 3.9.3
jeanfbrito Mar 1, 2023
1b4b74e
disable mac targets to try build
jeanfbrito Mar 1, 2023
0660f28
bump version
jeanfbrito Mar 16, 2023
4986f6f
fix: Add screenCapture request to mac builds
jeanfbrito Mar 17, 2023
369af68
fix screen picker dialog size
jeanfbrito Mar 20, 2023
664e0fc
chore: implement conference deeplink (#2617)
dougfabris Mar 20, 2023
ef65b07
chore: Check screen recording permission (#2623)
jeanfbrito Mar 22, 2023
e776691
add dotenv
jeanfbrito Apr 10, 2023
619c1f4
expose getOutlookEvents to DesktopAPI
jeanfbrito Apr 10, 2023
a8995ba
wip
jeanfbrito Apr 18, 2023
39012c6
wip
jeanfbrito Apr 20, 2023
3f50586
Ntlm Authentication
pierre-lehnen-rc Apr 25, 2023
6b15990
Merge branch 'jb-ntlm' into ntlm-login
jeanfbrito Apr 27, 2023
155dca5
wip
jeanfbrito Apr 27, 2023
405ffea
wip
jeanfbrito May 2, 2023
9d46c92
WIP
jeanfbrito May 3, 2023
f05906c
wip
jeanfbrito May 3, 2023
44ac6c2
wip
jeanfbrito May 3, 2023
7c8f480
wip
jeanfbrito May 3, 2023
1ed1132
wip
jeanfbrito May 4, 2023
72658d3
wip
jeanfbrito May 4, 2023
5aaeece
remove unused dotenv
jeanfbrito May 4, 2023
201e343
add required fields
jeanfbrito May 5, 2023
9b91c83
fix type error
jeanfbrito May 5, 2023
5c88091
Merge remote-tracking branch 'origin/master' into ntlm-login
pierre-lehnen-rc May 8, 2023
e55f0d0
changed response type to include a status
pierre-lehnen-rc May 8, 2023
c1b4ba7
add clear and has credentials functions
jeanfbrito May 8, 2023
785605a
fix set credentials
jeanfbrito May 9, 2023
d791c7c
add required field validation
jeanfbrito May 9, 2023
1d0bde6
clear field after submit
jeanfbrito May 9, 2023
17a44d0
chore: RHF
dougfabris May 9, 2023
f99f5c5
fix error on filtered appointments
jeanfbrito May 10, 2023
c7181f7
clear fields after submit
jeanfbrito May 10, 2023
92abdba
add EN translation
jeanfbrito May 10, 2023
bfa27a7
focus on dialog window and clear fields on cancel
jeanfbrito May 11, 2023
3caca2f
translate
jeanfbrito May 11, 2023
5800774
create auto sync
jeanfbrito May 12, 2023
aeaba4c
chore: dialog title
dougfabris May 12, 2023
56d670d
wip auto sync
jeanfbrito May 12, 2023
82f0777
Merge branch 'ntlm-login' of https://github.com/RocketChat/Rocket.Cha…
jeanfbrito May 12, 2023
6090232
autosync wip
jeanfbrito May 16, 2023
0d55741
code cleanup
jeanfbrito May 16, 2023
07e1209
lint fix
jeanfbrito May 17, 2023
66f8084
fix manual sync
jeanfbrito May 17, 2023
28a0583
fix error
jeanfbrito May 17, 2023
077d60a
report errors
pierre-lehnen-rc May 18, 2023
ce7a651
Load events on startup
pierre-lehnen-rc May 18, 2023
df5d850
Merge branch 'master' into develop
jeanfbrito May 23, 2023
c611514
Merge branch 'ntlm-login' into develop
jeanfbrito May 23, 2023
e8f4d1c
add unsupported server pane
jeanfbrito Aug 24, 2023
1af7c33
wip
jeanfbrito Aug 29, 2023
d87b986
read file with JWT and load serverInfo
jeanfbrito Aug 31, 2023
96fd388
remove setSupportedVersions from preload
jeanfbrito Aug 31, 2023
5498b42
check if server is supported on webview load
jeanfbrito Aug 31, 2023
13632b9
check server support after load
jeanfbrito Sep 4, 2023
0fc8502
saving decoded supported versions for debug
jeanfbrito Sep 5, 2023
2e92897
create supported version dialog
jeanfbrito Sep 5, 2023
fd4c1a9
show message after some time again
jeanfbrito Sep 8, 2023
53c31c6
only show message when the expiring server is shown
jeanfbrito Sep 8, 2023
b493a76
ignore if there is no expirationMessage
jeanfbrito Sep 8, 2023
e6447c4
improve code organization
jeanfbrito Sep 8, 2023
e8eedba
make translation work with app language
jeanfbrito Sep 8, 2023
6690bbe
add ModalBackDrop
jeanfbrito Sep 8, 2023
239bbe5
use onDismiss
jeanfbrito Sep 12, 2023
713d908
use State component
jeanfbrito Sep 13, 2023
d26272d
add margin to modal
jeanfbrito Sep 13, 2023
6908c56
Merge branch 'master' into lts-support-announcement
jeanfbrito Sep 22, 2023
1934b80
download from cloud on build
jeanfbrito Oct 13, 2023
3718be6
add enforcementStartDate
jeanfbrito Oct 13, 2023
4872ac8
use cloud info
jeanfbrito Oct 16, 2023
ff48b20
fix loading server and other QA things
jeanfbrito Oct 17, 2023
ea05046
make learn more link open on external browser
jeanfbrito Oct 17, 2023
02b6cf7
reactivate not alert before 15 days and on each 12 hours
jeanfbrito Oct 17, 2023
eceb92f
add back expirationMessage title from cloud
jeanfbrito Oct 20, 2023
87149d5
add source of supported versions to config
jeanfbrito Oct 20, 2023
63b5a0a
get back in check only minor version
jeanfbrito Oct 20, 2023
a62edaa
Merge branch 'lts-support-announcement' into develop
jeanfbrito Oct 20, 2023
8df472e
fix import
jeanfbrito Oct 20, 2023
645a5c0
Merge branch 'master' into develop
jeanfbrito Oct 20, 2023
50f7ff1
handle errors on fetching servers
jeanfbrito Oct 23, 2023
f8801b7
fix using cloud info
jeanfbrito Oct 23, 2023
a430ec8
Merge branch 'lts-support-announcement' into develop
jeanfbrito Oct 23, 2023
a82c341
update yarn.lock
jeanfbrito Oct 23, 2023
a750c6a
update workspaces
jeanfbrito Oct 23, 2023
eb1223a
show server version on console
jeanfbrito Oct 23, 2023
899caa6
diferentiate name for develop version
jeanfbrito Oct 23, 2023
03f711a
fix build in windows
jeanfbrito Oct 23, 2023
2dfba7d
fix sv file on windows
jeanfbrito Oct 23, 2023
f83414e
fix lint
jeanfbrito Oct 23, 2023
bccf7b1
change to get info from server API and not by injection
jeanfbrito Oct 25, 2023
ebf8c5a
fix last day by using hours to compare
jeanfbrito Oct 25, 2023
b37151f
add mas and dmg build back
jeanfbrito Oct 26, 2023
dd6fa26
fix lint
jeanfbrito Oct 26, 2023
be47405
fix bug getting cloud info
jeanfbrito Oct 27, 2023
2ba809c
fix lint
jeanfbrito Oct 31, 2023
99314a5
remove 15 days hard coded filter
jeanfbrito Oct 31, 2023
9c5c94f
Redo SV (#2765)
jeanfbrito Nov 8, 2023
97bad31
watch currentView to check sv
jeanfbrito Nov 8, 2023
5b86011
chore: Update hu.i18n.json (#2768)
urbalazs Nov 10, 2023
c837459
Merge branch 'master' into develop
jeanfbrito Nov 10, 2023
ca70a4f
add persistence debounce back
jeanfbrito Nov 10, 2023
d39b25b
add back mac build types
jeanfbrito Nov 10, 2023
871d832
clean injected code
jeanfbrito Nov 10, 2023
5d3a5eb
remove unused code
jeanfbrito Nov 10, 2023
ad97c10
lint fix
jeanfbrito Nov 10, 2023
228a3cf
remove develop name
jeanfbrito Nov 10, 2023
44faad6
fix overlay color
jeanfbrito Nov 13, 2023
eaad48f
rollback electron to version 22.3.27
jeanfbrito Nov 13, 2023
ce9296c
fix message showing empty
jeanfbrito Dec 6, 2023
87299eb
add back 12 hours and check after reload
jeanfbrito Dec 6, 2023
dc8244e
use axios instead of fetch
jeanfbrito Nov 6, 2023
7d2eaac
Merge branch 'master' into develop
jeanfbrito Dec 6, 2023
c099ac8
increase bundleVersion
jeanfbrito Dec 6, 2023
a2e1569
update yarn.lock
jeanfbrito Dec 6, 2023
50e3064
fix exception messages not showing
jeanfbrito Dec 26, 2023
ecd5e6b
update SV when reloaded
jeanfbrito Oct 31, 2023
74ae68d
fix loop
jeanfbrito Dec 30, 2023
96d0f98
disable persist store debounce
jeanfbrito Dec 6, 2023
fd4ed46
Merge branch 'master' into develop
jeanfbrito Mar 18, 2024
38ba543
chore: Update to Electron 29.1.4 (#2866)
jeanfbrito Mar 20, 2024
9a8b2a6
add Reload clearing cache on server actions
jeanfbrito Mar 25, 2024
30644e6
change reload ignoring cache to reload clearing cache
jeanfbrito Mar 25, 2024
c87dfe4
open dialog to user on clear cache
jeanfbrito Mar 26, 2024
0d138f3
change layout and texts
jeanfbrito Mar 27, 2024
25cd1bc
remove console log
jeanfbrito Mar 27, 2024
6f0712f
rename functions
jeanfbrito Mar 27, 2024
1b8e153
change text to force reload
jeanfbrito Mar 27, 2024
a72938b
Add PR build
jeanfbrito Apr 5, 2024
5d0fae6
change provision profile
jeanfbrito Apr 5, 2024
6781ab9
Merge branch 'develop' into chore-improve-clear-cache
jeanfbrito Apr 5, 2024
327ea37
Merge branch 'master' into chore-improve-clear-cache
jeanfbrito Apr 5, 2024
2d6c1c2
notarize even on pull request
jeanfbrito Apr 5, 2024
98e5037
change the notarize env var
jeanfbrito Apr 8, 2024
cbc1bc0
add clearing cache state for modal
jeanfbrito Apr 10, 2024
97c7685
Merge branch 'master' into chore-improve-clear-cache
jeanfbrito May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
"yes": "Yes",
"no": "No"
},
"clearCache": {
"announcement": "Clearing cache",
"title": "Keep your login session?",
"message": "By deleting your login session you will be logged out and asked to inform your credentials again.",
"keepLoginData": "Keep login session",
"deleteLoginData": "Delete login session",
"cancel": "Cancel"
},
"downloadRemoval": {
"title": "Are you sure?",
"message": "Remove this download?",
Expand Down Expand Up @@ -277,7 +285,7 @@
"quit": "&Quit {{- appName}}",
"redo": "&Redo",
"reload": "&Reload",
"reloadIgnoringCache": "Reload ignoring cache",
"reloadClearingCache": "Force reload",
"reportIssue": "Report issue",
"resetAppData": "Reset app data",
"resetZoom": "Reset zoom",
Expand Down Expand Up @@ -321,7 +329,8 @@
"openDevTools": "Open DevTools",
"clearCache": "Clear Cache",
"clearStorageData": "Clear Storage Data",
"copyCurrentUrl": "Copy current URL"
"copyCurrentUrl": "Copy current URL",
"reloadClearingCache": "Force reload"
}
},
"touchBar": {
Expand Down Expand Up @@ -352,4 +361,4 @@
"unreadMention": "Unread mentions",
"noUnreadMessage": "No unread messages"
}
}
}
15 changes: 12 additions & 3 deletions src/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
"yes": "Sim",
"no": "Não"
},
"clearCache": {
"announcement": "Limpeza de cache",
"title": "Deseja manter a sessão de login?",
"message": "Ao excluir sua sessão de login, você será desconectado e precisará informar suas credenciais novamente.",
"keepLoginData": "Manter sessão de login",
"deleteLoginData": "Excluir sessão de login",
"cancel": "Cancelar"
},
"downloadRemoval": {
"title": "Você tem certeza?",
"message": "Remover este download?",
Expand Down Expand Up @@ -263,7 +271,7 @@
"quit": "&Sair do {{- appName}}",
"redo": "&Refazer",
"reload": "&Recarregar",
"reloadIgnoringCache": "Recarregar ignorando o cache",
"reloadClearingCache": "Forçar recarregamento",
"reportIssue": "Reportar problema",
"resetAppData": "Limpar dados do aplicativo",
"resetZoom": "Redefinir zoom",
Expand Down Expand Up @@ -307,7 +315,8 @@
"openDevTools": "Abrir DevTools",
"clearCache": "Limpar cache",
"clearStorageData": "Limpar dados de armazenamento",
"copyCurrentUrl": "Copiar URL atual"
"copyCurrentUrl": "Copiar URL atual",
"reloadClearingCache": "Forçar recarregamento"
}
},
"touchBar": {
Expand Down Expand Up @@ -338,4 +347,4 @@
"unreadMention": "Menções não lidas",
"noUnreadMessage": "Nenhuma mensagem"
}
}
}
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { setupNavigation } from './navigation/main';
import { setupNotifications } from './notifications/main';
import { startOutlookCalendarUrlHandler } from './outlookCalendar/ipc';
import { setupScreenSharing } from './screenSharing/main';
import { handleClearCacheDialog } from './servers/cache';
import { setupServers } from './servers/main';
import { checkSupportedVersionServers } from './servers/supportedVersions/main';
import { setupSpellChecking } from './spellChecking/main';
Expand Down Expand Up @@ -98,6 +99,7 @@ const start = async (): Promise<void> => {
watchAndPersistChanges();
handleJitsiDesktopCapturerGetSources();
handleDesktopCapturerGetSources();
handleClearCacheDialog();
startOutlookCalendarUrlHandler();
startDocumentViewerHandler();
checkSupportedVersionServers();
Expand Down
53 changes: 53 additions & 0 deletions src/servers/cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { webContents, type WebContents } from 'electron';

import { listen } from '../store';
import {
CLEAR_CACHE_DIALOG_DELETE_LOGIN_DATA_CLICKED,
CLEAR_CACHE_DIALOG_KEEP_LOGIN_DATA_CLICKED,
} from '../ui/actions';

export const clearWebviewStorageKeepingLoginData = async (
guestWebContents: WebContents
) => {
if (!guestWebContents) return;
await guestWebContents.session.clearCache();
await guestWebContents.session.clearStorageData({
storages: [
'cookies',
'indexdb',
'filesystem',
'shadercache',
'websql',
'serviceworkers',
'cachestorage',
],
});
guestWebContents?.reloadIgnoringCache();
};

export const clearWebviewStorageDeletingLoginData = async (
guestWebContents: WebContents
) => {
if (!guestWebContents) return;
await guestWebContents.session.clearCache();
await guestWebContents.session.clearStorageData();
guestWebContents?.reloadIgnoringCache();
};

export const handleClearCacheDialog = () => {
listen(CLEAR_CACHE_DIALOG_KEEP_LOGIN_DATA_CLICKED, async (action) => {
const guestWebContents = webContents.fromId(action.payload);
if (!guestWebContents) {
return;
}
await clearWebviewStorageKeepingLoginData(guestWebContents);
});

listen(CLEAR_CACHE_DIALOG_DELETE_LOGIN_DATA_CLICKED, async (action) => {
const guestWebContents = webContents.fromId(action.payload);
if (!guestWebContents) {
return;
}
await clearWebviewStorageDeletingLoginData(guestWebContents);
});
};
12 changes: 12 additions & 0 deletions src/ui/actions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import type { WebContents } from 'electron';

import type { Server } from '../servers/common';
import type { RootWindowIcon, WindowState } from './common';

export const ABOUT_DIALOG_DISMISSED = 'about-dialog/dismissed';
export const ABOUT_DIALOG_TOGGLE_UPDATE_ON_START =
'about-dialog/toggle-update-on-start';
export const ADD_SERVER_VIEW_SERVER_ADDED = 'add-server/view-server-added';
export const CLEAR_CACHE_TRIGGERED = 'clear-cache/triggered';
export const CLEAR_CACHE_DIALOG_DISMISSED = 'clear-cache-dialog/dismissed';
export const CLEAR_CACHE_DIALOG_DELETE_LOGIN_DATA_CLICKED =
'clear-cache-dialog/delete-login-data-clicked';
export const CLEAR_CACHE_DIALOG_KEEP_LOGIN_DATA_CLICKED =
'clear-cache-dialog/keep-login-data-clicked';
export const LOADING_ERROR_VIEW_RELOAD_SERVER_CLICKED =
'loading-error-view/reload-server-clicked';
export const MENU_BAR_ABOUT_CLICKED = 'menu-bar/about-clicked';
Expand Down Expand Up @@ -108,6 +116,10 @@ export type UiActionTypeToPayloadMap = {
[ABOUT_DIALOG_DISMISSED]: void;
[ABOUT_DIALOG_TOGGLE_UPDATE_ON_START]: boolean;
[ADD_SERVER_VIEW_SERVER_ADDED]: Server['url'];
[CLEAR_CACHE_TRIGGERED]: WebContents['id'];
[CLEAR_CACHE_DIALOG_DISMISSED]: void;
[CLEAR_CACHE_DIALOG_DELETE_LOGIN_DATA_CLICKED]: WebContents['id'];
[CLEAR_CACHE_DIALOG_KEEP_LOGIN_DATA_CLICKED]: WebContents['id'];
[LOADING_ERROR_VIEW_RELOAD_SERVER_CLICKED]: { url: Server['url'] };
[MENU_BAR_ABOUT_CLICKED]: void;
[MENU_BAR_ADD_NEW_SERVER_CLICKED]: void;
Expand Down
88 changes: 88 additions & 0 deletions src/ui/components/ClearCacheDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { Box, Button, ButtonGroup, Margins } from '@rocket.chat/fuselage';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';
import type { Dispatch } from 'redux';

import { listen } from '../../../store';
import type { RootAction } from '../../../store/actions';
import {
CLEAR_CACHE_DIALOG_DELETE_LOGIN_DATA_CLICKED,
CLEAR_CACHE_DIALOG_DISMISSED,
CLEAR_CACHE_DIALOG_KEEP_LOGIN_DATA_CLICKED,
CLEAR_CACHE_TRIGGERED,
} from '../../actions';
import { Dialog } from '../Dialog';

export const ClearCacheDialog = () => {
const dispatch = useDispatch<Dispatch<RootAction>>();
const [webContendId, setWebcontentId] = useState<number>();
const [isVisible, setIsVisible] = useState(false);

const { t } = useTranslation();

const handleKeepButtonClick = (): void => {
if (webContendId === undefined) return;
dispatch({
type: CLEAR_CACHE_DIALOG_KEEP_LOGIN_DATA_CLICKED,
payload: webContendId,
});
setIsVisible(false);
};

const handleDeleteButtonClick = (): void => {
if (webContendId === undefined) return;
dispatch({
type: CLEAR_CACHE_DIALOG_DELETE_LOGIN_DATA_CLICKED,
payload: webContendId,
});
setIsVisible(false);
};

const handleClose = (): void => {
dispatch({
type: CLEAR_CACHE_DIALOG_DISMISSED,
});
setIsVisible(false);
};

useEffect(
() =>
listen(CLEAR_CACHE_TRIGGERED, async (action) => {
setWebcontentId(action.payload);
setIsVisible(true);
}),
[dispatch]
);

return (
<Dialog isVisible={isVisible} onClose={handleClose}>
<Box
width='x300'
display='flex'
flexDirection='column'
alignItems='center'
>
<Margins block='x18'>
<Box fontScale='h1'>{t('dialog.clearCache.announcement')}</Box>
<Box>
<strong>{t('dialog.clearCache.title')}</strong>
<br />
{t('dialog.clearCache.message')}
</Box>
</Margins>
</Box>
<ButtonGroup stretch vertical>
<Button type='button' primary onClick={handleKeepButtonClick}>
{t('dialog.clearCache.keepLoginData')}
</Button>
<Button type='button' danger onClick={handleDeleteButtonClick}>
{t('dialog.clearCache.deleteLoginData')}
</Button>
<Button type='button' onClick={handleClose}>
{t('dialog.clearCache.cancel')}
</Button>
</ButtonGroup>
</Dialog>
);
};
2 changes: 2 additions & 0 deletions src/ui/components/Shell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useSelector } from 'react-redux';
import type { RootState } from '../../../store/rootReducer';
import { AboutDialog } from '../AboutDialog';
import { AddServerView } from '../AddServerView';
import { ClearCacheDialog } from '../ClearCacheDialog';
import DownloadsManagerView from '../DownloadsManagerView';
import { OutlookCredentialsDialog } from '../OutlookCredentialsDialog';
import { ScreenSharingDialog } from '../ScreenSharingDialog';
Expand Down Expand Up @@ -51,6 +52,7 @@ export const Shell = () => {
<ScreenSharingDialog />
<SelectClientCertificateDialog />
<UpdateDialog />
<ClearCacheDialog />
<OutlookCredentialsDialog />
</>
);
Expand Down
11 changes: 8 additions & 3 deletions src/ui/main/menuBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { dispatch, select, Service } from '../../store';
import type { RootState } from '../../store/rootReducer';
import * as urls from '../../urls';
import {
CLEAR_CACHE_TRIGGERED,
MENU_BAR_ABOUT_CLICKED,
MENU_BAR_ADD_NEW_SERVER_CLICKED,
MENU_BAR_SELECT_SERVER_CLICKED,
Expand Down Expand Up @@ -216,12 +217,16 @@ const createViewMenu = createSelector(
},
},
{
id: 'reloadIgnoringCache',
label: t('menus.reloadIgnoringCache'),
id: 'reloadClearingCache',
label: t('menus.reloadClearingCache'),
enabled: typeof currentView === 'object' && !!currentView.url,
click: async () => {
const guestWebContents = await getCurrentViewWebcontents();
guestWebContents?.reloadIgnoringCache();
if (guestWebContents)
dispatch({
type: CLEAR_CACHE_TRIGGERED,
payload: guestWebContents.id,
});
const currentView = await getCurrentView();
if (typeof currentView === 'object' && !!currentView.url) {
dispatch({
Expand Down
18 changes: 9 additions & 9 deletions src/ui/main/serverView/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
WEBVIEW_DID_START_LOADING,
WEBVIEW_ATTACHED,
WEBVIEW_SERVER_RELOADED,
CLEAR_CACHE_TRIGGERED,
} from '../../actions';
import { getRootWindow } from '../rootWindow';
import { createPopupMenuForServerView } from './popupMenu';
Expand Down Expand Up @@ -425,17 +426,16 @@ export const attachGuestWebContentsEvents = async (): Promise<void> => {
},
},
{
label: t('sidebar.item.clearCache'),
label: t('sidebar.item.reloadClearingCache'),
click: async () => {
const guestWebContents = getWebContentsByServerUrl(serverUrl);
await guestWebContents?.session.clearCache();
},
},
{
label: t('sidebar.item.clearStorageData'),
click: async () => {
const guestWebContents = getWebContentsByServerUrl(serverUrl);
await guestWebContents?.session.clearStorageData();
if (!guestWebContents) {
return;
}
dispatch({
type: CLEAR_CACHE_TRIGGERED,
payload: guestWebContents.id,
});
},
},
];
Expand Down
Loading