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

Unverified Commit 45897a92 authored by Wolf-Martell Montwé's avatar Wolf-Martell Montwé Committed by GitHub
Browse files

Merge pull request #9262 from shamim-emon/fix-issue-9257

Refactor:replace all direct usage of K9.isShowStarredCount with generalSettingsDataStore
parents 6610cbdc 62e7f4b0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ data class GeneralSettings(
    val messageComposeTheme: SubTheme,
    val fixedMessageViewTheme: Boolean,
    val isShowUnifiedInbox: Boolean,
    val isShowStarredCount: Boolean,
)

enum class BackgroundSync {
+1 −0
Original line number Diff line number Diff line
@@ -17,4 +17,5 @@ interface GeneralSettingsManager {
    fun setMessageComposeTheme(subTheme: SubTheme)
    fun setFixedMessageViewTheme(fixedMessageViewTheme: Boolean)
    fun setIsShowUnifiedInbox(isShowUnifiedInbox: Boolean)
    fun setIsShowStarredCount(isShowStarredCount: Boolean)
}
+0 −5
Original line number Diff line number Diff line
@@ -212,9 +212,6 @@ object K9 : KoinComponent {
    @JvmStatic
    var isShowAccountSelector = true

    @JvmStatic
    var isShowStarredCount = false

    @JvmStatic
    var isAutoFitWidth: Boolean = false

@@ -340,7 +337,6 @@ object K9 : KoinComponent {
        isShowAnimations = storage.getBoolean("animations", true)
        isUseVolumeKeysForNavigation = storage.getBoolean("useVolumeKeysForNavigation", false)
        isShowAccountSelector = storage.getBoolean("showAccountSelector", true)
        isShowStarredCount = storage.getBoolean("showStarredCount", false)
        isMessageListSenderAboveSubject = storage.getBoolean("messageListSenderAboveSubject", false)
        isShowMessageListStars = storage.getBoolean("messageListStars", true)
        messageListPreviewLines = storage.getInt("messageListPreviewLines", 2)
@@ -440,7 +436,6 @@ object K9 : KoinComponent {
        editor.putEnum("messageListDensity", messageListDensity)
        editor.putBoolean("messageListSenderAboveSubject", isMessageListSenderAboveSubject)
        editor.putBoolean("showAccountSelector", isShowAccountSelector)
        editor.putBoolean("showStarredCount", isShowStarredCount)
        editor.putBoolean("messageListStars", isShowMessageListStars)
        editor.putInt("messageListPreviewLines", messageListPreviewLines)
        editor.putBoolean("showCorrespondentNames", isShowCorrespondentNames)
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ internal class RealDrawerConfigManager(
    private fun loadDrawerConfig(): DrawerConfig {
        return DrawerConfig(
            showAccountSelector = K9.isShowAccountSelector,
            showStarredCount = K9.isShowStarredCount,
            showStarredCount = generalSettingsManager.getSettings().isShowStarredCount,
            showUnifiedFolders = generalSettingsManager.getSettings().isShowUnifiedInbox,
        )
    }
+6 −0
Original line number Diff line number Diff line
@@ -138,6 +138,10 @@ internal class RealGeneralSettingsManager(
        getSettings().copy(isShowUnifiedInbox = isShowUnifiedInbox).persist()
    }

    override fun setIsShowStarredCount(isShowStarredCount: Boolean) {
        getSettings().copy(isShowStarredCount = isShowStarredCount).persist()
    }

    private fun writeSettings(editor: StorageEditor, settings: GeneralSettings) {
        editor.putBoolean("showRecentChanges", settings.showRecentChanges)
        editor.putEnum("theme", settings.appTheme)
@@ -145,6 +149,7 @@ internal class RealGeneralSettingsManager(
        editor.putEnum("messageComposeTheme", settings.messageComposeTheme)
        editor.putBoolean("fixedMessageViewTheme", settings.fixedMessageViewTheme)
        editor.putBoolean("showUnifiedInbox", settings.isShowUnifiedInbox)
        editor.putBoolean("showStarredCount", settings.isShowStarredCount)
    }

    private fun loadGeneralSettings(): GeneralSettings {
@@ -164,6 +169,7 @@ internal class RealGeneralSettingsManager(
            ),
            fixedMessageViewTheme = storage.getBoolean("fixedMessageViewTheme", true),
            isShowUnifiedInbox = storage.getBoolean("showUnifiedInbox", false),
            isShowStarredCount = storage.getBoolean("showStarredCount", false),
        )

        updateSettingsFlow(settings)
Loading