Skip to content

Instantly share code, notes, and snippets.

View Raiden18's full-sized avatar
🎯
Focusing

Paul Karpukhin Raiden18

🎯
Focusing
View GitHub Profile
@Raiden18
Raiden18 / CartViewModel.kt
Last active May 10, 2022 14:28
Information Expert. ViewModel
class CartViewModel(
private val cartInteractor: CartInteractor
): ViewModel() {
private val approximatePriceOfProductsLiveData = MutableLiveData<String>()
init {
val cart = cartInteractor.getCart()
val approximatePriceOfProducts : BigDecimal = TODO("Must be calculated")
val approximatePriceOfProductsLiveData = approximatePriceOfProducts.toString()
@Raiden18
Raiden18 / CartInteractor.kt
Last active May 10, 2022 14:29
Information Expert. Interactor
class CartInteractor(
private val cartRepository: CartRepository
) {
fun getCart() : Cart {
return cartRepository.getCart()
}
}
@Raiden18
Raiden18 / Cart.kt
Last active May 10, 2022 12:19
Information Expert. Domain Classes
data class Cart(
val products: List<Product>
)