mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 18:05:59 +03:00
Fix / ignore message sent by me in push rules
This commit is contained in:
parent
7821ca12fd
commit
090ee1d4e9
2 changed files with 9 additions and 5 deletions
|
@ -192,7 +192,7 @@ internal class SessionModule(private val sessionParams: SessionParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
scope(DefaultSession.SCOPE) {
|
scope(DefaultSession.SCOPE) {
|
||||||
BingRuleWatcher(get(), get(), get(), get())
|
BingRuleWatcher(get(), get(), get(), get(), get())
|
||||||
}
|
}
|
||||||
|
|
||||||
scope(DefaultSession.SCOPE) {
|
scope(DefaultSession.SCOPE) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package im.vector.matrix.android.internal.session.notification
|
package im.vector.matrix.android.internal.session.notification
|
||||||
|
|
||||||
import com.zhuinden.monarchy.Monarchy
|
import com.zhuinden.monarchy.Monarchy
|
||||||
|
import im.vector.matrix.android.api.auth.data.SessionParams
|
||||||
import im.vector.matrix.android.api.session.events.model.EventType
|
import im.vector.matrix.android.api.session.events.model.EventType
|
||||||
import im.vector.matrix.android.internal.database.RealmLiveEntityObserver
|
import im.vector.matrix.android.internal.database.RealmLiveEntityObserver
|
||||||
import im.vector.matrix.android.internal.database.mapper.asDomain
|
import im.vector.matrix.android.internal.database.mapper.asDomain
|
||||||
|
@ -28,6 +29,7 @@ import im.vector.matrix.android.internal.task.configureWith
|
||||||
internal class BingRuleWatcher(monarchy: Monarchy,
|
internal class BingRuleWatcher(monarchy: Monarchy,
|
||||||
private val task: ProcessEventForPushTask,
|
private val task: ProcessEventForPushTask,
|
||||||
private val defaultPushRuleService: DefaultPushRuleService,
|
private val defaultPushRuleService: DefaultPushRuleService,
|
||||||
|
private val sessionParams: SessionParams,
|
||||||
private val taskExecutor: TaskExecutor) :
|
private val taskExecutor: TaskExecutor) :
|
||||||
RealmLiveEntityObserver<EventEntity>(monarchy) {
|
RealmLiveEntityObserver<EventEntity>(monarchy) {
|
||||||
|
|
||||||
|
@ -41,10 +43,12 @@ internal class BingRuleWatcher(monarchy: Monarchy,
|
||||||
|
|
||||||
override fun processChanges(inserted: List<EventEntity>, updated: List<EventEntity>, deleted: List<EventEntity>) {
|
override fun processChanges(inserted: List<EventEntity>, updated: List<EventEntity>, deleted: List<EventEntity>) {
|
||||||
val rules = defaultPushRuleService.getPushrules("global")
|
val rules = defaultPushRuleService.getPushrules("global")
|
||||||
inserted.map { it.asDomain() }.let { events ->
|
inserted.map { it.asDomain() }
|
||||||
task.configureWith(ProcessEventForPushTask.Params(events, rules))
|
.filter { it.senderId != sessionParams.credentials.userId }
|
||||||
.executeBy(taskExecutor)
|
.let { events ->
|
||||||
}
|
task.configureWith(ProcessEventForPushTask.Params(events, rules))
|
||||||
|
.executeBy(taskExecutor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue