diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/IncomingVerificationRequestHandler.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/IncomingVerificationRequestHandler.kt index 7bb8154484..ccd3e6578a 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/IncomingVerificationRequestHandler.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/IncomingVerificationRequestHandler.kt @@ -78,7 +78,7 @@ class IncomingVerificationRequestHandler @Inject constructor( } else true }) .apply { - matrixItem = session?.getUser(tx.otherUserId ?: "")?.toMatrixItem() + matrixItem = session?.getUser(tx.otherUserId)?.toMatrixItem() contentAction = Runnable { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let { diff --git a/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt index 2fb557eb12..9a681cdf7a 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/HomeDetailFragment.kt @@ -43,6 +43,7 @@ import im.vector.riotx.features.home.room.list.RoomListParams import im.vector.riotx.features.home.room.list.UnreadCounterBadgeView 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.workers.signout.SignOutViewModel import kotlinx.android.synthetic.main.fragment_home_detail.* import timber.log.Timber @@ -93,13 +94,13 @@ class HomeDetailFragment @Inject constructor( unknownDevices.forEachIndexed { index, deviceInfo -> Timber.v("## Detector - #$index deviceId:${deviceInfo.second.deviceId} lastSeenTs:${deviceInfo.second.lastSeenTs}") } + val uid = "Newest_Device" + alertManager.cancelAlert(uid) if (it.canCrossSign && unknownDevices.isNotEmpty()) { val newest = unknownDevices.first().second val user = unknownDevices.first().first - val uid = "ND_${newest.deviceId}" - alertManager.cancelAlert(uid) alertManager.postVectorAlert( - VectorAlert( + VerificationVectorAlert( uid = uid, title = getString(R.string.new_session), description = getString(R.string.new_session_review), diff --git a/vector/src/main/java/im/vector/riotx/features/home/UnknwonDeviceDetectorSharedViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/UnknwonDeviceDetectorSharedViewModel.kt index 1693c7fe81..1ac46d5124 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/UnknwonDeviceDetectorSharedViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/UnknwonDeviceDetectorSharedViewModel.kt @@ -36,8 +36,7 @@ import im.vector.riotx.core.platform.VectorViewModel import io.reactivex.android.schedulers.AndroidSchedulers data class UnknownDevicesState( - val unknownSessions: Async>?> = Uninitialized, - val verifiedSessions: Async>?> = Uninitialized, + val unknownSessions: Async>> = Uninitialized, val canCrossSign: Boolean = false ) : MvRxState @@ -47,16 +46,21 @@ class UnknownDeviceDetectorSharedViewModel(session: Session, initialState: Unkno session.rx().liveUserCryptoDevices(session.myUserId) .observeOn(AndroidSchedulers.mainThread()) .switchMap { deviceList -> + // Timber.v("## Detector - ============================") +// Timber.v("## Detector - Crypto device update ${deviceList.map { "${it.deviceId} : ${it.isVerified}" }}") singleBuilder { session.cryptoService().getDevicesList(it) NoOpCancellable }.map { resp -> + // Timber.v("## Detector - Device Infos ${resp.devices?.map { "${it.deviceId} : lastSeen:${it.lastSeenTs}" }}") resp.devices?.filter { info -> - deviceList.firstOrNull { info.deviceId == it.deviceId }?.isVerified?.not() ?: false + deviceList.firstOrNull { info.deviceId == it.deviceId }?.let { + !it.isVerified + } ?: false }?.sortedByDescending { it.lastSeenTs } ?.map { session.getUser(it.user_id ?: "")?.toMatrixItem() to it - } + } ?: emptyList() } .toObservable() }