package com.gh.gamecenter.minigame

import com.gh.gamecenter.SearchActivity.Companion.TRACK_SEARCH_TYPE_INPUT
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.search.SearchGameResultFragment
import com.gh.gamecenter.search.SearchGameResultViewModel
import com.halo.assistant.HaloApp

/**
 * 小游戏-搜索结果页面
 */
class MiniGameSearchResultFragment : SearchGameResultFragment() {

    /**
     * 仅替换搜索游戏的API，搜索结果页面样式与首页的完全一致
     */
    override fun provideListViewModel(): SearchGameResultViewModel {
        val factory = SearchGameResultViewModel.Factory(
            HaloApp.getInstance().application,
            mKey,
            true,
            MiniGameSearchResultRepository(),
            TRACK_SEARCH_TYPE_INPUT,
            activity?.intent?.getStringExtra(EntranceConsts.KEY_SOURCE_ENTRANCE) ?: ""
        )
        return viewModelProvider(factory)
    }
}