Skip to content

Commit

Permalink
Merge pull request #58 from PetJournal/refactor/birthPetScreen
Browse files Browse the repository at this point in the history
Refatoração da tela Birth Date Pet Screen
  • Loading branch information
gusoliveira21 authored May 5, 2024
2 parents f12f0e0 + 32965cb commit b04834b
Show file tree
Hide file tree
Showing 153 changed files with 3,958 additions and 911 deletions.
27 changes: 22 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@

petJournal/.idea/misc.xml
petJournal/.idea/misc.xml
petJournal/.idea/compiler.xml
petJournal/.idea/.name
petJournal/.idea/compiler.xml
petJournal/.idea/discord.xml
petJournal/.idea/gradle.xml
petJournal/.idea/inspectionProfiles/Project_Default.xml
petJournal/.idea/misc.xml
petJournal/.idea/vcs.xml
petJournal/.idea/misc.xml
petJournal/.idea/gradle.xml
.idea/modules/app/PetJournal.app.iml
.idea/modules.xml
.idea/petjournal.android.iml
.idea/vcs.xml
.idea/workspace.xml
/.idea
.husky/pre-commit
node_modules/.bin/husky
node_modules/.package-lock.json
node_modules/husky/bin.mjs
node_modules/husky/husky
node_modules/husky/index.d.mts
node_modules/husky/index.mjs
node_modules/husky/LICENSE
node_modules/husky/package.json
node_modules/husky/README.md
package-lock.json
package.json
.DS_Store
.husky/.DS_Store
.husky/commit-msg
.husky/pre-push
7 changes: 0 additions & 7 deletions .idea/.gitignore

This file was deleted.

51 changes: 51 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions petJournal/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@
local.properties
petJournal/.idea/misc.xml
petJournal/.idea/compiler.xml
petJournal/.idea/misc.xml
petJournal/.idea/misc.xml
petJournal/.idea/compiler.xml
petJournal/.idea/.name
petJournal/.idea/compiler.xml
petJournal/.idea/discord.xml
petJournal/.idea/gradle.xml
petJournal/.idea/inspectionProfiles/Project_Default.xml
petJournal/.idea/misc.xml
petJournal/.idea/vcs.xml
12 changes: 2 additions & 10 deletions petJournal/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,12 @@ plugins {
android {
namespace 'com.soujunior.petjournal'
compileSdk 34
testOptions {
unitTests {
includeAndroidResources = true
}
}
testOptions {
unitTests.returnDefaultValues = true
}
defaultConfig {
applicationId "com.soujunior.petjournal"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
versionCode 6
versionName "1.0.6"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
package com.soujunior.petjournal.nameGenderScreen

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.assertIsEnabled
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextInput
import androidx.compose.ui.test.printToLog
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.soujunior.petjournal.ui.appArea.pets.petNameAndGenderScreen.components.GenderSelector
import com.soujunior.petjournal.ui.screens_app.screens_pets.petNameAndGenderScreen.components.GenderSelector
import com.soujunior.petjournal.ui.components.Button3
import com.soujunior.petjournal.ui.components.DashedInputText
import org.junit.Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.navigation.compose.rememberNavController
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.accompanist.pager.ExperimentalPagerApi
import com.soujunior.petjournal.navigation.NavHostMock
import com.soujunior.petjournal.navigation.navHostMock
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
Expand All @@ -23,22 +23,22 @@ class NavHostMainContentInstrumentedTest {
fun navigateFrom_Home_to_accountManager(){
composeTestRule.setContent {
navController = rememberNavController()
NavHostMock(navController = navController, startDestination = "home")
navHostMock(navController = navController, startDestination = "home")
}

composeTestRule.runOnUiThread {
navController.navigate("accountManager")
navController.navigate("account_manager")
}

assertEquals(navController.currentDestination?.route, "accountManager")
assertEquals(navController.currentDestination?.route, "account_manager")

}

@Test
fun navigateFrom_accountManager_to_tutorScreen(){
composeTestRule.setContent {
navController = rememberNavController()
NavHostMock(navController = navController, startDestination = "accountManager")
navHostMock(navController = navController, startDestination = "account_manager")
}

composeTestRule.runOnUiThread {
Expand All @@ -53,7 +53,7 @@ class NavHostMainContentInstrumentedTest {
fun navigateFrom_tutorScreen_to_introRegisterPet(){
composeTestRule.setContent {
navController = rememberNavController()
NavHostMock(navController = navController, startDestination = "tutorScreen")
navHostMock(navController = navController, startDestination = "tutorScreen")
}

composeTestRule.runOnUiThread {
Expand All @@ -68,7 +68,7 @@ class NavHostMainContentInstrumentedTest {
fun navigateFrom_introRegisterPet_to_speciesChoice(){
composeTestRule.setContent {
navController = rememberNavController()
NavHostMock(navController = navController, startDestination = "pets/introRegisterPet")
navHostMock(navController = navController, startDestination = "pets/introRegisterPet")
}

composeTestRule.runOnUiThread {
Expand All @@ -82,7 +82,7 @@ class NavHostMainContentInstrumentedTest {
fun navigateFrom_speciesChoice_to_nameGenderScreen(){
composeTestRule.setContent {
navController = rememberNavController()
NavHostMock(navController = navController, startDestination = "pets/speciesChoice")
navHostMock(navController = navController, startDestination = "pets/speciesChoice")
}

composeTestRule.runOnUiThread {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,24 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.google.accompanist.pager.ExperimentalPagerApi
import com.soujunior.petjournal.ui.appArea.home.homeScreen.HomeScreen
import com.soujunior.petjournal.ui.appArea.pets.introRegisterPetScreen.RegisterPetScreen
import com.soujunior.petjournal.ui.appArea.pets.petNameAndGenderScreen.PetNameAndGenderScreen
import com.soujunior.petjournal.ui.appArea.pets.petRaceAndSizeScreen.PetRaceAndSizeScreen
import com.soujunior.petjournal.ui.appArea.pets.speciesChoiceScreen.SpeciesChoiceScreen
import com.soujunior.petjournal.ui.appArea.tutor.tutorScreen.TutorScreen
import com.soujunior.petjournal.ui.navigation.AccountManager
import com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen.HomeScreen
import com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.RegisterPetScreen
import com.soujunior.petjournal.ui.screens_app.screens_pets.petNameAndGenderScreen.PetNameAndGenderScreen
import com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.PetRaceAndSizeScreen
import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.SpeciesChoiceScreen
import com.soujunior.petjournal.ui.screens_app.screen_tutor.tutorScreen.TutorScreen

@OptIn(ExperimentalPagerApi::class)
@Composable
fun NavHostMock(navController: NavHostController, startDestination: String) {
fun navHostMock(navController: NavHostController, startDestination: String) {
NavHost(navController = navController, startDestination = startDestination) {
composable("home") { HomeScreen(navController) }
composable("accountManager") { AccountManager() }
composable("account_manager") { AccountManager() }
composable("tutorScreen") { TutorScreen(navController) }

composable("pets/introRegisterPet") { RegisterPetScreen(navController) }
composable("pets/speciesChoice") { SpeciesChoiceScreen(navController) }
composable("pets/nameAndGender/{arg}"){
backStackEntry ->
PetNameAndGenderScreen(
backStackEntry.arguments?.getString("arg"),
navController)
}
composable("pets/RaceAndSize/{arg}"){
navBackStackEntry ->
PetRaceAndSizeScreen(
petName = navBackStackEntry.arguments?.getString("arg"),
navController = navController)
}
composable("pets/nameAndGender/{arg}") { backStackEntry -> PetNameAndGenderScreen(backStackEntry.arguments?.getString("arg"), navController) }
composable("pets/RaceAndSize/{arg}") { navBackStackEntry -> PetRaceAndSizeScreen( idPetInformation = navBackStackEntry.arguments?.getString("arg"), navController = navController ) }
}
}
2 changes: 1 addition & 1 deletion petJournal/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:theme="@style/Theme.PetJournal"
tools:targetApi="31">
<activity
android:name=".ui.navigation.MainActivity"
android:name=".navigation.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.PetJournal">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.soujunior.petjournal.di

import androidx.lifecycle.SavedStateHandle
import androidx.room.Room
import com.petjournal.database.database.db.AppDatabase
import com.petjournal.database.repository.AppInfoDataBaseImpl
Expand Down Expand Up @@ -28,26 +29,32 @@ import com.soujunior.domain.use_case.auth.SignUpUseCase
import com.soujunior.domain.use_case.guardian.GetGuardianNameUseCase
import com.soujunior.domain.use_case.guardian.GetPetRegistrationWentLive
import com.soujunior.domain.use_case.guardian.SetPetRegistrationWentLive
import com.soujunior.domain.use_case.pet.GetPetInformationUseCase
import com.soujunior.domain.use_case.pet.SavePetInformationUseCase
import com.soujunior.domain.use_case.pet.UpdatePetInformationUseCase
import com.soujunior.domain.use_case.util.ValidationRepositoryImpl
import com.soujunior.petjournal.ui.accountManager.awaitingCodeScreen.AwaitingCodeViewModel
import com.soujunior.petjournal.ui.accountManager.awaitingCodeScreen.AwaitingCodeViewModelImpl
import com.soujunior.petjournal.ui.accountManager.changePasswordScreen.ChangePasswordViewModel
import com.soujunior.petjournal.ui.accountManager.changePasswordScreen.ChangePasswordViewModelImpl
import com.soujunior.petjournal.ui.accountManager.forgotPasswordScreen.ForgotPasswordViewModel
import com.soujunior.petjournal.ui.accountManager.forgotPasswordScreen.ForgotPasswordViewModelImpl
import com.soujunior.petjournal.ui.accountManager.loginScreen.LoginViewModel
import com.soujunior.petjournal.ui.accountManager.loginScreen.LoginViewModelImpl
import com.soujunior.petjournal.ui.accountManager.registerScreen.RegisterViewModel
import com.soujunior.petjournal.ui.accountManager.registerScreen.RegisterViewModelImpl
import com.soujunior.petjournal.ui.appArea.home.homeScreen.HomeScreenViewModel
import com.soujunior.petjournal.ui.appArea.home.homeScreen.HomeScreenViewModelImpl
import com.soujunior.petjournal.ui.appArea.pets.introRegisterPetScreen.IntroIntroRegisterPetViewModelImpl
import com.soujunior.petjournal.ui.appArea.pets.introRegisterPetScreen.IntroRegisterPetViewModel
import com.soujunior.petjournal.ui.appArea.pets.petNameAndGenderScreen.ViewModelNameGender
import com.soujunior.petjournal.ui.appArea.pets.petNameAndGenderScreen.ViewModelNameGenderImpl
import com.soujunior.petjournal.ui.appArea.pets.speciesChoiceScreen.ViewModelChoiceSpecies
import com.soujunior.petjournal.ui.appArea.pets.speciesChoiceScreen.ViewModelChoiceSpeciesImpl
import com.soujunior.petjournal.ui.apresentation.splashScreen.SplashViewModel
import com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen.HomeScreenViewModel
import com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen.HomeScreenViewModelImpl
import com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.IntroRegisterPetViewModel
import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateViewModel
import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateViewModelImpl
import com.soujunior.petjournal.ui.screens_app.screens_pets.petNameAndGenderScreen.ViewModelNameGender
import com.soujunior.petjournal.ui.screens_app.screens_pets.petNameAndGenderScreen.ViewModelNameGenderImpl
import com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.ViewModelRaceSize
import com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.ViewModelRaceSizeImpl
import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.ViewModelChoiceSpecies
import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.ViewModelChoiceSpeciesImpl
import com.soujunior.petjournal.ui.screens_app.screens_apresentation.splashScreen.SplashViewModel
import com.soujunior.petjournal.ui.screens_app.account_manager.awaitingCodeScreen.AwaitingCodeViewModel
import com.soujunior.petjournal.ui.screens_app.account_manager.awaitingCodeScreen.AwaitingCodeViewModelImpl
import com.soujunior.petjournal.ui.screens_app.account_manager.changePasswordScreen.ChangePasswordViewModel
import com.soujunior.petjournal.ui.screens_app.account_manager.changePasswordScreen.ChangePasswordViewModelImpl
import com.soujunior.petjournal.ui.screens_app.account_manager.forgotPasswordScreen.ForgotPasswordViewModel
import com.soujunior.petjournal.ui.screens_app.account_manager.forgotPasswordScreen.ForgotPasswordViewModelImpl
import com.soujunior.petjournal.ui.screens_app.account_manager.loginScreen.LoginViewModel
import com.soujunior.petjournal.ui.screens_app.account_manager.loginScreen.LoginViewModelImpl
import com.soujunior.petjournal.ui.screens_app.account_manager.registerScreen.RegisterViewModel
import com.soujunior.petjournal.ui.screens_app.account_manager.registerScreen.RegisterViewModelImpl
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import org.koin.android.ext.koin.androidContext
Expand Down Expand Up @@ -90,6 +97,10 @@ val mainModule = module {
factory { AppInfoDataBaseImpl(get()) }
factory { GetPetRegistrationWentLive(get()) }
factory { SetPetRegistrationWentLive(get()) }
factory { SavePetInformationUseCase(get()) }
factory { GetPetInformationUseCase(get()) }
factory { UpdatePetInformationUseCase(get()) }
factory { SavedStateHandle() }

single<AuthService> { get<Retrofit>().create(AuthService::class.java) }
single<GuardianService> { get<Retrofit>().create(GuardianService::class.java) }
Expand All @@ -104,21 +115,41 @@ val mainModule = module {
// Retrofit Service
single {
Retrofit.Builder()
.baseUrl("https://petjournal-api.onrender.com/")
.baseUrl("https://petjournal-api-z9gs.onrender.com/")
.addConverterFactory(MoshiConverterFactory.create(get()))
.addCallAdapterFactory(NetworkResultCallAdapterFactory.create())
.build()
}

// viewModel { (handle: SavedStateHandle) -> CleanerTaskViewModel(savedStateHandle = handle) }

// ViewModels
viewModel<HomeScreenViewModel> { HomeScreenViewModelImpl(get(), get()) }
viewModel<IntroRegisterPetViewModel> { IntroIntroRegisterPetViewModelImpl(get(), get(), get()) }
viewModel<IntroRegisterPetViewModel> {
com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.IntroIntroRegisterPetViewModelImpl(
get(),
get(),
get()
)
}
viewModel<LoginViewModel> { LoginViewModelImpl(get(), get(), get(), get()) }
viewModel<RegisterViewModel> { RegisterViewModelImpl(get(), get()) }
viewModel<AwaitingCodeViewModel> { AwaitingCodeViewModelImpl(get(), get(), get()) }
viewModel<ForgotPasswordViewModel> { ForgotPasswordViewModelImpl(get(), get()) }
viewModel<ChangePasswordViewModel> { ChangePasswordViewModelImpl(get(), get()) }
viewModel { SplashViewModel(get()) }
viewModel<ViewModelChoiceSpecies> { ViewModelChoiceSpeciesImpl(get(), get()) }
viewModel<ViewModelNameGender> {ViewModelNameGenderImpl(get())}
}
viewModel<ViewModelChoiceSpecies> { ViewModelChoiceSpeciesImpl(get(), get(), get()) }

//viewModel<ViewModelNameGender> { (handle: SavedStateHandle) -> ViewModelNameGenderImpl(get(), get(), get(), handle) }
viewModel<ViewModelNameGender> {// (handle: SavedStateHandle) ->
ViewModelNameGenderImpl(
validation = get(),
getPetInformationUseCase = get(),
updatePetInformationUseCase = get(),
//savedStateHandle = get()
)
}

viewModel<BirthDateViewModel> { BirthDateViewModelImpl(get(), get(), get()) }
viewModel<ViewModelRaceSize> { ViewModelRaceSizeImpl(get(), get(), get()) }
}
Loading

0 comments on commit b04834b

Please sign in to comment.