forked from github/wulkanowy-mirror
Fix admin messages caching (#1632)
This commit is contained in:
parent
10cb2b70f1
commit
6de937703a
@ -5,7 +5,6 @@ import io.github.wulkanowy.data.db.dao.AdminMessageDao
|
|||||||
import io.github.wulkanowy.data.db.entities.Student
|
import io.github.wulkanowy.data.db.entities.Student
|
||||||
import io.github.wulkanowy.utils.AppInfo
|
import io.github.wulkanowy.utils.AppInfo
|
||||||
import io.github.wulkanowy.utils.AutoRefreshHelper
|
import io.github.wulkanowy.utils.AutoRefreshHelper
|
||||||
import io.github.wulkanowy.utils.getRefreshKey
|
|
||||||
import io.github.wulkanowy.utils.networkBoundResource
|
import io.github.wulkanowy.utils.networkBoundResource
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -27,7 +26,7 @@ class AdminMessageRepository @Inject constructor(
|
|||||||
query = { adminMessageDao.loadAll() },
|
query = { adminMessageDao.loadAll() },
|
||||||
fetch = { adminMessageService.getAdminMessages() },
|
fetch = { adminMessageService.getAdminMessages() },
|
||||||
shouldFetch = {
|
shouldFetch = {
|
||||||
refreshHelper.shouldBeRefreshed(getRefreshKey(cacheKey, student)) || forceRefresh
|
refreshHelper.shouldBeRefreshed(cacheKey) || forceRefresh
|
||||||
},
|
},
|
||||||
saveFetchResult = { oldItems, newItems ->
|
saveFetchResult = { oldItems, newItems ->
|
||||||
adminMessageDao.removeOldAndSaveNew(oldItems, newItems)
|
adminMessageDao.removeOldAndSaveNew(oldItems, newItems)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user