Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nouvel accès pour les FAQ #913

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/913.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rendre la FAQ plus visible et accessible
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 @@ -877,7 +877,7 @@
<string name="push_gateway_item_url">URL :</string>
<string name="push_gateway_item_format">Format :</string>
<string name="preference_voice_and_video">Voix et vidéo</string>
<string name="preference_root_help_about">Aide et à propos</string>
<string name="preference_root_help_about">À propos</string> <!-- Tchap: Custom string -->
<string name="settings_troubleshoot_test_token_registration_quick_fix">Inscrire le jeton</string>
<string name="send_suggestion">Faire une suggestion</string>
<string name="send_suggestion_content">Saisissez votre suggestion ci-dessous.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import im.vector.app.core.extensions.validateBackPressed
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.core.platform.VectorMenuProvider
import im.vector.app.core.pushers.UnifiedPushHelper
import im.vector.app.core.utils.openUrlInChromeCustomTab
import im.vector.app.core.utils.registerForPermissionsResult
import im.vector.app.core.utils.startSharePlainTextIntent
import im.vector.app.databinding.ActivityHomeBinding
Expand Down Expand Up @@ -676,6 +677,11 @@ class HomeActivity :
launchQrCode()
true
}
// Tchap : new faq entry
R.id.menu_home_faq -> {
openUrlInChromeCustomTab(this, null, VectorSettingsUrls.HELP)
true
}
else -> false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
package im.vector.app.features.settings

import android.os.Bundle
import androidx.preference.Preference
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.preference.VectorPreference
import im.vector.app.core.utils.FirstThrottler
import im.vector.app.core.utils.openUrlInChromeCustomTab
import im.vector.app.features.analytics.plan.MobileScreen

@AndroidEntryPoint
Expand All @@ -29,13 +32,24 @@ class VectorSettingsRootFragment :
override var titleRes: Int = R.string.title_activity_settings
override val preferenceXmlRes = R.xml.vector_settings_root

private val firstThrottler = FirstThrottler(1000)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
analyticsScreenName = MobileScreen.ScreenName.Settings
}

override fun bindPref() {
tintIcons()

// Tchap : Manage new FAQ entry
findPreference<VectorPreference>(VectorPreferences.SETTINGS_HELP_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
if (firstThrottler.canHandle() is FirstThrottler.CanHandlerResult.Yes) {
openUrlInChromeCustomTab(requireContext(), null, VectorSettingsUrls.HELP)
}
false
}
}

private fun tintIcons() {
Expand Down
6 changes: 6 additions & 0 deletions vector/src/main/res/menu/menu_new_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
android:title="@string/add_by_qr_code"
app:showAsAction="never" />

<!-- Tchap : add a FAQ access -->
<item
android:id="@+id/menu_home_faq"
android:title="@string/preference_help_title"
app:showAsAction="never" />

<item
android:id="@+id/menu_home_suggestion"
android:icon="@drawable/ic_material_bug_report"
Expand Down
9 changes: 6 additions & 3 deletions vector/src/main/res/xml/vector_settings_help_about.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">

<!-- Tchap : hide faq because it's on main menu-->
<im.vector.app.core.preference.VectorPreferenceCategory
android:title="@string/preference_help">
android:title="@string/preference_help"
app:isPreferenceVisible="false">

<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_HELP_PREFERENCE_KEY"
Expand Down Expand Up @@ -40,4 +43,4 @@

</im.vector.app.core.preference.VectorPreferenceCategory>

</androidx.preference.PreferenceScreen>
</androidx.preference.PreferenceScreen>
6 changes: 6 additions & 0 deletions vector/src/main/res/xml/vector_settings_root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
app:fragment="im.vector.app.features.settings.VectorSettingsAdvancedSettingsFragment"
app:isPreferenceVisible="@bool/settings_root_advanced_visible" />

<!-- Tchap : independent access for faq -->
<im.vector.app.core.preference.VectorPreference
android:icon="@drawable/ic_settings_root_help_about"
android:key="SETTINGS_HELP_PREFERENCE_KEY"
android:title="@string/preference_help_title" />

<im.vector.app.core.preference.VectorPreference
android:icon="@drawable/ic_settings_root_help_about"
android:title="@string/preference_root_help_about"
Expand Down