diff --git a/CHANGES.md b/CHANGES.md index 03817341bc..12ecb2e027 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Improvements 🙌: - Support homeserver discovery from MXID (DISABLED: waiting for design) (#476) Bugfix 🐛: + - Fix | Verify Manually by Text crashes if private SSK not known (#1337) - Sometimes the same device appears twice in the list of devices of a user (#1329) Translations 🗣: diff --git a/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt b/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt index cd5e53b7c3..d0369e7707 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt @@ -30,7 +30,6 @@ import com.squareup.inject.assisted.Assisted import com.squareup.inject.assisted.AssistedInject import im.vector.matrix.android.api.MatrixCallback import im.vector.matrix.android.api.NoOpMatrixCallback -import im.vector.matrix.android.api.extensions.tryThis import im.vector.matrix.android.api.failure.Failure import im.vector.matrix.android.api.session.Session import im.vector.matrix.android.api.session.crypto.verification.VerificationMethod @@ -48,6 +47,7 @@ import io.reactivex.Observable import io.reactivex.functions.BiFunction import io.reactivex.subjects.PublishSubject import kotlinx.coroutines.launch +import timber.log.Timber import java.util.concurrent.TimeUnit data class DevicesViewState( @@ -65,6 +65,7 @@ data class DeviceFullInfo( val deviceInfo: DeviceInfo, val cryptoDeviceInfo: CryptoDeviceInfo? ) + class DevicesViewModel @AssistedInject constructor( @Assisted initialState: DevicesViewState, private val session: Session @@ -215,8 +216,13 @@ class DevicesViewModel @AssistedInject constructor( private fun handleVerifyManually(action: DevicesAction.MarkAsManuallyVerified) = withState { state -> viewModelScope.launch { if (state.hasAccountCrossSigning) { - awaitCallback { - tryThis { session.cryptoService().crossSigningService().trustDevice(action.cryptoDeviceInfo.deviceId, it) } + try { + awaitCallback { + session.cryptoService().crossSigningService().trustDevice(action.cryptoDeviceInfo.deviceId, it) + } + } catch (failure: Throwable) { + Timber.e("Failed to manually cross sign device ${action.cryptoDeviceInfo.deviceId} : ${failure.localizedMessage}") + _viewEvents.post(DevicesViewEvents.Failure(failure)) } } else { // legacy