Fix build warnings

pull/504/head
Don Turner 2 years ago
parent b00ed067a7
commit cf053ade5a

@ -27,8 +27,10 @@ class AndroidHiltConventionPlugin : Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) {
with(target) { with(target) {
with(pluginManager) { with(pluginManager) {
apply("org.jetbrains.kotlin.kapt")
apply("dagger.hilt.android.plugin") apply("dagger.hilt.android.plugin")
// KAPT must go last to avoid build warnings.
// See: https://stackoverflow.com/questions/70550883/warning-the-following-options-were-not-recognized-by-any-processor-dagger-f
apply("org.jetbrains.kotlin.kapt")
} }
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")

@ -56,10 +56,10 @@ class GetSaveableNewsResourcesUseCase @Inject constructor(
} }
private fun Flow<List<NewsResource>>.mapToSaveableNewsResources( private fun Flow<List<NewsResource>>.mapToSaveableNewsResources(
savedNewsResourceIds: Flow<Set<String>> savedNewsResourceIdsStream: Flow<Set<String>>
): Flow<List<SaveableNewsResource>> = ): Flow<List<SaveableNewsResource>> =
filterNot { it.isEmpty() } filterNot { it.isEmpty() }
.combine(savedNewsResourceIds) { newsResources, savedNewsResourceIds -> .combine(savedNewsResourceIdsStream) { newsResources, savedNewsResourceIds ->
newsResources.map { newsResource -> newsResources.map { newsResource ->
SaveableNewsResource( SaveableNewsResource(
newsResource = newsResource, newsResource = newsResource,

@ -213,6 +213,7 @@ fun NewsResourceMetaData(
@Composable @Composable
fun NewsResourceLink( fun NewsResourceLink(
@Suppress("UNUSED_PARAMETER")
newsResource: NewsResource newsResource: NewsResource
) { ) {
TODO() TODO()

@ -45,7 +45,6 @@ class TopicViewModel @Inject constructor(
stringDecoder: StringDecoder, stringDecoder: StringDecoder,
private val userDataRepository: UserDataRepository, private val userDataRepository: UserDataRepository,
topicsRepository: TopicsRepository, topicsRepository: TopicsRepository,
// newsRepository: NewsRepository,
getSaveableNewsResources: GetSaveableNewsResourcesUseCase getSaveableNewsResources: GetSaveableNewsResourcesUseCase
) : ViewModel() { ) : ViewModel() {
@ -97,13 +96,13 @@ private fun topicUiState(
.map { it.followedTopics } .map { it.followedTopics }
// Observe topic information // Observe topic information
val topic: Flow<Topic> = topicsRepository.getTopic( val topicStream: Flow<Topic> = topicsRepository.getTopic(
id = topicId id = topicId
) )
return combine( return combine(
followedTopicIds, followedTopicIds,
topic, topicStream,
::Pair ::Pair
) )
.asResult() .asResult()
@ -135,7 +134,7 @@ private fun newsUiState(
userDataRepository: UserDataRepository, userDataRepository: UserDataRepository,
): Flow<NewsUiState> { ): Flow<NewsUiState> {
// Observe news // Observe news
val news: Flow<List<SaveableNewsResource>> = getSaveableNewsResources( val newsStream: Flow<List<SaveableNewsResource>> = getSaveableNewsResources(
filterTopicIds = setOf(element = topicId), filterTopicIds = setOf(element = topicId),
) )
@ -144,7 +143,7 @@ private fun newsUiState(
.map { it.bookmarkedNewsResources } .map { it.bookmarkedNewsResources }
return combine( return combine(
news, newsStream,
bookmark, bookmark,
::Pair ::Pair
) )
@ -152,7 +151,7 @@ private fun newsUiState(
.map { newsToBookmarksResult -> .map { newsToBookmarksResult ->
when (newsToBookmarksResult) { when (newsToBookmarksResult) {
is Result.Success -> { is Result.Success -> {
val (news, bookmarks) = newsToBookmarksResult.data val news = newsToBookmarksResult.data.first
NewsUiState.Success(news) NewsUiState.Success(news)
} }
is Result.Loading -> { is Result.Loading -> {

Loading…
Cancel
Save