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

Feat/estimate carbon footprint #44

Merged
merged 7 commits into from
Dec 15, 2024

Conversation

Francisco-Paulino-Arruda-Filho
Copy link
Collaborator

feat: ExpectedCarbonFootprintScreen.kt

@Francisco-Paulino-Arruda-Filho Francisco-Paulino-Arruda-Filho marked this pull request as ready for review December 15, 2024 20:32
Comment on lines 53 to 69
try {
_formulary.value = repository.getFormulary(area, type)
_currentQuestion.value = formulary.value?.questions?.get(0)
} catch (e: Exception) {
Log.e("HomeViewModel", e.message ?: "")
_error.value = formulary.value?.let { DataError(source = it, operation = DataOperation.GET) }
}
}
}

fun retryFormularyFetch() {
viewModelScope.launch {
try {
_formulary.value = repository.getFormulary(area, type)
} catch (e: Exception) {
_error.value = DataError(source = formulary, operation = DataOperation.GET)
}
fun retryFormularyFetch() {
viewModelScope.launch {
try {
_formulary.value = repository.getFormulary(area, type)
} catch (e: Exception) {
_error.value = DataError(source = formulary, operation = DataOperation.GET)
}

Choose a reason for hiding this comment

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

Setar estado de loading para true dentro de viewModelScope.launch e definir como falso no bloco finally, erro havia passado despercebido

Comment on lines +336 to +337
ExpectedCarbonFootprintScreen(navController, formularyViewModel)
}

Choose a reason for hiding this comment

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

Melhor passar o callback que vai ser executado do que usar o navController diretamente

@Joao-Pedro-P-Holanda Joao-Pedro-P-Holanda merged commit bf1a79d into main Dec 15, 2024
@Joao-Pedro-P-Holanda Joao-Pedro-P-Holanda deleted the freat/estimateCarbonFootprint branch December 15, 2024 22:44
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