mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
code review
This commit is contained in:
parent
286a5081ff
commit
6fe77eba72
2 changed files with 12 additions and 12 deletions
|
@ -90,7 +90,7 @@ class KeyShareTests : InstrumentedTest {
|
|||
mTestHelper.retryPeriodicallyWithLatch(waitLatch) {
|
||||
aliceSession2.cryptoService().getOutgoingRoomKeyRequest()
|
||||
.filter { req ->
|
||||
// filter out request thwat was known before
|
||||
// filter out request that was known before
|
||||
!outgoingRequestBefore.any { req.requestId == it.requestId }
|
||||
}
|
||||
.let {
|
||||
|
|
|
@ -455,7 +455,7 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
startReq: ValidVerificationInfoStart,
|
||||
txConfigure: (DefaultVerificationTransaction) -> Unit): CancelCode? {
|
||||
Timber.d("## SAS onStartRequestReceived ${startReq.transactionId}")
|
||||
if (checkKeysAreDownloaded(otherUserId!!, startReq.fromDevice) != null) {
|
||||
if (otherUserId?.let { checkKeysAreDownloaded(it, startReq.fromDevice) } != null) {
|
||||
val tid = startReq.transactionId
|
||||
var existing = getExistingTransaction(otherUserId, tid)
|
||||
|
||||
|
@ -469,15 +469,15 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
if (existing != null && !existing.isIncoming) {
|
||||
val readyRequest = getExistingVerificationRequest(otherUserId, tid)
|
||||
if (readyRequest?.isReady == true) {
|
||||
if (isOtherPrioritary(otherUserId, existing.otherDeviceId ?: "")) {
|
||||
// The other is prioritary!
|
||||
// I should replace my outgoing with an incoming
|
||||
removeTransaction(otherUserId, tid)
|
||||
existing = null
|
||||
} else {
|
||||
// i am prioritary, ignore this start event!
|
||||
return null
|
||||
}
|
||||
if (isOtherPrioritary(otherUserId, existing.otherDeviceId ?: "")) {
|
||||
// The other is prioritary!
|
||||
// I should replace my outgoing with an incoming
|
||||
removeTransaction(otherUserId, tid)
|
||||
existing = null
|
||||
} else {
|
||||
// i am prioritary, ignore this start event!
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -554,7 +554,7 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun isOtherPrioritary(otherUserId: String, otherDeviceId: String) : Boolean {
|
||||
private fun isOtherPrioritary(otherUserId: String, otherDeviceId: String): Boolean {
|
||||
if (userId < otherUserId) {
|
||||
return false
|
||||
} else if (userId > otherUserId) {
|
||||
|
|
Loading…
Reference in a new issue