mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
extracting constants for the pusher kinds and email appId
This commit is contained in:
parent
4c4f2fce74
commit
d31ad7e187
3 changed files with 15 additions and 8 deletions
|
@ -26,7 +26,15 @@ data class Pusher(
|
|||
val data: PusherData,
|
||||
|
||||
val state: PusherState
|
||||
)
|
||||
) {
|
||||
companion object {
|
||||
|
||||
const val KIND_EMAIL = "email"
|
||||
const val KIND_HTTP = "http"
|
||||
const val APP_ID_EMAIL = "m.email"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
enum class PusherState {
|
||||
UNREGISTERED,
|
||||
|
|
|
@ -70,7 +70,7 @@ internal class DefaultPushersService @Inject constructor(
|
|||
) = addPusher(
|
||||
JsonPusher(
|
||||
pushKey = pushkey,
|
||||
kind = "http",
|
||||
kind = Pusher.KIND_HTTP,
|
||||
appId = appId,
|
||||
profileTag = profileTag,
|
||||
lang = lang,
|
||||
|
@ -84,8 +84,8 @@ internal class DefaultPushersService @Inject constructor(
|
|||
override fun addEmailPusher(email: String, lang: String, emailBranding: String, appDisplayName: String, deviceDisplayName: String) = addPusher(
|
||||
JsonPusher(
|
||||
pushKey = email,
|
||||
kind = "email",
|
||||
appId = "m.email",
|
||||
kind = Pusher.KIND_EMAIL,
|
||||
appId = Pusher.APP_ID_EMAIL,
|
||||
profileTag = "",
|
||||
lang = lang,
|
||||
appDisplayName = appDisplayName,
|
||||
|
|
|
@ -37,9 +37,8 @@ abstract class PushGatewayItem : EpoxyModelWithHolder<PushGatewayItem.Holder>()
|
|||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
holder.kind.text = when (pusher.kind) {
|
||||
// TODO Create const
|
||||
"http" -> "Http Pusher"
|
||||
"mail" -> "Email Pusher"
|
||||
Pusher.KIND_HTTP -> "Http Pusher"
|
||||
Pusher.KIND_EMAIL -> "Email Pusher"
|
||||
else -> pusher.kind
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue