mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Code cleanup
This commit is contained in:
parent
a05caf6f0e
commit
c13b636bae
@ -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()
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -136,7 +136,6 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
activeSessionHolder.getSafeActiveSession()?.refreshPushers()
|
||||
|
Loading…
Reference in New Issue
Block a user