diff --git a/CHANGES.md b/CHANGES.md index 09e1775ae2..e767802cd5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,6 +24,7 @@ Bugfix 🐛: - Can't handle ongoing call events in background (#1992) - Crash / Attachment viewer: Cannot draw a recycled Bitmap #2034 - Login with Matrix-Id | Autodiscovery fails if identity server is invalid and Homeserver ok (#2027) + - Verification popup won't show Translations 🗣: - diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt index fb8ef1f114..0a1b631344 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt @@ -69,17 +69,17 @@ class IncomingVerificationRequestHandler @Inject constructor( R.drawable.ic_shield_black, shouldBeDisplayedIn = { activity -> if (activity is VectorBaseActivity) { - // TODO a bit too hugly :/ + // TODO a bit too ugly :/ activity.supportFragmentManager.findFragmentByTag(VerificationBottomSheet.WAITING_SELF_VERIF_TAG)?.let { false.also { popupAlertManager.cancelAlert(uid) } } ?: true } else true - }) + }, + matrixItem = session?.getUser(tx.otherUserId)?.toMatrixItem() + ) .apply { - matrixItem = session?.getUser(tx.otherUserId)?.toMatrixItem() - contentAction = Runnable { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let { it.navigator.performDeviceVerification(it, tx.otherUserId, tx.transactionId) @@ -132,10 +132,10 @@ class IncomingVerificationRequestHandler @Inject constructor( it.roomId != pr.roomId } ?: true } else true - }) + }, + matrixItem = session?.getUser(pr.otherUserId)?.toMatrixItem() + ) .apply { - matrixItem = session?.getUser(pr.otherUserId)?.toMatrixItem() - contentAction = Runnable { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let { val roomId = pr.roomId diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt index 62ae0bfc2c..76de2daf54 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt @@ -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.ServerBackupStatusViewState 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.synthetic.main.activity_home.* 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 javax.inject.Inject @@ -239,9 +239,9 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable, UnknownDeviceDet uid = "upgradeSecurity", title = getString(titleRes), description = getString(descRes), - iconId = R.drawable.ic_shield_warning + iconId = R.drawable.ic_shield_warning, + matrixItem = userItem ).apply { - matrixItem = userItem colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_positive_accent) contentAction = Runnable { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let { diff --git a/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt index 7b8f1148c9..1c63d63ae0 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt @@ -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.ServerBackupStatusViewModel 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.util.toMatrixItem import org.matrix.android.sdk.internal.crypto.model.rest.DeviceInfo -import kotlinx.android.synthetic.main.fragment_home_detail.* import timber.log.Timber import javax.inject.Inject @@ -151,9 +151,9 @@ class HomeDetailFragment @Inject constructor( uid = uid, title = getString(R.string.new_session), 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 { - matrixItem = user colorInt = ContextCompat.getColor(requireActivity(), R.color.riotx_accent) contentAction = Runnable { (weakCurrentActivity?.get() as? VectorBaseActivity) @@ -179,9 +179,9 @@ class HomeDetailFragment @Inject constructor( uid = uid, title = getString(R.string.review_logins), description = getString(R.string.verify_other_sessions), - iconId = R.drawable.ic_shield_warning + iconId = R.drawable.ic_shield_warning, + matrixItem = user ).apply { - matrixItem = user colorInt = ContextCompat.getColor(requireActivity(), R.color.riotx_accent) contentAction = Runnable { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let { diff --git a/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt b/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt index c52b586eb4..593527448b 100644 --- a/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt +++ b/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt @@ -254,6 +254,6 @@ class PopupAlertManager @Inject constructor(private val avatarRenderer: Lazy Boolean)? + val shouldBeDisplayedIn: ((Activity) -> 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 description: String, @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 override var weakCurrentActivity: WeakReference? = null @@ -87,9 +91,11 @@ class VerificationVectorAlert(uid: String, title: String, override val description: String, @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( uid, title, description, iconId, shouldBeDisplayedIn -) { - var matrixItem: MatrixItem? = null -} +)