mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 01:45:36 +03:00
Merge pull request #8006 from vector-im/feature/mna/push-rules-api-order
[Push rules] Call /actions api before /enabled api (PSG-1099)
This commit is contained in:
commit
00c90c19d7
2 changed files with 8 additions and 7 deletions
1
changelog.d/8005.sdk
Normal file
1
changelog.d/8005.sdk
Normal file
|
@ -0,0 +1 @@
|
|||
[Push rules] Call /actions api before /enabled api
|
|
@ -34,10 +34,16 @@ internal interface UpdatePushRuleActionsTask : Task<UpdatePushRuleActionsTask.Pa
|
|||
|
||||
internal class DefaultUpdatePushRuleActionsTask @Inject constructor(
|
||||
private val pushRulesApi: PushRulesApi,
|
||||
private val globalErrorReceiver: GlobalErrorReceiver
|
||||
private val globalErrorReceiver: GlobalErrorReceiver,
|
||||
) : UpdatePushRuleActionsTask {
|
||||
|
||||
override suspend fun execute(params: UpdatePushRuleActionsTask.Params) {
|
||||
if (params.actions != null) {
|
||||
val body = mapOf("actions" to params.actions.toJson())
|
||||
executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body)
|
||||
}
|
||||
}
|
||||
executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateEnableRuleStatus(
|
||||
params.kind.value,
|
||||
|
@ -45,11 +51,5 @@ internal class DefaultUpdatePushRuleActionsTask @Inject constructor(
|
|||
EnabledBody(params.enable)
|
||||
)
|
||||
}
|
||||
if (params.actions != null) {
|
||||
val body = mapOf("actions" to params.actions.toJson())
|
||||
executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue