Warn on verify when private keys not known

This commit is contained in:
Valere 2020-02-01 14:35:18 +01:00
parent 10094a212c
commit 8f7b18239d
4 changed files with 26 additions and 5 deletions

View File

@ -23,5 +23,5 @@ sealed class RoomMemberProfileAction : VectorViewModelAction {
object RetryFetchingInfo: RoomMemberProfileAction()
object IgnoreUser: RoomMemberProfileAction()
data class VerifyUser(val userId: String? = null, val roomId: String? = null): RoomMemberProfileAction()
data class VerifyUser(val userId: String? = null, val roomId: String? = null, val canCrossSign: Boolean? = true): RoomMemberProfileAction()
}

View File

@ -20,6 +20,7 @@ package im.vector.riotx.features.roommemberprofile
import android.os.Bundle
import android.os.Parcelable
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import com.airbnb.mvrx.Fail
import com.airbnb.mvrx.Incomplete
@ -100,9 +101,22 @@ class RoomMemberProfileFragment @Inject constructor(
is Success -> {
when (val action = async.invoke()) {
is RoomMemberProfileAction.VerifyUser -> {
VerificationBottomSheet
.withArgs(roomId = null, otherUserId = action.userId!!)
.show(parentFragmentManager, "VERIF")
if (action.canCrossSign == true) {
VerificationBottomSheet
.withArgs(roomId = null, otherUserId = action.userId!!)
.show(parentFragmentManager, "VERIF")
} else {
AlertDialog.Builder(requireContext())
.setTitle(R.string.dialog_title_warning)
.setMessage(R.string.verify_cannot_cross_sign)
.setPositiveButton(R.string.verification_profile_verify) { _, _ ->
VerificationBottomSheet
.withArgs(roomId = null, otherUserId = action.userId!!)
.show(parentFragmentManager, "VERIF")
}
.setNegativeButton(R.string.cancel, null)
.show()
}
}
}
}

View File

@ -149,7 +149,12 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
if (!state.isMine && state.userMXCrossSigningInfo?.isTrusted() == false) {
// ok, let's find or create the DM room
_actionResultLiveData.postValue(
LiveEvent(Success(action.copy(userId = state.userId)))
LiveEvent(Success(
action.copy(
userId = state.userId,
canCrossSign = session.getCrossSigningService().canCrossSign()
)
))
)
}
}

View File

@ -91,6 +91,8 @@
<string name="unignore">Unignore</string>
<string name="verify_cannot_cross_sign">This session is unable to share this verification with your other sessions.\nThe verification will be saved locally and shared in a future version of the app.</string>
<string name="room_list_sharing_header_recent_rooms">Recent rooms</string>
<string name="room_list_sharing_header_other_rooms">Other rooms</string>