-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove uistate cast in component VM.
- Loading branch information
1 parent
b898a96
commit f50730e
Showing
26 changed files
with
434 additions
and
452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
...otlin/org/gdglille/devfest/android/theme/m3/partners/feature/PartnerDetailOrientableVM.kt
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...src/main/kotlin/org/gdglille/devfest/android/theme/m3/partners/feature/PartnerDetailVM.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.gdglille.devfest.android.theme.m3.partners.feature | ||
|
||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.collectAsState | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import org.gdglille.devfest.android.theme.m3.partners.screens.PartnerDetailOrientable | ||
import org.gdglille.devfest.android.theme.m3.style.R | ||
import org.koin.androidx.compose.koinViewModel | ||
import org.koin.core.parameter.parametersOf | ||
|
||
@Composable | ||
fun PartnerDetailVM( | ||
partnerId: String, | ||
onLinkClicked: (url: String) -> Unit, | ||
onItineraryClicked: (lat: Double, lng: Double) -> Unit, | ||
onBackClicked: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
viewModel: PartnerDetailViewModel = koinViewModel(parameters = { parametersOf(partnerId) }) | ||
) { | ||
when (val uiState = viewModel.uiState.collectAsState().value) { | ||
is PartnerUiState.Loading -> PartnerDetailOrientable( | ||
partnerItemUi = uiState.partner, | ||
onLinkClicked = {}, | ||
onItineraryClicked = { _, _ -> }, | ||
onBackClicked = onBackClicked, | ||
modifier = modifier, | ||
isLoading = true | ||
) | ||
|
||
is PartnerUiState.Failure -> Text(text = stringResource(id = R.string.text_error)) | ||
is PartnerUiState.Success -> PartnerDetailOrientable( | ||
partnerItemUi = uiState.partner, | ||
onLinkClicked = onLinkClicked, | ||
onItineraryClicked = onItineraryClicked, | ||
onBackClicked = onBackClicked, | ||
modifier = modifier | ||
) | ||
} | ||
} |
Oops, something went wrong.