Skip to content

Commit

Permalink
Fix: pinned message overlay should disable action bar item
Browse files Browse the repository at this point in the history
Change-Id: I1b00a71626b034d4b86e7111465c71d0c2fa33dd
  • Loading branch information
SpiritCroc committed Sep 17, 2024
1 parent c2a0cb5 commit d42a823
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sealed interface AbstractScPref : Parcelable {
sealed interface ScPref<T> : AbstractScPref {
val sKey: String
val defaultValue: T
val disabledValue: T
val authorsChoice: T?
val upstreamChoice: T?

Expand Down Expand Up @@ -63,6 +64,7 @@ data class ScBoolPref(
override val titleRes: Int,
@StringRes
override val summaryRes: Int? = null,
override val disabledValue: Boolean = defaultValue,
override val authorsChoice: Boolean? = null,
override val upstreamChoice: Boolean? = null,
override val dependencies: List<ScPrefDependency> = emptyList(),
Expand Down Expand Up @@ -99,6 +101,7 @@ data class ScStringListPref(
override val titleRes: Int,
@StringRes
override val summaryRes: Int? = null,
override val disabledValue: String = defaultValue,
override val authorsChoice: String? = null,
override val upstreamChoice: String? = null,
override val dependencies: List<ScPrefDependency> = emptyList(),
Expand All @@ -121,6 +124,7 @@ data class ScColorPref(
override val titleRes: Int,
@StringRes
override val summaryRes: Int? = null,
override val disabledValue: Int = defaultValue,
override val authorsChoice: Int? = null,
override val upstreamChoice: Int? = null,
override val dependencies: List<ScPrefDependency> = emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DefaultScPreferencesStore @Inject constructor(
if (isEnabled(prefs, scPref)) {
prefs[key] ?: scPref.defaultValue
} else {
scPref.defaultValue
scPref.disabledValue
}
}
}
Expand All @@ -80,7 +80,7 @@ class DefaultScPreferencesStore @Inject constructor(
if (isEnabled(prefs, scPref)) {
prefs[key] ?: scPref.defaultValue
} else {
scPref.defaultValue
scPref.disabledValue
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object ScPrefs {

// Timeline
val PINNED_MESSAGE_OVERLAY = ScBoolPref("PINNED_MESSAGE_OVERLAY", false, R.string.sc_pref_pinned_message_overlay_title, R.string.sc_pref_pinned_message_overlay_summary, authorsChoice = false, upstreamChoice = true)
val PINNED_MESSAGE_TOOLBAR_ACTION = ScBoolPref("PINNED_MESSAGE_TOOLBAR_ACTION", true, R.string.sc_pref_pinned_message_toolbar_title, R.string.sc_pref_pinned_message_toolbar_summary, authorsChoice = true, upstreamChoice = false, dependencies = PINNED_MESSAGE_OVERLAY.asDependencies(expect = false))
val PINNED_MESSAGE_TOOLBAR_ACTION = ScBoolPref("PINNED_MESSAGE_TOOLBAR_ACTION", true, R.string.sc_pref_pinned_message_toolbar_title, R.string.sc_pref_pinned_message_toolbar_summary, authorsChoice = true, upstreamChoice = false, dependencies = PINNED_MESSAGE_OVERLAY.asDependencies(expect = false), disabledValue = false)
val SC_TIMELINE_LAYOUT = ScBoolPref("SC_TIMELINE_LAYOUT", true, R.string.sc_pref_sc_timeline_layout_title, upstreamChoice = false)
val FLOATING_DATE = ScBoolPref("FLOATING_DATE", true, R.string.sc_pref_sc_floating_date_title, R.string.sc_pref_sc_floating_date_summary, upstreamChoice = false)
val PL_DISPLAY_NAME = ScBoolPref("PL_DISPLAY_NAME", false, R.string.sc_pref_pl_display_name_title, R.string.sc_pref_pl_display_name_summary_warning, authorsChoice = false, upstreamChoice = false)
Expand Down

0 comments on commit d42a823

Please sign in to comment.