MM-46300 Clear cached images on logout (#6582)
This commit is contained in:
parent
b42710759a
commit
851b0fcc0a
2 changed files with 9 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import CookieManager, {Cookie} from '@react-native-cookies/cookies';
|
||||
import {Alert, DeviceEventEmitter, Linking, Platform} from 'react-native';
|
||||
import FastImage from 'react-native-fast-image';
|
||||
import semver from 'semver';
|
||||
|
||||
import LocalConfig from '@assets/config.json';
|
||||
|
|
@ -17,7 +18,7 @@ import NetworkManager from '@managers/network_manager';
|
|||
import WebsocketManager from '@managers/websocket_manager';
|
||||
import {getCurrentUser} from '@queries/servers/user';
|
||||
import EphemeralStore from '@store/ephemeral_store';
|
||||
import {deleteFileCache} from '@utils/file';
|
||||
import {deleteFileCache, deleteFileCacheByDir} from '@utils/file';
|
||||
|
||||
import type {jsAndNativeErrorHandler} from '@typings/global/error_handling';
|
||||
import type {LaunchType} from '@typings/launch';
|
||||
|
|
@ -112,7 +113,13 @@ class GlobalEventHandler {
|
|||
|
||||
this.resetLocale();
|
||||
this.clearCookiesForServer(serverUrl);
|
||||
FastImage.clearDiskCache();
|
||||
deleteFileCache(serverUrl);
|
||||
deleteFileCacheByDir('mmPasteInput');
|
||||
deleteFileCacheByDir('thumbnails');
|
||||
if (Platform.OS === 'android') {
|
||||
deleteFileCacheByDir('image_cache');
|
||||
}
|
||||
|
||||
if (activeServerUrl === serverUrl) {
|
||||
let displayName = '';
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ export async function deleteLegacyFileCache(serverUrl: string) {
|
|||
deleteFileCacheByDir(serverDir);
|
||||
}
|
||||
|
||||
async function deleteFileCacheByDir(dir: string) {
|
||||
export async function deleteFileCacheByDir(dir: string) {
|
||||
const cacheDir = `${FileSystem.CachesDirectoryPath}/${dir}`;
|
||||
if (cacheDir) {
|
||||
const cacheDirInfo = await FileSystem.exists(cacheDir);
|
||||
|
|
|
|||
Loading…
Reference in a new issue