Skip to content

Commit

Permalink
Merge pull request #6 from raikwaramit/dev
Browse files Browse the repository at this point in the history
[Added new feature] Added support for all other screen
  • Loading branch information
raikwaramit authored Aug 7, 2023
2 parents 6ed1b1b + 962ed39 commit 63faebc
Show file tree
Hide file tree
Showing 71 changed files with 29,756 additions and 377 deletions.
Binary file modified .DS_Store
Binary file not shown.
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,36 @@

![CryptoAtlas Logo](app/src/main/ic_launcher-playstore.png)

CryptoAtlas is a comprehensive cryptocurrency tracking app that allows users to explore and monitor data for various cryptocurrencies from around the world. It provides real-time information, price trends, historical data, and other essential details for each coin, making it a valuable tool for crypto enthusiasts, investors, and traders.
CryptoAtlas is a comprehensive cryptocurrency tracking app that allows users to explore and monitor
data for various cryptocurrencies from around the world. It provides real-time information, price
trends, historical data, and other essential details for each coin, making it a valuable tool for
crypto enthusiasts, investors, and traders.

![Check out logo](https://looka.com/s/140548111)
## Features

- 💸 **Extensive Coin Listing**: Access an extensive list of cryptocurrencies from different exchanges and tokens available in the market.

- 📈 **Real-Time Data**: Get up-to-date information on cryptocurrency prices, market capitalization, trading volume, and more.
## Features

- 📊 **Detailed Coin Pages**: View detailed pages for each cryptocurrency, showcasing historical price charts, market performance, and key statistics.
- 💸 **Extensive Coin Listing**: Access an extensive list of cryptocurrencies from different
exchanges and tokens available in the market.

-**Favorite Coins**: Mark coins as favorites to keep track of your preferred cryptocurrencies in one place.
- 📈 **Real-Time Data**: Get up-to-date information on cryptocurrency prices, market capitalization,
trading volume, and more.

- 🔔 **Price Alerts**: Set custom price alerts for specific cryptocurrencies and get notified when the price reaches your defined threshold.
- 📊 **Detailed Coin Pages**: View detailed pages for each cryptocurrency, showcasing historical
price charts, market performance, and key statistics.

- 📰 **News Feed**: Stay informed with the latest news and updates from the cryptocurrency world.
-**Favorite Coins**: Mark coins as favorites to keep track of your preferred cryptocurrencies in
one place.

## Screenshots

![Screenshot 1](link-to-screenshot1.png)
![Screenshot 2](link-to-screenshot2.png)
![Screenshot 3](link-to-screenshot3.png)
![Screenshot 1](screenshots/mainscreen_normal.png)
![Screenshot 2](screenshots/navigation_drawer.png)
![Screenshot 3](screenshots/detail_coindetail.png)
![Screenshot 3](screenshots/mainscreen_search.png)
![Screenshot 4](screenshots/favoritescreen.png)
![Screenshot 5](screenshots/about_app.png)
![Screenshot 6](screenshots/contact_us.png)

## Getting Started

Expand All @@ -33,7 +41,8 @@ CryptoAtlas is a comprehensive cryptocurrency tracking app that allows users to

## Contributing

We welcome contributions from the open-source community! If you'd like to contribute to CryptoAtlas, please follow these steps:
We welcome contributions from the open-source community! If you'd like to contribute to CryptoAtlas,
please follow these steps:

1. Fork the repository.
2. Create a new branch: `git checkout -b feature/your-feature`
Expand Down
Binary file modified app/.DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
kotlin("kapt")
id("com.google.devtools.ksp")
id("com.google.dagger.hilt.android")
}

Expand Down Expand Up @@ -38,6 +39,9 @@ android {
kotlinOptions {
jvmTarget = "17"
}
kotlin {
jvmToolchain(17)
}
buildFeatures {
compose = true
}
Expand All @@ -61,6 +65,7 @@ dependencies {
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material:1.4.3")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
Expand Down Expand Up @@ -101,6 +106,13 @@ dependencies {

// Coil library
implementation("io.coil-kt:coil-compose:2.4.0")

// Room dependency
val room_version = "2.5.2"

implementation("androidx.room:room-ktx:$room_version")
// To use Kotlin annotation processing tool (kapt)
ksp("androidx.room:room-compiler:$room_version")
}

// Allow references to generated code
Expand Down
Binary file modified app/src/.DS_Store
Binary file not shown.
Binary file modified app/src/main/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ package com.raikwaramit.cryptoatlas
import android.app.Application
import dagger.hilt.android.HiltAndroidApp

/**
* Hilt android app class for providing the application context.
*/
@HiltAndroidApp
class CoinApplication : Application()
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.raikwaramit.cryptoatlas.common

/**
* Constants that will be used in app.
*/
object Constants {
const val HTTP_BASE_URL = "https://api.coinpaprika.com/"
const val COIN_ID = "coinId"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.raikwaramit.cryptoatlas.data.local

import androidx.room.Database
import androidx.room.RoomDatabase

/**
* Room database abstract class for creating the data base.
*/
@Database(entities = [FavoriteCoin::class], version = 1, exportSchema = false)
abstract class AppDatabase : RoomDatabase() {
abstract fun favoriteDao(): FavoriteDao
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.raikwaramit.cryptoatlas.data.local

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

/**
* Data class representing the room data base table.
*
* @property coinId Id of the crypto coin.
* @property coinName Name of the crypto coin.
* @property symbol Symbol of the crypto coin.
* @property isActive Tells if the coin is active or not.
*/
@Entity
data class FavoriteCoin(
@PrimaryKey @ColumnInfo(name = "coin_id") val coinId: String,
@ColumnInfo(name = "coin_name") val coinName: String?,
@ColumnInfo(name = "coin_symbol") val symbol: String?,
@ColumnInfo(name = "is_active") val isActive: Boolean?,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.raikwaramit.cryptoatlas.data.local

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Query
import androidx.room.Upsert

@Dao
interface FavoriteDao {
@Query("SELECT * FROM favoritecoin")
suspend fun getAll(): List<FavoriteCoin>

@Upsert
suspend fun insert(favoriteCoin: FavoriteCoin)

@Delete
suspend fun delete(favoriteCoin: FavoriteCoin)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ import com.raikwaramit.cryptoatlas.data.remote.dto.coin_details_dto.CoinDetailsD
import retrofit2.http.GET
import retrofit2.http.Path

/**
* Interface for making the retrofit api calls.
*/
interface CoinPaprikaApi {

/**
* Method the fetch the crypto coin list.
*/
@GET("/v1/coins")
suspend fun getCoins(): List<CoinDto>

/**
* Method to fetch the specific crypto coin details.
*
* @param coinId Id of the coin for fetching the details.
*/
@GET("/v1/coins/{coinId}")
suspend fun getCoinById(@Path("coinId") coinId: String): CoinDetailsDto
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import com.raikwaramit.cryptoatlas.data.remote.dto.coin_details_dto.CoinDetailsD
import com.raikwaramit.cryptoatlas.domain.repository.CoinRepository
import javax.inject.Inject

/**
* Repository class implementation for providing the api to view model
*
* @property api Retrofit api for making the network request.
*/
class CoinRepositoryImpl @Inject constructor(
private val api: CoinPaprikaApi,
) : CoinRepository {
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/java/com/raikwaramit/cryptoatlas/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
package com.raikwaramit.cryptoatlas.di

import android.content.Context
import androidx.room.Room
import com.raikwaramit.cryptoatlas.common.Constants
import com.raikwaramit.cryptoatlas.data.local.AppDatabase
import com.raikwaramit.cryptoatlas.data.local.FavoriteDao
import com.raikwaramit.cryptoatlas.data.remote.CoinPaprikaApi
import com.raikwaramit.cryptoatlas.data.repository.CoinRepositoryImpl
import com.raikwaramit.cryptoatlas.domain.repository.CoinRepository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import javax.inject.Singleton

/**
* Module for providing the retrofit api and room database
*/
@Module
@InstallIn(SingletonComponent::class)
object AppModule {
Expand All @@ -29,4 +37,16 @@ object AppModule {
fun provideCoinRepository(api: CoinPaprikaApi): CoinRepository {
return CoinRepositoryImpl(api)
}

@Provides
@Singleton
fun provideRoomDatabase(@ApplicationContext context: Context): AppDatabase {
return Room.databaseBuilder(context, AppDatabase::class.java, "favorite").build()
}

@Provides
@Singleton
fun provideRoomDao(appDatabase: AppDatabase): FavoriteDao {
return appDatabase.favoriteDao()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package com.raikwaramit.cryptoatlas.domain.model
/**
* Coin data class having coin details that will be shown.
*
* @property id
* @property name
* @property rank
* @property isActive
* @property symbol
* @property id Id of the coin.
* @property name Name of the coin.
* @property rank Word wide rank of the coin.
* @property isActive Is currently in active state.
* @property symbol Symbol of the coin.
*/
data class Coin(
var id: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ package com.raikwaramit.cryptoatlas.domain.model

import com.raikwaramit.cryptoatlas.data.remote.dto.coin_details_dto.TeamMember

/**
* Data class for holding the details of the specific coin that will be shown in details screen.
*/
data class CoinDetail(
val coinId: String,
val name: String,
val description: String,
val symbol: String,
val rank: Int,
val logo: String,
val logo: String?,
val isActive: Boolean,
val tags: List<String>,
val team: List<TeamMember>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ package com.raikwaramit.cryptoatlas.domain.repository
import com.raikwaramit.cryptoatlas.data.remote.dto.CoinDto
import com.raikwaramit.cryptoatlas.data.remote.dto.coin_details_dto.CoinDetailsDto

/**
* Interface for getting the coins related details from the network.
*/
interface CoinRepository {

/**
* Method to fetch the coin list and provide it to the view model.
*/
suspend fun getCoins(): List<CoinDto>

/**
* Method to fetch the details of a specific coin.
*
* @param coinId Id of the coin.
*/
suspend fun getCoinById(coinId: String): CoinDetailsDto
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import okio.IOException
import retrofit2.HttpException
import javax.inject.Inject

/**
* Class for getting the data of coin list that will be directly used in viewModel.
*/
class GetCoinUseCase @Inject constructor(
private val repository: CoinRepository,
) {
Expand All @@ -20,7 +23,6 @@ class GetCoinUseCase @Inject constructor(
emit(Resource.Success(coin))
} catch (e: HttpException) {
emit(Resource.Error(e.localizedMessage ?: ""))

} catch (e: IOException) {
emit(Resource.Error(e.localizedMessage ?: ""))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import okio.IOException
import retrofit2.HttpException
import javax.inject.Inject

/**
* Class to get the specific coin details.
*/
class GetCoinsUseCase @Inject constructor(
private val repository: CoinRepository,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.raikwaramit.cryptoatlas.common.Constants
import com.raikwaramit.cryptoatlas.presentation.coin_detail.CoinDetailScreen
import com.raikwaramit.cryptoatlas.presentation.coin_list.CoinListScreen
import com.raikwaramit.cryptoatlas.presentation.graph.RootNavGraph
import com.raikwaramit.cryptoatlas.presentation.ui.theme.CryptoAtlasTheme
import dagger.hilt.android.AndroidEntryPoint

/**
* Entry point of the app.
*/
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -27,21 +26,7 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
val navController = rememberNavController()
NavHost(
navController = navController,
startDestination = Screen.CoinListScreen.route
) {
composable(route = Screen.CoinListScreen.route) {
CoinListScreen(navController = navController)
}
composable(
route = Screen.CoinDetailScreen.route +
"/{${Constants.COIN_ID}}"
) {
CoinDetailScreen()
}
}
RootNavGraph(navController = rememberNavController())
}
}
}
Expand Down

This file was deleted.

Loading

0 comments on commit 63faebc

Please sign in to comment.