Skip to content

Commit

Permalink
Navigate to new chat directly if only one platform is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Taewan-P committed Oct 6, 2024
1 parent 3fd53dc commit c7aef0e
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,17 @@ fun HomeScreen(
}
)
},
floatingActionButton = { NewChatButton(expanded = listState.isScrollingUp(), onClick = homeViewModel::openSelectModelDialog) }
floatingActionButton = {
NewChatButton(expanded = listState.isScrollingUp(), onClick = {
val enabledApiTypes = platformState.filter { it.enabled }.map { it.name }
if (enabledApiTypes.size == 1) {
// Navigate to new chat directly if only one platform is enabled
navigateToNewChat(enabledApiTypes)
} else {
homeViewModel.openSelectModelDialog()
}
})
}
) { innerPadding ->
LazyColumn(
modifier = Modifier.padding(innerPadding),
Expand Down

0 comments on commit c7aef0e

Please sign in to comment.