Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2021-05-19 10:22:54 +02:00
parent f6d14856a4
commit e70b61d7a3
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -92,14 +92,8 @@ class AccountRemovalWork(
val user = optionalUser.get() val user = optionalUser.get()
backgroundJobManager.cancelPeriodicContactsBackup(user) backgroundJobManager.cancelPeriodicContactsBackup(user)
val userRemoved = userAccountManager.removeUser(user) val userRemoved = userAccountManager.removeUser(user)
if (userRemoved) {
eventBus.post(AccountRemovedEvent())
}
val storageManager = FileDataStorageManager(user.toPlatformAccount(), context.contentResolver) val storageManager = FileDataStorageManager(user.toPlatformAccount(), context.contentResolver)
// remove all files
removeFiles(user, storageManager)
// delete all database entries
storageManager.deleteAllFiles()
// disable daily backup // disable daily backup
arbitraryDataProvider.storeOrUpdateKeyValue( arbitraryDataProvider.storeOrUpdateKeyValue(
user.accountName, user.accountName,
@ -108,15 +102,26 @@ class AccountRemovalWork(
) )
// unregister push notifications // unregister push notifications
unregisterPushNotifications(context, user, arbitraryDataProvider) unregisterPushNotifications(context, user, arbitraryDataProvider)
// remove pending account removal // remove pending account removal
arbitraryDataProvider.deleteKeyForAccount(user.accountName, ManageAccountsActivity.PENDING_FOR_REMOVAL) arbitraryDataProvider.deleteKeyForAccount(user.accountName, ManageAccountsActivity.PENDING_FOR_REMOVAL)
// remove synced folders set for account // remove synced folders set for account
remoceSyncedFolders(context, user.toPlatformAccount(), clock) remoceSyncedFolders(context, user.toPlatformAccount(), clock)
// delete all uploads for account // delete all uploads for account
uploadsStorageManager.removeAccountUploads(user.toPlatformAccount()) uploadsStorageManager.removeAccountUploads(user.toPlatformAccount())
// delete stored E2E keys
// delete stored E2E keys and mnemonic
arbitraryDataProvider.deleteKeyForAccount(user.accountName, EncryptionUtils.PRIVATE_KEY) arbitraryDataProvider.deleteKeyForAccount(user.accountName, EncryptionUtils.PRIVATE_KEY)
arbitraryDataProvider.deleteKeyForAccount(user.accountName, EncryptionUtils.PUBLIC_KEY) arbitraryDataProvider.deleteKeyForAccount(user.accountName, EncryptionUtils.PUBLIC_KEY)
arbitraryDataProvider.deleteKeyForAccount(user.accountName, EncryptionUtils.MNEMONIC)
// remove all files
removeFiles(user, storageManager)
// delete all database entries
storageManager.deleteAllFiles()
if (remoteWipe) { if (remoteWipe) {
val optionalClient = createClient(user) val optionalClient = createClient(user)
if (optionalClient.isPresent) { if (optionalClient.isPresent) {
@ -127,6 +132,11 @@ class AccountRemovalWork(
} }
// notify Document Provider // notify Document Provider
DocumentsStorageProvider.notifyRootsChanged(context) DocumentsStorageProvider.notifyRootsChanged(context)
if (userRemoved) {
eventBus.post(AccountRemovedEvent())
}
return Result.success() return Result.success()
} }