From 593cba830612f769fdf22d7fb4abd0581d177ee5 Mon Sep 17 00:00:00 2001 From: Gustavo Oliveira <42920754+gusoliveira21@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:56:00 -0300 Subject: [PATCH 01/12] feat: preview on screen intro register pet --- .../IntroRegisterPetViewModel.kt | 17 +++++++ .../components/Screen.kt | 46 +++++++++++++++---- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/IntroRegisterPetViewModel.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/IntroRegisterPetViewModel.kt index 845e2a91..53c0d9ef 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/IntroRegisterPetViewModel.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/IntroRegisterPetViewModel.kt @@ -7,6 +7,23 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.receiveAsFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.emptyFlow + +class FakeIntroRegisterPetViewModel : IntroRegisterPetViewModel() { + override val name = MutableStateFlow("Nome de Teste") + override val visualizedScreen = MutableStateFlow(false) + override val message = MutableStateFlow("Mensagem de Teste") + override val validationEventChannel = Channel() + override val validationEvents = emptyFlow() + override val taskState = MutableStateFlow(TaskState.Idle) + + override fun success() { /* No-op */ } + override fun failed(exception: Throwable?) { /* No-op */ } + override fun setWasViewed() { /* No-op */ } + override fun getName() { /* No-op */ } + override fun getWasViewed() { /* No-op */ } +} abstract class IntroRegisterPetViewModel : ViewModel() { abstract val name: StateFlow diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt index 83d0ab34..b0d00e81 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt @@ -17,33 +17,54 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment.Companion.CenterHorizontally import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController +import androidx.navigation.NavHostController +import androidx.navigation.compose.rememberNavController import com.soujunior.petjournal.R import com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.IntroRegisterPetViewModel import com.soujunior.petjournal.ui.components.Button2 import com.soujunior.petjournal.ui.components.IndeterminateCircularIndicator import com.soujunior.petjournal.ui.components.NavigationBar import com.soujunior.petjournal.ui.components.ScaffoldCustom +import com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.FakeIntroRegisterPetViewModel import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.theme.PetJournalTheme import com.soujunior.petjournal.ui.util.ValidationEvent +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow import org.koin.androidx.compose.getViewModel +@Composable +fun getIntroRegisterPetViewModelForPreview(): IntroRegisterPetViewModel { + return if (LocalInspectionMode.current) { + FakeIntroRegisterPetViewModel() + } else { + getViewModel() + } +} + @Composable fun Screen(navController: NavController) { - val viewModel: IntroRegisterPetViewModel = getViewModel() + val viewModel: IntroRegisterPetViewModel = getIntroRegisterPetViewModelForPreview() val context = LocalContext.current val name by viewModel.name.collectAsState() val taskState by viewModel.taskState.collectAsState() - LaunchedEffect(key1 = context) { - viewModel.validationEvents.collect { event -> - when (event) { - is ValidationEvent.Success -> { - navController.popBackStack() - navController.navigate("pets/speciesChoice") + if(!LocalInspectionMode.current){ + LaunchedEffect(key1 = context) { + viewModel.validationEvents.collect { event -> + when (event) { + is ValidationEvent.Success -> { + navController.popBackStack() + navController.navigate("pets/speciesChoice") + } + + is ValidationEvent.Failed -> {} } - is ValidationEvent.Failed -> {} } } } @@ -84,4 +105,13 @@ fun Screen(navController: NavController) { }) }) } +} + +@Preview(showBackground = true) +@Composable +fun IntroRegister(){ + val nav = rememberNavController() + PetJournalTheme { + Screen(nav) + } } \ No newline at end of file From 3e4e748ebf0dca2b5fbadde3487ccf7b2b445899 Mon Sep 17 00:00:00 2001 From: Gustavo Oliveira <42920754+gusoliveira21@users.noreply.github.com> Date: Fri, 13 Sep 2024 18:39:04 -0300 Subject: [PATCH 02/12] feat: change bottom bar color --- .../petjournal/ui/components/NavigationBar.kt | 6 +++--- petJournal/buildSrc/build/libs/buildSrc.jar | Bin 261 -> 261 bytes 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/components/NavigationBar.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/components/NavigationBar.kt index 64bd19f5..07955dad 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/components/NavigationBar.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/components/NavigationBar.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.material.BottomNavigation import androidx.compose.material.BottomNavigationItem import androidx.compose.material.Icon +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier @@ -24,9 +25,8 @@ fun NavigationBar(navController: NavController) { ) BottomNavigation( - modifier = Modifier - .fillMaxWidth(), - backgroundColor = if (darkTheme) Color(0xFFFF4081) else Color(0xFFB90063) + modifier = Modifier.fillMaxWidth(), + backgroundColor = if (darkTheme) Color(0xFFFF4081) else MaterialTheme.colorScheme.primary ) { val navBackStackEntry by navController.currentBackStackEntryAsState() val currentRoute = navBackStackEntry?.destination?.route diff --git a/petJournal/buildSrc/build/libs/buildSrc.jar b/petJournal/buildSrc/build/libs/buildSrc.jar index 0b22f24c5c6bf1b3e5103b75c2524cf96437f22d..6f1bd8552fb52030ae9f6b627e7bdcd16b1e4a65 100644 GIT binary patch delta 42 qcmZo=YGvXL@MdNaVPN3kV91Tooye=kEDog1e3(JJRueF9k0$`H5DC5j delta 42 scmZo=YGvXL@MdNaVPN3kU{GyipUA7m9MQx+(aeV##A`JH^Y(ZG0IZS;$N&HU From cea8b3d6bc8e539cef779e24ef3633e23879494a Mon Sep 17 00:00:00 2001 From: Gustavo Oliveira <42920754+gusoliveira21@users.noreply.github.com> Date: Sat, 14 Sep 2024 15:01:57 -0300 Subject: [PATCH 03/12] Update README.md --- README.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 16ff66cb..0f0ffdc7 100644 --- a/README.md +++ b/README.md @@ -116,19 +116,9 @@ Nossa abordagem de teste ajuda a manter a qualidade e estabilidade do software, - **Perguntas, dúvidas ou problemas**: Sinta-se a vontade para abrir uma essue [Clicando aqui](https://github.com/PetJournal/petjournal.android/issues) ## Contribuições - - gus - - gus - - luc - - vin - - vit - - gel - + + +[![NotyKT Contributors](https://contrib.rocks/image?repo=PetJournal/petjournal.android)](https://github.com/PetJournal/petjournal.android/graphs/contributors) ## Licença From b3ddc5f6df458ad5a58dc2b853a5fe515249589a Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 09:24:40 -0400 Subject: [PATCH 04/12] feat: add preview login screen --- .../loginScreen/LoginScreen.kt | 2 +- .../loginScreen/LoginViewModel.kt | 38 +++++++++++++++++-- .../loginScreen/components/Screen.kt | 28 ++++++++++++-- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginScreen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginScreen.kt index 89673419..51c92f6d 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginScreen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginScreen.kt @@ -33,5 +33,5 @@ fun LoginScreen(navController: NavController) { } } } - Screen(navController, viewModel) + Screen(navController) } \ No newline at end of file diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginViewModel.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginViewModel.kt index feb2b9f1..6f3e36e1 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginViewModel.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/LoginViewModel.kt @@ -1,12 +1,42 @@ package com.soujunior.petjournal.ui.screens_app.account_manager.loginScreen import androidx.lifecycle.ViewModel +import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.util.ValidationEvent import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.receiveAsFlow -import com.soujunior.petjournal.ui.util.ValidationEvent -import com.soujunior.petjournal.ui.states.TaskState +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.emptyFlow +import kotlinx.coroutines.flow.receiveAsFlow + +class FakeLoginViewModel : LoginViewModel() { + override val message = MutableStateFlow("Mensagem de Teste") + override var state: LoginFormState + get() = LoginFormState() + set(value) {} + override val validationEventChannel = Channel() + override val validationEvents = emptyFlow() + override val taskState = MutableStateFlow(TaskState.Idle) + override fun passwordRemember() { + } + + override fun success(resultPostLogin: String) { + } + + override fun failed(exception: Throwable?) { /* No-op */ + } + + override fun submitData() { + } + + override fun enableButton(): Boolean { + return true + } + + override fun onEvent(event: LoginFormEvent) { + } +} abstract class LoginViewModel : ViewModel() { abstract var state: LoginFormState @@ -14,7 +44,7 @@ abstract class LoginViewModel : ViewModel() { open val validationEvents: Flow get() = validationEventChannel.receiveAsFlow() - abstract val message : StateFlow + abstract val message: StateFlow abstract val taskState: StateFlow diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/components/Screen.kt index 57c104f9..0f65e856 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/account_manager/loginScreen/components/Screen.kt @@ -15,20 +15,34 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.soujunior.petjournal.R import com.soujunior.petjournal.ui.components.DashedInputText +import com.soujunior.petjournal.ui.screens_app.account_manager.loginScreen.FakeLoginViewModel import com.soujunior.petjournal.ui.screens_app.account_manager.loginScreen.LoginFormEvent import com.soujunior.petjournal.ui.screens_app.account_manager.loginScreen.LoginViewModel +import com.soujunior.petjournal.ui.theme.PetJournalTheme import ir.kaaveh.sdpcompose.sdp +import org.koin.androidx.compose.getViewModel @Composable -fun Screen(navController: NavController, viewModel: LoginViewModel) { - +fun getLoginViewModelForPreview(): LoginViewModel { + return if (LocalInspectionMode.current) { + FakeLoginViewModel() + } else { + getViewModel() + } +} +@Composable +fun Screen(navController: NavController, /*viewModel: LoginViewModel*/) { + val viewModel = getLoginViewModelForPreview() val systemUiController = rememberSystemUiController() systemUiController.setSystemBarsColor( @@ -99,7 +113,7 @@ fun Screen(navController: NavController, viewModel: LoginViewModel) { } item { - Spacer(modifier = Modifier.padding(top = 75.sdp)) + Spacer(modifier = Modifier.padding(top = 45.sdp)) } item { @@ -111,3 +125,11 @@ fun Screen(navController: NavController, viewModel: LoginViewModel) { } } } +@Preview(showBackground = true) +@Composable +fun LoginRegisterPreview(){ + val nav = rememberNavController() + PetJournalTheme { + Screen(nav) + } +} From 83cc0ddb73122c682b1fdebfe4dae433f01bb19d Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 09:33:17 -0400 Subject: [PATCH 05/12] feat: add preview Specie Choice screen --- .../ViewModelChoiceSpecies.kt | 29 ++++++++++++++++++ .../speciesChoiceScreen/components/Screen.kt | 30 +++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/ViewModelChoiceSpecies.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/ViewModelChoiceSpecies.kt index 286af524..a26bf85b 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/ViewModelChoiceSpecies.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/ViewModelChoiceSpecies.kt @@ -6,15 +6,43 @@ import com.soujunior.petjournal.ui.states.TaskState import com.soujunior.petjournal.ui.util.ValidationEvent import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.receiveAsFlow +class FakeChoiceSpeciesViewModel : ViewModelChoiceSpecies() { + override var state: PetFormState + get() = PetFormState() + set(value) {} + override val validationEventChannel = Channel() + override val validationEvents = emptyFlow() + override fun success(name: GuardianNameResponse) {} + + override val taskState = MutableStateFlow(TaskState.Idle) + + override fun failed(exception: Throwable?) { /* No-op */ + } + + override fun onEvent(event: PetFormEvent) {} + + + override fun enableButton(): Boolean = true + + + override fun change(specieSelected: String?, specieWritten: String?) {} + + override fun savePetInformation(specie: String) {} + +} + abstract class ViewModelChoiceSpecies : ViewModel() { abstract var state: PetFormState abstract val validationEventChannel: Channel abstract val taskState: StateFlow open val validationEvents: Flow get() = validationEventChannel.receiveAsFlow() + abstract fun success(name: GuardianNameResponse) abstract fun failed(exception: Throwable?) abstract fun onEvent(event: PetFormEvent) @@ -23,5 +51,6 @@ abstract class ViewModelChoiceSpecies : ViewModel() { specieSelected: String? = null, specieWritten: String? = null ) + abstract fun savePetInformation(specie: String) } \ No newline at end of file diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/components/Screen.kt index fdbfd118..0cc8eaf3 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/speciesChoiceScreen/components/Screen.kt @@ -29,25 +29,39 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import com.soujunior.petjournal.R -import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.PetFormEvent -import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.ViewModelChoiceSpecies import com.soujunior.petjournal.ui.components.Button2 import com.soujunior.petjournal.ui.components.IndeterminateCircularIndicator import com.soujunior.petjournal.ui.components.InputSpecies import com.soujunior.petjournal.ui.components.NavigationBar import com.soujunior.petjournal.ui.components.ScaffoldCustom +import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.FakeChoiceSpeciesViewModel +import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.PetFormEvent +import com.soujunior.petjournal.ui.screens_app.screens_pets.speciesChoiceScreen.ViewModelChoiceSpecies import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.theme.PetJournalTheme import com.soujunior.petjournal.ui.util.ValidationEvent import org.koin.androidx.compose.getViewModel +@Composable +fun getSpecieChoiceViewModelForPreview(): ViewModelChoiceSpecies { + return if (LocalInspectionMode.current) { + FakeChoiceSpeciesViewModel() + } else { + getViewModel() + } +} + @SuppressLint("StateFlowValueCalledInComposition") @Composable fun Screen(navController: NavController) { - val viewModel: ViewModelChoiceSpecies = getViewModel() + val viewModel: ViewModelChoiceSpecies = getSpecieChoiceViewModelForPreview() val activateContinueButton = remember { mutableStateOf(false) } val taskState by viewModel.taskState.collectAsState() var isOthersFieldVisible by remember { mutableStateOf(false) } @@ -60,6 +74,7 @@ fun Screen(navController: NavController) { is ValidationEvent.Success -> { navController.navigate("pets/nameAndGender/${viewModel.state.idRoomPetInformation}") } + is ValidationEvent.Failed -> { Log.i(TAG, viewModel.state.idRoomPetInformation.toString()) } @@ -194,4 +209,13 @@ fun Screen(navController: NavController) { } ) } +} + +@Preview(showBackground = true) +@Composable +fun SpecieChoicePreview() { + val nav = rememberNavController() + PetJournalTheme { + Screen(nav) + } } \ No newline at end of file From 3aeab5e65e7ad5029c5b1d1f7e5802f2426c3e0d Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 09:38:55 -0400 Subject: [PATCH 06/12] feat: add preview Name And Gender Screen --- .../ViewModelNameGender.kt | 25 +++++++++++++++++++ .../components/Screen.kt | 25 ++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/ViewModelNameGender.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/ViewModelNameGender.kt index e3237c8c..b41dd391 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/ViewModelNameGender.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/ViewModelNameGender.kt @@ -5,9 +5,34 @@ import com.soujunior.petjournal.ui.states.TaskState import com.soujunior.petjournal.ui.util.ValidationEvent import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.receiveAsFlow +class FakeNameAndGenderViewModel : ViewModelNameGender() { + override var state: NameGenderFormState + get() = NameGenderFormState() + set(value) {} + override val validationEventChannel = Channel() + override val validationEvents = emptyFlow() + + override val taskState = MutableStateFlow(TaskState.Idle) + + override fun failed(exception: Throwable?) { /* No-op */ + } + + override fun onEvent(event: NameGenderFormEvent) {} + override fun enableButton(): Boolean = true + override fun change(petName: String?, petGender: String?, idPetInformation: Long?) {} + + override fun getPetInformation(id: Long) {} + override fun updatePetInformation() {} + + override fun successPetUpdate(unit: Unit) {} + +} + abstract class ViewModelNameGender : ViewModel() { abstract var state: NameGenderFormState abstract val validationEventChannel: Channel diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/components/Screen.kt index 9af56651..c9ba157c 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petNameAndGenderScreen/components/Screen.kt @@ -23,12 +23,15 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import com.soujunior.petjournal.R import com.soujunior.petjournal.ui.components.Breadcrumb import com.soujunior.petjournal.ui.components.Button3 @@ -36,9 +39,11 @@ import com.soujunior.petjournal.ui.components.DashedInputText import com.soujunior.petjournal.ui.components.IndeterminateCircularIndicator import com.soujunior.petjournal.ui.components.NavigationBar import com.soujunior.petjournal.ui.components.ScaffoldCustom +import com.soujunior.petjournal.ui.screens_app.screens_pets.petNameAndGenderScreen.FakeNameAndGenderViewModel import com.soujunior.petjournal.ui.screens_app.screens_pets.petNameAndGenderScreen.NameGenderFormEvent import com.soujunior.petjournal.ui.screens_app.screens_pets.petNameAndGenderScreen.ViewModelNameGender import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.theme.PetJournalTheme import com.soujunior.petjournal.ui.util.Constants.BIRD import com.soujunior.petjournal.ui.util.Constants.CAT import com.soujunior.petjournal.ui.util.Constants.DOG @@ -47,10 +52,19 @@ import com.soujunior.petjournal.ui.util.Constants.REPTILE import com.soujunior.petjournal.ui.util.Constants.RODENT import org.koin.androidx.compose.getViewModel +@Composable +fun getNameAndGenderViewModelForPreview(): ViewModelNameGender { + return if (LocalInspectionMode.current) { + FakeNameAndGenderViewModel() + } else { + getViewModel() + } +} + @SuppressLint("StateFlowValueCalledInComposition") @Composable fun Screen(idPetInformation: String?, navController: NavController) { - val viewModel: ViewModelNameGender = getViewModel() + val viewModel: ViewModelNameGender = getNameAndGenderViewModelForPreview() val taskState by viewModel.taskState.collectAsState() var isClearGender by remember { mutableStateOf(false) } if (idPetInformation != null) { @@ -186,4 +200,13 @@ fun Screen(idPetInformation: String?, navController: NavController) { } }) } +} + +@Preview(showBackground = true) +@Composable +fun NameAndGenderPreview() { + val nav = rememberNavController() + PetJournalTheme { + Screen("1", nav) + } } \ No newline at end of file From 53212d007370defd95088229301bc198cf265dfa Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 09:46:43 -0400 Subject: [PATCH 07/12] feat: add preview Name and Race screen --- .../petRaceAndSizeScreen/ViewModelRaceSize.kt | 42 +++++++++++++++++++ .../petRaceAndSizeScreen/components/Screen.kt | 26 +++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/ViewModelRaceSize.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/ViewModelRaceSize.kt index cb413c38..517cfb6c 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/ViewModelRaceSize.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/ViewModelRaceSize.kt @@ -10,8 +10,49 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.receiveAsFlow +class FakeRaceAndSizeViewModel : ViewModelRaceSize() { + override var state: RaceSizeFormState + get() = RaceSizeFormState() + set(value) {} + override val validationEventChannel = Channel() + override val message = MutableStateFlow("Mensagem de Teste") + override val validationEvents = emptyFlow() + override fun success(petInformationModel: PetInformationModel) {} + + override fun successGetPetSizes(listPetSizes: List) {} + + override fun successGetPetRaces(listPetRaces: List) {} + + override val taskState = MutableStateFlow(TaskState.Idle) + override val isTextFiledOthersVisible: StateFlow = MutableStateFlow(true) + + override fun failed(exception: Throwable?) { /* No-op */ + } + + override fun onEvent(event: RaceSizeFormEvent) {} + + override fun enableButton(): Boolean = true + override fun enableRaceOthers(): Boolean = false + + override fun enableRace(): Boolean = true + + override val shouldScrollToTop: MutableStateFlow = MutableStateFlow(false) + + override fun change(petRace: String?, petSize: String?, petRaceOthers: String?) {} + + override fun getPetInformation(id: Long) {} + override fun updatePetInformation() {} + + override fun successPetUpdate(unit: Unit) {} + override suspend fun requestGetListSizes() {} + + override suspend fun requestGetListRaces() {} + +} + abstract class ViewModelRaceSize : ViewModel() { abstract var state: RaceSizeFormState abstract val validationEventChannel: Channel @@ -35,6 +76,7 @@ abstract class ViewModelRaceSize : ViewModel() { petSize: String? = null, petRaceOthers: String? = null, ) + abstract fun getPetInformation(id: Long) abstract fun updatePetInformation() diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/components/Screen.kt index dfb6e680..c1f95e1c 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petRaceAndSizeScreen/components/Screen.kt @@ -1,7 +1,6 @@ package com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.components import android.annotation.SuppressLint -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.gestures.animateScrollBy @@ -28,10 +27,13 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import com.soujunior.petjournal.R import com.soujunior.petjournal.ui.components.AutoCompleteDropDown import com.soujunior.petjournal.ui.components.Breadcrumb @@ -41,16 +43,27 @@ import com.soujunior.petjournal.ui.components.DropDown import com.soujunior.petjournal.ui.components.IndeterminateCircularIndicator import com.soujunior.petjournal.ui.components.NavigationBar import com.soujunior.petjournal.ui.components.ScaffoldCustom +import com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.FakeRaceAndSizeViewModel import com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.RaceSizeFormEvent import com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.ViewModelRaceSize import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.theme.PetJournalTheme import com.soujunior.petjournal.ui.util.getScreenHeightInch import org.koin.androidx.compose.getViewModel +@Composable +fun getRaceAndSizeViewModelForPreview(): ViewModelRaceSize { + return if (LocalInspectionMode.current) { + FakeRaceAndSizeViewModel() + } else { + getViewModel() + } +} + @SuppressLint("StateFlowValueCalledInComposition") @Composable fun Screen(idPetInformation: String?, navController: NavController) { - val viewModel: ViewModelRaceSize = getViewModel() + val viewModel: ViewModelRaceSize = getRaceAndSizeViewModelForPreview() val taskState by viewModel.taskState.collectAsState() val isTextFiledOthersVisible by viewModel.isTextFiledOthersVisible.collectAsState() if (idPetInformation != null) { @@ -279,4 +292,13 @@ fun Screen(idPetInformation: String?, navController: NavController) { } +} + +@Preview(showBackground = true) +@Composable +fun NameAndGenderPreview() { + val nav = rememberNavController() + PetJournalTheme { + Screen("1", nav) + } } \ No newline at end of file From c68a0529b7456badf531aeacfa0c62152a416fa7 Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 11:13:58 -0400 Subject: [PATCH 08/12] feat: add preview birth date screen --- .../petBirthDateScreen/BirthDateViewModel.kt | 33 ++++++++++++++++++- .../petBirthDateScreen/components/Screen.kt | 28 +++++++++++++--- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/BirthDateViewModel.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/BirthDateViewModel.kt index d9761b57..76026435 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/BirthDateViewModel.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/BirthDateViewModel.kt @@ -6,10 +6,40 @@ import com.soujunior.petjournal.ui.states.TaskState import com.soujunior.petjournal.ui.util.ValidationEvent import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.receiveAsFlow -abstract class BirthDateViewModel : ViewModel(){ +class FakeBirthDateViewModel : BirthDateViewModel() { + override var state: BirthDateFormState + get() = BirthDateFormState() + set(value) {} + override val validationEventChannel = Channel() + override val message = MutableStateFlow("Mensagem de Teste") + override val validationEvents = emptyFlow() + override fun success(petInformationModel: PetInformationModel) {} + + + override val taskState = MutableStateFlow(TaskState.Idle) + + override fun failed(exception: Throwable?) { /* No-op */ } + + override fun onEvent(event: BirthDateFormEvent) {} + + + override fun enableButton(): Boolean = true + override fun change(petBirth: String?, idPetInformation: Long?, petCastration: Boolean?) {} + + override fun getPetInformation(id: Long) {} + override fun updatePetInformation() {} + override fun createPetInformation() {} + + override fun successPetUpdate(unit: Unit) {} + +} + +abstract class BirthDateViewModel : ViewModel() { abstract var state: BirthDateFormState abstract val validationEventChannel: Channel abstract val message: StateFlow @@ -26,6 +56,7 @@ abstract class BirthDateViewModel : ViewModel(){ idPetInformation: Long? = null, petCastration: Boolean? = null ) + abstract fun getPetInformation(id: Long) abstract fun updatePetInformation() abstract fun createPetInformation() diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/components/Screen.kt index dc45fb10..fb142446 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/petBirthDateScreen/components/Screen.kt @@ -1,9 +1,6 @@ package com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.components import android.annotation.SuppressLint -import android.content.ContentValues.TAG -import android.util.Log -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -26,9 +23,12 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import com.soujunior.petjournal.R import com.soujunior.petjournal.ui.components.Breadcrumb import com.soujunior.petjournal.ui.components.Button3 @@ -39,14 +39,25 @@ import com.soujunior.petjournal.ui.components.ScaffoldCustom import com.soujunior.petjournal.ui.components.mask.formatDate import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateFormEvent import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateViewModel +import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.FakeBirthDateViewModel import com.soujunior.petjournal.ui.screens_app.screens_pets.petRaceAndSizeScreen.RaceSizeFormEvent import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.theme.PetJournalTheme import org.koin.androidx.compose.getViewModel +@Composable +fun getBirthDateViewModelForPreview(): BirthDateViewModel { + return if (LocalInspectionMode.current) { + FakeBirthDateViewModel() + } else { + getViewModel() + } +} + @SuppressLint("StateFlowValueCalledInComposition") @Composable fun Screen(idPetInformation: String?, navController: NavController) { - val viewModel: BirthDateViewModel = getViewModel() + val viewModel: BirthDateViewModel = getBirthDateViewModelForPreview() val taskState by viewModel.taskState.collectAsState() var isClearCastration by remember { mutableStateOf(false) } if (idPetInformation != null) { @@ -177,4 +188,13 @@ fun Screen(idPetInformation: String?, navController: NavController) { }) } +} + +@Preview(showBackground = true) +@Composable +fun BirthDatePreview() { + val nav = rememberNavController() + PetJournalTheme { + Screen("1", nav) + } } \ No newline at end of file From b66dc2af0c785648123d29ac0170ac301d4066d4 Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 11:21:50 -0400 Subject: [PATCH 09/12] feat: add preview in home screen --- .../screen_home/homeScreen/HomeScreen.kt | 2 +- .../homeScreen/HomeScreenViewModel.kt | 27 ++++++++++++++++ .../homeScreen/components/Screen.kt | 32 +++++++++++++++++-- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreen.kt index bac29f60..daf31b27 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreen.kt @@ -9,5 +9,5 @@ import org.koin.androidx.compose.getViewModel @ExperimentalPagerApi @Composable fun HomeScreen(navController: NavController) { - Screen(navController, getViewModel()) + Screen(navController) } diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt index a4737586..22f1649c 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt @@ -2,15 +2,42 @@ package com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen import androidx.lifecycle.ViewModel +import com.soujunior.domain.model.PetInformationModel import com.soujunior.domain.model.response.GuardianNameResponse import com.soujunior.petjournal.R +import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateFormEvent +import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateFormState +import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateViewModel import com.soujunior.petjournal.ui.util.ValidationEvent import com.soujunior.petjournal.ui.states.TaskState import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.receiveAsFlow +class FakeHomeViewModel : HomeScreenViewModel() { + override var state: HomeState + get() = HomeState() + set(value) {} + override val validationEventChannel = Channel() + override val message = MutableStateFlow("Mensagem de Teste") + override fun success(name: GuardianNameResponse) {} + override fun getData() {} + + override fun logout() {} + + override val validationEvents = emptyFlow() + override val name: StateFlow = MutableStateFlow(GuardianNameResponse("Jorge", "")) + + + override val taskState = MutableStateFlow(TaskState.Idle) + + override fun failed(exception: Throwable?) { /* No-op */ } + + +} abstract class HomeScreenViewModel : ViewModel() { abstract val taskState: StateFlow abstract var state: HomeState diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/components/Screen.kt index e94f3de9..88087835 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/components/Screen.kt @@ -27,24 +27,40 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import com.google.accompanist.pager.ExperimentalPagerApi import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.soujunior.petjournal.R -import com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen.HomeScreenViewModel import com.soujunior.petjournal.ui.components.NavigationBar import com.soujunior.petjournal.ui.components.ScaffoldCustom +import com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen.FakeHomeViewModel +import com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen.HomeScreenViewModel import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.theme.PetJournalTheme import com.soujunior.petjournal.ui.util.ValidationEvent import com.soujunior.petjournal.ui.util.capitalizeFirstLetter +import org.koin.androidx.compose.getViewModel + +@Composable +fun getHomeViewModelForPreview(): HomeScreenViewModel { + return if (LocalInspectionMode.current) { + FakeHomeViewModel() + } else { + getViewModel() + } +} @ExperimentalPagerApi @Composable -fun Screen(navController: NavController, viewModel: HomeScreenViewModel) { +fun Screen(navController: NavController) { + val viewModel: HomeScreenViewModel = getHomeViewModelForPreview() val showDropdownMenu = remember { mutableStateOf(false) } val taskState by viewModel.taskState.collectAsState() val name = remember { mutableStateOf(viewModel.name.value.firstName) } @@ -64,7 +80,7 @@ fun Screen(navController: NavController, viewModel: HomeScreenViewModel) { } val systemUiController = rememberSystemUiController() - systemUiController.setSystemBarsColor( color = Color.Transparent, darkIcons = true ) + systemUiController.setSystemBarsColor(color = Color.Transparent, darkIcons = true) systemUiController.setNavigationBarColor(Color.Black) Column(modifier = Modifier.navigationBarsPadding()) { ScaffoldCustom( @@ -155,4 +171,14 @@ fun Screen(navController: NavController, viewModel: HomeScreenViewModel) { } }) } +} + +@OptIn(ExperimentalPagerApi::class) +@Preview(showBackground = true) +@Composable +fun HomeScreenPreview() { + val nav = rememberNavController() + PetJournalTheme { + Screen(nav) + } } \ No newline at end of file From 9e4aca8d294bcf07832d4daa886fe539570e26d0 Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 11:22:35 -0400 Subject: [PATCH 10/12] refactor: remove imports --- .../homeScreen/HomeScreenViewModel.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt index 22f1649c..0e3fc25c 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screen_home/homeScreen/HomeScreenViewModel.kt @@ -2,20 +2,17 @@ package com.soujunior.petjournal.ui.screens_app.screen_home.homeScreen import androidx.lifecycle.ViewModel -import com.soujunior.domain.model.PetInformationModel import com.soujunior.domain.model.response.GuardianNameResponse import com.soujunior.petjournal.R -import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateFormEvent -import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateFormState -import com.soujunior.petjournal.ui.screens_app.screens_pets.petBirthDateScreen.BirthDateViewModel -import com.soujunior.petjournal.ui.util.ValidationEvent import com.soujunior.petjournal.ui.states.TaskState +import com.soujunior.petjournal.ui.util.ValidationEvent import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.receiveAsFlow + class FakeHomeViewModel : HomeScreenViewModel() { override var state: HomeState get() = HomeState() @@ -29,15 +26,18 @@ class FakeHomeViewModel : HomeScreenViewModel() { override fun logout() {} override val validationEvents = emptyFlow() - override val name: StateFlow = MutableStateFlow(GuardianNameResponse("Jorge", "")) + override val name: StateFlow = + MutableStateFlow(GuardianNameResponse("Jorge", "")) override val taskState = MutableStateFlow(TaskState.Idle) - override fun failed(exception: Throwable?) { /* No-op */ } + override fun failed(exception: Throwable?) { /* No-op */ + } } + abstract class HomeScreenViewModel : ViewModel() { abstract val taskState: StateFlow abstract var state: HomeState @@ -45,8 +45,8 @@ abstract class HomeScreenViewModel : ViewModel() { open val validationEvents: Flow get() = validationEventChannel.receiveAsFlow() - abstract val name : StateFlow - abstract val message : StateFlow + abstract val name: StateFlow + abstract val message: StateFlow abstract fun success(name: GuardianNameResponse) abstract fun getData() abstract fun logout() From 0747c0de6f0df08c2972f9cacc55097f17d11a70 Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Mon, 16 Sep 2024 11:25:59 -0400 Subject: [PATCH 11/12] refactor: remove imports unsed --- .../introRegisterPetScreen/components/Screen.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt index b0d00e81..5ed93c4e 100644 --- a/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt +++ b/petJournal/app/src/main/java/com/soujunior/petjournal/ui/screens_app/screens_pets/introRegisterPetScreen/components/Screen.kt @@ -21,21 +21,17 @@ import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController -import androidx.navigation.NavHostController import androidx.navigation.compose.rememberNavController import com.soujunior.petjournal.R -import com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.IntroRegisterPetViewModel import com.soujunior.petjournal.ui.components.Button2 import com.soujunior.petjournal.ui.components.IndeterminateCircularIndicator import com.soujunior.petjournal.ui.components.NavigationBar import com.soujunior.petjournal.ui.components.ScaffoldCustom import com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.FakeIntroRegisterPetViewModel +import com.soujunior.petjournal.ui.screens_app.screens_pets.introRegisterPetScreen.IntroRegisterPetViewModel import com.soujunior.petjournal.ui.states.TaskState import com.soujunior.petjournal.ui.theme.PetJournalTheme import com.soujunior.petjournal.ui.util.ValidationEvent -import kotlinx.coroutines.channels.Channel -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow import org.koin.androidx.compose.getViewModel @Composable From 34021da6b085f2bece6df71b806735801c7a8a84 Mon Sep 17 00:00:00 2001 From: Antonio Jorge Garcia Tranin Date: Sat, 21 Sep 2024 11:50:41 -0400 Subject: [PATCH 12/12] refactor: remove buildSrc --- petJournal/buildSrc/build.gradle.kts | 8 -------- .../buildSrc/build/kotlin/buildSrcjar-classes.txt | 0 petJournal/buildSrc/build/libs/buildSrc.jar | Bin 261 -> 0 bytes petJournal/buildSrc/build/tmp/jar/MANIFEST.MF | 2 -- 4 files changed, 10 deletions(-) delete mode 100644 petJournal/buildSrc/build.gradle.kts delete mode 100644 petJournal/buildSrc/build/kotlin/buildSrcjar-classes.txt delete mode 100644 petJournal/buildSrc/build/libs/buildSrc.jar delete mode 100644 petJournal/buildSrc/build/tmp/jar/MANIFEST.MF diff --git a/petJournal/buildSrc/build.gradle.kts b/petJournal/buildSrc/build.gradle.kts deleted file mode 100644 index 8f869550..00000000 --- a/petJournal/buildSrc/build.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -plugins{ - `kotlin-dsl` -} - -repositories { - mavenCentral() - google() -} \ No newline at end of file diff --git a/petJournal/buildSrc/build/kotlin/buildSrcjar-classes.txt b/petJournal/buildSrc/build/kotlin/buildSrcjar-classes.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/petJournal/buildSrc/build/libs/buildSrc.jar b/petJournal/buildSrc/build/libs/buildSrc.jar deleted file mode 100644 index 6f1bd8552fb52030ae9f6b627e7bdcd16b1e4a65..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 261 zcmWIWW@Zs#VBp|j$c@mAWB>vt5CH_7K6 z1GOU*`a1e~y1532==r*R_C0gj$6HtLBCofu*10q1HwPJ9F@Es$(NiX%VT?>7%((3Z vng|2}3~wDlG~5-)+OW9-q!