Soft Logout - issue with device display name
This commit is contained in:
parent
7699560458
commit
205fc0d9d6
|
@ -29,7 +29,6 @@ interface SignOutService {
|
|||
* The same deviceId will be used
|
||||
*/
|
||||
fun signInAgain(password: String,
|
||||
deviceName: String,
|
||||
callback: MatrixCallback<Unit>): Cancelable
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,10 +28,9 @@ internal class DefaultSignOutService @Inject constructor(private val signOutTask
|
|||
private val taskExecutor: TaskExecutor) : SignOutService {
|
||||
|
||||
override fun signInAgain(password: String,
|
||||
deviceName: String,
|
||||
callback: MatrixCallback<Unit>): Cancelable {
|
||||
return signInAgainTask
|
||||
.configureWith(SignInAgainTask.Params(password, deviceName)) {
|
||||
.configureWith(SignInAgainTask.Params(password)) {
|
||||
this.callback = callback
|
||||
}
|
||||
.executeBy(taskExecutor)
|
||||
|
|
|
@ -26,8 +26,7 @@ import javax.inject.Inject
|
|||
|
||||
internal interface SignInAgainTask : Task<SignInAgainTask.Params, Unit> {
|
||||
data class Params(
|
||||
val password: String,
|
||||
val deviceName: String
|
||||
val password: String
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -43,9 +42,11 @@ internal class DefaultSignInAgainTask @Inject constructor(
|
|||
// Reuse the same userId
|
||||
sessionParams.credentials.userId,
|
||||
params.password,
|
||||
params.deviceName,
|
||||
// The spec says it will be ignored
|
||||
// https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-login
|
||||
// but https://github.com/matrix-org/synapse/issues/6525
|
||||
// Reuse the same deviceId
|
||||
sessionParams.credentials.deviceId
|
||||
deviceId = sessionParams.credentials.deviceId
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -22,11 +22,9 @@ import com.squareup.inject.assisted.AssistedInject
|
|||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.android.api.util.Cancelable
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.di.ActiveSessionHolder
|
||||
import im.vector.riotx.core.extensions.toReducedUrl
|
||||
import im.vector.riotx.core.platform.VectorViewModel
|
||||
import im.vector.riotx.core.resources.StringProvider
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -34,7 +32,6 @@ import im.vector.riotx.core.resources.StringProvider
|
|||
class SoftLogoutViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: SoftLogoutViewState,
|
||||
private val session: Session,
|
||||
private val stringProvider: StringProvider,
|
||||
private val activeSessionHolder: ActiveSessionHolder)
|
||||
: VectorViewModel<SoftLogoutViewState, SoftLogoutAction>(initialState) {
|
||||
|
||||
|
@ -77,8 +74,6 @@ class SoftLogoutViewModel @AssistedInject constructor(
|
|||
private fun handleSignInAgain(action: SoftLogoutAction.SignInAgain) {
|
||||
setState { copy(asyncLoginAction = Loading()) }
|
||||
currentTask = session.signInAgain(action.password,
|
||||
// TODO We should use the previous device name (we have to provide it for the homeserver
|
||||
stringProvider.getString(R.string.login_mobile_device),
|
||||
object : MatrixCallback<Unit> {
|
||||
override fun onFailure(failure: Throwable) {
|
||||
setState {
|
||||
|
|
Loading…
Reference in New Issue