|
|
|
@ -21,9 +21,7 @@ import com.keylesspalace.tusky.util.ViewDataUtils |
|
|
|
|
import com.keylesspalace.tusky.viewdata.StatusViewData |
|
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers |
|
|
|
|
import io.reactivex.disposables.CompositeDisposable |
|
|
|
|
import java.util.* |
|
|
|
|
import javax.inject.Inject |
|
|
|
|
import kotlin.collections.ArrayList |
|
|
|
|
|
|
|
|
|
class SearchViewModel @Inject constructor( |
|
|
|
|
mastodonApi: MastodonApi, |
|
|
|
@ -78,9 +76,11 @@ class SearchViewModel @Inject constructor( |
|
|
|
|
repoResultAccount.value = accountsRepository.getSearchData(SearchType.Account, query, disposables) { |
|
|
|
|
it?.accounts ?: emptyList() |
|
|
|
|
} |
|
|
|
|
repoResultHashTag.value = hashtagsRepository.getSearchData(SearchType.Hashtag, String.format(Locale.getDefault(),"#%s",query), disposables) { |
|
|
|
|
it?.hashtags ?: emptyList() |
|
|
|
|
} |
|
|
|
|
val hashtagQuery = if (query != null && query.startsWith("#")) query else "#$query" |
|
|
|
|
repoResultHashTag.value = |
|
|
|
|
hashtagsRepository.getSearchData(SearchType.Hashtag, hashtagQuery, disposables) { |
|
|
|
|
it?.hashtags ?: emptyList() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|