Refactor a bit to make testing easier

This commit is contained in:
Bradlee Speice
2014-11-22 16:28:05 -05:00
parent cc3c8ea486
commit 18d3620da3
2 changed files with 30 additions and 51 deletions

View File

@ -48,9 +48,9 @@ class RefreshManager(val installers: Collection<Installer>,
val fifteenDaysAgo = Calendar.getInstance().getTime().getTime() - 1296000
fun doReload(enabledDownload: Boolean, lastUpdated: Long,
fun doReload(downloadEnabled: Boolean, lastUpdated: Long,
networkState: Int? = ConnectivityManager.TYPE_DUMMY): Boolean =
if (!enabledDownload || networkState != ConnectivityManager.TYPE_WIFI)
if (!downloadEnabled || networkState != ConnectivityManager.TYPE_WIFI)
false
else if (lastUpdated < fifteenDaysAgo)
true