embedded distrib with sygnal
This commit is contained in:
parent
b32fab390e
commit
6c80b3a14b
|
@ -1,7 +1,6 @@
|
|||
package im.vector.app.push.fcm
|
||||
|
||||
import android.content.Context
|
||||
import im.vector.app.R
|
||||
import org.unifiedpush.android.embedded_fcm_distributor.GetEndpointHandler
|
||||
import org.unifiedpush.android.embedded_fcm_distributor.EmbeddedDistributorReceiver
|
||||
|
||||
|
@ -23,8 +22,8 @@ import org.unifiedpush.android.embedded_fcm_distributor.EmbeddedDistributorRecei
|
|||
|
||||
val handlerFCM = object: GetEndpointHandler {
|
||||
override fun getEndpoint(context: Context?, token: String, instance: String): String {
|
||||
// This returns the endpoint of your FCM Rewrite-Proxy
|
||||
return "${context!!.getString(R.string.pusher_http_url)}/FCM?instance=$instance&token=$token"
|
||||
// Here token is the FCM Token, used by the gateway (sygnal)
|
||||
return token
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,13 @@ object UPHelper {
|
|||
}
|
||||
|
||||
fun customOrDefaultGateway(context: Context, endpoint: String?): String {
|
||||
// if we use the embedded distributor,
|
||||
// register app_id type upfcm on sygnal
|
||||
// the pushkey if FCM key
|
||||
val up = Registration()
|
||||
if (up.getDistributor(context) == context.packageName)
|
||||
return context.getString(R.string.pusher_http_url)
|
||||
// else, unifiedpush, and pushkey is an endpoint
|
||||
val default = context.getString(R.string.default_push_gateway_http_url)
|
||||
endpoint?.let {
|
||||
val uri = URI(it)
|
||||
|
|
Loading…
Reference in New Issue