private suspend fun init() { logger.d { "Initializing ChannelListViewModel" } searchQuery.combine(queryConfigFlow) { query, config -> query to config }.collectLatest { (query, config) ->val queryChannelsRequest = QueryChannelsRequest(filter = createQueryChannelsFilter(config.filters, query),querySort = config.querySort,limit = channelLimit,messageLimit = messageLimit,memberLimit = memberLimit,) logger.d { "Querying channels as state" } queryChannelsState = chatClient.queryChannelsAsState( request = queryChannelsRequest, chatEventHandlerFactory = chatEventHandlerFactory, coroutineScope = viewModelScope, )observeChannels(searchQuery = query)}}
Makes the initial query to request channels and starts observing state changes.