mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +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,10 +37,9 @@ 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"
|
||||
else -> pusher.kind
|
||||
Pusher.KIND_HTTP -> "Http Pusher"
|
||||
Pusher.KIND_EMAIL -> "Email Pusher"
|
||||
else -> pusher.kind
|
||||
}
|
||||
|
||||
holder.appId.text = pusher.appId
|
||||
|
|
Loading…
Reference in a new issue