Skip to content

Commit

Permalink
Updating progress in coroutine
Browse files Browse the repository at this point in the history
Signed-off-by: Arnau Mora <[email protected]>
  • Loading branch information
ArnyminerZ committed Aug 23, 2023
1 parent 0f1f8fd commit cc709e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/at/bitfire/icsdroid/ProcessEventsTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import at.bitfire.icsdroid.db.AppDatabase
import at.bitfire.icsdroid.db.entity.Subscription
import at.bitfire.icsdroid.ui.EditCalendarActivity
import at.bitfire.icsdroid.ui.NotificationUtils
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import net.fortuna.ical4j.model.Property
import net.fortuna.ical4j.model.PropertyList
import net.fortuna.ical4j.model.component.VAlarm
Expand Down Expand Up @@ -215,7 +217,7 @@ class ProcessEventsTask(
val uids = HashSet<String>(events.size)

for ((i, ev) in events.withIndex()) {
runBlocking { progress?.invoke(i, events.size) }
CoroutineScope(Dispatchers.IO).launch { progress?.invoke(i, events.size) }

val event = updateAlarms(ev)
val uid = event.uid!!
Expand Down

0 comments on commit cc709e8

Please sign in to comment.