Introduce PushHistoryService to store data about the received push (#4573)
* Introduce PushHistoryService to store data about the received push Add a push database. * Update screenshots * Improve preview. * Update screenshots * Add missing test. * Add test for PushHistoryView * Fix configuration issue. Was: w: /libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/history/PushHistoryPresenterTest.kt:35:27 Cannot access class 'PushProvider' in the expression type. While it may work, this case indicates a configuration mistake and can lead to avoidable compilation errors, so it may be forbidden soon. Check your module classpath for missing or conflicting dependencies. --------- Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
2b1a66ff37
commit
c7f0566dc1
60 changed files with 1656 additions and 214 deletions
|
|
@ -9,6 +9,7 @@ package io.element.android.libraries.push.api
|
|||
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.push.api.history.PushHistoryItem
|
||||
import io.element.android.libraries.pushproviders.api.Distributor
|
||||
import io.element.android.libraries.pushproviders.api.PushProvider
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
|
@ -51,4 +52,19 @@ interface PushService {
|
|||
* Return false in case of early error.
|
||||
*/
|
||||
suspend fun testPush(): Boolean
|
||||
|
||||
/**
|
||||
* Get a flow of total number of received Push.
|
||||
*/
|
||||
val pushCounter: Flow<Int>
|
||||
|
||||
/**
|
||||
* Get a flow of list of [PushHistoryItem].
|
||||
*/
|
||||
fun getPushHistoryItemsFlow(): Flow<List<PushHistoryItem>>
|
||||
|
||||
/**
|
||||
* Reset the push history, including the push counter.
|
||||
*/
|
||||
suspend fun resetPushHistory()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.push.api.history
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
|
||||
/**
|
||||
* Data class representing a push history item.
|
||||
* @property pushDate Date (timestamp).
|
||||
* @property formattedDate Formatted date.
|
||||
* @property providerInfo Push provider name / info
|
||||
* @property eventId EventId from the push, can be null if the received data are not correct.
|
||||
* @property roomId RoomId from the push, can be null if the received data are not correct.
|
||||
* @property sessionId The session Id, can be null if the session cannot be retrieved
|
||||
* @property hasBeenResolved Result of resolving the event
|
||||
* @property comment Comment. Can contains an error message if the event could not be resolved, or other any information.
|
||||
*/
|
||||
data class PushHistoryItem(
|
||||
val pushDate: Long,
|
||||
val formattedDate: String,
|
||||
val providerInfo: String,
|
||||
val eventId: EventId?,
|
||||
val roomId: RoomId?,
|
||||
val sessionId: SessionId?,
|
||||
val hasBeenResolved: Boolean,
|
||||
val comment: String?,
|
||||
)
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Copyright 2023, 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.push.api.store
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface PushDataStore {
|
||||
val pushCounterFlow: Flow<Int>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue