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

Spaces | Default to 'Home' in settings #3765

Merged
merged 2 commits into from
Aug 27, 2021
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/3754.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
M11.12 Spaces | Default to 'Home' in settings
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null).takeIf {
vectorPreferences.labsSpacesOnlyOrphansInHome()
!vectorPreferences.prefSpacesShowAllRoomInHome()
} ?: ActiveSpaceFilter.None
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class RoomListViewModel @Inject constructor(
updatableQuery = it
},
suggestedRoomJoiningState,
vectorPreferences.labsSpacesOnlyOrphansInHome()
!vectorPreferences.prefSpacesShowAllRoomInHome()
)
} else {
RoomListSectionBuilderGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
const val SETTINGS_LABS_ALLOW_EXTENDED_LOGS = "SETTINGS_LABS_ALLOW_EXTENDED_LOGS"
const val SETTINGS_LABS_USE_RESTRICTED_JOIN_RULE = "SETTINGS_LABS_USE_RESTRICTED_JOIN_RULE"
const val SETTINGS_LABS_SPACES_HOME_AS_ORPHAN = "SETTINGS_LABS_SPACES_HOME_AS_ORPHAN"
const val SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME = "SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME"

private const val SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY = "SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY"
private const val SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY = "SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY"
Expand Down Expand Up @@ -971,10 +972,16 @@ class VectorPreferences @Inject constructor(private val context: Context) {
return defaultPrefs.getBoolean(SETTINGS_LABS_USE_RESTRICTED_JOIN_RULE, false)
}

fun labsSpacesOnlyOrphansInHome(): Boolean {
private fun labsSpacesOnlyOrphansInHome(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_SPACES_HOME_AS_ORPHAN, false)
}

fun prefSpacesShowAllRoomInHome(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME,
// migration of old property
!labsSpacesOnlyOrphansInHome())
}

/*
* Photo / video picker
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,12 @@
package im.vector.app.features.settings

import im.vector.app.R
import im.vector.app.core.preference.VectorSwitchPreference
import im.vector.app.features.MainActivity
import im.vector.app.features.MainActivityArgs
import javax.inject.Inject

class VectorSettingsLabsFragment @Inject constructor(
private val vectorPreferences: VectorPreferences
) : VectorSettingsBaseFragment() {
class VectorSettingsLabsFragment @Inject constructor() : VectorSettingsBaseFragment() {

override var titleRes = R.string.room_settings_labs_pref_title
override val preferenceXmlRes = R.xml.vector_settings_labs

override fun bindPref() {
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_SPACES_HOME_AS_ORPHAN)!!.let { pref ->
pref.setOnPreferenceChangeListener { _, _ ->
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = false))
true
}
}
}
override fun bindPref() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import im.vector.app.core.dialogs.PhotoOrVideoDialog
import im.vector.app.core.extensions.restart
import im.vector.app.core.preference.VectorListPreference
import im.vector.app.core.preference.VectorPreference
import im.vector.app.core.preference.VectorSwitchPreference
import im.vector.app.databinding.DialogSelectTextSizeBinding
import im.vector.app.features.MainActivity
import im.vector.app.features.MainActivityArgs
import im.vector.app.features.configuration.VectorConfiguration
import im.vector.app.features.themes.ThemeUtils
import javax.inject.Inject
Expand Down Expand Up @@ -67,6 +70,14 @@ class VectorSettingsPreferencesFragment @Inject constructor(
}
}

findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME)!!.let { pref ->
pref.isChecked = vectorPreferences.prefSpacesShowAllRoomInHome()
pref.setOnPreferenceChangeListener { _, _ ->
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = false))
true
}
}

// Url preview
/*
TODO Note: we keep the setting client side for now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null).takeIf {
vectorPreferences.labsSpacesOnlyOrphansInHome()
!vectorPreferences.prefSpacesShowAllRoomInHome()
} ?: ActiveSpaceFilter.None
}, sortOrder = RoomSortOrder.NONE
).asObservable()
Expand All @@ -139,7 +139,7 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null).takeIf {
vectorPreferences.labsSpacesOnlyOrphansInHome()
!vectorPreferences.prefSpacesShowAllRoomInHome()
} ?: ActiveSpaceFilter.None
}
)
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,6 @@
<string name="space_mark_as_suggested">علم كمقترحة</string>
<string name="space_mark_as_not_suggested">علم كغير مقترحة</string>
<string name="space_manage_rooms_and_spaces">إدارة الغُرف والمساحات</string>
<string name="labs_space_show_orphan_in_home">مساحة تجريبية - فقط أعرض المُيتِّمة في الصفحة الرئيسية</string>
<string name="spaces_feeling_experimental_subspace">تشعر بالتجربة؟
\nيمكنك إضافة مساحات موجودة إلى مساحة.</string>
<string name="spaces_no_server_support_description">يرجى الاتصال بمسؤول الخادم الخاص بك للحصول على مزيد من المعلومات</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2832,7 +2832,6 @@
<string name="spaces_no_server_support_title">Vypadá to, že váš domovský server zatím Prostory nepodporuje</string>
<string name="spaces_feeling_experimental_subspace">Chcete experimentovat\?
\nDo prostoru můžete přidat existující prostory.</string>
<string name="labs_space_show_orphan_in_home">Experimentální prostor - Zobrazit pouze sirotky v Domově</string>
<string name="space_add_rooms">Přidat místnosti</string>
<string name="space_leave_prompt_msg_as_admin">Jste administrátorem tohoto prostoru, ujistěte se, že jste před odchodem převedli administrátorská práva na jiného člena.</string>
<string name="space_leave_prompt_msg_private">Tento prostor není veřejný. Bez pozvánky se do něj nebudete moci znovu připojit.</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,6 @@
<string name="this_space_has_no_rooms_not_admin">Möglicherweise musst du extra eingeladen werden, damit du die Räume siehst.
\nDie fehlt die Berechtigung, Räume hinzuzufügen.</string>
<string name="spaces_feeling_experimental_subspace">Du kannst Unterspaces zu einem Space hinzufügen.</string>
<string name="labs_space_show_orphan_in_home">Experimentelle Spaces - Nur verweiste Räume auf Startseite</string>
<string name="error_jitsi_join_conf">Leider ist ein Fehler beim Betreten der Konferenz aufgetreten</string>
<string name="unnamed_room">Unbenannter Raum</string>
<string name="this_space_has_no_rooms">Dieser Space hat noch keine Räume</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-eo/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2656,7 +2656,6 @@
<string name="spaces_no_server_support_title">Ŝajnas, ke via hejmservilo ankoraŭ ne subtenas arojn</string>
<string name="spaces_feeling_experimental_subspace">Ĉu vi eksperimentemas\?
\nVi povas arigi jamajn arojn.</string>
<string name="labs_space_show_orphan_in_home">Eksperimenta aro – montri nur orfojn en la Hejmo</string>
<string name="space_manage_rooms_and_spaces">Administri ĉambrojn kaj arojn</string>
<string name="space_mark_as_not_suggested">Marki nerekomendita</string>
<string name="space_mark_as_suggested">Marki rekomendita</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-et/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2779,7 +2779,6 @@
<string name="spaces_no_server_support_title">Tundub, et sinu koduserver veel ei võimalda kogukonnakeskuste kasutamist</string>
<string name="spaces_feeling_experimental_subspace">Kas sa tahad katsetada\?
\nSa võid kogukonnakeskusele lisada ka teisi kogukonnakeskuseid.</string>
<string name="labs_space_show_orphan_in_home">Katseline kogukonnakeskus, mis näitab avalehel vaid hüljatud jututube</string>
<string name="space_add_rooms">Lisa jututube</string>
<string name="space_leave_prompt_msg_as_admin">Sa oled selle kogukonnakeskuse haldaja. Enne oma lahkumist palun lisa siia veel vähemalt üks uus haldaja.</string>
<string name="space_leave_prompt_msg_private">See ei ole avalik kogukonnakeskus. Ilma kutseta sa ei saa uuesti liituda.</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2838,7 +2838,6 @@
<string name="a11y_public_space">این فضا عمومی است</string>
<string name="spaces_feeling_experimental_subspace">حس آزمایش دارید؟
\nمی‌توانید فضاهای موجود را به فضایی بیفزایید.</string>
<string name="labs_space_show_orphan_in_home">فضای آزمایشی - فقط نمایش یتسم‌ها در خانه</string>
<string name="call_transfer_consulting_with">مشاوره با %1$s</string>
<string name="voice_message_reply_content">پیام صوتی (%1$s)</string>
<string name="error_voice_message_cannot_reply_or_edit">نمی‌توان هنگام فعّال بودن پیام صوتی، پاسخ داد یا ویراست</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-fr-rCA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2730,7 +2730,6 @@
<string name="spaces_no_server_support_title">Il semble que votre serveur d’accueil ne prend pas encore en charge les espaces</string>
<string name="spaces_feeling_experimental_subspace">Envie d’expérimenter\?
\nVous pouvez ajouter des espaces existants à un espace.</string>
<string name="labs_space_show_orphan_in_home">Espace expérimental – afficher seulement les orphelins dans Accueil</string>
<string name="space_manage_rooms_and_spaces">Gérer les salons et les espaces</string>
<string name="space_mark_as_not_suggested">Marquer comme non recommandé</string>
<string name="space_mark_as_suggested">Marquer comme recommandé</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,6 @@
<item quantity="one">Envoyer la vidéo en taille originale</item>
<item quantity="other">Envoyer les vidéos en taille originale</item>
</plurals>
<string name="labs_space_show_orphan_in_home">Espace expérimental – afficher seulement les orphelins dans Accueil</string>
<string name="space_leave_prompt_msg_as_admin">Vous êtes administrateur de cet espace, assurez-vous d’avoir transféré les droits d’administration à un autre membre avant de partir.</string>
<string name="send_feedback_space_info">Vous utilisez une version bêta des espaces. Vos remarques aideront à concevoir les prochaines versions. Votre plateforme et votre nom d’utilisateur seront marqués pour nous aider à utiliser vos remarques autant que possible.</string>
<string name="this_space_has_no_rooms_admin">Il se peut que certains salons soient masqués parce qu’ils sont privés et vous avez besoin d’une invitation.</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2472,7 +2472,6 @@ Ha nem te állítottad be a visszaállítási metódust, akkor egy támadó pró
<string name="spaces_no_server_support_title">Úgy látszik a matrix szervered nem támogatja egyelőre a Tereket</string>
<string name="spaces_feeling_experimental_subspace">Szeretsz kísérletezni\?
\nTereket adhatsz terekhez.</string>
<string name="labs_space_show_orphan_in_home">Kísérleti tér - Csak árvák mutatása a Kezdőlapon</string>
<string name="space_manage_rooms_and_spaces">Szobák és terek kezelése</string>
<string name="space_mark_as_not_suggested">Nem javasoltnak jelölés</string>
<string name="space_mark_as_suggested">Javasoltnak jelölés</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2838,7 +2838,6 @@
<string name="space_leave_prompt_msg_as_admin">Sei l\'Amministratore di questo Spazio. Assicurati di aver nominato un altro amministratore prima di uscire.</string>
<string name="space_leave_prompt_msg_only_you">Sei l\'unico utente di questo Spazio. Se esci nessuno potrà più entrarci. Nemmeno tu.</string>
<string name="space_add_rooms">Aggiungi stanze</string>
<string name="labs_space_show_orphan_in_home">Spazio sperimentale - Mostra solo stanze orfane nella Home</string>
<string name="this_space_has_no_rooms_admin">Alcune stanze potrebbero essere nascoste perché sono private e ti serve il loro invito.</string>
<string name="this_space_has_no_rooms_not_admin">Alcune stanze potrebbero essere nascoste perché sono private e ti serve il loro invito.
\nNon hai il permesso di aggiungere stanze.</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,6 @@
<string name="spaces_no_server_support_title">Parece que seu servidorcasa não suporta Espaços ainda</string>
<string name="spaces_feeling_experimental_subspace">Se sentindo experimental\?
\nVocê pode adicionar espaços existentes a um espaço.</string>
<string name="labs_space_show_orphan_in_home">Espaço Experimental - Somente mostrar órfãos em Home</string>
<string name="space_manage_rooms_and_spaces">Gerenciar salas e espaços</string>
<string name="make_this_space_public">Fazer este espaço público</string>
<string name="space_settings_manage_rooms">Gerenciar salas</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2850,7 +2850,6 @@
<string name="spaces_no_server_support_title">Похоже, что ваш домашний сервер пока не поддерживает пространства</string>
<string name="spaces_feeling_experimental_subspace">Чувствуете себя экспериментатором\?
\nВы можете добавить существующие пространства в пространство.</string>
<string name="labs_space_show_orphan_in_home">Экспериментальное пространство - показывать в Главной только сирот</string>
<string name="space_manage_rooms_and_spaces">Управление комнатами и пространствами</string>
<string name="space_mark_as_not_suggested">Отметить как не рекомендуется</string>
<string name="space_mark_as_suggested">Отметить как рекомендуется</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-sq/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2769,7 +2769,6 @@
<string name="spaces_no_server_support_title">Duket sikur shërbyesi juaj Home nuk mbulon ende Hapësira</string>
<string name="spaces_feeling_experimental_subspace">Ndiheni eksperimentues\?
\nMund të shtoni te një hapësirë hapësira ekzistuese.</string>
<string name="labs_space_show_orphan_in_home">Hapësirë Eksperimentale - Shfaq jetimë te Kreu</string>
<string name="space_add_rooms">Shtoni dhoma</string>
<string name="space_leave_prompt_msg_as_admin">Jeni përgjegjës i kësaj hapësirë, sigurohuni se keni shpërngulur të drejt përgjegjësi te një anëtar tjetër, përpara braktisjes.</string>
<string name="space_leave_prompt_msg_private">Kjo hapësirë s’është publike. S’do të jeni në gjendje të rihyni pa një ftesë.</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-sv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2779,7 +2779,6 @@
<string name="spaces_no_server_support_title">Det verkar som att din hemserver inte stöder utrymmen än</string>
<string name="spaces_feeling_experimental_subspace">Känner du dig äventyrlig\?
\nDu kan lägga till existerande utrymmen till ett utrymme.</string>
<string name="labs_space_show_orphan_in_home">Experimentellt utrymme - Visa bara övergivna i Hem</string>
<string name="space_add_rooms">Lägg till rum</string>
<string name="space_leave_prompt_msg_as_admin">Du är administratör för det här utrymmet, se till att du har överfört administratörsrättigheter till en annan medlem innan du lämnar.</string>
<string name="space_leave_prompt_msg_private">Det här utrymmet är inte offentligt. Du kommer inte att kunna gå med igen utan en inbjudan.</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,6 @@
<string name="spaces_no_server_support_title">看来你的主服务器尚未支持空间</string>
<string name="spaces_feeling_experimental_subspace">想要做点实验?
\n你可以将现有的空间添加到其他空间中。</string>
<string name="labs_space_show_orphan_in_home">实验性空间 - 仅在首页显示无人看管的聊天室</string>
<string name="space_manage_rooms_and_spaces">管理聊天室和空间</string>
<string name="space_mark_as_not_suggested">标记为不建议</string>
<string name="space_mark_as_suggested">标记为建议</string>
Expand Down
1 change: 0 additions & 1 deletion vector/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2726,7 +2726,6 @@
<string name="spaces_no_server_support_title">看來您的家伺服器尚未支援空間</string>
<string name="spaces_feeling_experimental_subspace">想要做點實驗嗎?
\n您可以將既有的空間新增至其他空間中。</string>
<string name="labs_space_show_orphan_in_home">實驗性空間,僅在首頁顯示無人看管的聊天室</string>
<string name="space_add_rooms">新增聊天室</string>
<string name="space_leave_prompt_msg_as_admin">您是此空間的管理員,請確保在您離開前已將管理權轉交給另一個成員。</string>
<string name="space_leave_prompt_msg_private">此空間並非公開。您將無法在無邀請的狀況下重新加入。</string>
Expand Down
6 changes: 5 additions & 1 deletion vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@
<string name="dismiss">Dismiss</string>
<string name="reset">Reset</string>
<string name="start_chatting">Start Chatting</string>
<string name="spaces">Spaces</string>

<!-- Permissions denied forever -->
<string name="denied_permission_generic">Some permissions are missing to perform this action, please grant the permissions from the system settings.</string>
Expand Down Expand Up @@ -3442,7 +3443,10 @@
<string name="space_manage_rooms_and_spaces">Manage rooms and spaces</string>


<string name="labs_space_show_orphan_in_home">Experimental Space - Only show orphans in Home</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint is not happy, you have to remove all the existing translations for this string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


<string name="preference_show_all_rooms_in_home">Show all rooms in Home</string>
<string name="all_rooms_youre_in_will_be_shown_in_home">All rooms you’re in will be shown in Home.</string>

<string name="spaces_feeling_experimental_subspace">Feeling experimental?\nYou can add existing spaces to a space.</string>
<string name="spaces_no_server_support_title">It looks like your homeserver does not support Spaces yet</string>
<string name="spaces_no_server_support_description">Please contact your homeserver admin for further information</string>
Expand Down
4 changes: 0 additions & 4 deletions vector/src/main/res/xml/vector_settings_labs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,5 @@
android:summary="@string/labs_use_restricted_join_rule_desc"/>
<!--</im.vector.app.core.preference.VectorPreferenceCategory>-->

<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_SPACES_HOME_AS_ORPHAN"
android:title="@string/labs_space_show_orphan_in_home"/>

</androidx.preference.PreferenceScreen>
Loading