|
|
@ -80,17 +80,14 @@ class OfflineFirstNewsRepository @Inject constructor(
|
|
|
|
val hasOnboarded = userData.shouldHideOnboarding
|
|
|
|
val hasOnboarded = userData.shouldHideOnboarding
|
|
|
|
val followedTopicIds = userData.followedTopics
|
|
|
|
val followedTopicIds = userData.followedTopics
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Make this more efficient, there is no need to retrieve populated
|
|
|
|
|
|
|
|
// news resources when all that's needed are the ids
|
|
|
|
|
|
|
|
val existingNewsResourceIdsThatHaveChanged = when {
|
|
|
|
val existingNewsResourceIdsThatHaveChanged = when {
|
|
|
|
hasOnboarded -> newsResourceDao.getNewsResources(
|
|
|
|
hasOnboarded -> newsResourceDao.getNewsResourceIds(
|
|
|
|
useFilterTopicIds = true,
|
|
|
|
useFilterTopicIds = true,
|
|
|
|
filterTopicIds = followedTopicIds,
|
|
|
|
filterTopicIds = followedTopicIds,
|
|
|
|
useFilterNewsIds = true,
|
|
|
|
useFilterNewsIds = true,
|
|
|
|
filterNewsIds = changedIds.toSet(),
|
|
|
|
filterNewsIds = changedIds.toSet(),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.first()
|
|
|
|
.first()
|
|
|
|
.map { it.entity.id }
|
|
|
|
|
|
|
|
.toSet()
|
|
|
|
.toSet()
|
|
|
|
// No need to retrieve anything if notifications won't be sent
|
|
|
|
// No need to retrieve anything if notifications won't be sent
|
|
|
|
else -> emptySet()
|
|
|
|
else -> emptySet()
|
|
|
|