mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
code cleaning
This commit is contained in:
parent
b56a41bec7
commit
cfcec04029
15 changed files with 7 additions and 30 deletions
|
@ -187,7 +187,6 @@ class KeyShareTests : InstrumentedTest {
|
|||
|
||||
@Test
|
||||
fun test_ShareSSSSSecret() {
|
||||
|
||||
val aliceSession1 = mTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
|
||||
|
||||
mTestHelper.doSync<Unit> {
|
||||
|
@ -203,7 +202,7 @@ class KeyShareTests : InstrumentedTest {
|
|||
val aliceVerificationService1 = aliceSession1.cryptoService().verificationService()
|
||||
val aliceVerificationService2 = aliceSession2.cryptoService().verificationService()
|
||||
|
||||
//force keys download
|
||||
// force keys download
|
||||
mTestHelper.doSync<MXUsersDevicesMap<CryptoDeviceInfo>> {
|
||||
aliceSession1.cryptoService().downloadKeys(listOf(aliceSession1.myUserId), true, it)
|
||||
}
|
||||
|
@ -245,7 +244,6 @@ class KeyShareTests : InstrumentedTest {
|
|||
aliceVerificationService2.beginKeyVerification(VerificationMethod.SAS, aliceSession1.myUserId, aliceSession1.sessionParams.credentials.deviceId
|
||||
?: "", txId)
|
||||
|
||||
|
||||
mTestHelper.waitWithLatch { latch ->
|
||||
mTestHelper.retryPeriodicallyWithLatch(latch) {
|
||||
aliceSession1.cryptoService().getDeviceInfo(aliceSession1.myUserId, aliceSession2.sessionParams.credentials.deviceId ?: "")?.isVerified == true
|
||||
|
@ -267,5 +265,4 @@ class KeyShareTests : InstrumentedTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -287,7 +287,6 @@ internal class IncomingGossipingRequestManager @Inject constructor(
|
|||
}?.let { secretValue ->
|
||||
Timber.i("## GOSSIP processIncomingSecretShareRequest() : Sharing secret $secretName with $device locally trusted")
|
||||
if (isDeviceLocallyVerified == true && hasBeenVerifiedLessThanFiveMinutesFromNow(deviceId)) {
|
||||
|
||||
val params = SendGossipWorker.Params(
|
||||
sessionId = sessionId,
|
||||
secretValue = secretValue,
|
||||
|
|
|
@ -99,7 +99,6 @@ internal class SendGossipWorker(context: Context,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
val payloadJson = mapOf(
|
||||
"type" to EventType.SEND_SECRET,
|
||||
"content" to toDeviceContent.toContent()
|
||||
|
@ -112,7 +111,6 @@ internal class SendGossipWorker(context: Context,
|
|||
Timber.e("## Fail to encrypt gossip + ${failure.localizedMessage}")
|
||||
}
|
||||
|
||||
|
||||
cryptoStore.saveGossipingEvent(Event(
|
||||
type = eventType,
|
||||
content = toDeviceContent.toContent(),
|
||||
|
|
|
@ -456,7 +456,7 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
private suspend fun handleStart(otherUserId: String?,
|
||||
startReq: ValidVerificationInfoStart,
|
||||
txConfigure: (DefaultVerificationTransaction) -> Unit): CancelCode? {
|
||||
Timber.d("## SAS onStartRequestReceived ${startReq}")
|
||||
Timber.d("## SAS onStartRequestReceived $startReq")
|
||||
if (otherUserId?.let { checkKeysAreDownloaded(it, startReq.fromDevice) } != null) {
|
||||
val tid = startReq.transactionId
|
||||
var existing = getExistingTransaction(otherUserId, tid)
|
||||
|
@ -549,7 +549,7 @@ internal class DefaultVerificationService @Inject constructor(
|
|||
existing.onStartReceived(startReq)
|
||||
return null
|
||||
} else {
|
||||
Timber.w("## SAS onStartRequestReceived - unexpected message ${startReq.transactionId} / ${existing}")
|
||||
Timber.w("## SAS onStartRequestReceived - unexpected message ${startReq.transactionId} / $existing")
|
||||
return CancelCode.UnexpectedMessage
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ internal class TimelineEventDecryptor @Inject constructor(
|
|||
}
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
Timber.e( "Failed to decrypt event $eventId, ${t.localizedMessage}")
|
||||
Timber.e("Failed to decrypt event $eventId, ${t.localizedMessage}")
|
||||
} finally {
|
||||
synchronized(existingRequests) {
|
||||
existingRequests.remove(request)
|
||||
|
|
|
@ -38,7 +38,6 @@ import im.vector.matrix.android.internal.crypto.model.rest.DevicesListResponse
|
|||
import im.vector.riotx.R
|
||||
import im.vector.riotx.features.popup.DefaultVectorAlert
|
||||
import im.vector.riotx.features.popup.PopupAlertManager
|
||||
import im.vector.riotx.features.popup.VectorAlert
|
||||
import timber.log.Timber
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
|
|
|
@ -78,7 +78,6 @@ class IncomingVerificationRequestHandler @Inject constructor(
|
|||
} else true
|
||||
})
|
||||
.apply {
|
||||
|
||||
matrixItem = session?.getUser(tx.otherUserId ?: "")?.toMatrixItem()
|
||||
|
||||
contentAction = Runnable {
|
||||
|
@ -135,7 +134,6 @@ class IncomingVerificationRequestHandler @Inject constructor(
|
|||
} else true
|
||||
})
|
||||
.apply {
|
||||
|
||||
matrixItem = session?.getUser(pr.otherUserId)?.toMatrixItem()
|
||||
|
||||
contentAction = Runnable {
|
||||
|
|
|
@ -155,7 +155,6 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
|||
|
||||
state.otherUserMxItem?.let { matrixItem ->
|
||||
if (state.isMe) {
|
||||
|
||||
avatarRenderer.render(matrixItem, otherUserAvatarImageView)
|
||||
if (state.sasTransactionState == VerificationTxState.Verified
|
||||
|| state.qrTransactionState == VerificationTxState.Verified
|
||||
|
|
|
@ -43,7 +43,6 @@ class VerificationNotMeController @Inject constructor(
|
|||
}
|
||||
|
||||
override fun buildModels() {
|
||||
|
||||
bottomSheetVerificationNoticeItem {
|
||||
id("notice")
|
||||
notice(eventHtmlRenderer.render(stringProvider.getString(R.string.verify_not_me_self_verification)))
|
||||
|
|
|
@ -95,7 +95,6 @@ class VerificationRequestController @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bottomSheetVerificationNoticeItem {
|
||||
id("notice")
|
||||
notice(styledText)
|
||||
|
@ -142,7 +141,6 @@ class VerificationRequestController @Inject constructor(
|
|||
}
|
||||
|
||||
if (state.isMe && state.currentDeviceCanCrossSign) {
|
||||
|
||||
dividerItem {
|
||||
id("sep_notMe")
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import im.vector.riotx.core.pushers.PushersManager
|
|||
import im.vector.riotx.features.disclaimer.showDisclaimerDialog
|
||||
import im.vector.riotx.features.notifications.NotificationDrawerManager
|
||||
import im.vector.riotx.features.popup.PopupAlertManager
|
||||
import im.vector.riotx.features.popup.VectorAlert
|
||||
import im.vector.riotx.features.popup.VerificationVectorAlert
|
||||
import im.vector.riotx.features.rageshake.VectorUncaughtExceptionHandler
|
||||
import im.vector.riotx.features.settings.VectorPreferences
|
||||
|
|
|
@ -91,7 +91,7 @@ class HomeDetailFragment @Inject constructor(
|
|||
it.unknownSessions.invoke()?.let { unknownDevices ->
|
||||
Timber.v("## Detector - ${unknownDevices.size} Unknown sessions")
|
||||
unknownDevices.forEachIndexed { index, deviceInfo ->
|
||||
Timber.v("## Detector - #${index} deviceId:${deviceInfo.second.deviceId} lastSeenTs:${deviceInfo.second.lastSeenTs}")
|
||||
Timber.v("## Detector - #$index deviceId:${deviceInfo.second.deviceId} lastSeenTs:${deviceInfo.second.lastSeenTs}")
|
||||
}
|
||||
if (it.canCrossSign && unknownDevices.isNotEmpty()) {
|
||||
val newest = unknownDevices.first().second
|
||||
|
|
|
@ -16,15 +16,7 @@
|
|||
|
||||
package im.vector.riotx.features.home
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.android.api.util.NoOpCancellable
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.DeviceInfo
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.DevicesListResponse
|
||||
import im.vector.matrix.rx.rx
|
||||
import im.vector.matrix.rx.singleBuilder
|
||||
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import javax.inject.Inject
|
||||
|
||||
class HomeSharedActionViewModel @Inject constructor() : VectorSharedActionViewModel<HomeActivitySharedAction>() {
|
||||
|
|
|
@ -36,8 +36,8 @@ import im.vector.riotx.core.platform.VectorViewModel
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
|
||||
data class UnknownDevicesState(
|
||||
val unknownSessions: Async<List<Pair<MatrixItem?,DeviceInfo>>?> = Uninitialized,
|
||||
val verifiedSessions: Async<List<Pair<MatrixItem?,DeviceInfo>>?> = Uninitialized,
|
||||
val unknownSessions: Async<List<Pair<MatrixItem?, DeviceInfo>>?> = Uninitialized,
|
||||
val verifiedSessions: Async<List<Pair<MatrixItem?, DeviceInfo>>?> = Uninitialized,
|
||||
val canCrossSign: Boolean = false
|
||||
) : MvRxState
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import android.app.Activity
|
|||
import android.app.Application
|
||||
import android.os.Bundle
|
||||
import im.vector.riotx.features.popup.PopupAlertManager
|
||||
import javax.inject.Inject
|
||||
|
||||
class VectorActivityLifecycleCallbacks constructor(private val popupAlertManager: PopupAlertManager) : Application.ActivityLifecycleCallbacks {
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
|
|
Loading…
Reference in a new issue