Skip to content

Commit

Permalink
Add service status url (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle authored Sep 7, 2023
1 parent 4541d9a commit 7ad284a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/955.improvements
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Le message d'erreur de connexion affiche un lien vers la page de status des services
3 changes: 2 additions & 1 deletion library/ui-strings/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,8 @@
<string name="qr_code_scanned_by_other_notice">On y est presque ! Est-ce que %s affiche une marque cochée \?</string>
<string name="qr_code_scanned_by_other_yes">Oui</string>
<string name="qr_code_scanned_by_other_no">Non</string>
<string name="no_connectivity_to_the_server_indicator">La connexion avec le serveur a été perdue</string>
<string name="no_connectivity_to_the_server_indicator">La connexion à ${app_name} n’est pas disponible
\npour le moment.</string> <!-- Tchap: Use custom string -->
<string name="login_signup_username_hint">Nom d’utilisateur</string>
<string name="settings_dev_tools">Outils de développement</string>
<string name="settings_account_data">Données du compte</string>
Expand Down
3 changes: 3 additions & 0 deletions library/ui-strings/src/main/res/values-fr/strings_tchap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,7 @@

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

<!-- Connectivity -->
<string name="tchap_no_connection_service_status">Voir l’état du service</string>
</resources>
3 changes: 2 additions & 1 deletion library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2484,7 +2484,8 @@
<string name="qr_code_scanned_by_other_yes">Yes</string>
<string name="qr_code_scanned_by_other_no">No</string>

<string name="no_connectivity_to_the_server_indicator">Connectivity to the server has been lost</string>
<string name="no_connectivity_to_the_server_indicator">${app_name} is not available
\nat the moment.</string>
<string name="no_connectivity_to_the_server_indicator_airplane">Airplane mode is on</string>

<string name="settings_dev_tools">Dev Tools</string>
Expand Down
3 changes: 3 additions & 0 deletions library/ui-strings/src/main/res/values/strings_tchap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,7 @@

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

<!-- Connectivity -->
<string name="tchap_no_connection_service_status">View the status of services</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ package im.vector.app.features.sync.widget

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Typeface
import android.text.Spannable
import android.text.SpannableString
import android.text.style.StyleSpan
import android.text.style.UnderlineSpan
import android.util.AttributeSet
import android.widget.LinearLayout
import androidx.core.view.isVisible
import im.vector.app.R
import im.vector.app.core.epoxy.onClick
import im.vector.app.core.utils.isAirplaneModeOn
import im.vector.app.core.utils.openUrlInExternalBrowser
import im.vector.app.databinding.ViewSyncStateBinding
import org.matrix.android.sdk.api.session.sync.SyncRequestState
import org.matrix.android.sdk.api.session.sync.SyncState
Expand Down Expand Up @@ -56,6 +63,15 @@ class SyncStateView @JvmOverloads constructor(context: Context, attrs: Attribute

if (newState == SyncState.NoNetwork) {
val isAirplaneModeOn = context.isAirplaneModeOn()
// Tchap: Add service status URL
val statusLink = context.getString(R.string.tchap_no_connection_service_status)
val spannable = SpannableString("${context.getString(R.string.no_connectivity_to_the_server_indicator)} $statusLink")
spannable.setSpan(StyleSpan(Typeface.BOLD), spannable.length - statusLink.length, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
spannable.setSpan(UnderlineSpan(),spannable.length - statusLink.length, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
views.syncStateNoNetwork.text = spannable
views.syncStateNoNetwork.onClick {
openUrlInExternalBrowser(context, TCHAP_SERVICE_STATUS_URL)
}
views.syncStateNoNetwork.isVisible = isAirplaneModeOn.not()
views.syncStateNoNetworkAirplane.isVisible = isAirplaneModeOn
} else {
Expand Down Expand Up @@ -87,4 +103,8 @@ class SyncStateView @JvmOverloads constructor(context: Context, attrs: Attribute
else -> "?"
}
}

companion object {
private const val TCHAP_SERVICE_STATUS_URL = "https://status.tchap.numerique.gouv.fr/"
}
}

0 comments on commit 7ad284a

Please sign in to comment.