Skip to content

Commit

Permalink
removing this. usages where there's no clashes
Browse files Browse the repository at this point in the history
  • Loading branch information
ouchadam committed Sep 23, 2021
1 parent 8734d5d commit 8316728
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }
}
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit 8316728

Please sign in to comment.