mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
cleaning
This commit is contained in:
parent
3c4506cb58
commit
935b3d7f3f
@ -48,6 +48,5 @@ interface SasVerificationTransaction {
|
||||
*/
|
||||
fun userHasVerifiedShortCode()
|
||||
|
||||
|
||||
fun shortCodeDoNotMatch()
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import im.vector.matrix.android.internal.crypto.verification.VerificationInfoRea
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class KeyVerificationReady(
|
||||
@Json(name = "from_device") override val fromDevice: String?,
|
||||
//TODO add qr?
|
||||
// TODO add qr?
|
||||
@Json(name = "methods") override val methods: List<String>? = listOf(KeyVerificationStart.VERIF_METHOD_SAS),
|
||||
@Json(name = "transaction_id") override var transactionID: String? = null
|
||||
) : SendToDeviceObject, VerificationInfoReady {
|
||||
|
@ -80,7 +80,6 @@ internal class DefaultSasVerificationService @Inject constructor(
|
||||
*/
|
||||
private val pendingRequests = HashMap<String, ArrayList<PendingVerificationRequest>>()
|
||||
|
||||
|
||||
// Event received from the sync
|
||||
fun onToDeviceEvent(event: Event) {
|
||||
GlobalScope.launch(coroutineDispatchers.crypto) {
|
||||
@ -184,7 +183,6 @@ internal class DefaultSasVerificationService @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun dispatchRequestAdded(tx: PendingVerificationRequest) {
|
||||
uiHandler.post {
|
||||
listeners.forEach {
|
||||
@ -756,14 +754,14 @@ internal class DefaultSasVerificationService @Inject constructor(
|
||||
override fun readyPendingVerificationInDMs(otherUserId: String, roomId: String, transactionId: String) {
|
||||
// Let's find the related request
|
||||
getExistingVerificationRequest(otherUserId)?.find { it.transactionId == transactionId }?.let {
|
||||
//we need to send a ready event, with matching methods
|
||||
// we need to send a ready event, with matching methods
|
||||
val transport = sasTransportRoomMessageFactory.createTransport(roomId, cryptoService, null)
|
||||
val methods = it.requestInfo?.methods?.intersect(listOf(KeyVerificationStart.VERIF_METHOD_SAS))?.toList()
|
||||
if (methods.isNullOrEmpty()) {
|
||||
Timber.i("Cannot ready this request, no common methods found txId:$transactionId")
|
||||
return@let
|
||||
}
|
||||
//TODO this is not yet related to a transaction, maybe we should use another method like for cancel?
|
||||
// TODO this is not yet related to a transaction, maybe we should use another method like for cancel?
|
||||
val readyMsg = transport.createReady(transactionId, credentials.deviceId ?: "", methods)
|
||||
transport.sendToOther(EventType.KEY_VERIFICATION_READY, readyMsg,
|
||||
SasVerificationTxState.None,
|
||||
|
@ -59,6 +59,5 @@ internal interface SasTransport {
|
||||
|
||||
fun createMac(tid: String, mac: Map<String, String>, keys: String): VerificationInfoMac
|
||||
|
||||
|
||||
fun createReady(tid: String, fromDevice: String, methods: List<String>): VerificationInfoReady
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
viewModel.requestLiveData.observe(this, Observer {
|
||||
viewModel.requestLiveData.observe(viewLifecycleOwner, Observer {
|
||||
it.peekContent().let { va ->
|
||||
when (va) {
|
||||
is Success -> {
|
||||
|
Loading…
Reference in New Issue
Block a user