Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bitfireAT/cert4android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunik Kupfer <kupfer@bitfire.at>2022-10-24 15:36:35 +0300
committerSunik Kupfer <kupfer@bitfire.at>2022-10-24 15:36:35 +0300
commit80618fc11db8d66504cbf6fb1f61ccc0304e1430 (patch)
tree125191472d72741fea27a064bb25a9b8bd71d3c4
parenteb47c00cb05fe5d27e8640444cc60aa7c271b47a (diff)
check for notify permission before notifyingandroid-13-compat
-rw-r--r--src/main/java/at/bitfire/cert4android/CustomCertService.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/at/bitfire/cert4android/CustomCertService.kt b/src/main/java/at/bitfire/cert4android/CustomCertService.kt
index e509611..2cece3f 100644
--- a/src/main/java/at/bitfire/cert4android/CustomCertService.kt
+++ b/src/main/java/at/bitfire/cert4android/CustomCertService.kt
@@ -250,7 +250,10 @@ class CustomCertService: Service() {
.setDeleteIntent(PendingIntent.getService(this@CustomCertService, id, rejectIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
.build()
val nm = NotificationUtils.createChannels(this@CustomCertService)
- nm.notify(CertUtils.getTag(cert), Constants.NOTIFICATION_CERT_DECISION, notify)
+ if (nm.areNotificationsEnabled())
+ nm.notify(CertUtils.getTag(cert), Constants.NOTIFICATION_CERT_DECISION, notify)
+ else
+ Constants.log.log(Level.WARNING,"Notifications disabled")
if (foreground) {
decisionIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)