mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Delete all data related to account being removed
This commit is contained in:
parent
f0ad67fb29
commit
7bead679ad
1 changed files with 14 additions and 3 deletions
|
|
@ -268,9 +268,20 @@ class AccountProfileViewModel
|
|||
fun deleteAccount() {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
if (::account.isInitialized) {
|
||||
Log.i("$TAG Removing call logs, conversations & meetings related to account being removed")
|
||||
account.clearCallLogs()
|
||||
|
||||
for (conversation in account.chatRooms) {
|
||||
core.deleteChatRoom(conversation)
|
||||
}
|
||||
for (meeting in account.conferenceInformationList) {
|
||||
core.deleteConferenceInformation(meeting)
|
||||
}
|
||||
|
||||
val identity = account.params.identityAddress?.asStringUriOnly()
|
||||
val authInfo = account.findAuthInfo()
|
||||
if (authInfo != null) {
|
||||
Log.i("$TAG Found auth info for account, removing it")
|
||||
Log.i("$TAG Found auth info for account [$identity], removing it")
|
||||
if (authInfo.password.isNullOrEmpty() && authInfo.ha1.isNullOrEmpty() && authInfo.accessToken != null) {
|
||||
Log.i("$TAG Auth info was using bearer token instead of password")
|
||||
val ssoCache = File(corePreferences.ssoCacheFile)
|
||||
|
|
@ -283,11 +294,11 @@ class AccountProfileViewModel
|
|||
}
|
||||
core.removeAuthInfo(authInfo)
|
||||
} else {
|
||||
Log.w("$TAG Failed to find matching auth info for account")
|
||||
Log.w("$TAG Failed to find matching auth info for account [$identity]")
|
||||
}
|
||||
|
||||
core.removeAccount(account)
|
||||
Log.i("$TAG Account has been removed")
|
||||
Log.i("$TAG Account [$identity] has been removed")
|
||||
accountRemovedEvent.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue