Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const val DISPLAY_SETTINGS_DEFAULT_IS_AUTO_FIT_WIDTH = true
const val DISPLAY_SETTINGS_DEFAULT_IS_SHOW_ANIMATION = true
const val DISPLAY_SETTINGS_DEFAULT_IS_SHOW_CORRESPONDENT_NAMES = true
const val DISPLAY_SETTINGS_DEFAULT_MESSAGE_LIST_PREVIEW_LINES = 2
const val DISPLAY_SETTINGS_DEFAULT_DRAWER_EXPAND_ALL_FOLDER = false

data class DisplayVisualSettings(
val isShowAnimations: Boolean = DISPLAY_SETTINGS_DEFAULT_IS_SHOW_ANIMATION,
Expand All @@ -22,4 +23,5 @@ data class DisplayVisualSettings(
val isUseMessageViewFixedWidthFont: Boolean = DISPLAY_SETTINGS_DEFAULT_IS_USE_MESSAGE_VIEW_FIXED_WIDTH_FONT,
val isAutoFitWidth: Boolean = DISPLAY_SETTINGS_DEFAULT_IS_AUTO_FIT_WIDTH,
val messageListPreviewLines: Int = DISPLAY_SETTINGS_DEFAULT_MESSAGE_LIST_PREVIEW_LINES,
val drawerExpandAllFolder: Boolean = DISPLAY_SETTINGS_DEFAULT_DRAWER_EXPAND_ALL_FOLDER,
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ const val KEY_AUTO_FIT_WIDTH = "autofitWidth"
const val KEY_SHOW_CONTACT_PICTURE = "showContactPicture"
const val KEY_MESSAGE_LIST_VIEW_PREVIEW_LINES = "messageListPreviewLines"

const val KEY_DRAWER_EXPAND_ALL_FOLDER = "drawerExpandAllFolder"

interface DisplayVisualSettingsPreferenceManager : PreferenceManager<DisplayVisualSettings>
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class DefaultDisplayVisualSettingsPreferenceManager(
KEY_MESSAGE_LIST_VIEW_PREVIEW_LINES,
DISPLAY_SETTINGS_DEFAULT_MESSAGE_LIST_PREVIEW_LINES,
),
drawerExpandAllFolder = storage.getBoolean(
KEY_DRAWER_EXPAND_ALL_FOLDER,
DISPLAY_SETTINGS_DEFAULT_DRAWER_EXPAND_ALL_FOLDER,
),
)

private fun writeConfig(config: DisplayVisualSettings) {
Expand Down Expand Up @@ -111,6 +115,7 @@ class DefaultDisplayVisualSettingsPreferenceManager(
KEY_MESSAGE_LIST_VIEW_PREVIEW_LINES,
config.messageListPreviewLines,
)
storageEditor.putBoolean(KEY_DRAWER_EXPAND_ALL_FOLDER, config.drawerExpandAllFolder)
storageEditor.commit().also { commited ->
logger.verbose(TAG) { "writeConfig: storageEditor.commit() resulted in: $commited" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface NavigationDrawerExternalContract {
val showUnifiedFolders: Boolean,
val showStarredCount: Boolean,
val showAccountSelector: Boolean,
val expandAllFolder: Boolean,
)

fun interface DrawerConfigLoader {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ internal fun DrawerContentSingleAccountPreview() {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = false,
expandAllFolder = false,
),
),
onEvent = {},
Expand All @@ -151,6 +152,7 @@ internal fun DrawerContentSingleAccountWithAccountSelectionPreview() {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = true,
expandAllFolder = false,
),
),
onEvent = {},
Expand All @@ -175,6 +177,7 @@ internal fun DrawerContentMultipleAccountsAccountPreview() {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = false,
expandAllFolder = false,
),
),
onEvent = {},
Expand All @@ -198,6 +201,7 @@ internal fun DrawerContentMultipleAccountsWithAccountSelectionPreview() {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = true,
expandAllFolder = false,
),
),
onEvent = {},
Expand All @@ -221,6 +225,7 @@ internal fun DrawerContentMultipleAccountsWithDifferentAccountSelectionPreview()
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = true,
expandAllFolder = false,
),
),
onEvent = {},
Expand Down Expand Up @@ -249,6 +254,7 @@ internal fun DrawerContentSmallScreenPreview() {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = true,
expandAllFolder = false,
),
),
onEvent = {},
Expand Down Expand Up @@ -278,6 +284,7 @@ internal fun DrawerContentVerySmallScreenPreview() {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = true,
expandAllFolder = false,
),
),
onEvent = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private fun FolderContent(
modifier = Modifier.fillMaxSize(),
) {
FolderList(
isExpandedInitial = state.config.expandAllFolder,
rootFolder = state.rootFolder,
selectedFolder = state.selectedFolder,
onFolderClick = { folder ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal interface DrawerContract {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = true,
expandAllFolder = false,
),
val accounts: ImmutableList<DisplayAccount> = persistentListOf(),
val selectedAccountId: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ internal fun FolderList(
onFolderClick: (DisplayFolder) -> Unit,
showStarredCount: Boolean,
modifier: Modifier = Modifier,
isExpandedInitial: Boolean = false,
) {
val resources = LocalContext.current.resources
val folderNameFormatter = remember { FolderNameFormatter(resources) }
Expand All @@ -45,6 +46,7 @@ internal fun FolderList(
onClick = onFolderClick,
folderNameFormatter = folderNameFormatter,
selectedFolderId = selectedFolder?.id,
isExpandInitial = isExpandedInitial,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ internal fun FolderListItem(
folderNameFormatter: FolderNameFormatter,
selectedFolderId: String?,
modifier: Modifier = Modifier,
isExpandInitial: Boolean = false,
treeFolder: DisplayTreeFolder? = null,
parentPrefix: String? = "",
indentationLevel: Int = 1,
) {
val isExpanded = rememberSaveable { mutableStateOf(false) }
val isExpanded = rememberSaveable(isExpandInitial) { mutableStateOf(isExpandInitial) }

var unreadCount = displayFolder.unreadMessageCount
var starredCount = displayFolder.starredMessageCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ internal class GetDrawerConfigTest {
showUnifiedFolders = true,
showStarredCount = true,
showAccountSelector = true,
expandAllFolder = false,
)

val testSubject = GetDrawerConfig(configLoader = configLoader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ internal class DrawerStateTest {
showUnifiedFolders = false,
showStarredCount = false,
showAccountSelector = true,
expandAllFolder = false,
),
accounts = persistentListOf(),
selectedAccountId = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,13 @@ internal class DrawerViewModelTest {
showUnifiedInbox: Boolean = false,
showStarredCount: Boolean = false,
showAccountSelector: Boolean = true,
expandAllFolder: Boolean = false,
): DrawerConfig {
return DrawerConfig(
showUnifiedFolders = showUnifiedInbox,
showStarredCount = showStarredCount,
showAccountSelector = showAccountSelector,
expandAllFolder = expandAllFolder,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,31 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import net.thunderbird.core.preference.display.inboxSettings.DisplayInboxSettingsPreferenceManager
import net.thunderbird.core.preference.display.visualSettings.DisplayVisualSettingsPreferenceManager
import net.thunderbird.core.preference.update
import net.thunderbird.feature.navigation.drawer.api.NavigationDrawerExternalContract.DrawerConfig

internal class DefaultDrawerConfigManager(
private val preferences: Preferences,
coroutineScope: CoroutineScope,
private val displayInboxSettingsPreferenceManager: DisplayInboxSettingsPreferenceManager,
private val displayVisualSettingsPreferenceManager: DisplayVisualSettingsPreferenceManager,
) : DrawerConfigManager {
private val showAccountSelector = MutableStateFlow(K9.isShowAccountSelector)
private val drawerConfig: StateFlow<DrawerConfig> = showAccountSelector
.combine(displayInboxSettingsPreferenceManager.getConfigFlow()) { showAccSelector, displayInboxSettings ->
.combine(
displayInboxSettingsPreferenceManager.getConfigFlow(),
) { showAccSelector, displayInboxSettings ->
Pair(showAccSelector, displayInboxSettings)
}
.combine(
displayVisualSettingsPreferenceManager.getConfigFlow(),
) { (showAccSelector, displayInboxSettings), displayVisualSettings ->
DrawerConfig(
showAccountSelector = showAccSelector,
showStarredCount = displayInboxSettings.isShowStarredCount,
showUnifiedFolders = displayInboxSettings.isShowUnifiedInbox,
expandAllFolder = displayVisualSettings.drawerExpandAllFolder,
)
}
.stateIn(
Expand All @@ -35,6 +45,7 @@ internal class DefaultDrawerConfigManager(
showAccountSelector = false,
showStarredCount = false,
showUnifiedFolders = false,
expandAllFolder = false,
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ class GeneralSettingsDescriptions {
s.put("shouldShowSetupArchiveFolderDialog", Settings.versions(
new V(105, new BooleanSetting(DISPLAY_SETTINGS_DEFAULT_SHOULD_SHOW_SETUP_ARCHIVE_FOLDER_DIALOG)))
);
s.put("drawerExpandAllFolder", Settings.versions(
new V(108, new BooleanSetting(false))
));

// TODO: Add a way to properly support feature-specific settings.
if (telemetryManager.isTelemetryFeatureIncluded()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ val preferencesModule = module {
preferences = get(),
coroutineScope = get(named("AppCoroutineScope")),
displayInboxSettingsPreferenceManager = get(),
displayVisualSettingsPreferenceManager = get(),
)
} bind DrawerConfigManager::class

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 107;
public static final int VERSION = 108;

static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription<?>>> settings,
Map<String, String> importedSettings, boolean useDefaultValues) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class GeneralSettingsDataStore(

"messageview_autofit_width" -> generalSettingsManager.getConfig()
.display.visualSettings.isAutoFitWidth
"drawerExpandAllFolder" -> generalSettingsManager.getConfig()
.display.visualSettings.drawerExpandAllFolder

"quiet_time_enabled" -> generalSettingsManager.getConfig()
.notification.isQuietTimeEnabled
Expand All @@ -86,6 +88,7 @@ class GeneralSettingsDataStore(
when (key) {
"fixed_message_view_theme" -> setFixedMessageViewTheme(value)
"animations" -> setIsShowAnimations(isShowAnimations = value)
"drawerExpandAllFolder" -> setDrawerExpandAllFolder(drawerExpandAllFolder = value)
"show_unified_inbox" -> setIsShowUnifiedInbox(value)
"show_starred_count" -> setIsShowStarredCount(isShowStarredCount = value)
"messagelist_stars" -> setIsShowMessageListStars(isShowMessageListStars = value)
Expand Down Expand Up @@ -426,6 +429,19 @@ class GeneralSettingsDataStore(
}
}

private fun setDrawerExpandAllFolder(drawerExpandAllFolder: Boolean) {
skipSaveSettings = true
generalSettingsManager.update { settings ->
settings.copy(
display = settings.display.copy(
visualSettings = settings.display.visualSettings.copy(
drawerExpandAllFolder = drawerExpandAllFolder,
),
),
)
}
}

private fun setIsShowCorrespondentNames(isShowCorrespondentNames: Boolean) {
skipSaveSettings = true
generalSettingsManager.update { settings ->
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@
<string name="archive_folder_label">مجلد الأرشيف</string>
<string name="spam_folder_label">مجلد البريد المزعج</string>
<string name="account_setup_incoming_subscribed_folders_only_label">إظهار المجلدات المشتركة فقط </string>
<string name="account_setup_auto_expand_folder">توسيع المجلد تلقائيا</string>
<string name="account_setup_options_mail_check_frequency_never">أبدًا</string>
<string name="account_setup_options_mail_check_frequency_15min">كل 15 دقيقة</string>
<string name="account_setup_options_mail_check_frequency_30min">كل 30 دقيقة</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-be/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@
<string name="archive_folder_label">Каталог архіва</string>
<string name="spam_folder_label">Каталог спаму</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Паказваць толькі падпісаныя каталогі</string>
<string name="account_setup_auto_expand_folder">Аўтапераход у каталог</string>
<string name="account_setup_options_mail_check_frequency_never">Ніколі</string>
<string name="account_setup_options_mail_check_frequency_15min">Кожныя 15 хвілін</string>
<string name="account_setup_options_mail_check_frequency_30min">Кожныя 30 хвілін</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@
<string name="archive_folder_label">Папка Архиви</string>
<string name="spam_folder_label">Папка Спам</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Показвай само абонираните папките</string>
<string name="account_setup_auto_expand_folder">Автоматично разгъване на папка</string>
<string name="account_setup_options_mail_check_frequency_never">Никога</string>
<string name="account_setup_options_mail_check_frequency_15min">На всеки 15 минути</string>
<string name="account_setup_options_mail_check_frequency_30min">На всеки 30 минути</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-br/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@
<string name="archive_folder_label">Teuliad dielloù</string>
<string name="spam_folder_label">Teuliad lastez</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Diskouez an teuliadoù koumanantet hepken</string>
<string name="account_setup_auto_expand_folder">Kreskaat an teuliad ent emgefreek</string>
<string name="account_setup_options_mail_check_frequency_never">Morse</string>
<string name="account_setup_options_mail_check_frequency_15min">Bep 15 munutenn</string>
<string name="account_setup_options_mail_check_frequency_30min">Bep 30 munutenn</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@
<string name="archive_folder_label">Carpeta d\'arxiu</string>
<string name="spam_folder_label">Carpeta brossa</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Mostra només carpetes subscrites</string>
<string name="account_setup_auto_expand_folder">Autoexpandeix la carpeta</string>
<string name="account_setup_options_mail_check_frequency_never">Mai</string>
<string name="account_setup_options_mail_check_frequency_15min">Cada 15 minuts</string>
<string name="account_setup_options_mail_check_frequency_30min">Cada 30 minuts</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-co/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@
<string name="account_setup_incoming_delete_policy_never_label">Ùn squassà micca nant’à u servitore</string>
<string name="trash_folder_label">Cartulare di a curbella</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Affissà solu i cartulari à quelli mi sò abbunatu</string>
<string name="account_setup_auto_expand_folder">Spiegà autumaticamente u cartulare</string>
<string name="account_setup_options_mail_check_frequency_never">Mai</string>
<string name="account_setup_options_mail_check_frequency_15min">Tutti i 15 minuti</string>
<string name="account_setup_options_mail_check_frequency_30min">Tutti i 30 minuti</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@
<string name="archive_folder_label">Název složky Archív</string>
<string name="spam_folder_label">Název složky Nevyžádaná</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Zobrazit jen odebírané složky</string>
<string name="account_setup_auto_expand_folder">Aut. rozbalená složka</string>
<string name="account_setup_options_mail_check_frequency_never">Nikdy</string>
<string name="account_setup_options_mail_check_frequency_15min">Každých 15 minut</string>
<string name="account_setup_options_mail_check_frequency_30min">Každých 30 minut</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-cy/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@
<string name="archive_folder_label">Ffolder archif</string>
<string name="spam_folder_label">Ffolder sbam</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Dangos dim ond y ffolderi dwi\'n eu dewis</string>
<string name="account_setup_auto_expand_folder">Awto-ehangu ffolder</string>
<string name="account_setup_options_mail_check_frequency_never">Byth</string>
<string name="account_setup_options_mail_check_frequency_15min">Pob 15 munud</string>
<string name="account_setup_options_mail_check_frequency_30min">Pob 30 munud</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@
<string name="archive_folder_label">Arkiv mappen</string>
<string name="spam_folder_label">Spam mappe</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Vis kun mapper du abonerer på</string>
<string name="account_setup_auto_expand_folder">Udvid mapper automatisk</string>
<string name="account_setup_options_mail_check_frequency_never">Aldrig</string>
<string name="account_setup_options_mail_check_frequency_15min">Hver 15 minut</string>
<string name="account_setup_options_mail_check_frequency_30min">Hver 30 minut</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@
<string name="archive_folder_label">Ordner für archivierte Nachrichten</string>
<string name="spam_folder_label">Ordner für Spam</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Nur ausgewählte Ordner anzeigen</string>
<string name="account_setup_auto_expand_folder">Startordner</string>
<string name="account_setup_options_mail_check_frequency_never">Nie (nur manuell)</string>
<string name="account_setup_options_mail_check_frequency_15min">Alle 15 Minuten</string>
<string name="account_setup_options_mail_check_frequency_30min">Alle 30 Minuten</string>
Expand Down
1 change: 0 additions & 1 deletion legacy/ui/legacy/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@
<string name="archive_folder_label">Φάκελος «Αρχειοθήκη»</string>
<string name="spam_folder_label">Φάκελος «Ανεπιθύμητα»</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Προβολή μόνον φακέλων υπό παρακολούθηση</string>
<string name="account_setup_auto_expand_folder">Αυτόματη επέκταση φακέλου</string>
<string name="account_setup_options_mail_check_frequency_never">Ποτέ</string>
<string name="account_setup_options_mail_check_frequency_15min">Κάθε 15 λεπτά</string>
<string name="account_setup_options_mail_check_frequency_30min">Κάθε 10 λεπτά</string>
Expand Down
Loading
Loading