UpdateHelper: Move init block to separate method
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import com.aurora.store.data.event.EventFlow
|
||||
import com.aurora.store.data.receiver.PackageManagerReceiver
|
||||
import com.aurora.store.util.CommonUtil
|
||||
import com.aurora.store.data.helper.DownloadHelper
|
||||
import com.aurora.store.data.helper.UpdateHelper
|
||||
import com.aurora.store.util.NotificationUtil
|
||||
import com.aurora.store.util.PackageUtil
|
||||
import com.aurora.store.util.Preferences
|
||||
@@ -55,6 +56,9 @@ class AuroraApp : Application(), Configuration.Provider, ImageLoaderFactory {
|
||||
@Inject
|
||||
lateinit var downloadHelper: DownloadHelper
|
||||
|
||||
@Inject
|
||||
lateinit var updateHelper: UpdateHelper
|
||||
|
||||
override val workManagerConfiguration: Configuration
|
||||
get() = Configuration.Builder()
|
||||
.setMinimumLoggingLevel(android.util.Log.INFO)
|
||||
@@ -85,8 +89,9 @@ class AuroraApp : Application(), Configuration.Provider, ImageLoaderFactory {
|
||||
//Create Notification Channels
|
||||
NotificationUtil.createNotificationChannel(this)
|
||||
|
||||
// Initialize DownloadWorker to observe and trigger downloads
|
||||
// Initialize Download and Update helpers to observe and trigger downloads
|
||||
downloadHelper.init()
|
||||
updateHelper.init()
|
||||
|
||||
//Register broadcast receiver for package install/uninstall
|
||||
ContextCompat.registerReceiver(
|
||||
|
||||
@@ -57,7 +57,10 @@ class UpdateHelper @Inject constructor(
|
||||
.map { list -> if (!isExtendedUpdateEnabled) list.filter { it.hasValidCert } else list }
|
||||
.stateIn(AuroraApp.scope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
init {
|
||||
/**
|
||||
* Deletes invalid updates from database and starts observing events
|
||||
*/
|
||||
fun init() {
|
||||
AuroraApp.scope.launch {
|
||||
deleteInvalidUpdates()
|
||||
}.invokeOnCompletion {
|
||||
|
||||
Reference in New Issue
Block a user