Merge pull request #2062 from vector-im/feature/fix_no_verif

Feature/fix no verif
This commit is contained in:
Benoit Marty 2020-09-07 10:49:38 +02:00 committed by GitHub
commit 6c6bba68ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 23 deletions

View File

@ -24,6 +24,7 @@ Bugfix 🐛:
- Can't handle ongoing call events in background (#1992) - Can't handle ongoing call events in background (#1992)
- Crash / Attachment viewer: Cannot draw a recycled Bitmap #2034 - Crash / Attachment viewer: Cannot draw a recycled Bitmap #2034
- Login with Matrix-Id | Autodiscovery fails if identity server is invalid and Homeserver ok (#2027) - Login with Matrix-Id | Autodiscovery fails if identity server is invalid and Homeserver ok (#2027)
- Verification popup won't show
Translations 🗣: Translations 🗣:
- -

View File

@ -69,17 +69,17 @@ class IncomingVerificationRequestHandler @Inject constructor(
R.drawable.ic_shield_black, R.drawable.ic_shield_black,
shouldBeDisplayedIn = { activity -> shouldBeDisplayedIn = { activity ->
if (activity is VectorBaseActivity) { if (activity is VectorBaseActivity) {
// TODO a bit too hugly :/ // TODO a bit too ugly :/
activity.supportFragmentManager.findFragmentByTag(VerificationBottomSheet.WAITING_SELF_VERIF_TAG)?.let { activity.supportFragmentManager.findFragmentByTag(VerificationBottomSheet.WAITING_SELF_VERIF_TAG)?.let {
false.also { false.also {
popupAlertManager.cancelAlert(uid) popupAlertManager.cancelAlert(uid)
} }
} ?: true } ?: true
} else true } else true
}) },
matrixItem = session?.getUser(tx.otherUserId)?.toMatrixItem()
)
.apply { .apply {
matrixItem = session?.getUser(tx.otherUserId)?.toMatrixItem()
contentAction = Runnable { contentAction = Runnable {
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let {
it.navigator.performDeviceVerification(it, tx.otherUserId, tx.transactionId) it.navigator.performDeviceVerification(it, tx.otherUserId, tx.transactionId)
@ -132,10 +132,10 @@ class IncomingVerificationRequestHandler @Inject constructor(
it.roomId != pr.roomId it.roomId != pr.roomId
} ?: true } ?: true
} else true } else true
}) },
matrixItem = session?.getUser(pr.otherUserId)?.toMatrixItem()
)
.apply { .apply {
matrixItem = session?.getUser(pr.otherUserId)?.toMatrixItem()
contentAction = Runnable { contentAction = Runnable {
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let {
val roomId = pr.roomId val roomId = pr.roomId

View File

@ -50,11 +50,11 @@ import im.vector.app.features.themes.ThemeUtils
import im.vector.app.features.workers.signout.ServerBackupStatusViewModel import im.vector.app.features.workers.signout.ServerBackupStatusViewModel
import im.vector.app.features.workers.signout.ServerBackupStatusViewState import im.vector.app.features.workers.signout.ServerBackupStatusViewState
import im.vector.app.push.fcm.FcmHelper import im.vector.app.push.fcm.FcmHelper
import org.matrix.android.sdk.api.session.InitialSyncProgressService
import org.matrix.android.sdk.api.util.MatrixItem
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import kotlinx.android.synthetic.main.activity_home.* import kotlinx.android.synthetic.main.activity_home.*
import kotlinx.android.synthetic.main.merge_overlay_waiting_view.* import kotlinx.android.synthetic.main.merge_overlay_waiting_view.*
import org.matrix.android.sdk.api.session.InitialSyncProgressService
import org.matrix.android.sdk.api.util.MatrixItem
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
@ -239,9 +239,9 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable, UnknownDeviceDet
uid = "upgradeSecurity", uid = "upgradeSecurity",
title = getString(titleRes), title = getString(titleRes),
description = getString(descRes), description = getString(descRes),
iconId = R.drawable.ic_shield_warning iconId = R.drawable.ic_shield_warning,
matrixItem = userItem
).apply { ).apply {
matrixItem = userItem
colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_positive_accent) colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_positive_accent)
contentAction = Runnable { contentAction = Runnable {
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let {

View File

@ -46,10 +46,10 @@ import im.vector.app.features.themes.ThemeUtils
import im.vector.app.features.workers.signout.BannerState import im.vector.app.features.workers.signout.BannerState
import im.vector.app.features.workers.signout.ServerBackupStatusViewModel import im.vector.app.features.workers.signout.ServerBackupStatusViewModel
import im.vector.app.features.workers.signout.ServerBackupStatusViewState import im.vector.app.features.workers.signout.ServerBackupStatusViewState
import kotlinx.android.synthetic.main.fragment_home_detail.*
import org.matrix.android.sdk.api.session.group.model.GroupSummary import org.matrix.android.sdk.api.session.group.model.GroupSummary
import org.matrix.android.sdk.api.util.toMatrixItem import org.matrix.android.sdk.api.util.toMatrixItem
import org.matrix.android.sdk.internal.crypto.model.rest.DeviceInfo import org.matrix.android.sdk.internal.crypto.model.rest.DeviceInfo
import kotlinx.android.synthetic.main.fragment_home_detail.*
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
@ -151,9 +151,9 @@ class HomeDetailFragment @Inject constructor(
uid = uid, uid = uid,
title = getString(R.string.new_session), title = getString(R.string.new_session),
description = getString(R.string.verify_this_session, newest.displayName ?: newest.deviceId ?: ""), description = getString(R.string.verify_this_session, newest.displayName ?: newest.deviceId ?: ""),
iconId = R.drawable.ic_shield_warning iconId = R.drawable.ic_shield_warning,
matrixItem = user
).apply { ).apply {
matrixItem = user
colorInt = ContextCompat.getColor(requireActivity(), R.color.riotx_accent) colorInt = ContextCompat.getColor(requireActivity(), R.color.riotx_accent)
contentAction = Runnable { contentAction = Runnable {
(weakCurrentActivity?.get() as? VectorBaseActivity) (weakCurrentActivity?.get() as? VectorBaseActivity)
@ -179,9 +179,9 @@ class HomeDetailFragment @Inject constructor(
uid = uid, uid = uid,
title = getString(R.string.review_logins), title = getString(R.string.review_logins),
description = getString(R.string.verify_other_sessions), description = getString(R.string.verify_other_sessions),
iconId = R.drawable.ic_shield_warning iconId = R.drawable.ic_shield_warning,
matrixItem = user
).apply { ).apply {
matrixItem = user
colorInt = ContextCompat.getColor(requireActivity(), R.color.riotx_accent) colorInt = ContextCompat.getColor(requireActivity(), R.color.riotx_accent)
contentAction = Runnable { contentAction = Runnable {
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let {

View File

@ -254,6 +254,6 @@ class PopupAlertManager @Inject constructor(private val avatarRenderer: Lazy<Ava
return alert != null return alert != null
&& activity !is PinActivity && activity !is PinActivity
&& activity is VectorBaseActivity && activity is VectorBaseActivity
&& alert.shouldBeDisplayedIn?.invoke(activity) == true && alert.shouldBeDisplayedIn.invoke(activity)
} }
} }

View File

@ -28,7 +28,7 @@ interface VectorAlert {
val title: String val title: String
val description: String val description: String
val iconId: Int? val iconId: Int?
val shouldBeDisplayedIn: ((Activity) -> Boolean)? val shouldBeDisplayedIn: ((Activity) -> Boolean)
data class Button(val title: String, val action: Runnable, val autoClose: Boolean) data class Button(val title: String, val action: Runnable, val autoClose: Boolean)
@ -59,7 +59,11 @@ open class DefaultVectorAlert(override val uid: String,
override val title: String, override val title: String,
override val description: String, override val description: String,
@DrawableRes override val iconId: Int?, @DrawableRes override val iconId: Int?,
override val shouldBeDisplayedIn: ((Activity) -> Boolean)? = null) : VectorAlert { /**
* Alert are displayed by default, but let this lambda return false to prevent displaying
*/
override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true }
) : VectorAlert {
// will be set by manager, and accessible by actions at runtime // will be set by manager, and accessible by actions at runtime
override var weakCurrentActivity: WeakReference<Activity>? = null override var weakCurrentActivity: WeakReference<Activity>? = null
@ -87,9 +91,11 @@ class VerificationVectorAlert(uid: String,
title: String, title: String,
override val description: String, override val description: String,
@DrawableRes override val iconId: Int?, @DrawableRes override val iconId: Int?,
override val shouldBeDisplayedIn: ((Activity) -> Boolean)? = null /**
* Alert are displayed by default, but let this lambda return false to prevent displaying
*/
override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true },
val matrixItem: MatrixItem?
) : DefaultVectorAlert( ) : DefaultVectorAlert(
uid, title, description, iconId, shouldBeDisplayedIn uid, title, description, iconId, shouldBeDisplayedIn
) { )
var matrixItem: MatrixItem? = null
}