Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizations #3

Open
wants to merge 1 commit into
base: app
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ dependencies {
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"

// Compose dependencies
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha08"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0-beta01"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha09"
implementation "com.google.accompanist:accompanist-flowlayout:0.17.0"

// Coroutines
Expand All @@ -80,7 +80,7 @@ dependencies {

//Dagger - Hilt
implementation "com.google.dagger:hilt-android:2.38.1"
kapt "com.google.dagger:hilt-android-compiler:2.37"
kapt "com.google.dagger:hilt-android-compiler:2.38.1"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:1.0.0"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.plcoding.cryptocurrencyappyt.data.remote.dto


import com.google.gson.annotations.SerializedName

data class LinksExtended(
val stats: Stats,
val type: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.plcoding.cryptocurrencyappyt.data.remote.dto


import com.google.gson.annotations.SerializedName

data class Stats(
val contributors: Int,
val followers: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.plcoding.cryptocurrencyappyt.data.remote.dto


import com.google.gson.annotations.SerializedName

data class TeamMember(
val id: String,
val name: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.plcoding.cryptocurrencyappyt.data.remote.dto


import com.google.gson.annotations.SerializedName

data class Whitepaper(
val link: String,
val thumbnail: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.plcoding.cryptocurrencyappyt.domain.model

import com.google.gson.annotations.SerializedName

data class Coin(
val id: String,
val isActive: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GetCoinUseCase @Inject constructor(
val coin = repository.getCoinById(coinId).toCoinDetail()
emit(Resource.Success<CoinDetail>(coin))
} catch(e: HttpException) {
emit(Resource.Error<CoinDetail>(e.localizedMessage ?: "An unexpected error occured"))
emit(Resource.Error<CoinDetail>(e.localizedMessage ?: "An unexpected error occurred"))
} catch(e: IOException) {
emit(Resource.Error<CoinDetail>("Couldn't reach server. Check your internet connection."))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GetCoinsUseCase @Inject constructor(
val coins = repository.getCoins().map { it.toCoin() }
emit(Resource.Success<List<Coin>>(coins))
} catch(e: HttpException) {
emit(Resource.Error<List<Coin>>(e.localizedMessage ?: "An unexpected error occured"))
emit(Resource.Error<List<Coin>>(e.localizedMessage ?: "An unexpected error occurred"))
} catch(e: IOException) {
emit(Resource.Error<List<Coin>>("Couldn't reach server. Check your internet connection."))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package com.plcoding.cryptocurrencyappyt.presentation.coin_detail

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.CircularProgressIndicator
Expand All @@ -16,12 +24,9 @@ import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.google.accompanist.flowlayout.FlowRow
import com.plcoding.cryptocurrencyappyt.presentation.Screen
import com.plcoding.cryptocurrencyappyt.presentation.coin_detail.components.CoinTag
import com.plcoding.cryptocurrencyappyt.presentation.coin_detail.components.TeamListItem
import com.plcoding.cryptocurrencyappyt.presentation.coin_list.components.CoinListItem

@Composable
fun CoinDetailScreen(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.plcoding.cryptocurrencyappyt.presentation.coin_detail

import com.plcoding.cryptocurrencyappyt.domain.model.Coin
import com.plcoding.cryptocurrencyappyt.domain.model.CoinDetail

data class CoinDetailState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.lifecycle.viewModelScope
import com.plcoding.cryptocurrencyappyt.common.Constants
import com.plcoding.cryptocurrencyappyt.common.Resource
import com.plcoding.cryptocurrencyappyt.domain.use_case.get_coin.GetCoinUseCase
import com.plcoding.cryptocurrencyappyt.domain.use_case.get_coins.GetCoinsUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand Down Expand Up @@ -37,7 +36,7 @@ class CoinDetailViewModel @Inject constructor(
}
is Resource.Error -> {
_state.value = CoinDetailState(
error = result.message ?: "An unexpected error occured"
error = result.message ?: "An unexpected error occurred"
)
}
is Resource.Loading -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CoinListViewModel @Inject constructor(
}
is Resource.Error -> {
_state.value = CoinListState(
error = result.message ?: "An unexpected error occured"
error = result.message ?: "An unexpected error occurred"
)
}
is Resource.Loading -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import com.plcoding.cryptocurrencyappyt.domain.model.Coin

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private val LightColorPalette = lightColors(
)

@Composable
fun CryptocurrencyAppYTTheme(darkTheme: Boolean = true, content: @Composable() () -> Unit) {
fun CryptocurrencyAppYTTheme(darkTheme: Boolean = true, content: @Composable () -> Unit) {
val colors = if (darkTheme) {
DarkColorPalette
} else {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.0.1'
compose_version = '1.0.2'
}
repositories {
google()
Expand Down