mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Fix clearing storage_account files on logout.
This commit is contained in:
parent
ad4afe9293
commit
7892ba97e6
2 changed files with 11 additions and 14 deletions
|
@ -1069,20 +1069,6 @@ void ClearManager::onStart() {
|
||||||
switch (task) {
|
switch (task) {
|
||||||
case ClearManagerAll: {
|
case ClearManagerAll: {
|
||||||
result = QDir(cTempDir()).removeRecursively();
|
result = QDir(cTempDir()).removeRecursively();
|
||||||
// #TODO
|
|
||||||
//QDirIterator di(_userBasePath, QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
|
|
||||||
//while (di.hasNext()) {
|
|
||||||
// di.next();
|
|
||||||
// const QFileInfo& fi = di.fileInfo();
|
|
||||||
// if (fi.isDir() && !fi.isSymLink()) {
|
|
||||||
// if (!QDir(di.filePath()).removeRecursively()) result = false;
|
|
||||||
// } else {
|
|
||||||
// QString path = di.filePath();
|
|
||||||
// if (!path.endsWith(qstr("map0")) && !path.endsWith(qstr("map1")) && !path.endsWith(qstr("maps"))) {
|
|
||||||
// if (!QFile::remove(di.filePath())) result = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
} break;
|
} break;
|
||||||
case ClearManagerDownloads:
|
case ClearManagerDownloads:
|
||||||
result = QDir(cTempDir()).removeRecursively();
|
result = QDir(cTempDir()).removeRecursively();
|
||||||
|
|
|
@ -540,6 +540,7 @@ void Account::setPasscode(const QByteArray &passcode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Account::reset() {
|
void Account::reset() {
|
||||||
|
auto names = collectGoodNames();
|
||||||
_passcodeKeySalt.clear();
|
_passcodeKeySalt.clear();
|
||||||
_draftsMap.clear();
|
_draftsMap.clear();
|
||||||
_draftCursorsMap.clear();
|
_draftCursorsMap.clear();
|
||||||
|
@ -564,6 +565,16 @@ void Account::reset() {
|
||||||
_cacheBigFileTotalTimeLimit = Database::Settings().totalTimeLimit;
|
_cacheBigFileTotalTimeLimit = Database::Settings().totalTimeLimit;
|
||||||
_mapChanged = true;
|
_mapChanged = true;
|
||||||
writeMap();
|
writeMap();
|
||||||
|
|
||||||
|
crl::async([base = _basePath, names = std::move(names)] {
|
||||||
|
for (const auto &name : names) {
|
||||||
|
if (!name.endsWith(qstr("map0"))
|
||||||
|
&& !name.endsWith(qstr("map1"))
|
||||||
|
&& !name.endsWith(qstr("maps"))) {
|
||||||
|
QFile::remove(base + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Account::writeLocations() {
|
void Account::writeLocations() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue