Skip to content

Commit

Permalink
fix: Syncing media notification getting stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
criticalAY committed Jan 4, 2025
1 parent ea311c9 commit 454c84c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncMediaWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class SyncMediaWorker(
setContentTitle(CollectionManager.TR.syncMediaFailed())
}
return Result.failure()
} finally {
if (isStopped) {
Timber.i("SyncMediaWorker stopped, clearing notifications")
clearNotification()
}
}

Timber.d("SyncMediaWorker: success")
Expand Down Expand Up @@ -111,6 +116,11 @@ class SyncMediaWorker(
}
}

private fun clearNotification() {
Timber.i("SyncMediaWorker notification cleared")
notificationManager.cancel(NotificationId.SYNC_MEDIA)
}

override suspend fun getForegroundInfo(): ForegroundInfo {
val title = applicationContext.getString(R.string.syncing_media)
val cancelTitle = CollectionManager.TR.syncAbortButton()
Expand Down

0 comments on commit 454c84c

Please sign in to comment.