|
17 | 17 | package org.matrix.android.sdk.api.session.room.threads
|
18 | 18 |
|
19 | 19 | import androidx.lifecycle.LiveData
|
20 |
| -import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent |
| 20 | +import org.matrix.android.sdk.api.session.room.threads.model.ThreadSummary |
21 | 21 |
|
22 | 22 | /**
|
23 |
| - * This interface defines methods to interact with threads related features. |
24 |
| - * It's implemented at the room level within the main timeline. |
| 23 | + * This interface defines methods to interact with thread related features. |
| 24 | + * It's the dynamic threads implementation and the homeserver must return |
| 25 | + * a capability entry for threads. If the server do not support m.thread |
| 26 | + * then [ThreadsLocalService] should be used instead |
25 | 27 | */
|
26 | 28 | interface ThreadsService {
|
27 | 29 |
|
28 | 30 | /**
|
29 |
| - * Returns a [LiveData] list of all the thread root TimelineEvents that exists at the room level |
| 31 | + * Returns a [LiveData] list of all the [ThreadSummary] that exists at the room level |
30 | 32 | */
|
31 |
| - fun getAllThreadsLive(): LiveData<List<TimelineEvent>> |
| 33 | + fun getAllThreadSummariesLive(): LiveData<List<ThreadSummary>> |
32 | 34 |
|
33 | 35 | /**
|
34 |
| - * Returns a list of all the thread root TimelineEvents that exists at the room level |
| 36 | + * Returns a list of all the [ThreadSummary] that exists at the room level |
35 | 37 | */
|
36 |
| - fun getAllThreads(): List<TimelineEvent> |
| 38 | + fun getAllThreadSummaries(): List<ThreadSummary> |
37 | 39 |
|
38 | 40 | /**
|
39 |
| - * Returns a [LiveData] list of all the marked unread threads that exists at the room level |
40 |
| - */ |
41 |
| - fun getMarkedThreadNotificationsLive(): LiveData<List<TimelineEvent>> |
42 |
| - |
43 |
| - /** |
44 |
| - * Returns a list of all the marked unread threads that exists at the room level |
45 |
| - */ |
46 |
| - fun getMarkedThreadNotifications(): List<TimelineEvent> |
47 |
| - |
48 |
| - /** |
49 |
| - * Returns whether or not the current user is participating in the thread |
50 |
| - * @param rootThreadEventId the eventId of the current thread |
| 41 | + * Enhance the provided ThreadSummary[List] by adding the latest |
| 42 | + * message edition for that thread |
| 43 | + * @return the enhanced [List] with edited updates |
51 | 44 | */
|
52 |
| - fun isUserParticipatingInThread(rootThreadEventId: String): Boolean |
| 45 | + fun enhanceThreadWithEditions(threads: List<ThreadSummary>): List<ThreadSummary> |
53 | 46 |
|
54 | 47 | /**
|
55 |
| - * Enhance the provided root thread TimelineEvent [List] by adding the latest |
56 |
| - * message edition for that thread |
57 |
| - * @return the enhanced [List] with edited updates |
| 48 | + * Fetch all thread replies for the specified thread using the /relations api |
| 49 | + * @param rootThreadEventId the root thread eventId |
| 50 | + * @param from defines the token that will fetch from that position |
| 51 | + * @param limit defines the number of max results the api will respond with |
58 | 52 | */
|
59 |
| - fun mapEventsWithEdition(threads: List<TimelineEvent>): List<TimelineEvent> |
| 53 | + suspend fun fetchThreadTimeline(rootThreadEventId: String, from: String, limit: Int) |
60 | 54 |
|
61 | 55 | /**
|
62 |
| - * Marks the current thread as read in local DB. |
63 |
| - * note: read receipts within threads are not yet supported with the API |
64 |
| - * @param rootThreadEventId the root eventId of the current thread |
| 56 | + * Fetch all thread summaries for the current room using the enhanced /messages api |
65 | 57 | */
|
66 |
| - suspend fun markThreadAsRead(rootThreadEventId: String) |
| 58 | + suspend fun fetchThreadSummaries() |
67 | 59 | }
|
0 commit comments