v0.3.5: update MainActivity.kt
This commit is contained in:
1 parent
9785f55b81
commit
c9213d4b2f
1 file changed
+10
-1
@@ -40,6 +40,9 @@ class MainActivity : ComponentActivity() {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var workerScheduler: WorkerScheduler
|
lateinit var workerScheduler: WorkerScheduler
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var scraperManager: com.hotdeal.alarm.domain.usecase.HotDealScraperManager
|
||||||
|
|
||||||
private var downloadReceiver: BroadcastReceiver? = null
|
private var downloadReceiver: BroadcastReceiver? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@@ -216,7 +219,13 @@ class MainActivity : ComponentActivity() {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if (isInBackground) {
|
if (isInBackground) {
|
||||||
workerScheduler.executeOnce()
|
lifecycleScope.launch {
|
||||||
|
try {
|
||||||
|
scraperManager.fetchAndProcessDeals()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// 무시
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
isInBackground = false
|
isInBackground = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user