mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-13 10:14:42 -04:00
InstalledViewModel: Inject WebAppDetailsHelper using hilt
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import com.aurora.gplayapi.helpers.PurchaseHelper
|
||||
import com.aurora.gplayapi.helpers.ReviewsHelper
|
||||
import com.aurora.gplayapi.helpers.SearchHelper
|
||||
import com.aurora.gplayapi.helpers.StreamHelper
|
||||
import com.aurora.gplayapi.helpers.web.WebAppDetailsHelper
|
||||
import com.aurora.gplayapi.helpers.web.WebCategoryStreamHelper
|
||||
import com.aurora.gplayapi.helpers.web.WebDataSafetyHelper
|
||||
import com.aurora.gplayapi.helpers.web.WebSearchHelper
|
||||
@@ -152,4 +153,15 @@ object HelperModule {
|
||||
.using(httpClient)
|
||||
.with(spoofProvider.locale)
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun providesWebAppDetailsHelperInstance(
|
||||
spoofProvider: SpoofProvider,
|
||||
httpClient: IHttpClient
|
||||
): WebAppDetailsHelper {
|
||||
return WebAppDetailsHelper()
|
||||
.using(httpClient)
|
||||
.with(spoofProvider.locale)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ import javax.inject.Inject
|
||||
class InstalledViewModel @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
private val blacklistProvider: BlacklistProvider,
|
||||
private val gson: Gson
|
||||
private val gson: Gson,
|
||||
private val webAppDetailsHelper: WebAppDetailsHelper
|
||||
) : ViewModel() {
|
||||
|
||||
private val TAG = InstalledViewModel::class.java.simpleName
|
||||
@@ -65,7 +66,7 @@ class InstalledViewModel @Inject constructor(
|
||||
// 50 is a safe number to avoid hitting the rate limit or package size limit
|
||||
val chunkedPackages = packages.chunked(50)
|
||||
val allApps = chunkedPackages.flatMap { chunk ->
|
||||
WebAppDetailsHelper().getAppDetails(chunk.map { it.packageName })
|
||||
webAppDetailsHelper.getAppDetails(chunk.map { it.packageName })
|
||||
}
|
||||
|
||||
_apps.emit(allApps)
|
||||
|
||||
Reference in New Issue
Block a user