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,28 +441,29 @@ object PushManager {
val message: CharSequence? = extractMessage(intent)
val pushMessage = intent?.extras?.getSerializable("push") as PushMessage?
if (pushMessage != null) {
val singleNotId = pushMessage.notificationId.toInt()
pushMessage?.let {
val userNotId = pushMessage.notificationId.toInt()
val groupTuple = groupMap.get(pushMessage.host)
for (msg in messageStack[singleNotId]) {
manager.cancel(singleNotId)
messageStack[userNotId]?.let {
for (msg in messageStack[userNotId]) {
manager.cancel(userNotId)
groupTuple?.second?.decrementAndGet()
println("Decremented")
}
clearMessageBundle(singleNotId)
if (groupTuple != null) {
clearMessageBundle(userNotId)
groupTuple?.let {
val groupNotId = groupTuple.first
val totalNot = groupTuple.second.get()
if (totalNot == 0) {
manager.cancel(groupNotId)
}
}
if (message != null) {
message?.let {
sendMessage(context, message, pushMessage.rid)
}
}
}
}
}
private fun extractMessage(intent: Intent?): CharSequence? {
val remoteInput: Bundle? =
......
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