Skip to content

Commit

Permalink
Merge pull request #49 from Taewan-P/feat/skip-platform-selection
Browse files Browse the repository at this point in the history
Navigate to new chat directly if only one platform is enabled
  • Loading branch information
Taewan-P authored Oct 6, 2024
2 parents 3fd53dc + c7aef0e commit 64984ce
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 64984ce

Please sign in to comment.