threads are enabled by default end forced to enabled for existing users (#7775)
This commit is contained in:
parent
4657729e36
commit
3dadebe505
|
@ -0,0 +1 @@
|
||||||
|
[Threads] - Threads Labs Flag is enabled by default and forced to be enabled for existing users, but sill can be disabled manually
|
|
@ -66,7 +66,7 @@ data class MatrixConfiguration(
|
||||||
/**
|
/**
|
||||||
* Thread messages default enable/disabled value.
|
* Thread messages default enable/disabled value.
|
||||||
*/
|
*/
|
||||||
val threadMessagesEnabledDefault: Boolean = false,
|
val threadMessagesEnabledDefault: Boolean = true,
|
||||||
/**
|
/**
|
||||||
* List of network interceptors, they will be added when building an OkHttp client.
|
* List of network interceptors, they will be added when building an OkHttp client.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<!-- Level 1: Labs -->
|
<!-- Level 1: Labs -->
|
||||||
<bool name="settings_labs_deferred_dm_visible">true</bool>
|
<bool name="settings_labs_deferred_dm_visible">true</bool>
|
||||||
<bool name="settings_labs_deferred_dm_default">true</bool>
|
<bool name="settings_labs_deferred_dm_default">true</bool>
|
||||||
<bool name="settings_labs_thread_messages_default">false</bool>
|
<bool name="settings_labs_thread_messages_default">true</bool>
|
||||||
<bool name="settings_labs_new_app_layout_default">true</bool>
|
<bool name="settings_labs_new_app_layout_default">true</bool>
|
||||||
<bool name="settings_labs_new_session_manager_default">false</bool>
|
<bool name="settings_labs_new_session_manager_default">false</bool>
|
||||||
<bool name="settings_labs_new_session_manager_visible">true</bool>
|
<bool name="settings_labs_new_session_manager_visible">true</bool>
|
||||||
|
|
|
@ -254,6 +254,12 @@ class HomeActivityViewModel @AssistedInject constructor(
|
||||||
// }
|
// }
|
||||||
|
|
||||||
when {
|
when {
|
||||||
|
!vectorPreferences.areThreadMessagesEnabled() && !vectorPreferences.wasThreadFlagChangedManually() -> {
|
||||||
|
vectorPreferences.setThreadMessagesEnabled()
|
||||||
|
lightweightSettingsStorage.setThreadMessagesEnabled(vectorPreferences.areThreadMessagesEnabled())
|
||||||
|
// Clear Cache
|
||||||
|
_viewEvents.post(HomeActivityViewEvents.MigrateThreads(checkSession = false))
|
||||||
|
}
|
||||||
// Notify users
|
// Notify users
|
||||||
vectorPreferences.shouldNotifyUserAboutThreads() && vectorPreferences.areThreadMessagesEnabled() -> {
|
vectorPreferences.shouldNotifyUserAboutThreads() && vectorPreferences.areThreadMessagesEnabled() -> {
|
||||||
Timber.i("----> Notify users about threads")
|
Timber.i("----> Notify users about threads")
|
||||||
|
|
|
@ -239,6 +239,7 @@ class VectorPreferences @Inject constructor(
|
||||||
|
|
||||||
// This key will be used to identify clients with the new thread support enabled m.thread
|
// This key will be used to identify clients with the new thread support enabled m.thread
|
||||||
const val SETTINGS_LABS_ENABLE_THREAD_MESSAGES = "SETTINGS_LABS_ENABLE_THREAD_MESSAGES_FINAL"
|
const val SETTINGS_LABS_ENABLE_THREAD_MESSAGES = "SETTINGS_LABS_ENABLE_THREAD_MESSAGES_FINAL"
|
||||||
|
const val SETTINGS_LABS_THREAD_MESSAGES_CHANGED_BY_USER = "SETTINGS_LABS_THREAD_MESSAGES_CHANGED_BY_USER"
|
||||||
const val SETTINGS_THREAD_MESSAGES_SYNCED = "SETTINGS_THREAD_MESSAGES_SYNCED"
|
const val SETTINGS_THREAD_MESSAGES_SYNCED = "SETTINGS_THREAD_MESSAGES_SYNCED"
|
||||||
|
|
||||||
// This key will be used to enable user for displaying live user info or not.
|
// This key will be used to enable user for displaying live user info or not.
|
||||||
|
@ -1129,6 +1130,24 @@ class VectorPreferences @Inject constructor(
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether or not user changed threads flag manually. We need this to not force flag to be enabled on app start.
|
||||||
|
* Should be removed when Threads flag will be removed
|
||||||
|
*/
|
||||||
|
fun wasThreadFlagChangedManually(): Boolean {
|
||||||
|
return defaultPrefs.getBoolean(SETTINGS_LABS_THREAD_MESSAGES_CHANGED_BY_USER, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the flag to indicate that user changed threads flag (e.g. disabled them).
|
||||||
|
*/
|
||||||
|
fun setThreadFlagChangedManually() {
|
||||||
|
defaultPrefs
|
||||||
|
.edit()
|
||||||
|
.putBoolean(SETTINGS_LABS_THREAD_MESSAGES_CHANGED_BY_USER, true)
|
||||||
|
.apply()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether or not the user will be notified about the new thread support.
|
* Indicates whether or not the user will be notified about the new thread support.
|
||||||
* We should notify the user only if he had old thread support enabled.
|
* We should notify the user only if he had old thread support enabled.
|
||||||
|
|
|
@ -141,6 +141,7 @@ class VectorSettingsLabsFragment :
|
||||||
*/
|
*/
|
||||||
private fun onThreadsPreferenceClicked() {
|
private fun onThreadsPreferenceClicked() {
|
||||||
// We should migrate threads only if threads are disabled
|
// We should migrate threads only if threads are disabled
|
||||||
|
vectorPreferences.setThreadFlagChangedManually()
|
||||||
vectorPreferences.setShouldMigrateThreads(!vectorPreferences.areThreadMessagesEnabled())
|
vectorPreferences.setShouldMigrateThreads(!vectorPreferences.areThreadMessagesEnabled())
|
||||||
lightweightSettingsStorage.setThreadMessagesEnabled(vectorPreferences.areThreadMessagesEnabled())
|
lightweightSettingsStorage.setThreadMessagesEnabled(vectorPreferences.areThreadMessagesEnabled())
|
||||||
displayLoadingView()
|
displayLoadingView()
|
||||||
|
|
Loading…
Reference in New Issue