mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
Rename VerificationListener to Listener
This commit is contained in:
parent
bf02746d87
commit
6acfab3242
10 changed files with 26 additions and 25 deletions
|
@ -66,7 +66,7 @@ class SASTest : InstrumentedTest {
|
|||
val bobVerificationService = bobSession!!.getVerificationService()
|
||||
|
||||
val bobTxCreatedLatch = CountDownLatch(1)
|
||||
val bobListener = object : VerificationService.VerificationListener {
|
||||
val bobListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
bobTxCreatedLatch.countDown()
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class SASTest : InstrumentedTest {
|
|||
// Let's cancel from alice side
|
||||
val cancelLatch = CountDownLatch(1)
|
||||
|
||||
val bobListener2 = object : VerificationService.VerificationListener {
|
||||
val bobListener2 = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
if (tx.transactionId == txID) {
|
||||
val immutableState = (tx as SASDefaultVerificationTransaction).state
|
||||
|
@ -149,7 +149,7 @@ class SASTest : InstrumentedTest {
|
|||
var cancelReason: CancelCode? = null
|
||||
val cancelLatch = CountDownLatch(1)
|
||||
|
||||
val bobListener = object : VerificationService.VerificationListener {
|
||||
val bobListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
if (tx.transactionId == tid && tx.state is VerificationTxState.Cancelled) {
|
||||
cancelReason = (tx.state as VerificationTxState.Cancelled).cancelCode
|
||||
|
@ -174,7 +174,7 @@ class SASTest : InstrumentedTest {
|
|||
val aliceUserID = aliceSession.myUserId
|
||||
val aliceDevice = aliceSession.getMyDevice().deviceId
|
||||
|
||||
val aliceListener = object : VerificationService.VerificationListener {
|
||||
val aliceListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
if ((tx as IncomingSasVerificationTransaction).uxState === IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
||||
(tx as IncomingSasVerificationTransaction).performAccept()
|
||||
|
@ -312,7 +312,7 @@ class SASTest : InstrumentedTest {
|
|||
val aliceCreatedLatch = CountDownLatch(2)
|
||||
val aliceCancelledLatch = CountDownLatch(2)
|
||||
val createdTx = mutableListOf<SASDefaultVerificationTransaction>()
|
||||
val aliceListener = object : VerificationService.VerificationListener {
|
||||
val aliceListener = object : VerificationService.Listener {
|
||||
override fun transactionCreated(tx: VerificationTransaction) {
|
||||
createdTx.add(tx as SASDefaultVerificationTransaction)
|
||||
aliceCreatedLatch.countDown()
|
||||
|
@ -354,7 +354,7 @@ class SASTest : InstrumentedTest {
|
|||
var startReq: KeyVerificationStart? = null
|
||||
|
||||
val aliceAcceptedLatch = CountDownLatch(1)
|
||||
val aliceListener = object : VerificationService.VerificationListener {
|
||||
val aliceListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
if ((tx as SASDefaultVerificationTransaction).state === VerificationTxState.OnAccepted) {
|
||||
val at = tx as SASDefaultVerificationTransaction
|
||||
|
@ -366,7 +366,7 @@ class SASTest : InstrumentedTest {
|
|||
}
|
||||
aliceVerificationService.addListener(aliceListener)
|
||||
|
||||
val bobListener = object : VerificationService.VerificationListener {
|
||||
val bobListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
if ((tx as IncomingSasVerificationTransaction).uxState === IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
||||
val at = tx as IncomingSasVerificationTransaction
|
||||
|
@ -407,7 +407,7 @@ class SASTest : InstrumentedTest {
|
|||
val bobVerificationService = bobSession!!.getVerificationService()
|
||||
|
||||
val aliceSASLatch = CountDownLatch(1)
|
||||
val aliceListener = object : VerificationService.VerificationListener {
|
||||
val aliceListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
val uxState = (tx as OutgoingSasVerificationTransaction).uxState
|
||||
when (uxState) {
|
||||
|
@ -421,7 +421,7 @@ class SASTest : InstrumentedTest {
|
|||
aliceVerificationService.addListener(aliceListener)
|
||||
|
||||
val bobSASLatch = CountDownLatch(1)
|
||||
val bobListener = object : VerificationService.VerificationListener {
|
||||
val bobListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
val uxState = (tx as IncomingSasVerificationTransaction).uxState
|
||||
when (uxState) {
|
||||
|
@ -463,7 +463,7 @@ class SASTest : InstrumentedTest {
|
|||
val bobVerificationService = bobSession!!.getVerificationService()
|
||||
|
||||
val aliceSASLatch = CountDownLatch(1)
|
||||
val aliceListener = object : VerificationService.VerificationListener {
|
||||
val aliceListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
val uxState = (tx as OutgoingSasVerificationTransaction).uxState
|
||||
when (uxState) {
|
||||
|
@ -480,7 +480,7 @@ class SASTest : InstrumentedTest {
|
|||
aliceVerificationService.addListener(aliceListener)
|
||||
|
||||
val bobSASLatch = CountDownLatch(1)
|
||||
val bobListener = object : VerificationService.VerificationListener {
|
||||
val bobListener = object : VerificationService.Listener {
|
||||
override fun transactionUpdated(tx: VerificationTransaction) {
|
||||
val uxState = (tx as IncomingSasVerificationTransaction).uxState
|
||||
when (uxState) {
|
||||
|
|
|
@ -178,7 +178,7 @@ class VerificationTest : InstrumentedTest {
|
|||
var bobReadyPendingVerificationRequest: PendingVerificationRequest? = null
|
||||
|
||||
val latch = CountDownLatch(2)
|
||||
val aliceListener = object : VerificationService.VerificationListener {
|
||||
val aliceListener = object : VerificationService.Listener {
|
||||
override fun verificationRequestUpdated(pr: PendingVerificationRequest) {
|
||||
// Step 4: Alice receive the ready request
|
||||
if (pr.isReady) {
|
||||
|
@ -189,7 +189,7 @@ class VerificationTest : InstrumentedTest {
|
|||
}
|
||||
aliceVerificationService.addListener(aliceListener)
|
||||
|
||||
val bobListener = object : VerificationService.VerificationListener {
|
||||
val bobListener = object : VerificationService.Listener {
|
||||
override fun verificationRequestCreated(pr: PendingVerificationRequest) {
|
||||
// Step 2: Bob accepts the verification request
|
||||
bobVerificationService.readyPendingVerificationInDMs(
|
||||
|
|
|
@ -30,9 +30,9 @@ import im.vector.matrix.android.internal.crypto.verification.PendingVerification
|
|||
*/
|
||||
interface VerificationService {
|
||||
|
||||
fun addListener(listener: VerificationListener)
|
||||
fun addListener(listener: Listener)
|
||||
|
||||
fun removeListener(listener: VerificationListener)
|
||||
fun removeListener(listener: Listener)
|
||||
|
||||
/**
|
||||
* Mark this device as verified manually
|
||||
|
@ -95,7 +95,8 @@ interface VerificationService {
|
|||
otherUserId: String,
|
||||
transactionId: String): Boolean
|
||||
|
||||
interface VerificationListener {
|
||||
interface Listener {
|
||||
// TODO javadoc
|
||||
fun verificationRequestCreated(pr: PendingVerificationRequest) {}
|
||||
fun verificationRequestUpdated(pr: PendingVerificationRequest) {}
|
||||
|
||||
|
|
|
@ -176,9 +176,9 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private var listeners = ArrayList<VerificationService.VerificationListener>()
|
||||
private var listeners = ArrayList<VerificationService.Listener>()
|
||||
|
||||
override fun addListener(listener: VerificationService.VerificationListener) {
|
||||
override fun addListener(listener: VerificationService.Listener) {
|
||||
uiHandler.post {
|
||||
if (!listeners.contains(listener)) {
|
||||
listeners.add(listener)
|
||||
|
@ -186,7 +186,7 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun removeListener(listener: VerificationService.VerificationListener) {
|
||||
override fun removeListener(listener: VerificationService.Listener) {
|
||||
uiHandler.post {
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import kotlin.collections.HashMap
|
|||
@Singleton
|
||||
class KeyRequestHandler @Inject constructor(private val context: Context)
|
||||
: RoomKeysRequestListener,
|
||||
VerificationService.VerificationListener {
|
||||
VerificationService.Listener {
|
||||
|
||||
private val alertsToRequests = HashMap<String, ArrayList<IncomingRoomKeyRequest>>()
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import javax.inject.Singleton
|
|||
* Listens to the VerificationManager and add a new notification when an incoming request is detected.
|
||||
*/
|
||||
@Singleton
|
||||
class IncomingVerificationRequestHandler @Inject constructor(private val context: Context) : VerificationService.VerificationListener {
|
||||
class IncomingVerificationRequestHandler @Inject constructor(private val context: Context) : VerificationService.Listener {
|
||||
|
||||
private var session: Session? = null
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(@Assisted ini
|
|||
@Assisted args: VerificationBottomSheet.VerificationArgs,
|
||||
private val session: Session)
|
||||
: VectorViewModel<VerificationBottomSheetViewState, VerificationAction, VerificationBottomSheetViewEvents>(initialState),
|
||||
VerificationService.VerificationListener {
|
||||
VerificationService.Listener {
|
||||
|
||||
init {
|
||||
session.getVerificationService().addListener(this)
|
||||
|
|
|
@ -45,7 +45,7 @@ data class VerificationChooseMethodViewState(
|
|||
class VerificationChooseMethodViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: VerificationChooseMethodViewState,
|
||||
private val session: Session
|
||||
) : VectorViewModel<VerificationChooseMethodViewState, EmptyAction, EmptyViewEvents>(initialState), VerificationService.VerificationListener {
|
||||
) : VectorViewModel<VerificationChooseMethodViewState, EmptyAction, EmptyViewEvents>(initialState), VerificationService.Listener {
|
||||
|
||||
override fun transactionCreated(tx: VerificationTransaction) {
|
||||
transactionUpdated(tx)
|
||||
|
|
|
@ -52,7 +52,7 @@ data class VerificationEmojiCodeViewState(
|
|||
class VerificationEmojiCodeViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: VerificationEmojiCodeViewState,
|
||||
private val session: Session
|
||||
) : VectorViewModel<VerificationEmojiCodeViewState, EmptyAction, EmptyViewEvents>(initialState), VerificationService.VerificationListener {
|
||||
) : VectorViewModel<VerificationEmojiCodeViewState, EmptyAction, EmptyViewEvents>(initialState), VerificationService.Listener {
|
||||
|
||||
init {
|
||||
withState { state ->
|
||||
|
|
|
@ -52,7 +52,7 @@ data class DevicesViewState(
|
|||
|
||||
class DevicesViewModel @AssistedInject constructor(@Assisted initialState: DevicesViewState,
|
||||
private val session: Session)
|
||||
: VectorViewModel<DevicesViewState, DevicesAction, DevicesViewEvents>(initialState), VerificationService.VerificationListener {
|
||||
: VectorViewModel<DevicesViewState, DevicesAction, DevicesViewEvents>(initialState), VerificationService.Listener {
|
||||
|
||||
@AssistedInject.Factory
|
||||
interface Factory {
|
||||
|
|
Loading…
Reference in a new issue