From 08200d84433fcc9d828b935f747d2d1f09126b06 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 20 Sep 2024 15:49:21 +0200 Subject: [PATCH] refine post-notifications-granted logging saying post-notifications-granted=false on API that do not need this grant is misleading as it looks as some error or if the user has rejected sth. just stumbled upon that and was irritated when trying out things wrt https://github.com/deltachat/deltachat-android/issues/3281 on android7 --- .../java/org/thoughtcrime/securesms/LogViewFragment.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/thoughtcrime/securesms/LogViewFragment.java b/src/main/java/org/thoughtcrime/securesms/LogViewFragment.java index 17ce31e42..2e18d1a7e 100644 --- a/src/main/java/org/thoughtcrime/securesms/LogViewFragment.java +++ b/src/main/java/org/thoughtcrime/securesms/LogViewFragment.java @@ -257,9 +257,14 @@ public class LogViewFragment extends Fragment { builder.append("rtl=").append(isRtl).append("\n"); } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + boolean notifPermGranted = PermissionChecker.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PermissionChecker.PERMISSION_GRANTED; + builder.append("post-notifications-granted=").append(notifPermGranted).append("\n"); + } else { + builder.append("post-notifications-granted=").append("\n"); + } + final String token = FcmReceiveService.getToken(); - boolean notifPermGranted = PermissionChecker.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PermissionChecker.PERMISSION_GRANTED; - builder.append("post-notifications-granted=").append(notifPermGranted).append("\n"); builder.append("push-enabled=").append(Prefs.isPushEnabled(context)).append("\n"); builder.append("push-token=").append(token == null ? "" : token).append("\n"); } catch (Exception e) {