Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 2955b783 authored by Ashley Soucar's avatar Ashley Soucar Committed by GitHub
Browse files

Merge pull request #9475 from shamim-emon/fix-issue-9474

Migrate K9.k9Language to PreferenceDataStore
parents d812a314 b6bf1b97
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ const val DISPLAY_SETTINGS_DEFAULT_IS_SHOW_COMPOSE_BUTTON_ON_MESSAGE_LIST = true
const val DISPLAY_SETTINGS_DEFAULT_IS_THREAD_VIEW_ENABLED = true
const val DISPLAY_SETTINGS_DEFAULT_IS_USE_MESSAGE_VIEW_FIXED_WIDTH_FONT = false
const val DISPLAY_SETTINGS_DEFAULT_IS_AUTO_FIT_WIDTH = true
const val DISPLAY_SETTINGS_DEFAULT_APP_LANGUAGE = ""

data class DisplaySettings(
    val fixedMessageViewTheme: Boolean = DISPLAY_SETTINGS_DEFAULT_FIXED_MESSAGE_VIEW_THEME,
@@ -47,4 +48,5 @@ data class DisplaySettings(
    val isThreadedViewEnabled: Boolean = DISPLAY_SETTINGS_DEFAULT_IS_THREAD_VIEW_ENABLED,
    val isUseMessageViewFixedWidthFont: Boolean = DISPLAY_SETTINGS_DEFAULT_IS_USE_MESSAGE_VIEW_FIXED_WIDTH_FONT,
    val isAutoFitWidth: Boolean = DISPLAY_SETTINGS_DEFAULT_IS_AUTO_FIT_WIDTH,
    val appLanguage: String = DISPLAY_SETTINGS_DEFAULT_APP_LANGUAGE,
)
+1 −0
Original line number Diff line number Diff line
@@ -23,5 +23,6 @@ const val KEY_MESSAGE_VIEW_FIXED_WIDTH_FONT = "messageViewFixedWidthFont"
const val KEY_AUTO_FIT_WIDTH = "autofitWidth"
const val KEY_MESSAGE_LIST_SENDER_ABOVE_SUBJECT = "messageListSenderAboveSubject"
const val KEY_SHOW_CONTACT_PICTURE = "showContactPicture"
const val KEY_APP_LANGUAGE = "language"

interface DisplaySettingsPreferenceManager : PreferenceManager<DisplaySettings>
+5 −0
Original line number Diff line number Diff line
@@ -119,6 +119,10 @@ class DefaultDisplaySettingsPreferenceManager(
            KEY_SHOW_CONTACT_PICTURE,
            DISPLAY_SETTINGS_DEFAULT_IS_SHOW_CONTACT_PICTURE,
        ),
        appLanguage = storage.getStringOrDefault(
            KEY_APP_LANGUAGE,
            DISPLAY_SETTINGS_DEFAULT_APP_LANGUAGE,
        ),
    )

    private fun writeConfig(config: DisplaySettings) {
@@ -185,6 +189,7 @@ class DefaultDisplaySettingsPreferenceManager(
                    config.isUseMessageViewFixedWidthFont,
                )
                storageEditor.putBoolean(KEY_AUTO_FIT_WIDTH, config.isAutoFitWidth)
                storageEditor.putString(KEY_APP_LANGUAGE, config.appLanguage)
                storageEditor.commit().also { commited ->
                    logger.verbose(TAG) { "writeConfig: storageEditor.commit() resulted in: $commited" }
                }
+0 −7
Original line number Diff line number Diff line
@@ -143,9 +143,6 @@ object K9 : KoinComponent {
    @JvmStatic
    var isSensitiveDebugLoggingEnabled: Boolean = false

    @JvmStatic
    var k9Language = ""

    @JvmStatic
    val fontSizes = FontSizes()

@@ -329,8 +326,6 @@ object K9 : KoinComponent {
        pgpInlineDialogCounter = storage.getInt("pgpInlineDialogCounter", 0)
        pgpSignOnlyDialogCounter = storage.getInt("pgpSignOnlyDialogCounter", 0)

        k9Language = storage.getStringOrDefault("language", "")

        swipeRightAction = storage.getEnum(
            key = SwipeActions.KEY_SWIPE_ACTION_RIGHT,
            defaultValue = SwipeAction.ToggleSelection,
@@ -363,8 +358,6 @@ object K9 : KoinComponent {
        editor.putEnum("messageViewPostDeleteAction", messageViewPostRemoveNavigation)
        editor.putEnum("messageViewPostMarkAsUnreadAction", messageViewPostMarkAsUnreadNavigation)

        editor.putString("language", k9Language)

        editor.putBoolean("confirmDelete", isConfirmDelete)
        editor.putBoolean("confirmDiscardMessage", isConfirmDiscardMessage)
        editor.putBoolean("confirmDeleteStarred", isConfirmDeleteStarred)
+2 −1
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import static net.thunderbird.core.preference.display.DisplaySettingsKt.DISPLAY_
import static net.thunderbird.core.preference.display.DisplaySettingsKt.DISPLAY_SETTINGS_DEFAULT_SHOULD_SHOW_SETUP_ARCHIVE_FOLDER_DIALOG;
import static net.thunderbird.core.preference.display.DisplaySettingsKt.DISPLAY_SETTINGS_DEFAULT_SHOW_RECENT_CHANGES;
import static net.thunderbird.core.preference.display.DisplaySettingsPreferenceManagerKt.KEY_ANIMATION;
import static net.thunderbird.core.preference.display.DisplaySettingsPreferenceManagerKt.KEY_APP_LANGUAGE;
import static net.thunderbird.core.preference.display.DisplaySettingsPreferenceManagerKt.KEY_AUTO_FIT_WIDTH;
import static net.thunderbird.core.preference.display.DisplaySettingsPreferenceManagerKt.KEY_CHANGE_REGISTERED_NAME_COLOR;
import static net.thunderbird.core.preference.display.DisplaySettingsPreferenceManagerKt.KEY_COLORIZE_MISSING_CONTACT_PICTURE;
@@ -181,7 +182,7 @@ class GeneralSettingsDescriptions {
            new V(1, new BooleanSetting(false)),
            new V(69, null)
        ));
        s.put("language", Settings.versions(
        s.put(KEY_APP_LANGUAGE, Settings.versions(
            new V(1, new LanguageSetting())
        ));
        s.put("messageListPreviewLines", Settings.versions(
Loading