Updating texts + other sessions list screen learn more

This commit is contained in:
Maxime NATUREL 2022-09-28 14:00:45 +02:00
parent c356c8090b
commit 20a24162f4
4 changed files with 40 additions and 6 deletions

View file

@ -3302,9 +3302,13 @@
<string name="device_manager_session_rename_edit_hint">Session name</string>
<string name="device_manager_session_rename_description">Custom session names can help you recognize your devices more easily.</string>
<string name="device_manager_session_rename_warning">Please be aware that session names are also visible to people you communicate with.</string>
<string name="device_manager_learn_more_sessions_inactive_title">Inactive sessions</string>
<string name="device_manager_learn_more_sessions_inactive">Inactive sessions are sessions you have not used in some time, but they continue to receive encryption keys.\n\nRemoving inactive sessions improves security and performance, and makes it easier for you to identify if a new session is suspicious.</string>
<string name="device_manager_learn_more_sessions_unverified_title">Unverified sessions</string>
<string name="device_manager_learn_more_sessions_unverified">Unverified sessions are sessions that have logged in with your credentials but not been cross-verified.\n\nYou should make especially certain that you recognise these sessions as they could represent an unauthorised use of your account.</string>
<string name="device_manager_learn_more_session_verified">This session has logged in with your credentials and then been verified, either using your secure passphrase or by cross-verifying.\n\nThis means it holds encryption keys for your previous messages, and confirms to other users you are communicating with that the session is really you.</string>
<string name="device_manager_learn_more_sessions_verified_title">Verified sessions</string>
<string name="device_manager_learn_more_sessions_verified">Verified sessions have logged in with your credentials and then been verified, either using your secure passphrase or by cross-verifying.\n\nThis means they hold encryption keys for your previous messages, and confirm to other users you are communicating with that these sessions are really you.</string>
<string name="device_manager_learn_more_session_rename_title">Renaming sessions</string>
<string name="device_manager_learn_more_session_rename">Other users in direct messages and rooms that you join are able to view a full list of your sessions.\n\nThis provides them with confidence that they are really speaking to you, but it also means they can see the session name you enter here.</string>
<!-- Note to translators: %s will be replaces with selected space name -->

View file

@ -20,6 +20,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.StringRes
import androidx.core.view.isVisible
import com.airbnb.mvrx.Success
import com.airbnb.mvrx.args
@ -37,6 +38,7 @@ import im.vector.app.features.settings.devices.v2.filter.DeviceManagerFilterBott
import im.vector.app.features.settings.devices.v2.filter.DeviceManagerFilterType
import im.vector.app.features.settings.devices.v2.list.OtherSessionsView
import im.vector.app.features.settings.devices.v2.list.SESSION_IS_MARKED_AS_INACTIVE_AFTER_DAYS
import im.vector.app.features.settings.devices.v2.more.SessionLearnMoreBottomSheet
import im.vector.app.features.themes.ThemeUtils
import javax.inject.Inject
@ -121,6 +123,7 @@ class OtherSessionsFragment :
)
)
views.otherSessionsNotFoundTextView.text = getString(R.string.device_manager_other_sessions_no_verified_sessions_found)
updateSecurityLearnMoreButton(R.string.device_manager_learn_more_sessions_verified_title, R.string.device_manager_learn_more_sessions_verified)
}
DeviceManagerFilterType.UNVERIFIED -> {
views.otherSessionsSecurityRecommendationView.render(
@ -132,6 +135,10 @@ class OtherSessionsFragment :
)
)
views.otherSessionsNotFoundTextView.text = getString(R.string.device_manager_other_sessions_no_unverified_sessions_found)
updateSecurityLearnMoreButton(
R.string.device_manager_learn_more_sessions_unverified_title,
R.string.device_manager_learn_more_sessions_unverified
)
}
DeviceManagerFilterType.INACTIVE -> {
views.otherSessionsSecurityRecommendationView.render(
@ -147,8 +154,10 @@ class OtherSessionsFragment :
)
)
views.otherSessionsNotFoundTextView.text = getString(R.string.device_manager_other_sessions_no_inactive_sessions_found)
updateSecurityLearnMoreButton(R.string.device_manager_learn_more_sessions_inactive_title, R.string.device_manager_learn_more_sessions_inactive)
}
DeviceManagerFilterType.ALL_SESSIONS -> { /* NOOP. View is not visible */
}
DeviceManagerFilterType.ALL_SESSIONS -> { /* NOOP. View is not visible */ }
}
if (devices.isNullOrEmpty()) {
@ -161,6 +170,26 @@ class OtherSessionsFragment :
}
}
private fun updateSecurityLearnMoreButton(
@StringRes titleResId: Int,
@StringRes descriptionResId: Int,
) {
views.otherSessionsSecurityRecommendationView.onLearnMoreClickListener = {
showLearnMoreInfo(titleResId, getString(descriptionResId))
}
}
private fun showLearnMoreInfo(
@StringRes titleResId: Int,
description: String,
) {
val args = SessionLearnMoreBottomSheet.Args(
title = getString(titleResId),
description = description,
)
SessionLearnMoreBottomSheet.show(childFragmentManager, args)
}
override fun onOtherSessionClicked(deviceId: String) {
viewNavigator.navigateToSessionOverview(
context = requireActivity(),

View file

@ -262,7 +262,7 @@ class SessionOverviewFragment :
R.string.device_manager_verification_status_unverified
}
val descriptionResId = if (isVerified) {
R.string.device_manager_learn_more_session_verified
R.string.device_manager_learn_more_sessions_verified
} else {
R.string.device_manager_learn_more_sessions_unverified
}

View file

@ -53,11 +53,12 @@
android:id="@+id/deviceListHeaderOtherSessions"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:sessionsListHeaderDescription="@string/device_manager_sessions_other_description"
app:sessionsListHeaderTitle=""
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appBarLayout" />
app:layout_constraintTop_toBottomOf="@id/appBarLayout"
app:sessionsListHeaderDescription="@string/device_manager_sessions_other_description"
app:sessionsListHeaderHasLearnMoreLink="false"
app:sessionsListHeaderTitle="" />
<im.vector.app.features.settings.devices.v2.othersessions.OtherSessionsSecurityRecommendationView
android:id="@+id/otherSessionsSecurityRecommendationView"