add get chat rooms

This commit is contained in:
2026-05-04 12:08:14 +07:00
parent e02338fd52
commit 109fe28d48
6 changed files with 259 additions and 41 deletions

View File

@@ -30,10 +30,13 @@ import su.reya.coop.screens.OnboardingScreen
@Composable
fun App(dbPath: String) {
val context = LocalContext.current
// Initialize Nostr and SecretStore
val nostr = remember { Nostr() }
val secretStore = remember { SecretStore(context) }
val viewModel: NostrViewModel = viewModel { NostrViewModel(nostr, secretStore) }
// Dynamic color scheme
val darkMode = isSystemInDarkTheme()
val colorScheme = when {
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S -> {
@@ -46,6 +49,7 @@ fun App(dbPath: String) {
LaunchedEffect(Unit) {
viewModel.initAndConnect(dbPath)
viewModel.getChatRooms()
}
MaterialExpressiveTheme(
@@ -60,7 +64,8 @@ fun App(dbPath: String) {
if (hasSecret == true) {
// Start a background notification handler
viewModel.startNotificationHandler()
// Get chat rooms
viewModel.getChatRooms()
// Navigate to the home screen
navController.navigate(Screen.Home) {
popUpTo(Screen.Onboarding) { inclusive = true }

View File

@@ -38,7 +38,10 @@ fun HomeScreen(onOpenChat: (String) -> Unit) {
searchBarState = searchState,
onSearch = { scope.launch { searchState.animateToCollapsed() } },
placeholder = {
Text(modifier = Modifier.clearAndSetSemantics() {}, text = "Search")
Text(
modifier = Modifier.clearAndSetSemantics() {},
text = "Find or start a conversation"
)
},
)
}