Fix / tap on accept shows request button instead of start
This commit is contained in:
parent
bf28f14b8b
commit
d1233e8470
|
@ -34,7 +34,6 @@ import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.Executors
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -48,8 +47,6 @@ internal class SasTransportRoomMessage(
|
||||||
private val tx: SASVerificationTransaction?
|
private val tx: SASVerificationTransaction?
|
||||||
) : SasTransport {
|
) : SasTransport {
|
||||||
|
|
||||||
private val listenerExecutor = Executors.newSingleThreadExecutor()
|
|
||||||
|
|
||||||
override fun sendToOther(type: String,
|
override fun sendToOther(type: String,
|
||||||
verificationInfo: VerificationInfo,
|
verificationInfo: VerificationInfo,
|
||||||
nextState: SasVerificationTxState,
|
nextState: SasVerificationTxState,
|
||||||
|
|
|
@ -152,7 +152,10 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
||||||
} else if (it.pendingRequest == null || !it.pendingRequest.isReady) {
|
} else if (it.pendingRequest == null || !it.pendingRequest.isReady) {
|
||||||
// We are waiting for other party to reply with ready
|
// We are waiting for other party to reply with ready
|
||||||
showFragment(VerificationRequestFragment::class, Bundle().apply {
|
showFragment(VerificationRequestFragment::class, Bundle().apply {
|
||||||
putParcelable(MvRx.KEY_ARG, VerificationArgs(it.otherUserMxItem?.id ?: ""))
|
putParcelable(MvRx.KEY_ARG, VerificationArgs(
|
||||||
|
it.otherUserMxItem?.id ?: "",
|
||||||
|
it.pendingRequest?.transactionId,
|
||||||
|
it.roomId))
|
||||||
})
|
})
|
||||||
} else if (it.pendingRequest.isReady) {
|
} else if (it.pendingRequest.isReady) {
|
||||||
showFragment(VerificationChooseMethodFragment::class, Bundle().apply {
|
showFragment(VerificationChooseMethodFragment::class, Bundle().apply {
|
||||||
|
|
|
@ -84,13 +84,12 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(@Assisted ini
|
||||||
|
|
||||||
val userItem = session.getUser(args.otherUserId)
|
val userItem = session.getUser(args.otherUserId)
|
||||||
|
|
||||||
val sasTx = state.pendingRequest?.transactionId?.let {
|
val pr = session.getSasVerificationService().getExistingVerificationRequest(args.otherUserId, args.verificationId)
|
||||||
|
|
||||||
|
val sasTx = pr?.transactionId?.let {
|
||||||
session.getSasVerificationService().getExistingTransaction(args.otherUserId, it)
|
session.getSasVerificationService().getExistingTransaction(args.otherUserId, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
val pr = session.getSasVerificationService().getExistingVerificationRequest(args.otherUserId)
|
|
||||||
?.firstOrNull { it.transactionId == args.verificationId }
|
|
||||||
|
|
||||||
return fragment.verificationViewModelFactory.create(VerificationBottomSheetViewState(
|
return fragment.verificationViewModelFactory.create(VerificationBottomSheetViewState(
|
||||||
otherUserMxItem = userItem?.toMatrixItem(),
|
otherUserMxItem = userItem?.toMatrixItem(),
|
||||||
sasTransactionState = sasTx?.state,
|
sasTransactionState = sasTx?.state,
|
||||||
|
|
|
@ -44,18 +44,6 @@ class VerificationRequestViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
withState {
|
|
||||||
val pr = session.getSasVerificationService()
|
|
||||||
.getExistingVerificationRequest(it.matrixItem.id)
|
|
||||||
?.firstOrNull()
|
|
||||||
setState {
|
|
||||||
copy(
|
|
||||||
started = Success(false).takeIf { pr == null }
|
|
||||||
?: Success(true).takeIf { pr?.isReady == true }
|
|
||||||
?: Loading<Boolean>()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
session.getSasVerificationService().addListener(this)
|
session.getSasVerificationService().addListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +59,18 @@ class VerificationRequestViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initialState(viewModelContext: ViewModelContext): VerificationRequestViewState? {
|
override fun initialState(viewModelContext: ViewModelContext): VerificationRequestViewState? {
|
||||||
val otherUserId = viewModelContext.args<VerificationBottomSheet.VerificationArgs>().otherUserId
|
val args = viewModelContext.args<VerificationBottomSheet.VerificationArgs>()
|
||||||
val session = (viewModelContext.activity as HasScreenInjector).injector().activeSessionHolder().getActiveSession()
|
val session = (viewModelContext.activity as HasScreenInjector).injector().activeSessionHolder().getActiveSession()
|
||||||
|
|
||||||
return session.getUser(otherUserId)?.let {
|
val pr = session.getSasVerificationService()
|
||||||
VerificationRequestViewState(matrixItem = it.toMatrixItem())
|
.getExistingVerificationRequest(args.otherUserId, args.verificationId)
|
||||||
|
return session.getUser(args.otherUserId)?.let {
|
||||||
|
VerificationRequestViewState(
|
||||||
|
started = Success(false).takeIf { pr == null }
|
||||||
|
?: Success(true).takeIf { pr?.isReady == true }
|
||||||
|
?: Loading(),
|
||||||
|
matrixItem = it.toMatrixItem()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue