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

First delivery #42

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

TheMaster1802
Copy link

First delivery with the set up, navigation, retrofit adapter and dependency injection.

HSPC and others added 8 commits January 31, 2023 11:07
- Uses permission enabled

Gradle
- Adding Dependencies

MainActivity
-  Setting up content container
- Adding Screens and Navigation

MainActivity
-  Setting up navHost
- Adding Data Transfer Object (DTO) Interface for Retrofit
- Adding AppModule and its provider for RetrofitInstance
- Adding Models for Available Book, Ticker and Order Book
- Adding New Class which extends from Application for Hilt annotation HiltAndroidApp
- Name registration in Manifest

MainActivity
-  Adding entry point Hilt annotation
- Adding Repository provider in AppModule
- Creating a Generic data class for each api response

Presentation
- Creating the repository
- Creating ViewModel and its corresponding functions
- Implementing ViewModel in Navigation and Principal Screen
- Generic Card component
- New SVG Image for app Icon and PlaceHolder
- Building up the Principal screen
- Setting up the Navigation flow in order to pass the book name as argument to Description Screen
- Creating an Interface for local and remote repository
Copy link

@em4n0101 em4n0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hola Samuel!

Quisiera felicitarte porque me parece muy bueno tu primer entregable! implementaste features que no eran requisitos para este entregable como inyeccion de dependencias y Compose, lo cual hizo tu código mucho mas legible. Te deje algunos comentarios que podrian hacer tu código un poco mas limpio como extraer valores constantes al archivo de dimens y en la parte de compose podrias pasar solo los datos que vas a mostrar por medio del constructor en lugar de todo el viewModel, asi la logica queda mejor encapsulada y tu composable solo se encarga de la parte visual. Tambien la pantalla de detalles la podrias mejorar ya que solo se muestra la respuesta de los servicios en forma de texto.

Sigue asi, por los avances que me has mostrado del siguiente entregable estoy seguro que sera igual de bueno.
Saludos!!

Comment on lines +56 to +64
.padding(16.dp),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically
) {
GlideImage(
modifier = Modifier
.padding(16.dp)
.clip(shape = CircleShape)
.size(40.dp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trata de separar estos valores constantes en un archivo de dimens.

Comment on lines +6 to +30
interface GenericCardInterface {
val glideModel: GlideModel
val background: Color
val title: String?
val subtitle: String?
val helper: String?
}

data class GenericCardPresentation(
override val glideModel: GlideModel,
override val background: Color,
override val title: String?,
override val subtitle: String? = null,
override val helper: String? = null,
val onClick: () -> Unit = {}
) : GenericCardInterface

data class GenericCardDescription(
val border: Color? = null,
override val glideModel: GlideModel,
override val background: Color,
override val title: String,
override val subtitle: String?,
override val helper: String?
) : GenericCardInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy buena forma de extraer la lógica en una interfaz principal!

Comment on lines +114 to +116
.padding(16.dp)
.clip(shape = RoundedCornerShape(size = 14.dp))
.size(100.dp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Igual que el anterior, pasa estos valores a un archivo de dimens

) {
items(elements) { element ->
GenericCard(genericCardInterface = element)
Spacer(modifier = Modifier.height(16.dp))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Igual que el anterior, pasa estos valores a un archivo de dimens

package com.example.baz_android_capstone.data.models.ticker

data class RollingAverageChange(
val `6`: String

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seria mejor cambiar el nombre de la variable a una mas legible, puedes usar la notación @SerializedName para esto

Comment on lines +15 to +31
@Module
@InstallIn(SingletonComponent::class)
object AppModule {
@Singleton
@Provides
fun provideBookRepository(api: BookAPI) : BookRepositoryInterface = BookRepository(api)

@Singleton
@Provides
fun provideBookApi(): BookAPI {
return Retrofit.Builder()
.baseUrl(Constants.AVAILABLE_BOOK_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(BookAPI::class.java)
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy buena forma de usar inyección de dependencias, aun cuando no era requerimiento para este entregable lo implementaste correctamente!

Comment on lines +26 to +32
slideInHorizontally(
initialOffsetX = { 500 },
animationSpec = tween(1300)
) +
fadeIn(
initialAlpha = 0.0f,
animationSpec = tween(1300)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Igual pasar estos valores constantes a un archivo dimens

@Composable
fun Principal(
navController: NavController,
viewModel: BookViewModel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Podrías optimizar esta parte pasando al constructor solo los datos que se van a usar en el composable en lugar de pasar el viewModel, de esa forma tu código en compose solo se encargar de la vista y la lógica la dejas aparte

}
Box(contentAlignment = Alignment.Center) {
Text(
text = "Aquí va un\nSplash Screen",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me parece que esto solo es de forma temporal, de otro forma pasa estos al archivo de strings

Comment on lines +39 to +47
GenericCardPresentation(
background = Color.LightGray,
title = it.book,
glideModel = GlideModel(
url = "https://cryptoicons.org/api/icon/${it.book.substring(startIndex = 0, endIndex = it.book.length - 4)}/200",
isRoundedShape = true,
contentScale = ContentScale.Crop
)
) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si estas usando las imágenes de esta api seria bueno que checaras el caso en que no se encuentre imagen de la moneda ya que al correr la app son varios los casos en que esto pasa y solo se ve la imagen genérica

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants