-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
app/src/main/java/io/github/sustainow/presentation/ui/ExpectedCarbonFootprintScreen.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/io/github/sustainow/presentation/ui/ExpectedCarbonFootprintScreen.kt
Outdated
Show resolved
Hide resolved
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) | ||
} |
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.
Setar estado de loading para true dentro de viewModelScope.launch e definir como falso no bloco finally, erro havia passado despercebido
ExpectedCarbonFootprintScreen(navController, formularyViewModel) | ||
} |
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.
Melhor passar o callback que vai ser executado do que usar o navController diretamente
feat: ExpectedCarbonFootprintScreen.kt