From 205cfab5ad6726f7b755f6888576cdeb3da70539 Mon Sep 17 00:00:00 2001 From: Jonas Heubuch Date: Sun, 14 Apr 2024 11:38:44 +0200 Subject: [PATCH] :recycle: Move user mention search to CheckIn (#354) fixes #351 --- .../de/hbch/traewelling/navigation/NavHost.kt | 9 +- .../shared/BottomSearchViewModel.kt | 38 +--- .../de/hbch/traewelling/ui/checkIn/CheckIn.kt | 73 +++++++- .../traewelling/ui/dashboard/Dashboard.kt | 5 +- .../include/cardSearchStation/CardSearch.kt | 5 +- .../hbch/traewelling/ui/main/MainActivity.kt | 177 ++++++------------ .../de/hbch/traewelling/ui/search/Search.kt | 3 - .../ui/searchConnection/SearchConnection.kt | 5 +- 8 files changed, 130 insertions(+), 185 deletions(-) diff --git a/app/src/main/kotlin/de/hbch/traewelling/navigation/NavHost.kt b/app/src/main/kotlin/de/hbch/traewelling/navigation/NavHost.kt index 596b2621..2817b97a 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/navigation/NavHost.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/navigation/NavHost.kt @@ -21,7 +21,6 @@ import androidx.navigation.compose.composable import com.jcloquell.androidsecurestorage.SecureStorage import de.hbch.traewelling.R import de.hbch.traewelling.api.models.status.Status -import de.hbch.traewelling.shared.BottomSearchViewModel import de.hbch.traewelling.shared.CheckInViewModel import de.hbch.traewelling.shared.EventViewModel import de.hbch.traewelling.shared.LoggedInUserViewModel @@ -57,7 +56,6 @@ fun TraewelldroidNavHost( eventViewModel: EventViewModel, checkInViewModel: CheckInViewModel, notificationsViewModel: NotificationsViewModel, - bottomSearchViewModel: BottomSearchViewModel, snackbarHostState: SnackbarHostState, modifier: Modifier = Modifier, onFloatingActionButtonChange: (Int, Int, () -> Unit) -> Unit = { _, _, _ -> }, @@ -137,7 +135,6 @@ fun TraewelldroidNavHost( Dashboard( loggedInUserViewModel = loggedInUserViewModel, - bottomSearchViewModel = bottomSearchViewModel, searchConnectionsAction = navToSearchConnections, statusSelectedAction = navToStatusDetails, userSelectedAction = navToUserProfile, @@ -391,8 +388,7 @@ fun TraewelldroidNavHost( ) shortcutManager.requestPinShortcut(shortcut, successCallback.intentSender) } - }, - bottomSearchViewModel = bottomSearchViewModel + } ) onResetFloatingActionButton() } @@ -487,8 +483,7 @@ fun TraewelldroidNavHost( ) { launchSingleTop = true } - }, - bottomSearchViewModel = bottomSearchViewModel + } ) onResetFloatingActionButton() } diff --git a/app/src/main/kotlin/de/hbch/traewelling/shared/BottomSearchViewModel.kt b/app/src/main/kotlin/de/hbch/traewelling/shared/BottomSearchViewModel.kt index 1d7e0320..459b9e74 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/shared/BottomSearchViewModel.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/shared/BottomSearchViewModel.kt @@ -1,37 +1,15 @@ package de.hbch.traewelling.shared -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import de.hbch.traewelling.api.TraewellingApi import de.hbch.traewelling.api.models.user.User class BottomSearchViewModel : ViewModel() { - private var _clickHandler: ((String) -> Unit)? = null - - private val _userResults = MutableLiveData?>(null) - val userResults: LiveData?> get() = _userResults - - private val _displayResults = MutableLiveData(false) - val displayResults: LiveData get() = _displayResults - - suspend fun searchUsers(query: String) { - _displayResults.postValue(true) - val data = try { TraewellingApi.userService.searchUsers(query).data } catch (_: Exception) { listOf() } - _userResults.postValue(data) - } - - fun reset() { - _displayResults.postValue(false) - _userResults.postValue(null) - _clickHandler = null - } - - fun registerClickHandler(handler: (String) -> Unit) { - _clickHandler = handler - } - - fun onClick(selection: String) { - _clickHandler?.invoke(selection) - } -} \ No newline at end of file + suspend fun searchUsers(query: String): List { + return try { + TraewellingApi.userService.searchUsers(query).data + } catch (_: Exception) { + listOf() + } + } +} diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt index 970f81a2..c0dee4ba 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt @@ -2,15 +2,18 @@ package de.hbch.traewelling.ui.checkIn import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.clickable +import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.AssistChip import androidx.compose.material3.Card import androidx.compose.material3.ElevatedCard import androidx.compose.material3.ExperimentalMaterial3Api @@ -21,6 +24,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope @@ -37,11 +41,13 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import androidx.lifecycle.viewmodel.compose.viewModel import com.jcloquell.androidsecurestorage.SecureStorage import de.hbch.traewelling.R import de.hbch.traewelling.api.models.event.Event import de.hbch.traewelling.api.models.status.StatusBusiness import de.hbch.traewelling.api.models.status.StatusVisibility +import de.hbch.traewelling.api.models.user.User import de.hbch.traewelling.shared.BottomSearchViewModel import de.hbch.traewelling.shared.CheckInViewModel import de.hbch.traewelling.shared.EventViewModel @@ -53,6 +59,7 @@ import de.hbch.traewelling.ui.composables.ButtonWithIconAndText import de.hbch.traewelling.ui.composables.DateTimeSelection import de.hbch.traewelling.ui.composables.Dialog import de.hbch.traewelling.ui.composables.OutlinedButtonWithIconAndText +import de.hbch.traewelling.ui.composables.ProfilePicture import de.hbch.traewelling.ui.composables.SwitchWithIconAndText import de.hbch.traewelling.ui.selectDestination.FromToTextRow import de.hbch.traewelling.util.checkAnyUsernames @@ -67,7 +74,6 @@ fun CheckIn( modifier: Modifier = Modifier, checkInViewModel: CheckInViewModel, eventViewModel: EventViewModel, - bottomSearchViewModel: BottomSearchViewModel, checkInAction: (Boolean, Boolean) -> Unit = { _, _ -> }, initText: String = "", isEditMode: Boolean = false, @@ -75,6 +81,7 @@ fun CheckIn( ) { val secureStorage = SecureStorage(LocalContext.current) val coroutineScope = rememberCoroutineScope() + val bottomSearchViewModel: BottomSearchViewModel = viewModel() var enableTrwlCheckIn by rememberSaveable { mutableStateOf(secureStorage.getObject(SharedValues.SS_TRWL_AUTO_LOGIN, Boolean::class.java) ?: true) } val travelynxConfigured = secureStorage.getObject(SharedValues.SS_TRAVELYNX_TOKEN, String::class.java)?.isNotBlank() ?: false @@ -89,20 +96,22 @@ fun CheckIn( val matches = statusText.text.checkAnyUsernames() matches.firstOrNull { it.range.contains(statusText.selection.min - 1) || it.range.contains(statusText.selection.max + 1) }?.value?.replace("@", "") } } + val userResults = remember { mutableStateListOf() } + var usersQuerying by remember { mutableStateOf(false) } + var displayUserResults by remember { mutableStateOf(false) } userSearchQuery.useDebounce( onChange = { query -> if (query == null) { - bottomSearchViewModel.reset() + usersQuerying = false + displayUserResults = false } else { - bottomSearchViewModel.registerClickHandler { selection -> - val firstMatch = statusText.text.checkAnyUsernames().first { it.range.contains(statusText.selection.min - 1) || it.range.contains(statusText.selection.max + 1) } - statusText = statusText.copy( - text = statusText.text.replaceRange(firstMatch.range.first, firstMatch.range.last + 1, selection), - selection = TextRange(firstMatch.range.first + selection.length) - ) - } + usersQuerying = true + displayUserResults = true coroutineScope.launch { - bottomSearchViewModel.searchUsers(query) + val users = bottomSearchViewModel.searchUsers(query) + usersQuerying = false + userResults.clear() + userResults.addAll(users) } } }, @@ -216,6 +225,50 @@ fun CheckIn( text = "${statusText.text.count()}/280", style = AppTypography.labelSmall ) + AnimatedVisibility(displayUserResults) { + Row( + modifier = Modifier + .fillMaxWidth() + .horizontalScroll(rememberScrollState()), + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + if (usersQuerying) { + Text( + text = stringResource(id = R.string.data_loading) + ) + } else { + if (userResults.isEmpty()) { + Text( + text = stringResource(id = R.string.no_results_found) + ) + } else { + userResults.forEach { + val username = "@${it.username}" + AssistChip( + onClick = { + val firstMatch = statusText.text.checkAnyUsernames().first { it.range.contains(statusText.selection.min - 1) || it.range.contains(statusText.selection.max + 1) } + statusText = statusText.copy( + text = statusText.text.replaceRange(firstMatch.range.first, firstMatch.range.last + 1, "@${it.username} "), + selection = TextRange(firstMatch.range.first + it.username.length + 2) + ) + }, + label = { + Text( + text = username + ) + }, + leadingIcon = { + ProfilePicture( + user = it, + modifier = Modifier.size(24.dp) + ) + } + ) + } + } + } + } + } } if (travelynxConfigured && !isEditMode) { diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/dashboard/Dashboard.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/dashboard/Dashboard.kt index b4a662dc..afcd7d61 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/dashboard/Dashboard.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/dashboard/Dashboard.kt @@ -20,7 +20,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import de.hbch.traewelling.api.models.status.Status -import de.hbch.traewelling.shared.BottomSearchViewModel import de.hbch.traewelling.shared.LoggedInUserViewModel import de.hbch.traewelling.ui.composables.NotificationsAvailableHint import de.hbch.traewelling.ui.include.cardSearchStation.CardSearch @@ -33,7 +32,6 @@ import java.time.ZonedDateTime @Composable fun Dashboard( loggedInUserViewModel: LoggedInUserViewModel, - bottomSearchViewModel: BottomSearchViewModel, searchConnectionsAction: (String, ZonedDateTime?) -> Unit = { _, _ -> }, userSelectedAction: (String) -> Unit = { }, statusSelectedAction: (Int) -> Unit = { }, @@ -86,8 +84,7 @@ fun Dashboard( recentStationsData = loggedInUserViewModel.lastVisitedStations, onUserSelected = { userSelectedAction(it.username) - }, - bottomSearchViewModel = bottomSearchViewModel + } ) } if (!knowsAboutNotifications) { diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/include/cardSearchStation/CardSearch.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/include/cardSearchStation/CardSearch.kt index 9cacabb8..903bd7e0 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/include/cardSearchStation/CardSearch.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/include/cardSearchStation/CardSearch.kt @@ -13,7 +13,6 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.LiveData import de.hbch.traewelling.api.models.station.Station import de.hbch.traewelling.api.models.user.User -import de.hbch.traewelling.shared.BottomSearchViewModel import de.hbch.traewelling.theme.AppTypography import de.hbch.traewelling.ui.search.Search import de.hbch.traewelling.util.getGreeting @@ -23,7 +22,6 @@ fun CardSearch( modifier: Modifier = Modifier, homelandStationData: LiveData, recentStationsData: LiveData?>, - bottomSearchViewModel: BottomSearchViewModel, onStationSelected: (String) -> Unit = { }, onUserSelected: (User) -> Unit = { }, queryStations: Boolean = true, @@ -50,8 +48,7 @@ fun CardSearch( onUserSelected = onUserSelected, queryStations = queryStations, queryUsers = queryUsers, - modifier = Modifier.fillMaxWidth(), - bottomSearchViewModel = bottomSearchViewModel + modifier = Modifier.fillMaxWidth() ) } } diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/main/MainActivity.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/main/MainActivity.kt index f872d22d..f88a0c7b 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/main/MainActivity.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/main/MainActivity.kt @@ -4,33 +4,21 @@ import android.content.Intent import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge import androidx.activity.viewModels import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.slideInVertically import androidx.compose.animation.slideOutVertically -import androidx.compose.foundation.horizontalScroll -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.asPaddingValues -import androidx.compose.foundation.layout.exclude import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.ime -import androidx.compose.foundation.layout.isImeVisible import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.systemBars -import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack -import androidx.compose.material3.AssistChip import androidx.compose.material3.Badge import androidx.compose.material3.BadgedBox -import androidx.compose.material3.BottomAppBar import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem @@ -55,7 +43,6 @@ import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.input.nestedscroll.nestedScroll @@ -83,7 +70,6 @@ import de.hbch.traewelling.navigation.Notifications import de.hbch.traewelling.navigation.PersonalProfile import de.hbch.traewelling.navigation.SCREENS import de.hbch.traewelling.navigation.TraewelldroidNavHost -import de.hbch.traewelling.shared.BottomSearchViewModel import de.hbch.traewelling.shared.CheckInViewModel import de.hbch.traewelling.shared.EventViewModel import de.hbch.traewelling.shared.FeatureFlags @@ -91,7 +77,6 @@ import de.hbch.traewelling.shared.LoggedInUserViewModel import de.hbch.traewelling.shared.SharedValues import de.hbch.traewelling.theme.LocalColorScheme import de.hbch.traewelling.theme.MainTheme -import de.hbch.traewelling.ui.composables.ProfilePicture import de.hbch.traewelling.ui.notifications.NotificationsViewModel import de.hbch.traewelling.util.popBackStackAndNavigate import de.hbch.traewelling.util.publishStationShortcuts @@ -109,7 +94,6 @@ class MainActivity : ComponentActivity() private val loggedInUserViewModel: LoggedInUserViewModel by viewModels() private val eventViewModel: EventViewModel by viewModels() private val checkInViewModel: CheckInViewModel by viewModels() - private val bottomSearchViewModel: BottomSearchViewModel by viewModels() private var newIntentReceived: ((Intent?) -> Unit)? = null private lateinit var secureStorage: SecureStorage @@ -133,13 +117,13 @@ class MainActivity : ComponentActivity() } override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) secureStorage = SecureStorage(this) emojiPackItemAdapter = EmojiPackItemAdapter.get(this) TraewellingApi.jwt = secureStorage.getObject(SharedValues.SS_JWT, String::class.java)!! SharedValues.TRAVELYNX_TOKEN = secureStorage.getObject(SharedValues.SS_TRAVELYNX_TOKEN, String::class.java) ?: "" eventViewModel.activeEvents() + enableEdgeToEdge() WindowCompat.setDecorFitsSystemWindows(window, false) setContent { @@ -153,10 +137,10 @@ class MainActivity : ComponentActivity() navController = navController, loggedInUserViewModel = loggedInUserViewModel, eventViewModel = eventViewModel, - checkInViewModel = checkInViewModel, - bottomSearchViewModel = bottomSearchViewModel + checkInViewModel = checkInViewModel ) } + super.onCreate(savedInstanceState) } override fun onNewIntent(intent: Intent?) { @@ -189,8 +173,7 @@ fun TraewelldroidApp( navController: NavHostController, loggedInUserViewModel: LoggedInUserViewModel, eventViewModel: EventViewModel, - checkInViewModel: CheckInViewModel, - bottomSearchViewModel: BottomSearchViewModel + checkInViewModel: CheckInViewModel ) { MainTheme { val context = LocalContext.current @@ -319,111 +302,60 @@ fun TraewelldroidApp( ) }, bottomBar = { - val displayBottomSearchBar by bottomSearchViewModel.displayResults.observeAsState(false) - Column { - AnimatedVisibility( - visible = displayBottomSearchBar && WindowInsets.isImeVisible, - enter = slideInVertically(initialOffsetY = { it }), - exit = slideOutVertically(targetOffsetY = { it }) - ) { - val userResultState by bottomSearchViewModel.userResults.observeAsState(null) - val userResults = userResultState - BottomAppBar( - modifier = Modifier.padding(bottom = if (WindowInsets.isImeVisible) WindowInsets.ime.exclude(WindowInsets.systemBars).asPaddingValues().calculateBottomPadding() else 0.dp) - ) { - Row( - modifier = Modifier - .horizontalScroll(rememberScrollState()) - .padding(horizontal = 8.dp), - horizontalArrangement = Arrangement.spacedBy(4.dp), - verticalAlignment = Alignment.CenterVertically - ) { - if (userResults == null) { - Text( - text = stringResource(id = R.string.data_loading) - ) - } else { - if (userResults.isEmpty()) { - Text( - text = stringResource(id = R.string.no_results_found) - ) - } - userResults.forEach { - val username = "@${it.username}" - AssistChip( - onClick = { bottomSearchViewModel.onClick(username) }, - label = { - Text( - text = username - ) - }, - leadingIcon = { - ProfilePicture( - user = it, - modifier = Modifier.size(24.dp) - ) - } - ) - } - } - } - } - } - AnimatedVisibility( - visible = navController.previousBackStackEntry == null, - enter = slideInVertically(initialOffsetY = { it }), - exit = slideOutVertically(targetOffsetY = { it }) - ) { - NavigationBar { - BOTTOM_NAVIGATION.forEach { destination -> - NavigationBarItem( - icon = { - BadgedBox( - badge = { - if (destination == Notifications && unreadNotificationCount > 0) { - Badge { - Text( - text = unreadNotificationCount.toString() - ) - } + AnimatedVisibility( + visible = navController.previousBackStackEntry == null, + enter = slideInVertically(initialOffsetY = { it }), + exit = slideOutVertically(targetOffsetY = { it }) + ) { + NavigationBar { + BOTTOM_NAVIGATION.forEach { destination -> + NavigationBarItem( + icon = { + BadgedBox( + badge = { + if (destination == Notifications && unreadNotificationCount > 0) { + Badge { + Text( + text = unreadNotificationCount.toString() + ) } } + } + ) { + val user = loggedInUser + if ( + destination == PersonalProfile && + user != null ) { - val user = loggedInUser - if ( - destination == PersonalProfile && - user != null - ) { - AsyncImage( - model = user.avatarUrl, - contentDescription = user.name, - modifier = Modifier - .size(24.dp) - .clip(CircleShape), - placeholder = painterResource(id = destination.icon) - ) - } else { - Icon( - painter = painterResource(id = destination.icon), - contentDescription = null - ) - } + AsyncImage( + model = user.avatarUrl, + contentDescription = user.name, + modifier = Modifier + .size(24.dp) + .clip(CircleShape), + placeholder = painterResource(id = destination.icon) + ) + } else { + Icon( + painter = painterResource(id = destination.icon), + contentDescription = null + ) } - }, - label = { - Text( - text = stringResource(id = destination.label), - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - }, - selected = currentScreen == destination, - onClick = { - navController.popBackStackAndNavigate(destination.route) - appBarState.contentOffset = 0f } - ) - } + }, + label = { + Text( + text = stringResource(id = destination.label), + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + }, + selected = currentScreen == destination, + onClick = { + navController.popBackStackAndNavigate(destination.route) + appBarState.contentOffset = 0f + } + ) } } } @@ -456,7 +388,6 @@ fun TraewelldroidApp( eventViewModel = eventViewModel, checkInViewModel = checkInViewModel, notificationsViewModel = notificationsViewModel, - bottomSearchViewModel = bottomSearchViewModel, snackbarHostState = snackbarHostState, modifier = Modifier .fillMaxWidth() diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/search/Search.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/search/Search.kt index 0f4e812e..1bb3ed93 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/search/Search.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/search/Search.kt @@ -48,7 +48,6 @@ import com.google.accompanist.permissions.rememberMultiplePermissionsState import de.hbch.traewelling.R import de.hbch.traewelling.api.models.station.Station import de.hbch.traewelling.api.models.user.User -import de.hbch.traewelling.shared.BottomSearchViewModel import de.hbch.traewelling.theme.AppTypography import de.hbch.traewelling.ui.composables.ProfilePicture import de.hbch.traewelling.util.getStationNameWithRL100 @@ -58,7 +57,6 @@ import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) @Composable fun Search( - bottomSearchViewModel: BottomSearchViewModel, modifier: Modifier = Modifier, initQuery: String = "", queryStations: Boolean = true, @@ -68,7 +66,6 @@ fun Search( onStationSelected: (String) -> Unit = { }, onUserSelected: (User) -> Unit = { } ) { - bottomSearchViewModel.reset() val searchInstruction = if (queryStations && queryUsers) stringResource(id = R.string.search_stop_users) diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/searchConnection/SearchConnection.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/searchConnection/SearchConnection.kt index 69479ec8..845ad999 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/searchConnection/SearchConnection.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/searchConnection/SearchConnection.kt @@ -45,7 +45,6 @@ import de.hbch.traewelling.api.models.station.Station import de.hbch.traewelling.api.models.trip.HafasLine import de.hbch.traewelling.api.models.trip.HafasTrip import de.hbch.traewelling.api.models.trip.ProductType -import de.hbch.traewelling.shared.BottomSearchViewModel import de.hbch.traewelling.shared.CheckInViewModel import de.hbch.traewelling.shared.LoggedInUserViewModel import de.hbch.traewelling.theme.AppTypography @@ -68,7 +67,6 @@ import java.time.ZoneId fun SearchConnection( loggedInUserViewModel: LoggedInUserViewModel, checkInViewModel: CheckInViewModel, - bottomSearchViewModel: BottomSearchViewModel, station: String, currentSearchDate: ZonedDateTime, onTripSelected: () -> Unit = { }, @@ -116,8 +114,7 @@ fun SearchConnection( }, homelandStationData = loggedInUserViewModel.home, recentStationsData = loggedInUserViewModel.lastVisitedStations, - queryUsers = false, - bottomSearchViewModel = bottomSearchViewModel + queryUsers = false ) ElevatedCard { Column {