mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Cleanup and fix resValue
This commit is contained in:
parent
238f772461
commit
3481fc70c7
4 changed files with 10 additions and 10 deletions
|
@ -216,6 +216,7 @@ internal class DefaultPushRuleService @Inject constructor(
|
|||
}
|
||||
|
||||
override fun getKeywords(): LiveData<Set<String>> {
|
||||
// Keywords are all content rules that don't start with '.'
|
||||
val liveData = monarchy.findAllMappedWithChanges(
|
||||
{ realm ->
|
||||
PushRulesEntity.where(realm, RuleScope.GLOBAL, RuleSetKey.CONTENT)
|
||||
|
|
|
@ -143,8 +143,8 @@ android {
|
|||
resValue "bool", "useLoginV2", "false"
|
||||
|
||||
// NotificationSettingsV2 is disabled. To be released in conjunction with iOS/Web
|
||||
resValue "bool", "useNotificationSettingsV1", "false"
|
||||
resValue "bool", "useNotificationSettingsV2", "true"
|
||||
resValue "bool", "useNotificationSettingsV1", "true"
|
||||
resValue "bool", "useNotificationSettingsV2", "false"
|
||||
|
||||
buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping"
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import androidx.preference.PreferenceViewHolder
|
|||
import com.google.android.material.chip.Chip
|
||||
import com.google.android.material.chip.ChipGroup
|
||||
import im.vector.app.R
|
||||
import java.util.SortedSet
|
||||
|
||||
class KeywordPreference : VectorPreference {
|
||||
|
||||
|
@ -112,7 +111,6 @@ class KeywordPreference : VectorPreference {
|
|||
chip.isClickable = true
|
||||
chip.isCheckable = false
|
||||
chip.isCloseIconVisible = true
|
||||
chip.clipBounds
|
||||
chipGroup.addView(chip)
|
||||
|
||||
chip.setOnCloseIconClickListener {
|
||||
|
|
|
@ -19,7 +19,6 @@ package im.vector.app.features.settings.notifications
|
|||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.CheckBoxPreference
|
||||
import androidx.preference.Preference
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.preference.KeywordPreference
|
||||
|
@ -50,20 +49,24 @@ class VectorSettingsKeywordAndMentionsNotificationPreferenceFragment
|
|||
super.bindPref()
|
||||
val mentionCategory = findPreference<VectorPreferenceCategory>("SETTINGS_KEYWORDS_AND_MENTIONS")!!
|
||||
mentionCategory.isIconSpaceReserved = false
|
||||
|
||||
val yourKeywordsCategory = findPreference<VectorPreferenceCategory>("SETTINGS_YOUR_KEYWORDS")!!
|
||||
yourKeywordsCategory.isIconSpaceReserved = false
|
||||
|
||||
val keywordRules = session.getPushRules().content?.filter { !it.ruleId.startsWith(".") }.orEmpty()
|
||||
val anyEnabledKeywords = keywordRules.any(PushRule::enabled)
|
||||
|
||||
val editKeywordPreference = findPreference<KeywordPreference>("SETTINGS_KEYWORD_EDIT")!!
|
||||
editKeywordPreference.isEnabled = anyEnabledKeywords
|
||||
|
||||
val keywordPreference = findPreference<VectorCheckboxPreference>("SETTINGS_PUSH_RULE_MESSAGES_CONTAINING_KEYWORDS_PREFERENCE_KEY")!!
|
||||
keywordPreference.isIconSpaceReserved = false
|
||||
val anyEnabledKeywords = keywordRules.any(PushRule::enabled)
|
||||
keywordPreference.isChecked = anyEnabledKeywords
|
||||
editKeywordPreference.isEnabled = anyEnabledKeywords
|
||||
|
||||
keywordPreference.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||
val keywords = editKeywordPreference.keywords
|
||||
val newChecked = newValue as Boolean
|
||||
displayLoadingView()
|
||||
session.getKeywords()
|
||||
updateKeywordPushRules(keywords, newChecked){ result ->
|
||||
hideLoadingView()
|
||||
if (!isAdded) {
|
||||
|
@ -81,8 +84,6 @@ class VectorSettingsKeywordAndMentionsNotificationPreferenceFragment
|
|||
false
|
||||
}
|
||||
|
||||
|
||||
editKeywordPreference.keywords = session.getKeywords().value.orEmpty()
|
||||
editKeywordPreference.listener = object: KeywordPreference.Listener {
|
||||
override fun didAddKeyword(keyword: String) {
|
||||
addKeyword(keyword)
|
||||
|
|
Loading…
Reference in a new issue