@@ -15,7 +15,6 @@ import com.nextcloud.talk.data.user.model.User
1515import com.nextcloud.talk.models.domain.ConversationModel
1616import com.nextcloud.talk.models.json.chat.ChatMessageJson
1717import com.nextcloud.talk.models.json.chat.ChatOverallSingleMessage
18- import kotlinx.coroutines.Job
1918import kotlinx.coroutines.flow.Flow
2019
2120@Suppress(" TooManyFunctions" )
@@ -52,7 +51,11 @@ interface ChatMessageRepository : LifecycleAwareManager {
5251
5352 fun updateConversation (conversationModel : ConversationModel )
5453
55- fun initScopeAndLoadInitialMessages (withNetworkParams : Bundle , hasHighPerformanceBackend : Boolean )
54+ suspend fun loadInitialMessages (withNetworkParams : Bundle , hasHighPerformanceBackend : Boolean )
55+
56+ fun startRegularMessagePolling (
57+ hasHighPerformanceBackend : Boolean
58+ ): Flow <Unit >
5659
5760 /* *
5861 * Loads messages from local storage. If the messages are not found, then it
@@ -61,19 +64,12 @@ interface ChatMessageRepository : LifecycleAwareManager {
6164 *
6265 * [withNetworkParams] credentials and url
6366 */
64- fun loadMoreMessages (
67+ suspend fun loadMoreMessages (
6568 beforeMessageId : Long ,
6669 roomToken : String ,
6770 withMessageLimit : Int ,
6871 withNetworkParams : Bundle
69- ): Job
70-
71- /* *
72- * Long polls the server for any updates to the chat, if found, it synchronizes
73- * the database with the server and emits the new messages to [messageFlow],
74- * else it simply retries after timeout.
75- */
76- fun initLongPolling (initialMessageId : Long ): Job
72+ )
7773
7874 /* *
7975 * Gets a individual message.
@@ -127,7 +123,7 @@ interface ChatMessageRepository : LifecycleAwareManager {
127123
128124 suspend fun hidePinnedMessage (credentials : String , url : String ): Flow <Boolean >
129125
130- fun onSignalingChatMessageReceived (chatMessage : ChatMessageJson )
126+ suspend fun onSignalingChatMessageReceived (chatMessage : ChatMessageJson )
131127
132128 fun observeMessages (internalConversationId : String ): Flow <List <ChatMessageEntity >>
133129}
0 commit comments