Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pull to refresh Stats bug #20524

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,11 @@ class StatsModule {
return if (trafficTabFeatureConfig.isEnabled()) {
mapOf(
StatsSection.TRAFFIC to trafficUseCase,
StatsSection.INSIGHTS to insightsUseCase
StatsSection.INSIGHTS to insightsUseCase,
StatsSection.DAYS to dayStatsUseCase,
StatsSection.WEEKS to weekStatsUseCase,
StatsSection.MONTHS to monthStatsUseCase,
StatsSection.YEARS to yearStatsUseCase
irfano marked this conversation as resolved.
Show resolved Hide resolved
)
} else {
mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,24 @@ class StatsViewModel
statsSiteProvider.clear()
if (networkUtilsWrapper.isNetworkAvailable()) {
loadData {
val baseListUseCase = listUseCases[statsSectionManager.getSelectedSection()]
baseListUseCase?.refreshTypes()
baseListUseCase?.refreshData(true)
if (statsTrafficTabFeatureConfig.isEnabled()) {
val currentUseCase: BaseListUseCase?
val statsGranularity = selectedTrafficGranularityManager.getSelectedTrafficGranularity()

currentUseCase = when (statsGranularity) {
StatsGranularity.DAYS -> listUseCases[StatsSection.DAYS]
StatsGranularity.WEEKS -> listUseCases[StatsSection.WEEKS]
StatsGranularity.MONTHS -> listUseCases[StatsSection.MONTHS]
else -> listUseCases[StatsSection.YEARS]
}
currentUseCase?.refreshTypes()
currentUseCase?.refreshData(true)
} else {
val statsSection = statsSectionManager.getSelectedSection()
val baseListUseCase = listUseCases[statsSection]
baseListUseCase?.refreshTypes()
baseListUseCase?.refreshData(true)
}
}
} else {
_isRefreshing.value = false
Expand Down
Loading