Commit 855cc652 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Null check message stack for the specific id before effectively replying the message

parent 015da5c3
...@@ -441,24 +441,25 @@ object PushManager { ...@@ -441,24 +441,25 @@ object PushManager {
val message: CharSequence? = extractMessage(intent) val message: CharSequence? = extractMessage(intent)
val pushMessage = intent?.extras?.getSerializable("push") as PushMessage? val pushMessage = intent?.extras?.getSerializable("push") as PushMessage?
if (pushMessage != null) { pushMessage?.let {
val singleNotId = pushMessage.notificationId.toInt() val userNotId = pushMessage.notificationId.toInt()
val groupTuple = groupMap.get(pushMessage.host) val groupTuple = groupMap.get(pushMessage.host)
for (msg in messageStack[singleNotId]) { messageStack[userNotId]?.let {
manager.cancel(singleNotId) for (msg in messageStack[userNotId]) {
groupTuple?.second?.decrementAndGet() manager.cancel(userNotId)
println("Decremented") groupTuple?.second?.decrementAndGet()
} }
clearMessageBundle(singleNotId) clearMessageBundle(userNotId)
if (groupTuple != null) { groupTuple?.let {
val groupNotId = groupTuple.first val groupNotId = groupTuple.first
val totalNot = groupTuple.second.get() val totalNot = groupTuple.second.get()
if (totalNot == 0) { if (totalNot == 0) {
manager.cancel(groupNotId) manager.cancel(groupNotId)
}
}
message?.let {
sendMessage(context, message, pushMessage.rid)
} }
}
if (message != null) {
sendMessage(context, message, pushMessage.rid)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment