removing this. usages where there's no clashes

This commit is contained in:
Adam Brown 2021-09-23 11:45:06 +01:00
parent 8734d5d2e7
commit 8316728e53
2 changed files with 8 additions and 8 deletions

View File

@ -109,9 +109,9 @@ internal class DefaultPushersService @Inject constructor(
private fun JsonPusher.validateParameters() {
// Do some parameter checks. It's ok to throw Exception, to inform developer of the problem
if (this.pushKey.length > 512) throw InvalidParameterException("pushkey should not exceed 512 chars")
if (this.appId.length > 64) throw InvalidParameterException("appId should not exceed 64 chars")
this.data?.url?.let { url -> if ("/_matrix/push/v1/notify" !in url) throw InvalidParameterException("url should contain '/_matrix/push/v1/notify'") }
if (pushKey.length > 512) throw InvalidParameterException("pushkey should not exceed 512 chars")
if (appId.length > 64) throw InvalidParameterException("appId should not exceed 64 chars")
data?.url?.let { url -> if ("/_matrix/push/v1/notify" !in url) throw InvalidParameterException("url should contain '/_matrix/push/v1/notify'") }
}
override suspend fun removePusher(pushkey: String, appId: String) {

View File

@ -156,8 +156,8 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
}
private fun Session.getEmailsWithPushInformation(): List<Pair<ThreePid.Email, Pusher?>> {
val emailPushers = this.getPushers().filter { it.kind == "email" }
return this.getThreePids()
val emailPushers = getPushers().filter { it.kind == "email" }
return getThreePids()
.filterIsInstance<ThreePid.Email>()
.map { it to emailPushers.firstOrNull { pusher -> pusher.pushKey == it.email } }
}
@ -386,13 +386,13 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
}
private fun SwitchPreference.setTransactionalSwitchChangeListener(scope: CoroutineScope, transaction: suspend (Boolean) -> Unit) {
this.setOnPreferenceChangeListener { switchPreference, isChecked ->
val originalState = this.isChecked
setOnPreferenceChangeListener { switchPreference, isChecked ->
require(switchPreference is SwitchPreference)
val originalState = switchPreference.isChecked
scope.launch {
try {
transaction(isChecked as Boolean)
} catch (failure: Throwable) {
require(switchPreference is SwitchPreference)
switchPreference.isChecked = originalState
Toast.makeText(switchPreference.context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
}