Skip to content
Snippets Groups Projects
Commit faf24a3f authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Created getContactsRequestsOnce() method for one-time call of

This method is for a single snapshot of the current requests, where a flow would not be appropriate
parent 917e8753
No related branches found
No related tags found
3 merge requests!84Version 2.92 build 629,!77v2.9 b627,!74FE-957: Requests stuck verifying
...@@ -21,6 +21,9 @@ interface RequestsDao { ...@@ -21,6 +21,9 @@ interface RequestsDao {
@Query("SELECT * FROM Requests WHERE requestId IN (SELECT userId FROM Contacts)") @Query("SELECT * FROM Requests WHERE requestId IN (SELECT userId FROM Contacts)")
fun getContactRequests(): Flow<List<RequestData>> fun getContactRequests(): Flow<List<RequestData>>
@Query("SELECT * FROM Requests WHERE requestId IN (SELECT userId FROM Contacts)")
fun getContactRequestsOnce(): List<RequestData>
@Query("SELECT * FROM Requests WHERE requestId IN (SELECT groupId FROM Groups)") @Query("SELECT * FROM Requests WHERE requestId IN (SELECT groupId FROM Groups)")
fun getGroupInvitations(): Flow<List<RequestData>> fun getGroupInvitations(): Flow<List<RequestData>>
......
...@@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.Flow ...@@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.Flow
interface LocalRequestsDataSource { interface LocalRequestsDataSource {
val unreadCount: Flow<Int> val unreadCount: Flow<Int>
suspend fun getContactRequestsOnce(): List<RequestData>
suspend fun getContactRequests(): Flow<List<RequestData>> suspend fun getContactRequests(): Flow<List<RequestData>>
suspend fun getGroupInvitations(): Flow<List<RequestData>> suspend fun getGroupInvitations(): Flow<List<RequestData>>
suspend fun getRequest(requestId: ByteArray): RequestData? suspend fun getRequest(requestId: ByteArray): RequestData?
......
...@@ -52,6 +52,9 @@ class RequestsDatabase @Inject constructor( ...@@ -52,6 +52,9 @@ class RequestsDatabase @Inject constructor(
} }
} }
override suspend fun getContactRequestsOnce(): List<RequestData> =
requestsDao.getContactRequestsOnce()
override suspend fun getContactRequests(): Flow<List<RequestData>> = override suspend fun getContactRequests(): Flow<List<RequestData>> =
requestsDao.getContactRequests() requestsDao.getContactRequests()
.stateIn(scope, SharingStarted.Eagerly, listOf()) .stateIn(scope, SharingStarted.Eagerly, listOf())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment