Skip to content

Commit

Permalink
Une surprise vous attend dans cette version (#994)
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle authored Dec 18, 2023
1 parent 621bf59 commit fbb8205
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<string name="tchap_settings_hide_from_users_directory_title">Inscrire mon compte sur liste rouge</string>
<string name="tchap_settings_hide_from_users_directory_summary">Les autres utilisateurs ne pourront pas découvrir mon compte lors de leurs recherches</string>
<string name="tchap_settings_show_external_user_in_users_directory_prompt">Pour désactiver cette option, vous devez accepter que votre adresse e\u2011mail soit visible des autres utilisateurs lors de leurs recherches.</string>
<string name="tchap_settings_christmas_title">🎄 Joyeuses Fêtes 🎄</string>

<!-- Verification -->
<string name="tchap_verification_conclusion_not_secure">La vérification de votre nouvelle session a échoué.</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 @@ -111,6 +111,7 @@
<string name="tchap_settings_hide_from_users_directory_title">Subscribe to the red list.</string>
<string name="tchap_settings_hide_from_users_directory_summary">"Other users won't be able to find my account in their search results."</string>
<string name="tchap_settings_show_external_user_in_users_directory_prompt">To disable this option, you must accept that your email address is visible to the other users.</string>
<string name="tchap_settings_christmas_title">🎄 Happy Holidays 🎄</string>

<!-- Verification -->
<string name="tchap_verification_conclusion_not_secure">Failed to verify your new session.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class VectorPreferences @Inject constructor(
private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH"

const val TCHAP_SETTINGS_HIDE_FROM_USERS_DIRECTORY_PREFERENCE_KEY = "TCHAP_SETTINGS_HIDE_FROM_USERS_DIRECTORY_PREFERENCE_KEY"
const val TCHAP_SETTINGS_CHRISTMAS_PREFERENCE_KEY = "TCHAP_SETTINGS_CHRISTMAS_PREFERENCE_KEY"

// Location Sharing
const val SETTINGS_PREF_ENABLE_LOCATION_SHARING = "SETTINGS_PREF_ENABLE_LOCATION_SHARING"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@

package im.vector.app.features.settings

import android.content.Context
import android.os.Bundle
import androidx.preference.Preference
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.singletonEntryPoint
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
import im.vector.app.features.navigation.Navigator
import java.util.Calendar

@AndroidEntryPoint
class VectorSettingsRootFragment :
Expand All @@ -34,6 +38,14 @@ class VectorSettingsRootFragment :

private val firstThrottler = FirstThrottler(1000)

private lateinit var navigator: Navigator

override fun onAttach(context: Context) {
val singletonEntryPoint = context.singletonEntryPoint()
navigator = singletonEntryPoint.navigator()
super.onAttach(context)
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
analyticsScreenName = MobileScreen.ScreenName.Settings
Expand All @@ -50,6 +62,19 @@ class VectorSettingsRootFragment :
}
false
}

// Tchap: Manage Christmas entry
if (Calendar.getInstance().before(Calendar.getInstance().apply { set(2024, 1, 10) })) {
findPreference<VectorPreference>(VectorPreferences.TCHAP_SETTINGS_CHRISTMAS_PREFERENCE_KEY)!!.let {
it.isVisible = true
it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
if (firstThrottler.canHandle() is FirstThrottler.CanHandlerResult.Yes) {
navigator.openRoom(requireContext(), "!cDKdQyXHeWBEaKDWWV:agent.dinum.tchap.gouv.fr", null)
}
false
}
}
}
}

private fun tintIcons() {
Expand Down
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 @@ -62,4 +62,10 @@
app:fragment="im.vector.app.features.settings.legals.LegalsFragment"
app:isPreferenceVisible="@bool/settings_root_legals_visible" />

<im.vector.app.core.preference.VectorPreference
android:icon="@drawable/ic_notification"
android:key="TCHAP_SETTINGS_CHRISTMAS_PREFERENCE_KEY"
android:title="@string/tchap_settings_christmas_title"
app:isPreferenceVisible="@bool/false_tchap_hidden" />

</androidx.preference.PreferenceScreen>

0 comments on commit fbb8205

Please sign in to comment.