Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-14 10:03:02 +01:00
parent b483293b23
commit 925eb4342a
13 changed files with 232 additions and 0 deletions

1
data/news/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,53 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
alias(deps.plugins.kotlin.kapt)
id("configuration")
}
android {
namespace = "com.tangem.data.news"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
dependencies {
// region Project - Core
implementation(projects.core.datasource)
api(projects.core.utils)
// endregion
// region Project - Data
implementation(projects.data.common)
// endregion
// region Project - Domain
implementation(projects.domain.news)
// endregion
// region Project - Libs
implementation(projects.libs.blockchainSdk)
// endregion
// region DI
implementation(deps.hilt.android)
kapt(deps.hilt.kapt)
// endregion
// region Other libraries
implementation(deps.androidx.datastore)
implementation(deps.moshi.kotlin)
implementation(deps.timber)
// endregion
// region Tests
testImplementation(deps.test.coroutine)
testImplementation(deps.test.junit5)
testRuntimeOnly(deps.test.junit5.engine)
testImplementation(deps.test.mockk)
testImplementation(deps.test.truth)
testImplementation(projects.common.test)
// endregion
}

View file

@ -0,0 +1,20 @@
package com.tangem.data.news.di
import com.tangem.data.news.repository.DefaultNewsRepository
import com.tangem.domain.news.repository.NewsRepository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
internal object NewsDataModule {
@Singleton
@Provides
fun providesQuotesRepository(): NewsRepository {
return DefaultNewsRepository()
}
}

View file

@ -0,0 +1,10 @@
package com.tangem.data.news.repository
import com.tangem.domain.news.repository.NewsRepository
/**
* Default implementation of [NewsRepository]
*
[REDACTED_AUTHOR]
*/
internal class DefaultNewsRepository : NewsRepository

1
domain/news/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,11 @@
plugins {
alias(deps.plugins.kotlin.jvm)
alias(deps.plugins.kotlin.serialization)
id("configuration")
}
dependencies {
api(projects.domain.core)
api(projects.domain.models)
implementation(deps.kotlin.serialization)
}

View file

@ -0,0 +1,16 @@
package com.tangem.domain.news.models
import kotlinx.serialization.Serializable
/**
* Represents an article category.
*
[REDACTED_AUTHOR]
* @param id - unique identifier of the category
* @param name - category name
*/
@Serializable
data class ArticleCategory(
val id: Int,
val name: String,
)

View file

@ -0,0 +1,36 @@
package com.tangem.domain.news.models
import kotlinx.serialization.Serializable
/**
* Represents an detailed article via news.
*
[REDACTED_AUTHOR]
* @param id - unique identifier of the article
* @param score - score of article (ex. 6.9)
* @param locale - language of the article
* @param isTrending - flag for trending article
* @param categories - list of included categories
* @param relatedTokens - tokens, which were mentioned in article
* @param title - article title
* @param newsUrl - link for article to share
* @param shortContent - short description
* @param content - main text of the article
* @param originalArticles - original articles, which were base to build detailed article.
*/
@Serializable
data class DetailedArticle(
val id: Int,
val createdAt: String,
val score: Float,
val locale: String,
val isTrending: Boolean,
val categories: List<ArticleCategory>,
val relatedTokens: List<RelatedToken>,
val title: String,
val newsUrl: String,
val shortContent: String,
val content: String,
val originalArticles: List<OriginalArticle>,
)

View file

@ -0,0 +1,26 @@
package com.tangem.domain.news.models
import kotlinx.serialization.Serializable
/**
* Represents an original article, which was base to build detailed article.
*
[REDACTED_AUTHOR]
* @param id - unique identifier of the article
* @param title - article title
* @param sourceName - name of original article source
* @param locale - language of the article
* @param publishedAt - date of article publishing
* @param url - link to source of original article
* @param imageUrl - image from source of original article
*/
@Serializable
data class OriginalArticle(
val id: Int,
val title: String,
val sourceName: String,
val locale: String,
val publishedAt: String,
val url: String,
val imageUrl: String?,
)

View file

@ -0,0 +1,18 @@
package com.tangem.domain.news.models
import kotlinx.serialization.Serializable
/**
* Represents related tokens for article.
*
[REDACTED_AUTHOR]
* @param id - unique identifier of the token
* @param symbol - token symbol(BTC, ETH etc.)
* @param name - token name
*/
@Serializable
data class RelatedToken(
val id: String,
val symbol: String,
val name: String,
)

View file

@ -0,0 +1,30 @@
package com.tangem.domain.news.models
import kotlinx.serialization.Serializable
/**
* Represents an short article info in news.
*
[REDACTED_AUTHOR]
* @param id - unique identifier of the article
* @param score - score of article (ex. 6.9)
* @param locale - language of the article
* @param isTrending - flag for trending article
* @param categories - list of included categories
* @param relatedTokens - tokens, which were mentioned in article
* @param title - article title
* @param newsUrl - link for article to share
*/
@Serializable
data class ShortArticle(
val id: Int,
val createdAt: String,
val score: Float,
val locale: String,
val categories: List<ArticleCategory>,
val relatedTokens: List<RelatedToken>,
val isTrending: Boolean,
val title: String,
val newsUrl: String,
)

View file

@ -0,0 +1,8 @@
package com.tangem.domain.news.repository
/**
* News repository
*
[REDACTED_AUTHOR]
*/
interface NewsRepository

View file

@ -362,6 +362,7 @@ include(":domain:wallet-manager")
include(":domain:wallet-manager:models")
include(":domain:yield-supply")
include(":domain:yield-supply:models")
include(":domain:news")
// endregion Domain modules
// region Data modules
@ -396,4 +397,5 @@ include(":data:swap")
include(":data:express")
include(":data:wallet-manager")
include(":data:yield-supply")
include(":data:news")
// endregion Data modules