-
Notifications
You must be signed in to change notification settings - Fork 3
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
load images by category #288
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # testomania/src/main/java/com/earth/testomania/home_screen/presentation/HomeScreenViewModel.kt
@@ -23,6 +23,7 @@ android { | |||
vectorDrawables { | |||
useSupportLibrary = true | |||
} | |||
buildConfigField("String", "UNSPLASH_ACCESS_KEY", "\"G81G0y0nGVostWCSStr1yTiB6tWUsIWi-ZQYja9td5I\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be visible in the request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it will
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
import retrofit2.http.Headers | ||
import retrofit2.http.Query | ||
|
||
interface UnsplashApi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import javax.inject.Inject | ||
|
||
|
||
class UnsplashRepo @Inject constructor(private val api: UnsplashApi) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create interface as we do for clean architecture
} | ||
|
||
private fun getIllustration(categoryName: String) = viewModelScope.launch { | ||
val catPrefix = "Entertainment: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need. If you pull my changes, I am removing this "Entertainment: "
string in convertation prosses
@@ -49,6 +64,7 @@ abstract class DestinationViewModel( | |||
when (it) { | |||
is DataState.Success -> it.payload?.apply { | |||
_data.addAll(this) | |||
getIllustration(this.first().quiz.category) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need iteration and we need to get image for every quiz
) : DestinationViewModel( | ||
useCase, | ||
dispatcher | ||
dispatcher, | ||
unsplashRepo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since unsplashRepo
is the same for every destination (category) can't we inject it directly into DestinationViewModel
instead of sending it as a parameter and duplicating it numerous times?
I am not sure that we can, but maybe you know some solutions guys.
What do you think?
@kdiakonidze @shalva97 @Vazhapp
# Conflicts: # testomania/src/main/java/com/earth/testomania/apis/opentdb/data/source/OpenTdbQuizApi.kt # testomania/src/main/java/com/earth/testomania/apis/opentdb/data/source/remote/dto/OpenTdbQuizDTO.kt # testomania/src/main/java/com/earth/testomania/apis/opentdb/data/source/remote/dto/ResultDto.kt # testomania/src/main/java/com/earth/testomania/apis/opentdb/di/openTDBModule.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/opentdb/data/source/OpenTdbQuizApi.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/opentdb/data/source/remote/dto/OpenTdbQuizDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/opentdb/data/source/remote/dto/ResultDto.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/data/repository/QuizRepositoryImpl.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/data/source/QuizApi.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/data/source/remote/dto/AnswersDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/data/source/remote/dto/CorrectAnswersDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/data/source/remote/dto/TagDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/data/source/remote/dto/TechQuizDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/di/QuizApiModule.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/domain/model/AnswerKey.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/domain/model/QuizApiCategory.kt # testomania/src/main/java/com/earth/testomania/apis/quiz/quizapi/domain/model/TechCategory.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/data/repository/QuizRepositoryImpl.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/data/source/QuizApi.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/data/source/remote/dto/AnswersDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/data/source/remote/dto/CorrectAnswersDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/data/source/remote/dto/TagDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/data/source/remote/dto/TechQuizDTO.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/di/QuizApiModule.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/domain/model/AnswerKey.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/domain/model/QuizApiCategory.kt # testomania/src/main/java/com/earth/testomania/apis/quizapi/domain/model/TechCategory.kt # testomania/src/main/java/com/earth/testomania/home_screen/presentation/HomeScreen.kt # testomania/src/main/java/com/earth/testomania/home_screen/presentation/HomeScreenViewModel.kt # testomania/src/main/java/com/earth/testomania/opentdb/OpenTdbQuizApi.kt # testomania/src/main/java/com/earth/testomania/opentdb/models/OpenTdbQuizDTO.kt # testomania/src/main/java/com/earth/testomania/opentdb/models/ResultDto.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/AnimalsDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/ArtDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/BoardGamesDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/BookDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/CelebritiesDestina.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/ComicsDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/DestinationViewModel.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/DevOpsDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/DockerDestination .kt # testomania/src/main/java/com/earth/testomania/quiz_categories/GadgetsDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/GeographyDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/HTMLDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/HistoryDestinatio.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/InformationalTechnologiesDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/LinuxDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/MathDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/MoviesDestination .kt # testomania/src/main/java/com/earth/testomania/quiz_categories/MusicDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/MySqlDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/MythDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/NatureDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/PHPDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/PoliticsDestinatio.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/ProgramingDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/SQLDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/SportsDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/TVDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/VehiclesDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/VideoGamesDestination.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/usecase/GetQuizUseCase.kt # testomania/src/main/java/com/earth/testomania/quiz_categories/viewmodel/DestinationViewModel.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/CategoryIllustration.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ErrorScreen.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/LoadingScreen.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/MainQuizScreen.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/QuizAnswerUI.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/QuizExplanationUI.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/QuizOverallProgressUI.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/QuizUI.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ui_components/CategoryIllustration.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ui_components/ErrorScreen.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ui_components/LoadingScreen.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ui_components/QuizAnswerUI.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ui_components/QuizExplanationUI.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ui_components/QuizOverallProgressUI.kt # testomania/src/main/java/com/earth/testomania/quiz_screen/ui_components/QuizUI.kt # testomania/src/main/java/com/earth/testomania/technical/data/repository/QuizRepositoryImpl.kt # testomania/src/main/java/com/earth/testomania/technical/data/source/remote/QuizApi.kt # testomania/src/main/java/com/earth/testomania/technical/data/source/remote/dto/AnswersDTO.kt # testomania/src/main/java/com/earth/testomania/technical/data/source/remote/dto/CorrectAnswersDTO.kt # testomania/src/main/java/com/earth/testomania/technical/data/source/remote/dto/TagDTO.kt # testomania/src/main/java/com/earth/testomania/technical/data/source/remote/dto/TechQuizDTO.kt # testomania/src/main/java/com/earth/testomania/technical/di/TechnicalTestsModule.kt # testomania/src/main/java/com/earth/testomania/technical/domain/model/AnswerKey.kt # testomania/src/main/java/com/earth/testomania/technical/domain/model/QuizCategory.kt # testomania/src/main/java/com/earth/testomania/technical/domain/model/TechCategory.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/QuizViewModel.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/ui_parts/CategoryIllustration.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/ui_parts/ErrorScreen.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/ui_parts/LoadingScreen.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/ui_parts/QuizAnswerUI.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/ui_parts/QuizExplanationUI.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/ui_parts/QuizOverallProgressUI.kt # testomania/src/main/java/com/earth/testomania/technical/presentation/ui_parts/QuizUI.kt # testomania/src/main/res/values/strings.xml
added unsplash Api for searching images associated to category