rename method

This commit is contained in:
Benoit Marty 2019-06-26 10:09:45 +02:00 committed by Benoit Marty
parent 9fa3a75fb6
commit 2625e11508
6 changed files with 26 additions and 7 deletions

View File

@ -20,14 +20,13 @@ import im.vector.matrix.android.api.session.events.model.Event

interface PushRuleService {


/**
* Fetch the push rules from the server
*/
fun fetchPushRules(scope: String = "global")

//TODO get push rule set
fun getPushrules(scope: String = "global"): List<PushRule>
fun getPushRules(scope: String = "global"): List<PushRule>

//TODO update rule


View File

@ -0,0 +1,20 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package im.vector.matrix.android.api.pushrules

enum class RuleIds {
}

View File

@ -503,8 +503,8 @@ internal class DefaultSession(override val sessionParams: SessionParams) : Sessi
return pushersService.livePushers()
}

override fun getPushrules(scope: String): List<PushRule> {
return pushRuleService.getPushrules(scope)
override fun getPushRules(scope: String): List<PushRule> {
return pushRuleService.getPushRules(scope)
}

override fun fetchPushRules(scope: String) {

View File

@ -42,7 +42,7 @@ internal class BingRuleWatcher(monarchy: Monarchy,
}

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() }
.filter { it.senderId != sessionParams.credentials.userId }
.let { events ->

View File

@ -103,7 +103,7 @@ internal class DefaultPushRuleService(
.executeBy(taskExecutor)
}

override fun getPushrules(scope: String): List<PushRule> {
override fun getPushRules(scope: String): List<PushRule> {

var contentRules: List<PushRule> = emptyList()
var overrideRules: List<PushRule> = emptyList()

View File

@ -34,7 +34,7 @@ class PushRulesViewModel(initialState: PushRulesViewState) : VectorViewModel<Pus

override fun initialState(viewModelContext: ViewModelContext): PushRulesViewState? {
val session = viewModelContext.activity.get<Session>()
val rules = session.getPushrules()
val rules = session.getPushRules()

return PushRulesViewState(rules)
}