Prefer using state.otherUserId
over nullable state.otherUserMxItem?.id
This commit is contained in:
parent
7982f4be00
commit
6d2a9ec9d5
@ -235,7 +235,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
|||||||
showFragment(
|
showFragment(
|
||||||
VerificationEmojiCodeFragment::class,
|
VerificationEmojiCodeFragment::class,
|
||||||
VerificationArgs(
|
VerificationArgs(
|
||||||
state.otherUserMxItem?.id ?: "",
|
state.otherUserId,
|
||||||
// If it was outgoing it.transaction id would be null, but the pending request
|
// If it was outgoing it.transaction id would be null, but the pending request
|
||||||
// would be updated (from localId to txId)
|
// would be updated (from localId to txId)
|
||||||
state.pendingRequest.invoke()?.transactionId ?: state.transactionId
|
state.pendingRequest.invoke()?.transactionId ?: state.transactionId
|
||||||
@ -271,7 +271,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
|||||||
VerificationQRWaitingFragment::class,
|
VerificationQRWaitingFragment::class,
|
||||||
VerificationQRWaitingFragment.Args(
|
VerificationQRWaitingFragment.Args(
|
||||||
isMe = state.isMe,
|
isMe = state.isMe,
|
||||||
otherUserName = state.otherUserMxItem?.getBestName() ?: ""
|
otherUserName = state.otherUserMxItem?.getBestName() ?: state.otherUserId
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return@withState
|
return@withState
|
||||||
@ -319,7 +319,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
|||||||
showFragment(
|
showFragment(
|
||||||
VerificationChooseMethodFragment::class,
|
VerificationChooseMethodFragment::class,
|
||||||
VerificationArgs(
|
VerificationArgs(
|
||||||
otherUserId = state.otherUserMxItem?.id ?: "",
|
otherUserId = state.otherUserId,
|
||||||
verificationId = state.pendingRequest.invoke()?.transactionId
|
verificationId = state.pendingRequest.invoke()?.transactionId
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -328,7 +328,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
|||||||
showFragment(
|
showFragment(
|
||||||
VerificationRequestFragment::class,
|
VerificationRequestFragment::class,
|
||||||
VerificationArgs(
|
VerificationArgs(
|
||||||
otherUserId = state.otherUserMxItem?.id ?: "",
|
otherUserId = state.otherUserId,
|
||||||
verificationId = state.pendingRequest.invoke()?.transactionId,
|
verificationId = state.pendingRequest.invoke()?.transactionId,
|
||||||
verificationLocalId = state.roomId
|
verificationLocalId = state.roomId
|
||||||
)
|
)
|
||||||
@ -340,7 +340,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
|||||||
showFragment(
|
showFragment(
|
||||||
VerificationChooseMethodFragment::class,
|
VerificationChooseMethodFragment::class,
|
||||||
VerificationArgs(
|
VerificationArgs(
|
||||||
otherUserId = state.otherUserMxItem?.id ?: "",
|
otherUserId = state.otherUserId,
|
||||||
verificationId = state.pendingRequest.invoke()?.transactionId
|
verificationId = state.pendingRequest.invoke()?.transactionId
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -216,12 +216,12 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||||||
|
|
||||||
private fun cancelAllPendingVerifications(state: VerificationBottomSheetViewState) {
|
private fun cancelAllPendingVerifications(state: VerificationBottomSheetViewState) {
|
||||||
session.cryptoService()
|
session.cryptoService()
|
||||||
.verificationService().getExistingVerificationRequest(state.otherUserMxItem?.id ?: "", state.transactionId)?.let {
|
.verificationService().getExistingVerificationRequest(state.otherUserId, state.transactionId)?.let {
|
||||||
session.cryptoService().verificationService().cancelVerificationRequest(it)
|
session.cryptoService().verificationService().cancelVerificationRequest(it)
|
||||||
}
|
}
|
||||||
session.cryptoService()
|
session.cryptoService()
|
||||||
.verificationService()
|
.verificationService()
|
||||||
.getExistingTransaction(state.otherUserMxItem?.id ?: "", state.transactionId ?: "")
|
.getExistingTransaction(state.otherUserId, state.transactionId ?: "")
|
||||||
?.cancel(CancelCode.User)
|
?.cancel(CancelCode.User)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun handle(action: VerificationAction) = withState { state ->
|
override fun handle(action: VerificationAction) = withState { state ->
|
||||||
val otherUserId = state.otherUserMxItem?.id ?: return@withState
|
val otherUserId = state.otherUserId
|
||||||
val roomId = state.roomId
|
val roomId = state.roomId
|
||||||
?: session.roomService().getExistingDirectRoomWithUser(otherUserId)
|
?: session.roomService().getExistingDirectRoomWithUser(otherUserId)
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||||||
override fun transactionUpdated(tx: VerificationTransaction) = withState { state ->
|
override fun transactionUpdated(tx: VerificationTransaction) = withState { state ->
|
||||||
if (state.selfVerificationMode && state.transactionId == null) {
|
if (state.selfVerificationMode && state.transactionId == null) {
|
||||||
// is this an incoming with that user
|
// is this an incoming with that user
|
||||||
if (tx.isIncoming && tx.otherUserId == state.otherUserMxItem?.id) {
|
if (tx.isIncoming && tx.otherUserId == state.otherUserId) {
|
||||||
// Also auto accept incoming if needed!
|
// Also auto accept incoming if needed!
|
||||||
if (tx is IncomingSasVerificationTransaction) {
|
if (tx is IncomingSasVerificationTransaction) {
|
||||||
if (tx.uxState == IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
if (tx.uxState == IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT) {
|
||||||
@ -564,7 +564,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||||||
|
|
||||||
if (state.selfVerificationMode && state.pendingRequest.invoke() == null && state.transactionId == null) {
|
if (state.selfVerificationMode && state.pendingRequest.invoke() == null && state.transactionId == null) {
|
||||||
// is this an incoming with that user
|
// is this an incoming with that user
|
||||||
if (pr.isIncoming && pr.otherUserId == state.otherUserMxItem?.id) {
|
if (pr.isIncoming && pr.otherUserId == state.otherUserId) {
|
||||||
if (!pr.isReady) {
|
if (!pr.isReady) {
|
||||||
// auto ready in this case, as we are waiting
|
// auto ready in this case, as we are waiting
|
||||||
// TODO, can I be here in DM mode? in this case should test if roomID is null?
|
// TODO, can I be here in DM mode? in this case should test if roomID is null?
|
||||||
|
@ -60,8 +60,8 @@ class VerificationCancelController @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val otherUserID = state.otherUserMxItem?.id ?: ""
|
val otherUserID = state.otherUserId
|
||||||
val otherDisplayName = state.otherUserMxItem?.displayName ?: ""
|
val otherDisplayName = state.otherUserMxItem?.displayName ?: state.otherUserId
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(
|
notice(
|
||||||
|
@ -78,7 +78,7 @@ class VerificationChooseMethodFragment :
|
|||||||
override fun doVerifyBySas() = withState(sharedViewModel) { state ->
|
override fun doVerifyBySas() = withState(sharedViewModel) { state ->
|
||||||
sharedViewModel.handle(
|
sharedViewModel.handle(
|
||||||
VerificationAction.StartSASVerification(
|
VerificationAction.StartSASVerification(
|
||||||
state.otherUserMxItem?.id ?: "",
|
state.otherUserId,
|
||||||
state.pendingRequest.invoke()?.transactionId ?: ""
|
state.pendingRequest.invoke()?.transactionId ?: ""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -130,7 +130,7 @@ class VerificationChooseMethodFragment :
|
|||||||
private fun onRemoteQrCodeScanned(remoteQrCode: String) = withState(sharedViewModel) { state ->
|
private fun onRemoteQrCodeScanned(remoteQrCode: String) = withState(sharedViewModel) { state ->
|
||||||
sharedViewModel.handle(
|
sharedViewModel.handle(
|
||||||
VerificationAction.RemoteQrCodeScanned(
|
VerificationAction.RemoteQrCodeScanned(
|
||||||
state.otherUserMxItem?.id ?: "",
|
state.otherUserId,
|
||||||
state.pendingRequest.invoke()?.transactionId ?: "",
|
state.pendingRequest.invoke()?.transactionId ?: "",
|
||||||
remoteQrCode
|
remoteQrCode
|
||||||
)
|
)
|
||||||
|
@ -54,7 +54,7 @@ class VerificationQrScannedByOtherController @Inject constructor(
|
|||||||
if (state.isMe) {
|
if (state.isMe) {
|
||||||
notice(host.stringProvider.getString(R.string.qr_code_scanned_self_verif_notice).toEpoxyCharSequence())
|
notice(host.stringProvider.getString(R.string.qr_code_scanned_self_verif_notice).toEpoxyCharSequence())
|
||||||
} else {
|
} else {
|
||||||
val name = state.otherUserMxItem?.getBestName() ?: ""
|
val name = state.otherUserMxItem?.getBestName() ?: state.otherUserId
|
||||||
notice(host.stringProvider.getString(R.string.qr_code_scanned_by_other_notice, name).toEpoxyCharSequence())
|
notice(host.stringProvider.getString(R.string.qr_code_scanned_by_other_notice, name).toEpoxyCharSequence())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class VerificationRequestController @Inject constructor(
|
|||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val state = viewState ?: return
|
val state = viewState ?: return
|
||||||
val matrixItem = viewState?.otherUserMxItem ?: return
|
val matrixItem = state.otherUserMxItem ?: return
|
||||||
val host = this
|
val host = this
|
||||||
|
|
||||||
if (state.selfVerificationMode) {
|
if (state.selfVerificationMode) {
|
||||||
|
@ -64,9 +64,7 @@ class VerificationRequestFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onClickOnVerificationStart(): Unit = withState(viewModel) { state ->
|
override fun onClickOnVerificationStart(): Unit = withState(viewModel) { state ->
|
||||||
state.otherUserMxItem?.id?.let { otherUserId ->
|
viewModel.handle(VerificationAction.RequestVerificationByDM(state.otherUserId, state.roomId))
|
||||||
viewModel.handle(VerificationAction.RequestVerificationByDM(otherUserId, state.roomId))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClickRecoverFromPassphrase() {
|
override fun onClickRecoverFromPassphrase() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user