embedded distrib: original gateway
This commit is contained in:
parent
09b290e579
commit
4a8fa4a3ce
|
@ -435,7 +435,7 @@ dependencies {
|
|||
|
||||
// Unifiedpush
|
||||
implementation 'com.github.UnifiedPush:android-connector:1.1.3'
|
||||
gplayImplementation 'com.github.UnifiedPush:android-embedded_fcm_distributor:1.0.2'
|
||||
gplayImplementation 'com.github.UnifiedPush:android-embedded_fcm_distributor:1.1.0'
|
||||
|
||||
// OSS License, gplay flavor only
|
||||
gplayImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
|
||||
|
|
|
@ -70,7 +70,7 @@ class PushersManager @Inject constructor(
|
|||
private fun getPusherAppId(context: Context) : String {
|
||||
val appId = stringProvider.getString(R.string.pusher_app_id)
|
||||
return if (UPHelper.isEmbeddedDistributor(context)) {
|
||||
"${appId}.fcm"
|
||||
appId
|
||||
} else
|
||||
"${appId}.up"
|
||||
}
|
||||
|
|
|
@ -94,13 +94,30 @@ val upHandler = object: MessagingReceiverHandler {
|
|||
|
||||
lateinit var data: JSONObject
|
||||
lateinit var notification: JSONObject
|
||||
try {
|
||||
data = JSONObject(message)
|
||||
notification = data.getJSONObject("notification")
|
||||
} catch (e: JSONException) {
|
||||
Timber.e(e)
|
||||
return
|
||||
if (UPHelper.isEmbeddedDistributor(context)) {
|
||||
try {
|
||||
notification = JSONObject(message)
|
||||
} catch (e: JSONException) {
|
||||
Timber.e(e)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
data = JSONObject(message)
|
||||
notification = data.getJSONObject("notification")
|
||||
} catch (e: JSONException) {
|
||||
Timber.e(e)
|
||||
return
|
||||
}
|
||||
try {
|
||||
notification.put("unread",
|
||||
notification.getJSONObject("count").getInt("unread"))
|
||||
} catch (e: JSONException) {
|
||||
Timber.i("No unread on notification")
|
||||
notification.put("unread", 0)
|
||||
}
|
||||
}
|
||||
|
||||
val eventId: String = try {
|
||||
notification.getString("event_id")
|
||||
} catch (e: JSONException) {
|
||||
|
@ -108,6 +125,7 @@ val upHandler = object: MessagingReceiverHandler {
|
|||
notification.put("event_id", "")
|
||||
""
|
||||
}
|
||||
|
||||
try {
|
||||
notification.getString("room_id")
|
||||
} catch (e: JSONException) {
|
||||
|
@ -191,7 +209,7 @@ val upHandler = object: MessagingReceiverHandler {
|
|||
}
|
||||
|
||||
// update the badge counter
|
||||
val unreadCount = data.getJSONObject("counts").getInt("unread")
|
||||
val unreadCount = data.getInt("unread")
|
||||
BadgeProxy.updateBadgeCount(context, unreadCount)
|
||||
|
||||
val session = activeSessionHolder.getSafeActiveSession()
|
||||
|
|
Loading…
Reference in New Issue