clean klint

This commit is contained in:
Valere 2020-01-29 09:40:17 +01:00
parent 9a79297e14
commit 2c568b4de9
35 changed files with 78 additions and 92 deletions

View file

@ -25,7 +25,14 @@ import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.crypto.keysbackup.KeysBackupService
import im.vector.matrix.android.api.session.crypto.keysbackup.KeysBackupState
import im.vector.matrix.android.api.session.crypto.keysbackup.KeysBackupStateListener
import im.vector.matrix.android.common.*
import im.vector.matrix.android.common.CommonTestHelper
import im.vector.matrix.android.common.CryptoTestData
import im.vector.matrix.android.common.CryptoTestHelper
import im.vector.matrix.android.common.SessionTestParams
import im.vector.matrix.android.common.TestConstants
import im.vector.matrix.android.common.TestMatrixCallback
import im.vector.matrix.android.common.assertDictEquals
import im.vector.matrix.android.common.assertListEquals
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM_BACKUP
import im.vector.matrix.android.internal.crypto.MegolmSessionData
import im.vector.matrix.android.internal.crypto.OutgoingRoomKeyRequest
@ -36,12 +43,18 @@ import im.vector.matrix.android.internal.crypto.keysbackup.model.rest.KeysVersio
import im.vector.matrix.android.internal.crypto.keysbackup.model.rest.KeysVersionResult
import im.vector.matrix.android.internal.crypto.model.ImportRoomKeysResult
import im.vector.matrix.android.internal.crypto.model.OlmInboundGroupSessionWrapper
import org.junit.Assert.*
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
import java.util.*
import java.util.ArrayList
import java.util.Collections
import java.util.concurrent.CountDownLatch
@RunWith(AndroidJUnit4::class)
@ -298,7 +311,10 @@ class KeysBackupTest : InstrumentedTest {
val decryption = keysBackup.pkDecryptionFromRecoveryKey(keyBackupCreationInfo.recoveryKey)
assertNotNull(decryption)
// - Check decryptKeyBackupData() returns stg
val sessionData = keysBackup.decryptKeyBackupData(keyBackupData, session.olmInboundGroupSession!!.sessionIdentifier(), cryptoTestData.roomId, decryption!!)
val sessionData = keysBackup
.decryptKeyBackupData(keyBackupData,
session.olmInboundGroupSession!!.sessionIdentifier(),
cryptoTestData.roomId, decryption!!)
assertNotNull(sessionData)
// - Compare the decrypted megolm key with the original one
assertKeysEquals(session.exportKeys(), sessionData)

View file

@ -21,7 +21,6 @@ import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.util.Optional
import im.vector.matrix.android.internal.crypto.crosssigning.DeviceTrustResult
import im.vector.matrix.android.internal.crypto.crosssigning.UserTrustResult
import im.vector.matrix.android.internal.crypto.model.rest.SignatureUploadResponse
import im.vector.matrix.android.internal.crypto.model.rest.UserPasswordAuth
interface CrossSigningService {

View file

@ -33,5 +33,4 @@ interface SasVerificationTransaction : VerificationTransaction {
fun userHasVerifiedShortCode()
fun shortCodeDoesNotMatch()
}

View file

@ -52,7 +52,11 @@ interface VerificationService {
/**
* Request a key verification from another user using toDevice events.
*/
fun requestKeyVerificationInDMs(methods: List<VerificationMethod>, otherUserId: String, roomId: String, localId: String? = LocalEcho.createLocalEchoId()): PendingVerificationRequest
fun requestKeyVerificationInDMs(methods: List<VerificationMethod>,
otherUserId: String,
roomId: String,
localId: String? = LocalEcho.createLocalEchoId()
): PendingVerificationRequest
fun declineVerificationRequestInDMs(otherUserId: String, otherDeviceId: String, transactionId: String, roomId: String)

View file

@ -16,7 +16,6 @@
package im.vector.matrix.android.internal.crypto
import com.zhuinden.monarchy.Monarchy
import dagger.Binds
import dagger.Module
import dagger.Provides

View file

@ -155,7 +155,6 @@ internal class DefaultCryptoService @Inject constructor(
private val cryptoCoroutineScope: CoroutineScope
) : CryptoService {
init {
verificationService.cryptoService = this
}
@ -188,7 +187,7 @@ internal class DefaultCryptoService @Inject constructor(
.configureWith(SetDeviceNameTask.Params(deviceId, deviceName)) {
this.callback = object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
//bg refresh of crypto device
// bg refresh of crypto device
downloadKeys(listOf(credentials.userId), true, object : MatrixCallback<MXUsersDevicesMap<CryptoDeviceInfo>> {})
callback.onSuccess(data)
}

View file

@ -27,7 +27,6 @@ import im.vector.matrix.android.internal.crypto.MXOlmDevice
import im.vector.matrix.android.internal.crypto.MyDeviceInfoHolder
import im.vector.matrix.android.internal.crypto.model.CryptoCrossSigningKey
import im.vector.matrix.android.internal.crypto.model.KeyUsage
import im.vector.matrix.android.internal.crypto.model.rest.KeysQueryResponse
import im.vector.matrix.android.internal.crypto.model.rest.UploadSignatureQueryBuilder
import im.vector.matrix.android.internal.crypto.model.rest.UserPasswordAuth
import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
@ -245,7 +244,7 @@ internal class DefaultCrossSigningService @Inject constructor(
resetTrustOnKeyChange()
uploadSignaturesTask.configureWith(UploadSignaturesTask.Params(uploadSignatureQueryBuilder.build())) {
//this.retryCount = 3
// this.retryCount = 3
this.constraints = TaskConstraints(true)
this.callback = object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
@ -254,7 +253,7 @@ internal class DefaultCrossSigningService @Inject constructor(
}
override fun onFailure(failure: Throwable) {
//Clear
// Clear
Timber.e(failure, "## CrossSigning - Failed to upload signatures")
clearSigningKeys()
}
@ -584,8 +583,13 @@ internal class DefaultCrossSigningService @Inject constructor(
*/
val otherSSKSignature = otherDevice.signatures?.get(otherUserId)?.get("ed25519:${otherKeys.selfSigningKey()?.unpaddedBase64PublicKey}")
?: return legacyFallbackTrust(locallyTrusted, DeviceTrustResult.MissingDeviceSignature(otherDeviceId, otherKeys.selfSigningKey()?.unpaddedBase64PublicKey
?: ""))
?: return legacyFallbackTrust(
locallyTrusted,
DeviceTrustResult.MissingDeviceSignature(otherDeviceId, otherKeys.selfSigningKey()
?.unpaddedBase64PublicKey
?: ""
)
)
// Check bob's device is signed by bob's SSK
try {
@ -606,7 +610,6 @@ internal class DefaultCrossSigningService @Inject constructor(
}
override fun onUsersDeviceUpdate(users: List<String>) {
Timber.d("## CrossSigning - onUsersDeviceUpdate for ${users.size} users")
users.forEach { otherUserId ->

View file

@ -38,7 +38,11 @@ data class UploadSignatureQueryBuilder(
fun build(): Map<String, Map<String, @JvmSuppressWildcards Any>> {
val map = HashMap<String, HashMap<String, Any>>()
val usersList = (deviceInfoList.map { it.userId } + signingKeyInfoList.mapNotNull { it.userId }).distinct()
val usersList = (
deviceInfoList.map { it.userId }
+ signingKeyInfoList
.map { it.userId }
).distinct()
usersList.forEach { userID ->
val userMap = HashMap<String, Any>()

View file

@ -365,7 +365,11 @@ internal class RealmCryptoStore(private val realmConfiguration: RealmConfigurati
override fun getLiveDeviceList(userId: String): LiveData<List<CryptoDeviceInfo>> {
val liveData = monarchy.findAllMappedWithChanges(
{ realm: Realm -> realm.where<UserEntity>().equalTo(UserEntityFields.USER_ID, userId) },
{ realm: Realm ->
realm
.where<UserEntity>()
.equalTo(UserEntityFields.USER_ID, userId)
},
{ entity ->
entity.devices.map { CryptoMapper.mapToModel(it) }
}
@ -929,7 +933,7 @@ internal class RealmCryptoStore(private val realmConfiguration: RealmConfigurati
val xInfoEntities = realm.where(CrossSigningInfoEntity::class.java)
.findAll()
xInfoEntities?.forEach { info ->
//Need to ignore mine
// Need to ignore mine
if (info.userId != credentials.userId) {
info.crossSigningKeys.forEach {
it.trustLevelEntity = null
@ -969,7 +973,10 @@ internal class RealmCryptoStore(private val realmConfiguration: RealmConfigurati
override fun getLiveCrossSigningInfo(userId: String): LiveData<Optional<MXCrossSigningInfo>> {
val liveData = monarchy.findAllMappedWithChanges(
{ realm: Realm -> realm.where<CrossSigningInfoEntity>().equalTo(UserEntityFields.USER_ID, userId) },
{ realm: Realm ->
realm.where<CrossSigningInfoEntity>()
.equalTo(UserEntityFields.USER_ID, userId)
},
{ entity ->
MXCrossSigningInfo(
userId = userId,
@ -1011,7 +1018,7 @@ internal class RealmCryptoStore(private val realmConfiguration: RealmConfigurati
} else {
// Just override existing, caller should check and untrust id needed
existing = CrossSigningInfoEntity.getOrCreate(realm, userId)
// existing.crossSigningKeys.forEach { it.deleteFromRealm() }
// existing.crossSigningKeys.forEach { it.deleteFromRealm() }
val xkeys = RealmList<KeyInfoEntity>()
info.crossSigningKeys.forEach { cryptoCrossSigningKey ->
xkeys.add(

View file

@ -49,7 +49,6 @@ internal object RealmCryptoStoreMigration : RealmMigration {
.addField(TrustLevelEntityFields.LOCALLY_VERIFIED, Boolean::class.java)
.setNullable(TrustLevelEntityFields.LOCALLY_VERIFIED, true)
val keyInfoEntitySchema = realm.schema.create("KeyInfoEntity")
.addField(KeyInfoEntityFields.PUBLIC_KEY_BASE64, String::class.java)
.addField(KeyInfoEntityFields.SIGNATURES, String::class.java)

View file

@ -34,8 +34,7 @@ internal class DefaultUploadSignaturesTask @Inject constructor(
private val eventBus: EventBus
) : UploadSignaturesTask {
override suspend fun execute(params: UploadSignaturesTask.Params): Unit {
override suspend fun execute(params: UploadSignaturesTask.Params) {
try {
val response = executeRequest<SignatureUploadResponse>(eventBus) {
apiCall = cryptoApi.uploadSignatures(params.signatures)

View file

@ -383,7 +383,7 @@ internal class DefaultVerificationService @Inject constructor(
val existing = getExistingTransaction(otherUserId, tid)
when (startReq.method) {
VERIFICATION_METHOD_SAS -> {
VERIFICATION_METHOD_SAS -> {
when (existing) {
is SasVerificationTransaction -> {
// should cancel both!
@ -400,8 +400,9 @@ internal class DefaultVerificationService @Inject constructor(
?.filterIsInstance(SasVerificationTransaction::class.java)
?.takeIf { it.isNotEmpty() }
?.also {
// Multiple keyshares between two devices: any two devices may only have at most one key verification in flight at a time.
Timber.v("## SAS onStartRequestReceived - There is already a transaction with this user ${startReq.transactionID}")
// Multiple keyshares between two devices:
// any two devices may only have at most one key verification in flight at a time.
Timber.v("## SAS onStartRequestReceived - Already a transaction with this user ${startReq.transactionID}")
}
?.forEach {
it.cancel(CancelCode.UnexpectedMessage)
@ -443,7 +444,7 @@ internal class DefaultVerificationService @Inject constructor(
return CancelCode.UnexpectedMessage
}
}
else ->{
else -> {
Timber.e("## SAS onStartRequestReceived - unknown method ${startReq.method}")
return CancelCode.UnknownMethod
}
@ -882,7 +883,9 @@ internal class DefaultVerificationService @Inject constructor(
val methodValues = if (crossSigningService.isCrossSigningEnabled()) {
// Add reciprocate method if application declares it can scan or show QR codes
// Not sure if it ok to do that (?)
val reciprocateMethod = methods.firstOrNull { it == VerificationMethod.QR_CODE_SCAN || it == VerificationMethod.QR_CODE_SHOW }?.let { listOf(VERIFICATION_METHOD_RECIPROCATE) }.orEmpty()
val reciprocateMethod = methods
.firstOrNull { it == VerificationMethod.QR_CODE_SCAN || it == VerificationMethod.QR_CODE_SHOW }
?.let { listOf(VERIFICATION_METHOD_RECIPROCATE) }.orEmpty()
methods.map { it.toValue() } + reciprocateMethod
} else {
// Filter out SCAN and SHOW qr code method

View file

@ -27,7 +27,6 @@ import im.vector.matrix.android.api.session.events.model.EventType
import im.vector.matrix.android.internal.crypto.actions.SetDeviceVerificationAction
import im.vector.matrix.android.internal.crypto.crosssigning.DeviceTrustLevel
import im.vector.matrix.android.internal.crypto.model.MXKey
import im.vector.matrix.android.internal.crypto.model.rest.SignatureUploadResponse
import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
import im.vector.matrix.android.internal.extensions.toUnsignedInt
import im.vector.matrix.android.internal.util.withoutPrefix

View file

@ -24,7 +24,6 @@ import im.vector.matrix.android.api.session.crypto.sas.VerificationTxState
import im.vector.matrix.android.api.session.events.model.EventType
import im.vector.matrix.android.internal.crypto.actions.SetDeviceVerificationAction
import im.vector.matrix.android.internal.crypto.crosssigning.DeviceTrustLevel
import im.vector.matrix.android.internal.crypto.model.rest.SignatureUploadResponse
import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
import im.vector.matrix.android.internal.crypto.verification.DefaultVerificationTransaction
import im.vector.matrix.android.internal.crypto.verification.VerificationInfo
@ -135,7 +134,6 @@ internal class DefaultQrCodeVerificationTransaction(
}
}
}
}
if (!canTrustOtherUserMasterKey && toVerifyDeviceIds.isEmpty()) {

View file

@ -66,7 +66,6 @@ abstract class GenericItemWithValue : VectorEpoxyModel<GenericItemWithValue.Hold
holder.titleIcon.isVisible = false
}
holder.valueText.setTextOrHide(value)
if (valueColorInt != null) {

View file

@ -139,7 +139,9 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(@Assisted ini
copy(
roomId = data,
pendingRequest = Success(
session.getVerificationService().requestKeyVerificationInDMs(supportedVerificationMethods, otherUserId, data, pendingLocalId)
session
.getVerificationService()
.requestKeyVerificationInDMs(supportedVerificationMethods, otherUserId, data, pendingLocalId)
)
)
}
@ -153,7 +155,12 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(@Assisted ini
})
} else {
setState {
copy(pendingRequest = Success(session.getVerificationService().requestKeyVerificationInDMs(supportedVerificationMethods, otherUserId, roomId)))
copy(
pendingRequest = Success(session
.getVerificationService()
.requestKeyVerificationInDMs(supportedVerificationMethods, otherUserId, roomId)
)
)
}
}
}

View file

@ -17,7 +17,6 @@ package im.vector.riotx.features.crypto.verification.request
import android.os.Bundle
import android.view.View
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.parentFragmentViewModel
import com.airbnb.mvrx.withState
import im.vector.riotx.R
@ -42,7 +41,6 @@ class VerificationRequestFragment @Inject constructor(
setupRecyclerView()
}
override fun onDestroyView() {
bottomSheetVerificationRecyclerView.cleanup()
controller.listener = null

View file

@ -1024,7 +1024,7 @@ class RoomDetailFragment @Inject constructor(
}
override fun onAvatarClicked(informationData: MessageInformationData) {
//roomDetailViewModel.handle(RoomDetailAction.RequestVerification(informationData.senderId))
// roomDetailViewModel.handle(RoomDetailAction.RequestVerification(informationData.senderId))
openRoomMemberProfile(informationData.senderId)
}

View file

@ -31,7 +31,7 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
private val defaultItemFactory: DefaultItemFactory,
private val roomCreateItemFactory: RoomCreateItemFactory,
private val verificationConclusionItemFactory: VerificationItemFactory,
private val userPreferencesProvider: UserPreferencesProvider ) {
private val userPreferencesProvider: UserPreferencesProvider) {
fun create(event: TimelineEvent,
nextEvent: TimelineEvent?,

View file

@ -120,7 +120,6 @@ object PopupAlertManager {
}
currentAlerter = next
next?.let {
if (next.shouldBeDisplayedIn?.invoke(currentActivity) == false) return
val currentTime = System.currentTimeMillis()
if (next.expirationTimestamp != null && currentTime > next.expirationTimestamp!!) {

View file

@ -78,7 +78,7 @@ class RoomMemberProfileController @Inject constructor(
if (state.userMXCrossSigningInfo != null) {
// Cross signing is enabled for this user
if (state.userMXCrossSigningInfo.isTrusted()) {
//User is trusted
// User is trusted
val icon = if (state.allDevicesAreTrusted.invoke() == true) R.drawable.ic_shield_trusted
else R.drawable.ic_shield_warning
@ -95,7 +95,7 @@ class RoomMemberProfileController @Inject constructor(
action = { callback?.onShowDeviceList() }
)
} else {
//Not trusted, propose to verify
// Not trusted, propose to verify
if (!state.isMine) {
buildProfileAction(
id = "learn_more",

View file

@ -101,7 +101,6 @@ class RoomMemberProfileFragment @Inject constructor(
}
}
}
}
}
@ -148,31 +147,8 @@ class RoomMemberProfileFragment @Inject constructor(
override fun onTapVerify() {
viewModel.handle(RoomMemberProfileAction.VerifyUser())
// if (state.isRoomEncrypted) {
// if( !state.isMine && state.userMXCrossSigningInfo?.isTrusted == false) {
// // we want to verify
// // TODO do not use current room, find or create DM
// VerificationBottomSheet.withArgs(
// state.roomId,
// state.userId
// ).show(parentFragmentManager, "REQ")
// }
// }
}
// override fun onTapVerify() = withState(viewModel) { state ->
// if (state.isRoomEncrypted) {
// if( !state.isMine && state.userMXCrossSigningInfo?.isTrusted == false) {
// // we want to verify
// // TODO do not use current room, find or create DM
// VerificationBottomSheet.withArgs(
// state.roomId,
// state.userId
// ).show(parentFragmentManager, "REQ")
// }
// }
// }
override fun onShowDeviceList() = withState(viewModel) {
DeviceListBottomSheet.newInstance(it.userId).show(parentFragmentManager, "DEV_LIST")
}

View file

@ -48,9 +48,7 @@ import im.vector.matrix.rx.unwrap
import im.vector.riotx.R
import im.vector.riotx.core.platform.VectorViewModel
import im.vector.riotx.core.resources.StringProvider
import im.vector.riotx.core.utils.DataSource
import im.vector.riotx.core.utils.LiveEvent
import im.vector.riotx.core.utils.PublishDataSource
import io.reactivex.Observable
import io.reactivex.functions.BiFunction
import kotlinx.coroutines.Dispatchers
@ -149,7 +147,6 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
)
}
}
}
private fun observeRoomMemberSummary(room: Room) {

View file

@ -23,7 +23,6 @@ import com.airbnb.mvrx.Uninitialized
import im.vector.matrix.android.api.session.crypto.crosssigning.MXCrossSigningInfo
import im.vector.matrix.android.api.session.room.model.PowerLevelsContent
import im.vector.matrix.android.api.util.MatrixItem
import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo
data class RoomMemberProfileViewState(
val userId: String,

View file

@ -55,7 +55,6 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
}
when (data.cryptoDevices) {
Uninitialized -> {
}
is Loading -> {
loadingItem {
@ -64,12 +63,10 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
}
}
is Success -> {
val deviceList = data.cryptoDevices.invoke().sortedByDescending {
it.isVerified
}
// Build top header
val allGreen = deviceList.fold(true, { prev, device ->
prev && device.isVerified
@ -96,7 +93,6 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
id("sessions")
style(GenericItem.STYLE.BIG_TEXT)
title(stringProvider.getString(R.string.room_member_profile_sessions_section_title))
}
if (deviceList.isEmpty()) {
// Can this really happen?

View file

@ -34,7 +34,6 @@ class DeviceTrustInfoActionFragment @Inject constructor(
val epoxyController: DeviceTrustInfoEpoxyController
) : VectorBaseFragment(), DeviceTrustInfoEpoxyController.InteractionListener {
override fun getLayoutResId() = R.layout.bottom_sheet_generic_list
private val viewModel: DeviceListBottomSheetViewModel by parentFragmentViewModel(DeviceListBottomSheetViewModel::class)
@ -66,5 +65,3 @@ class DeviceTrustInfoActionFragment @Inject constructor(
viewModel.manuallyVerify(device)
}
}

View file

@ -118,7 +118,6 @@ class CrossSigningEpoxyController @Inject constructor(
id("loading")
}
} else {
val crossSigningKeys = data.crossSigningInfo
crossSigningKeys?.masterKey()?.let {

View file

@ -122,4 +122,3 @@ class CrossSigningSettingsFragment @Inject constructor(
viewModel.handle(CrossSigningAction.InitializeCrossSigning())
}
}

View file

@ -99,7 +99,6 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted privat
copy(isUploadingKeys = true)
}
session.getCrossSigningService().initializeCrossSigning(auth, object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
setState {
copy(isUploadingKeys = false)

View file

@ -17,7 +17,6 @@
package im.vector.riotx.features.settings.devices
import android.graphics.Typeface
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
@ -110,7 +109,6 @@ abstract class DeviceItem : VectorEpoxyModel<DeviceItem.Holder>() {
it.isVisible = false
}
}
}
class Holder : VectorEpoxyHolder() {

View file

@ -43,7 +43,7 @@ class DeviceVerificationInfoBottomSheet : VectorBaseBottomSheetDialogFragment(),
private val viewModel: DeviceVerificationInfoBottomSheetViewModel by fragmentViewModel(DeviceVerificationInfoBottomSheetViewModel::class)
private val sharedViewModel: DevicesViewModel by parentFragmentViewModel (DevicesViewModel::class)
private val sharedViewModel: DevicesViewModel by parentFragmentViewModel(DevicesViewModel::class)
@Inject lateinit var deviceVerificationInfoViewModelFactory: DeviceVerificationInfoBottomSheetViewModel.Factory
@ -91,5 +91,4 @@ class DeviceVerificationInfoBottomSheet : VectorBaseBottomSheetDialogFragment(),
dismiss()
sharedViewModel.handle(action)
}
}

View file

@ -47,7 +47,8 @@ class DeviceVerificationInfoBottomSheetViewModel @AssistedInject constructor(@As
companion object : MvRxViewModelFactory<DeviceVerificationInfoBottomSheetViewModel, DeviceVerificationInfoBottomSheetViewState> {
@JvmStatic
override fun create(viewModelContext: ViewModelContext, state: DeviceVerificationInfoBottomSheetViewState): DeviceVerificationInfoBottomSheetViewModel? {
override fun create(viewModelContext: ViewModelContext, state: DeviceVerificationInfoBottomSheetViewState)
: DeviceVerificationInfoBottomSheetViewModel? {
val fragment: DeviceVerificationInfoBottomSheet = (viewModelContext as FragmentViewModelContext).fragment()
return fragment.deviceVerificationInfoViewModelFactory.create(state)
}

View file

@ -22,11 +22,9 @@ import im.vector.riotx.core.epoxy.dividerItem
import im.vector.riotx.core.epoxy.loadingItem
import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.resources.StringProvider
import im.vector.riotx.core.resources.UserPreferencesProvider
import im.vector.riotx.core.ui.list.GenericItem
import im.vector.riotx.core.ui.list.genericItem
import im.vector.riotx.features.crypto.verification.epoxy.bottomSheetVerificationActionItem
import im.vector.riotx.features.home.AvatarRenderer
import javax.inject.Inject
class DeviceVerificationInfoEpoxyController @Inject constructor(private val stringProvider: StringProvider,
@ -43,7 +41,6 @@ class DeviceVerificationInfoEpoxyController @Inject constructor(private val stri
id("loading")
}
} else {
if (device.isVerified) {
genericItem {
id("trust${device.deviceId}")
@ -85,7 +82,7 @@ class DeviceVerificationInfoEpoxyController @Inject constructor(private val stri
}
if (device.deviceId != session.sessionParams.credentials.deviceId) {
//Add the delete option
// Add the delete option
dividerItem {
id("d2")
}

View file

@ -29,7 +29,6 @@ import im.vector.riotx.core.epoxy.errorWithRetryItem
import im.vector.riotx.core.epoxy.loadingItem
import im.vector.riotx.core.error.ErrorFormatter
import im.vector.riotx.core.resources.StringProvider
import im.vector.riotx.core.ui.list.genericFooterItem
import im.vector.riotx.core.ui.list.genericItemHeader
import im.vector.riotx.features.settings.VectorPreferences
import javax.inject.Inject
@ -97,7 +96,6 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
// Other devices
if (devices.size > 1) {
genericItemHeader {
id("others")
text(stringProvider.getString(R.string.devices_other_devices))

View file

@ -96,7 +96,7 @@ class DevicesViewModel @AssistedInject constructor(@Assisted initialState: Devic
override fun transactionCreated(tx: VerificationTransaction) {}
override fun transactionUpdated(tx: VerificationTransaction) {
if(tx.state == VerificationTxState.Verified) {
if (tx.state == VerificationTxState.Verified) {
refreshDevicesList()
}
}