mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 02:39:55 +01:00
Removal final usage of VerifyResponseProcessor.
This commit is contained in:
committed by
Cody Henthorne
parent
bf46e5bc24
commit
f29d4f980a
@@ -1,30 +0,0 @@
|
||||
package org.thoughtcrime.securesms.registration
|
||||
|
||||
import org.whispersystems.signalservice.api.account.PreKeyCollection
|
||||
import org.whispersystems.signalservice.api.kbs.MasterKey
|
||||
import org.whispersystems.signalservice.internal.ServiceResponse
|
||||
import org.whispersystems.signalservice.internal.push.VerifyAccountResponse
|
||||
|
||||
data class VerifyResponse(
|
||||
val verifyAccountResponse: VerifyAccountResponse,
|
||||
val masterKey: MasterKey?,
|
||||
val pin: String?,
|
||||
val aciPreKeyCollection: PreKeyCollection?,
|
||||
val pniPreKeyCollection: PreKeyCollection?
|
||||
) {
|
||||
companion object {
|
||||
fun from(
|
||||
response: ServiceResponse<VerifyAccountResponse>,
|
||||
masterKey: MasterKey?,
|
||||
pin: String?,
|
||||
aciPreKeyCollection: PreKeyCollection?,
|
||||
pniPreKeyCollection: PreKeyCollection?
|
||||
): ServiceResponse<VerifyResponse> {
|
||||
return if (response.result.isPresent) {
|
||||
ServiceResponse.forResult(VerifyResponse(response.result.get(), masterKey, pin, aciPreKeyCollection, pniPreKeyCollection), 200, null)
|
||||
} else {
|
||||
ServiceResponse.coerceError(response)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package org.thoughtcrime.securesms.registration
|
||||
|
||||
import org.whispersystems.signalservice.internal.ServiceResponse
|
||||
import org.whispersystems.signalservice.internal.ServiceResponseProcessor
|
||||
import org.whispersystems.signalservice.internal.push.LockedException
|
||||
|
||||
/**
|
||||
* Process responses from attempting to verify an account for use in account registration.
|
||||
*/
|
||||
sealed class VerifyResponseProcessor(response: ServiceResponse<VerifyResponse>) : ServiceResponseProcessor<VerifyResponse>(response) {
|
||||
|
||||
public override fun authorizationFailed(): Boolean {
|
||||
return super.authorizationFailed()
|
||||
}
|
||||
|
||||
public override fun registrationLock(): Boolean {
|
||||
return super.registrationLock()
|
||||
}
|
||||
|
||||
public override fun rateLimit(): Boolean {
|
||||
return super.rateLimit()
|
||||
}
|
||||
|
||||
public override fun getError(): Throwable? {
|
||||
return super.getError()
|
||||
}
|
||||
|
||||
fun getLockedException(): LockedException {
|
||||
return error as LockedException
|
||||
}
|
||||
|
||||
/** True if the account has reglock enabled but all guesses have been exhausted, otherwise false. */
|
||||
abstract fun isRegistrationLockPresentAndSvrExhausted(): Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify processor specific to verifying without needing to handle registration lock.
|
||||
*/
|
||||
class VerifyResponseWithoutKbs(response: ServiceResponse<VerifyResponse>) : VerifyResponseProcessor(response) {
|
||||
override fun isRegistrationLockPresentAndSvrExhausted(): Boolean {
|
||||
return registrationLock() && getLockedException().svr2Credentials == null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user