Clean code

This commit is contained in:
ganfra 2020-02-17 15:23:24 +01:00
parent e349a35419
commit fd0dceb597
4 changed files with 7 additions and 5 deletions

View file

@ -39,7 +39,6 @@ import im.vector.matrix.android.api.session.signout.SignOutService
import im.vector.matrix.android.api.session.sync.FilterService
import im.vector.matrix.android.api.session.sync.SyncState
import im.vector.matrix.android.api.session.user.UserService
import im.vector.matrix.android.internal.crypto.DefaultCryptoService
/**
* This interface defines interactions with a session.

View file

@ -49,7 +49,6 @@ import im.vector.matrix.android.internal.crypto.crosssigning.ShieldTrustUpdater
import im.vector.matrix.android.internal.database.LiveEntityObserver
import im.vector.matrix.android.internal.di.SessionId
import im.vector.matrix.android.internal.di.WorkManagerProvider
import im.vector.matrix.android.internal.session.sync.SyncTaskSequencer
import im.vector.matrix.android.internal.session.sync.SyncTokenStore
import im.vector.matrix.android.internal.session.sync.job.SyncThread
import im.vector.matrix.android.internal.session.sync.job.SyncWorker

View file

@ -96,10 +96,11 @@ class VerificationChooseMethodViewModel @AssistedInject constructor(
override fun initialState(viewModelContext: ViewModelContext): VerificationChooseMethodViewState? {
val args: VerificationBottomSheet.VerificationArgs = viewModelContext.args()
val session = (viewModelContext.activity as HasScreenInjector).injector().activeSessionHolder().getActiveSession()
val pvr = session.cryptoService().verificationService().getExistingVerificationRequest(args.otherUserId, args.verificationId)
val verificationService = session.cryptoService().verificationService()
val pvr = verificationService.getExistingVerificationRequest(args.otherUserId, args.verificationId)
// Get the QR code now, because transaction is already created, so transactionCreated() will not be called
val qrCodeVerificationTransaction = session.cryptoService().verificationService().getExistingTransaction(args.otherUserId, args.verificationId ?: "")
val qrCodeVerificationTransaction = verificationService.getExistingTransaction(args.otherUserId, args.verificationId ?: "")
return VerificationChooseMethodViewState(otherUserId = args.otherUserId,
transactionId = args.verificationId ?: "",

View file

@ -420,7 +420,10 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
popDraft()
}
is ParsedCommand.VerifyUser -> {
session.cryptoService().verificationService().requestKeyVerificationInDMs(supportedVerificationMethods, slashCommandResult.userId, room.roomId)
session
.cryptoService()
.verificationService()
.requestKeyVerificationInDMs(supportedVerificationMethods, slashCommandResult.userId, room.roomId)
_viewEvents.post(RoomDetailViewEvents.SlashCommandHandled())
popDraft()
}