Clenaup VerificationService.VerificationListener
This commit is contained in:
parent
377d944228
commit
bf02746d87
@ -67,13 +67,9 @@ class SASTest : InstrumentedTest {
|
|||||||
|
|
||||||
val bobTxCreatedLatch = CountDownLatch(1)
|
val bobTxCreatedLatch = CountDownLatch(1)
|
||||||
val bobListener = object : VerificationService.VerificationListener {
|
val bobListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
bobTxCreatedLatch.countDown()
|
bobTxCreatedLatch.countDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
bobVerificationService.addListener(bobListener)
|
bobVerificationService.addListener(bobListener)
|
||||||
|
|
||||||
@ -107,8 +103,6 @@ class SASTest : InstrumentedTest {
|
|||||||
val cancelLatch = CountDownLatch(1)
|
val cancelLatch = CountDownLatch(1)
|
||||||
|
|
||||||
val bobListener2 = object : VerificationService.VerificationListener {
|
val bobListener2 = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if (tx.transactionId == txID) {
|
if (tx.transactionId == txID) {
|
||||||
val immutableState = (tx as SASDefaultVerificationTransaction).state
|
val immutableState = (tx as SASDefaultVerificationTransaction).state
|
||||||
@ -117,8 +111,6 @@ class SASTest : InstrumentedTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
bobVerificationService.addListener(bobListener2)
|
bobVerificationService.addListener(bobListener2)
|
||||||
|
|
||||||
@ -158,16 +150,12 @@ class SASTest : InstrumentedTest {
|
|||||||
val cancelLatch = CountDownLatch(1)
|
val cancelLatch = CountDownLatch(1)
|
||||||
|
|
||||||
val bobListener = object : VerificationService.VerificationListener {
|
val bobListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if (tx.transactionId == tid && tx.state is VerificationTxState.Cancelled) {
|
if (tx.transactionId == tid && tx.state is VerificationTxState.Cancelled) {
|
||||||
cancelReason = (tx.state as VerificationTxState.Cancelled).cancelCode
|
cancelReason = (tx.state as VerificationTxState.Cancelled).cancelCode
|
||||||
cancelLatch.countDown()
|
cancelLatch.countDown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
bobSession.getVerificationService().addListener(bobListener)
|
bobSession.getVerificationService().addListener(bobListener)
|
||||||
|
|
||||||
@ -187,15 +175,11 @@ class SASTest : InstrumentedTest {
|
|||||||
val aliceDevice = aliceSession.getMyDevice().deviceId
|
val aliceDevice = aliceSession.getMyDevice().deviceId
|
||||||
|
|
||||||
val aliceListener = object : VerificationService.VerificationListener {
|
val aliceListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if ((tx as IncomingSasVerificationTransaction).uxState === IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
if ((tx as IncomingSasVerificationTransaction).uxState === IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
||||||
(tx as IncomingSasVerificationTransaction).performAccept()
|
(tx as IncomingSasVerificationTransaction).performAccept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
aliceSession.getVerificationService().addListener(aliceListener)
|
aliceSession.getVerificationService().addListener(aliceListener)
|
||||||
|
|
||||||
@ -339,8 +323,6 @@ class SASTest : InstrumentedTest {
|
|||||||
aliceCancelledLatch.countDown()
|
aliceCancelledLatch.countDown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
aliceVerificationService.addListener(aliceListener)
|
aliceVerificationService.addListener(aliceListener)
|
||||||
|
|
||||||
@ -373,10 +355,6 @@ class SASTest : InstrumentedTest {
|
|||||||
|
|
||||||
val aliceAcceptedLatch = CountDownLatch(1)
|
val aliceAcceptedLatch = CountDownLatch(1)
|
||||||
val aliceListener = object : VerificationService.VerificationListener {
|
val aliceListener = object : VerificationService.VerificationListener {
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
|
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if ((tx as SASDefaultVerificationTransaction).state === VerificationTxState.OnAccepted) {
|
if ((tx as SASDefaultVerificationTransaction).state === VerificationTxState.OnAccepted) {
|
||||||
val at = tx as SASDefaultVerificationTransaction
|
val at = tx as SASDefaultVerificationTransaction
|
||||||
@ -389,16 +367,12 @@ class SASTest : InstrumentedTest {
|
|||||||
aliceVerificationService.addListener(aliceListener)
|
aliceVerificationService.addListener(aliceListener)
|
||||||
|
|
||||||
val bobListener = object : VerificationService.VerificationListener {
|
val bobListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if ((tx as IncomingSasVerificationTransaction).uxState === IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
if ((tx as IncomingSasVerificationTransaction).uxState === IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
||||||
val at = tx as IncomingSasVerificationTransaction
|
val at = tx as IncomingSasVerificationTransaction
|
||||||
at.performAccept()
|
at.performAccept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
bobVerificationService.addListener(bobListener)
|
bobVerificationService.addListener(bobListener)
|
||||||
|
|
||||||
@ -434,8 +408,6 @@ class SASTest : InstrumentedTest {
|
|||||||
|
|
||||||
val aliceSASLatch = CountDownLatch(1)
|
val aliceSASLatch = CountDownLatch(1)
|
||||||
val aliceListener = object : VerificationService.VerificationListener {
|
val aliceListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
val uxState = (tx as OutgoingSasVerificationTransaction).uxState
|
val uxState = (tx as OutgoingSasVerificationTransaction).uxState
|
||||||
when (uxState) {
|
when (uxState) {
|
||||||
@ -445,15 +417,11 @@ class SASTest : InstrumentedTest {
|
|||||||
else -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
aliceVerificationService.addListener(aliceListener)
|
aliceVerificationService.addListener(aliceListener)
|
||||||
|
|
||||||
val bobSASLatch = CountDownLatch(1)
|
val bobSASLatch = CountDownLatch(1)
|
||||||
val bobListener = object : VerificationService.VerificationListener {
|
val bobListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
val uxState = (tx as IncomingSasVerificationTransaction).uxState
|
val uxState = (tx as IncomingSasVerificationTransaction).uxState
|
||||||
when (uxState) {
|
when (uxState) {
|
||||||
@ -466,8 +434,6 @@ class SASTest : InstrumentedTest {
|
|||||||
bobSASLatch.countDown()
|
bobSASLatch.countDown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
bobVerificationService.addListener(bobListener)
|
bobVerificationService.addListener(bobListener)
|
||||||
|
|
||||||
@ -498,8 +464,6 @@ class SASTest : InstrumentedTest {
|
|||||||
|
|
||||||
val aliceSASLatch = CountDownLatch(1)
|
val aliceSASLatch = CountDownLatch(1)
|
||||||
val aliceListener = object : VerificationService.VerificationListener {
|
val aliceListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
val uxState = (tx as OutgoingSasVerificationTransaction).uxState
|
val uxState = (tx as OutgoingSasVerificationTransaction).uxState
|
||||||
when (uxState) {
|
when (uxState) {
|
||||||
@ -512,15 +476,11 @@ class SASTest : InstrumentedTest {
|
|||||||
else -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
aliceVerificationService.addListener(aliceListener)
|
aliceVerificationService.addListener(aliceListener)
|
||||||
|
|
||||||
val bobSASLatch = CountDownLatch(1)
|
val bobSASLatch = CountDownLatch(1)
|
||||||
val bobListener = object : VerificationService.VerificationListener {
|
val bobListener = object : VerificationService.VerificationListener {
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
val uxState = (tx as IncomingSasVerificationTransaction).uxState
|
val uxState = (tx as IncomingSasVerificationTransaction).uxState
|
||||||
when (uxState) {
|
when (uxState) {
|
||||||
@ -536,8 +496,6 @@ class SASTest : InstrumentedTest {
|
|||||||
else -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
}
|
}
|
||||||
bobVerificationService.addListener(bobListener)
|
bobVerificationService.addListener(bobListener)
|
||||||
|
|
||||||
|
@ -95,15 +95,13 @@ interface VerificationService {
|
|||||||
otherUserId: String,
|
otherUserId: String,
|
||||||
transactionId: String): Boolean
|
transactionId: String): Boolean
|
||||||
|
|
||||||
// fun transactionUpdated(tx: SasVerificationTransaction)
|
|
||||||
|
|
||||||
interface VerificationListener {
|
interface VerificationListener {
|
||||||
fun transactionCreated(tx: VerificationTransaction)
|
|
||||||
fun transactionUpdated(tx: VerificationTransaction)
|
|
||||||
fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
|
||||||
|
|
||||||
fun verificationRequestCreated(pr: PendingVerificationRequest) {}
|
fun verificationRequestCreated(pr: PendingVerificationRequest) {}
|
||||||
fun verificationRequestUpdated(pr: PendingVerificationRequest) {}
|
fun verificationRequestUpdated(pr: PendingVerificationRequest) {}
|
||||||
|
|
||||||
|
fun transactionCreated(tx: VerificationTransaction) {}
|
||||||
|
fun transactionUpdated(tx: VerificationTransaction) {}
|
||||||
|
fun markedAsManuallyVerified(userId: String, deviceId: String) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -262,9 +262,6 @@ class KeyRequestHandler @Inject constructor(private val context: Context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if (tx is SasVerificationTransaction) {
|
if (tx is SasVerificationTransaction) {
|
||||||
val state = tx.state
|
val state = tx.state
|
||||||
|
@ -48,8 +48,6 @@ class IncomingVerificationRequestHandler @Inject constructor(private val context
|
|||||||
this.session = null
|
this.session = null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if (!tx.isToDeviceTransport()) return
|
if (!tx.isToDeviceTransport()) return
|
||||||
// TODO maybe check also if
|
// TODO maybe check also if
|
||||||
@ -111,9 +109,6 @@ class IncomingVerificationRequestHandler @Inject constructor(private val context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun markedAsManuallyVerified(userId: String, deviceId: String) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun verificationRequestCreated(pr: PendingVerificationRequest) {
|
override fun verificationRequestCreated(pr: PendingVerificationRequest) {
|
||||||
// For incoming request we should prompt (if not in activity where this request apply)
|
// For incoming request we should prompt (if not in activity where this request apply)
|
||||||
if (pr.isIncoming) {
|
if (pr.isIncoming) {
|
||||||
@ -162,7 +157,6 @@ class IncomingVerificationRequestHandler @Inject constructor(private val context
|
|||||||
if (pr.isIncoming && (pr.isReady || pr.handledByOtherSession)) {
|
if (pr.isIncoming && (pr.isReady || pr.handledByOtherSession)) {
|
||||||
PopupAlertManager.cancelAlert(uniqueIdForVerificationRequest(pr))
|
PopupAlertManager.cancelAlert(uniqueIdForVerificationRequest(pr))
|
||||||
}
|
}
|
||||||
super.verificationRequestUpdated(pr)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun uniqueIdForVerificationRequest(pr: PendingVerificationRequest) =
|
private fun uniqueIdForVerificationRequest(pr: PendingVerificationRequest) =
|
||||||
|
@ -89,7 +89,6 @@ class DevicesViewModel @AssistedInject constructor(@Assisted initialState: Devic
|
|||||||
super.onCleared()
|
super.onCleared()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transactionCreated(tx: VerificationTransaction) {}
|
|
||||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||||
if (tx.state == VerificationTxState.Verified) {
|
if (tx.state == VerificationTxState.Verified) {
|
||||||
refreshDevicesList()
|
refreshDevicesList()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user