mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Doc and method signature
This commit is contained in:
parent
c76ced68e0
commit
73e93e7d3d
5 changed files with 13 additions and 9 deletions
|
@ -51,6 +51,7 @@ class DeactivateAccountTest : InstrumentedTest {
|
|||
// Deactivate the account
|
||||
commonTestHelper.runBlockingTest {
|
||||
session.deactivateAccount(
|
||||
eraseAllData = false,
|
||||
userInteractiveAuthInterceptor = object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
promise.resume(
|
||||
|
@ -61,8 +62,7 @@ class DeactivateAccountTest : InstrumentedTest {
|
|||
)
|
||||
)
|
||||
}
|
||||
},
|
||||
eraseAllData = false
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ interface AccountService {
|
|||
* @param password Current password.
|
||||
* @param newPassword New password
|
||||
*/
|
||||
suspend fun changePassword(password: String, newPassword: String)
|
||||
suspend fun changePassword(password: String,
|
||||
newPassword: String)
|
||||
|
||||
/**
|
||||
* Deactivate the account.
|
||||
|
@ -41,9 +42,10 @@ interface AccountService {
|
|||
* be shared with any new or unregistered users, but registered users who already have access to these messages will still
|
||||
* have access to their copy.
|
||||
*
|
||||
* @param password the account password
|
||||
* @param eraseAllData set to true to forget all messages that have been sent. Warning: this will cause future users to see
|
||||
* an incomplete view of conversations
|
||||
* @param userInteractiveAuthInterceptor see [UserInteractiveAuthInterceptor]
|
||||
*/
|
||||
suspend fun deactivateAccount(userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor, eraseAllData: Boolean)
|
||||
suspend fun deactivateAccount(eraseAllData: Boolean,
|
||||
userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor)
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ import javax.inject.Inject
|
|||
|
||||
internal interface DeactivateAccountTask : Task<DeactivateAccountTask.Params, Unit> {
|
||||
data class Params(
|
||||
val userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor,
|
||||
val eraseAllData: Boolean,
|
||||
val userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor,
|
||||
val userAuthParam: UIABaseAuth? = null
|
||||
)
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ internal class DefaultAccountService @Inject constructor(private val changePassw
|
|||
changePasswordTask.execute(ChangePasswordTask.Params(password, newPassword))
|
||||
}
|
||||
|
||||
override suspend fun deactivateAccount(userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor, eraseAllData: Boolean) {
|
||||
deactivateAccountTask.execute(DeactivateAccountTask.Params(userInteractiveAuthInterceptor, eraseAllData))
|
||||
override suspend fun deactivateAccount(eraseAllData: Boolean, userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) {
|
||||
deactivateAccountTask.execute(DeactivateAccountTask.Params(eraseAllData, userInteractiveAuthInterceptor))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,13 +98,15 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v
|
|||
viewModelScope.launch {
|
||||
val event = try {
|
||||
session.deactivateAccount(
|
||||
action.eraseAllData,
|
||||
object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
_viewEvents.post(DeactivateAccountViewEvents.RequestReAuth(flowResponse, errCode))
|
||||
pendingAuth = DefaultBaseAuth(session = flowResponse.session)
|
||||
uiaContinuation = promise
|
||||
}
|
||||
}, action.eraseAllData)
|
||||
}
|
||||
)
|
||||
DeactivateAccountViewEvents.Done
|
||||
} catch (failure: Exception) {
|
||||
if (failure.isInvalidUIAAuth()) {
|
||||
|
|
Loading…
Reference in a new issue