documenting the getEmails function and lifting it out of the class as it's not directly tied to the class

This commit is contained in:
Adam Brown 2021-09-23 12:02:46 +01:00
parent 8316728e53
commit efec63e979
1 changed files with 14 additions and 7 deletions

View File

@ -155,13 +155,6 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
} }
} }
private fun Session.getEmailsWithPushInformation(): List<Pair<ThreePid.Email, Pusher?>> {
val emailPushers = getPushers().filter { it.kind == "email" }
return getThreePids()
.filterIsInstance<ThreePid.Email>()
.map { it to emailPushers.firstOrNull { pusher -> pusher.pushKey == it.email } }
}
private val batteryStartForActivityResult = registerStartForActivityResult { private val batteryStartForActivityResult = registerStartForActivityResult {
// Noop // Noop
} }
@ -400,3 +393,17 @@ private fun SwitchPreference.setTransactionalSwitchChangeListener(scope: Corouti
true true
} }
} }
/**
* Fetches the current users 3pid emails and pairs them with pushers with same email as the push key.
* If no pusher is available for a given emails we can infer that push is not registered for the email.
* @return a list of ThreePid emails paired with its associated Pusher or null.
* @see ThreePid.Email
* @see Pusher
*/
private fun Session.getEmailsWithPushInformation(): List<Pair<ThreePid.Email, Pusher?>> {
val emailPushers = getPushers().filter { it.kind == "email" }
return getThreePids()
.filterIsInstance<ThreePid.Email>()
.map { it to emailPushers.firstOrNull { pusher -> pusher.pushKey == it.email } }
}