fix: cancel stale progress notification on process start
Notifications belong to the package and outlive the process: after the system kills the foreground service mid-download the frozen progress notification stays in the shade forever. A fresh process means no service is running, so any leftover notification is stale.
This commit is contained in:
@@ -2,6 +2,7 @@ package com.example.research
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import com.example.research.common.progress.DictionaryProgressStateHolder
|
import com.example.research.common.progress.DictionaryProgressStateHolder
|
||||||
|
import com.example.research.common.util.NotificationHelper
|
||||||
import com.example.research.data.local.preferences.PreferencesManager
|
import com.example.research.data.local.preferences.PreferencesManager
|
||||||
import com.example.research.data.repository.LocalDictionaryRepository
|
import com.example.research.data.repository.LocalDictionaryRepository
|
||||||
import com.example.research.feature.download.DownloadManager
|
import com.example.research.feature.download.DownloadManager
|
||||||
@@ -41,6 +42,8 @@ class ReSearchApplication : Application() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
|
||||||
|
NotificationHelper(this).cancelNotification()
|
||||||
|
|
||||||
preferencesManager = PreferencesManager(this)
|
preferencesManager = PreferencesManager(this)
|
||||||
applicationScope.launch(Dispatchers.IO) {
|
applicationScope.launch(Dispatchers.IO) {
|
||||||
preferencesManager.sanitizeDictionarySources()
|
preferencesManager.sanitizeDictionarySources()
|
||||||
|
|||||||
Reference in New Issue
Block a user