Ensure the sync is started when receiving a Push, to ensure that the encryption loop is running.
Fixes notification with endecrypted content (#1178)
This commit is contained in:
parent
fedd0b39b1
commit
82f6f358a7
6 changed files with 75 additions and 16 deletions
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2023 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 io.element.android.libraries.matrix.api.sync
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
|
||||
sealed interface StartSyncReason {
|
||||
data object AppInForeground : StartSyncReason
|
||||
data class Notification(val roomId: RoomId, val eventId: EventId) : StartSyncReason
|
||||
}
|
||||
|
|
@ -22,12 +22,12 @@ interface SyncService {
|
|||
/**
|
||||
* Tries to start the sync. If already syncing it has no effect.
|
||||
*/
|
||||
suspend fun startSync(): Result<Unit>
|
||||
suspend fun startSync(reason: StartSyncReason): Result<Unit>
|
||||
|
||||
/**
|
||||
* Tries to stop the sync. If service is not syncing it has no effect.
|
||||
*/
|
||||
suspend fun stopSync(): Result<Unit>
|
||||
suspend fun stopSync(reason: StartSyncReason): Result<Unit>
|
||||
|
||||
/**
|
||||
* Flow of [SyncState]. Will be updated as soon as the current [SyncState] changes.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue