Code cleanup

This commit is contained in:
Benoit Marty 2020-02-29 10:05:00 +01:00
parent a05caf6f0e
commit c13b636bae
5 changed files with 11 additions and 21 deletions

View File

@ -85,7 +85,7 @@ data class PushRule(
*/
fun removeNotificationSound(): PushRule {
return copy(
actions = (getActions().filter { it !is Action.Sound }).toJson()
actions = getActions().filter { it !is Action.Sound }.toJson()
)
}

View File

@ -45,7 +45,6 @@ class VectorPreferences @Inject constructor(private val context: Context) {
const val SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY = "SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY"
const val SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY = "SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY"
const val SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY"
const val SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY"
const val SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY"
const val SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY"

View File

@ -77,21 +77,14 @@ class VectorSettingsActivity : VectorBaseActivity(),
}
override fun onPreferenceStartFragment(caller: PreferenceFragmentCompat, pref: Preference): Boolean {
val oFragment = when {
VectorPreferences.SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY == pref.key ->
supportFragmentManager.fragmentFactory.instantiate(classLoader, VectorSettingsNotificationsTroubleshootFragment::class.java.name)
VectorPreferences.SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY == pref.key ->
supportFragmentManager.fragmentFactory.instantiate(classLoader, VectorSettingsAdvancedNotificationPreferenceFragment::class.java.name)
else ->
try {
pref.fragment?.let {
supportFragmentManager.fragmentFactory.instantiate(classLoader, it)
}
} catch (e: Throwable) {
showSnackbar(getString(R.string.not_implemented))
Timber.e(e)
null
}
val oFragment = try {
pref.fragment?.let {
supportFragmentManager.fragmentFactory.instantiate(classLoader, it)
}
} catch (e: Throwable) {
showSnackbar(getString(R.string.not_implemented))
Timber.e(e)
null
}
if (oFragment != null) {

View File

@ -25,9 +25,8 @@ import im.vector.riotx.core.preference.VectorPreference
import im.vector.riotx.core.utils.toast
import javax.inject.Inject
class VectorSettingsAdvancedNotificationPreferenceFragment @Inject constructor(
private val vectorPreferences: VectorPreferences
) : VectorSettingsBaseFragment() {
class VectorSettingsAdvancedNotificationPreferenceFragment @Inject constructor()
: VectorSettingsBaseFragment() {
override var titleRes: Int = R.string.settings_notification_advanced

View File

@ -136,7 +136,6 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
}
}
override fun onResume() {
super.onResume()
activeSessionHolder.getSafeActiveSession()?.refreshPushers()