File tree Expand file tree Collapse file tree
app/src/main/kotlin/com/darkrockstudios/app/securecamera/import Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.darkrockstudios.app.securecamera.import
22
3+ import android.app.NotificationManager
4+ import android.content.Context
35import android.net.Uri
46import androidx.core.net.toUri
57import androidx.lifecycle.viewModelScope
68import androidx.work.*
79import com.darkrockstudios.app.securecamera.BaseViewModel
10+ import com.darkrockstudios.app.securecamera.import.ImportWorker.Companion.NOTIFICATION_ID
811import dev.whyoleg.cryptography.CryptographyProvider
912import dev.whyoleg.cryptography.algorithms.SHA512
1013import dev.whyoleg.cryptography.operations.Hasher
1114import kotlinx.coroutines.launch
1215import timber.log.Timber
1316
1417class ImportPhotosViewModel (
18+ private val appContext : Context ,
1519 private val workManager : WorkManager ,
1620) : BaseViewModel<ImportPhotosState>() {
1721
@@ -128,6 +132,10 @@ class ImportPhotosViewModel(
128132 currentImportWorkName?.let { workName ->
129133 Timber .d(" Cancelling import work: $workName " )
130134 workManager.cancelUniqueWork(workName)
135+
136+ val notificationManager =
137+ appContext.getSystemService(Context .NOTIFICATION_SERVICE ) as NotificationManager
138+ notificationManager.cancel(NOTIFICATION_ID )
131139 }
132140 }
133141}
You can’t perform that action at this time.
0 commit comments