mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-25 03:14:37 -06:00
[Feedback] Hide notification when feedback is open. Fix mixing messages when a thread is open.
This commit is contained in:
parent
bcf3fef303
commit
37ddd643ac
@ -74,6 +74,7 @@ class SzkolnyAppFirebase(val app: App, val profiles: List<Profile>, val message:
|
|||||||
}
|
}
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.Default) {
|
||||||
app.db.feedbackMessageDao().add(message)
|
app.db.feedbackMessageDao().add(message)
|
||||||
|
if (!EventBus.getDefault().hasSubscriberForEvent(FeedbackMessageEvent::class.java)) {
|
||||||
val notification = Notification(
|
val notification = Notification(
|
||||||
id = System.currentTimeMillis(),
|
id = System.currentTimeMillis(),
|
||||||
title = "Wiadomość od ${message.senderName}",
|
title = "Wiadomość od ${message.senderName}",
|
||||||
@ -87,6 +88,7 @@ class SzkolnyAppFirebase(val app: App, val profiles: List<Profile>, val message:
|
|||||||
}
|
}
|
||||||
EventBus.getDefault().postSticky(FeedbackMessageEvent(message))
|
EventBus.getDefault().postSticky(FeedbackMessageEvent(message))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun sharedEvent(teamCode: String, jsonStr: String, message: String) {
|
private fun sharedEvent(teamCode: String, jsonStr: String, message: String) {
|
||||||
val json = JsonParser().parse(jsonStr).asJsonObject
|
val json = JsonParser().parse(jsonStr).asJsonObject
|
||||||
|
@ -70,10 +70,15 @@ class FeedbackFragment : Fragment(), CoroutineScope {
|
|||||||
fun onFeedbackMessageEvent(event: FeedbackMessageEvent) {
|
fun onFeedbackMessageEvent(event: FeedbackMessageEvent) {
|
||||||
EventBus.getDefault().removeStickyEvent(event)
|
EventBus.getDefault().removeStickyEvent(event)
|
||||||
val message = event.message
|
val message = event.message
|
||||||
|
if (currentDeviceId != null && message.deviceId == currentDeviceId) {
|
||||||
val chatMessage = getChatMessage(message)
|
val chatMessage = getChatMessage(message)
|
||||||
if (message.received) chatView.receive(chatMessage)
|
if (message.received) chatView.receive(chatMessage)
|
||||||
else chatView.send(chatMessage)
|
else chatView.send(chatMessage)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(context, "${message.senderName}: Nowa wiadomość w innym wątku.", Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private val users = mutableMapOf(
|
private val users = mutableMapOf(
|
||||||
0 to User(0, "Ja", null)
|
0 to User(0, "Ja", null)
|
||||||
|
Loading…
Reference in New Issue
Block a user