Skip to content

Commit

Permalink
Add help item in bottom sheet verification
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Oct 30, 2024
1 parent 3153aa6 commit cfb4dfd
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/1116.improvements
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faciliter l'accès à l'aide sur la vérification d'appareil
2 changes: 1 addition & 1 deletion library/ui-strings/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@
<string name="power_level_edit_title">Définir le rôle</string>
<string name="secure_backup_reset_no_history">Vous redémarrerez sans aucun historique, message, appareil ou utilisateurs connus</string>
<string name="secure_backup_reset_if_you_reset_all">Si vous réinitialisez tout</string>
<string name="secure_backup_reset_all_no_other_devices">Uniquement si vous avez perdu votre Code et n\'avez aucun autre appareil connecté à ${app_name}.</string> <!-- Tchap: Use custom string -->
<string name="secure_backup_reset_all_no_other_devices">Uniquement si vous avez perdu votre code et n\'avez aucun autre appareil connecté à ${app_name}.</string> <!-- Tchap: Use custom string -->
<string name="secure_backup_reset_all">Réinitialiser tout</string>
<string name="bad_passphrase_key_reset_all_action">Générer un nouveau Code de Récupération</string> <!-- Tchap: Use custom string -->
<string name="error_saving_media_file">Impossible d’enregistrer le fichier multimédia</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@

<!-- Verification -->
<string name="tchap_verification_conclusion_not_secure">La vérification de votre nouvelle session a échoué.</string>
<string name="tchap_verification_get_help">Obtenir de l’aide</string>

<!-- Connectivity -->
<string name="tchap_no_connection_service_status">Voir l’état du service</string>
Expand Down
2 changes: 1 addition & 1 deletion library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2688,7 +2688,7 @@
<string name="failed_to_access_secure_storage">Failed to access secure storage</string>
<string name="bad_passphrase_key_reset_all_action">Lost your Recovery Code? Generate a new one.</string><!-- Tchap: Use custom string -->
<string name="secure_backup_reset_all">Reset everything</string>
<string name="secure_backup_reset_all_no_other_devices">Only do this if you have no other device you can verify this device with.</string>
<string name="secure_backup_reset_all_no_other_devices">Only do this if you lost your recovery code and you have no other device connected to ${app_name}.</string><!-- Tchap: Use custom string -->
<string name="secure_backup_reset_all_no_other_devices_long">Resetting your verification keys cannot be undone. After resetting, you won\'t have access to old encrypted messages, and any friends who have previously verified you will see security warnings until you re-verify with them.</string>
<!-- TODO TO BE REMOVED -->
<string tools:ignore="UnusedResources" name="secure_backup_reset_if_you_reset_all">If you reset everything</string>
Expand Down
1 change: 1 addition & 0 deletions library/ui-strings/src/main/res/values/strings_tchap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@

<!-- Verification -->
<string name="tchap_verification_conclusion_not_secure">Failed to verify your new session.</string>
<string name="tchap_verification_get_help">Get help</string>

<!-- Connectivity -->
<string name="tchap_no_connection_service_status">View the status of services</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class SelfVerificationController @Inject constructor(
) : BaseEpoxyVerificationController(stringProvider, colorProvider, eventHtmlRenderer) {

interface InteractionListener : BaseEpoxyVerificationController.InteractionListener {
fun onClickHelp()
fun onClickRecoverFromPassphrase()
fun onClickSkip()
fun onClickResetSecurity()
Expand Down Expand Up @@ -320,6 +321,15 @@ class SelfVerificationController @Inject constructor(
listener { host.selfVerificationListener?.onClickResetSecurity() }
}

bottomSheetVerificationActionItem {
id("help")
title(host.stringProvider.getString(CommonStrings.tchap_verification_get_help))
titleColor(host.colorProvider.getColorFromAttribute(com.google.android.material.R.attr.colorError))
iconRes(R.drawable.ic_arrow_right)
iconColor(host.colorProvider.getColorFromAttribute(com.google.android.material.R.attr.colorError))
listener { host.selfVerificationListener?.onClickHelp() }
}

if (!state.isVerificationRequired) {
bottomSheetDividerItem {
id("reset_div")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.core.utils.PERMISSIONS_FOR_TAKING_PHOTO
import im.vector.app.core.utils.checkPermissions
import im.vector.app.core.utils.onPermissionDeniedDialog
import im.vector.app.core.utils.openUrlInChromeCustomTab
import im.vector.app.core.utils.registerForPermissionsResult
import im.vector.app.databinding.BottomSheetVerificationChildFragmentBinding
import im.vector.app.features.crypto.verification.VerificationAction
import im.vector.app.features.qrcode.QrCodeScannerActivity
import im.vector.app.features.settings.VectorSettingsUrls
import im.vector.lib.strings.CommonStrings
import org.matrix.android.sdk.api.session.crypto.verification.EVerificationState
import timber.log.Timber
Expand Down Expand Up @@ -94,6 +96,10 @@ class SelfVerificationFragment : VectorBaseFragment<BottomSheetVerificationChild
controller.update(state)
}

override fun onClickHelp() {
openUrlInChromeCustomTab(requireContext(), null, TCHAP_FAQ_VERIFICATION_URL)
}

override fun onClickRecoverFromPassphrase() {
viewModel.handle(VerificationAction.VerifyFromPassphrase)
}
Expand Down Expand Up @@ -235,4 +241,9 @@ class SelfVerificationFragment : VectorBaseFragment<BottomSheetVerificationChild
}
}
}

companion object {
private const val TCHAP_FAQ_VERIFICATION_URL =
"${VectorSettingsUrls.HELP}/fr/article/comment-verifier-un-nouvel-appareil-sur-tchap-xm0b0y/"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttrib
import im.vector.app.features.home.room.detail.timeline.item.MessageTextItem_
import im.vector.app.features.home.room.detail.timeline.tools.createLinkMovementMethod
import im.vector.app.features.settings.VectorPreferences
import im.vector.app.features.settings.VectorSettingsUrls
import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence
import im.vector.lib.strings.CommonStrings
import me.gujun.android.span.image
Expand Down Expand Up @@ -139,6 +140,6 @@ class EncryptedItemFactory @Inject constructor(

companion object {
private const val TCHAP_FAQ_UTD_URL =
"https://aide.tchap.beta.gouv.fr/fr/article/dechiffrement-impossible-de-mes-messages-comment-y-remedier-android-m6e371/"
"${VectorSettingsUrls.HELP}/fr/article/dechiffrement-impossible-de-mes-messages-comment-y-remedier-android-m6e371/"
}
}

0 comments on commit cfb4dfd

Please sign in to comment.