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 data: PusherData,
|
||||||
|
|
||||||
val state: PusherState
|
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 {
|
enum class PusherState {
|
||||||
UNREGISTERED,
|
UNREGISTERED,
|
||||||
|
|
|
@ -70,7 +70,7 @@ internal class DefaultPushersService @Inject constructor(
|
||||||
) = addPusher(
|
) = addPusher(
|
||||||
JsonPusher(
|
JsonPusher(
|
||||||
pushKey = pushkey,
|
pushKey = pushkey,
|
||||||
kind = "http",
|
kind = Pusher.KIND_HTTP,
|
||||||
appId = appId,
|
appId = appId,
|
||||||
profileTag = profileTag,
|
profileTag = profileTag,
|
||||||
lang = lang,
|
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(
|
override fun addEmailPusher(email: String, lang: String, emailBranding: String, appDisplayName: String, deviceDisplayName: String) = addPusher(
|
||||||
JsonPusher(
|
JsonPusher(
|
||||||
pushKey = email,
|
pushKey = email,
|
||||||
kind = "email",
|
kind = Pusher.KIND_EMAIL,
|
||||||
appId = "m.email",
|
appId = Pusher.APP_ID_EMAIL,
|
||||||
profileTag = "",
|
profileTag = "",
|
||||||
lang = lang,
|
lang = lang,
|
||||||
appDisplayName = appDisplayName,
|
appDisplayName = appDisplayName,
|
||||||
|
|
|
@ -37,10 +37,9 @@ abstract class PushGatewayItem : EpoxyModelWithHolder<PushGatewayItem.Holder>()
|
||||||
override fun bind(holder: Holder) {
|
override fun bind(holder: Holder) {
|
||||||
super.bind(holder)
|
super.bind(holder)
|
||||||
holder.kind.text = when (pusher.kind) {
|
holder.kind.text = when (pusher.kind) {
|
||||||
// TODO Create const
|
Pusher.KIND_HTTP -> "Http Pusher"
|
||||||
"http" -> "Http Pusher"
|
Pusher.KIND_EMAIL -> "Email Pusher"
|
||||||
"mail" -> "Email Pusher"
|
else -> pusher.kind
|
||||||
else -> pusher.kind
|
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.appId.text = pusher.appId
|
holder.appId.text = pusher.appId
|
||||||
|
|
Loading…
Reference in a new issue