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

Commit d15b6f77 authored by shamim-emon's avatar shamim-emon
Browse files

refactor: replace direct usage of K9.isShowComposeButtonOnMessageList

parent 48ce9477
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ data class GeneralSettings(
    val isChangeContactNameColor: Boolean,
    val isColorizeMissingContactPictures: Boolean,
    val isUseBackgroundAsUnreadIndicator: Boolean,
    val isShowComposeButtonOnMessageList: Boolean,
)

enum class BackgroundSync {
+1 −0
Original line number Diff line number Diff line
@@ -28,4 +28,5 @@ interface GeneralSettingsManager {
    fun setIsChangeContactNameColor(isChangeContactNameColor: Boolean)
    fun setIsColorizeMissingContactPictures(isColorizeMissingContactPictures: Boolean)
    fun setIsUseBackgroundAsUnreadIndicator(isUseBackgroundAsUnreadIndicator: Boolean)
    fun setIsShowComposeButtonOnMessageList(isShowComposeButtonOnMessageList: Boolean)
}
+0 −7
Original line number Diff line number Diff line
@@ -220,10 +220,6 @@ object K9 : KoinComponent {
    var sortType: SortType = AccountDefaultsProvider.DEFAULT_SORT_TYPE
    private val sortAscending = mutableMapOf<SortType, Boolean>()

    @get:Synchronized
    @set:Synchronized
    var isShowComposeButtonOnMessageList = true

    @get:Synchronized
    @set:Synchronized
    @JvmStatic
@@ -359,8 +355,6 @@ object K9 : KoinComponent {
        )

        splitViewMode = storage.getEnum("splitViewMode", SplitViewMode.NEVER)

        isShowComposeButtonOnMessageList = storage.getBoolean("showComposeButtonOnMessageList", true)
        isThreadedViewEnabled = storage.getBoolean("threadedView", true)

        featureFlagProvider.provide("disable_font_size_config".toFeatureFlagKey())
@@ -437,7 +431,6 @@ object K9 : KoinComponent {
        editor.putString("notificationQuickDelete", notificationQuickDeleteBehaviour.toString())
        editor.putString("lockScreenNotificationVisibility", lockScreenNotificationVisibility.toString())

        editor.putBoolean("showComposeButtonOnMessageList", isShowComposeButtonOnMessageList)
        editor.putBoolean("threadedView", isThreadedViewEnabled)
        editor.putEnum("splitViewMode", splitViewMode)

+7 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ internal const val KEY_SHOULD_SHOW_SETUP_ARCHIVE_FOLDER_DIALOG = "shouldShowSetu
internal const val KEY_CHANGE_REGISTERED_NAME_COLOR = "changeRegisteredNameColor"
internal const val KEY_COLORIZE_MISSING_CONTACT_PICTURE = "colorizeMissingContactPictures"
internal const val KEY_USE_BACKGROUND_AS_UNREAD_INDICATOR = "isUseBackgroundAsUnreadIndicator"
internal const val KEY_SHOW_COMPOSE_BUTTON_ON_MESSAGE_LIST = "showComposeButtonOnMessageList"

/**
 * Retrieve and modify general settings.
@@ -190,6 +191,10 @@ internal class RealGeneralSettingsManager(
        getSettings().copy(isUseBackgroundAsUnreadIndicator = isUseBackgroundAsUnreadIndicator).persist()
    }

    override fun setIsShowComposeButtonOnMessageList(isShowComposeButtonOnMessageList: Boolean) {
        getSettings().copy(isShowComposeButtonOnMessageList = isShowComposeButtonOnMessageList).persist()
    }

    private fun writeSettings(editor: StorageEditor, settings: GeneralSettings) {
        editor.putBoolean("showRecentChanges", settings.showRecentChanges)
        editor.putEnum("theme", settings.appTheme)
@@ -208,6 +213,7 @@ internal class RealGeneralSettingsManager(
        editor.putBoolean(KEY_CHANGE_REGISTERED_NAME_COLOR, settings.isChangeContactNameColor)
        editor.putBoolean(KEY_COLORIZE_MISSING_CONTACT_PICTURE, settings.isColorizeMissingContactPictures)
        editor.putBoolean(KEY_USE_BACKGROUND_AS_UNREAD_INDICATOR, settings.isUseBackgroundAsUnreadIndicator)
        editor.putBoolean(KEY_SHOW_COMPOSE_BUTTON_ON_MESSAGE_LIST, settings.isShowComposeButtonOnMessageList)
    }

    private fun loadGeneralSettings(): GeneralSettings {
@@ -241,6 +247,7 @@ internal class RealGeneralSettingsManager(
            isColorizeMissingContactPictures = storage.getBoolean(KEY_COLORIZE_MISSING_CONTACT_PICTURE, true),
            isChangeContactNameColor = storage.getBoolean(KEY_CHANGE_REGISTERED_NAME_COLOR, false),
            isUseBackgroundAsUnreadIndicator = storage.getBoolean(KEY_USE_BACKGROUND_AS_UNREAD_INDICATOR, false),
            isShowComposeButtonOnMessageList = storage.getBoolean(KEY_SHOW_COMPOSE_BUTTON_ON_MESSAGE_LIST, true),
        )

        updateSettingsFlow(settings)
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ data class MessageListActivityConfig(
                isShowContactPicture = settings.isShowContactPicture,
                isColorizeMissingContactPictures = settings.isColorizeMissingContactPictures,
                isUseBackgroundAsUnreadIndicator = settings.isUseBackgroundAsUnreadIndicator,
                isShowComposeButton = K9.isShowComposeButtonOnMessageList,
                isShowComposeButton = settings.isShowComposeButtonOnMessageList,
                contactNameColor = K9.contactNameColor,
                messageViewTheme = settings.messageViewTheme,
                messageListPreviewLines = K9.messageListPreviewLines,
Loading