From 74cc5f99b1f7b10e9119e3b5e2864aa52e50b4ee Mon Sep 17 00:00:00 2001 From: Naveen Date: Tue, 13 Sep 2022 01:38:29 +0530 Subject: [PATCH 1/2] Handle notification permission --- app/src/main/AndroidManifest.xml | 1 + .../simplemobiletools/smsmessenger/activities/MainActivity.kt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 372a05cd..3eea3fbf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,6 +12,7 @@ + + if (!granted) toast(R.string.no_post_notifications_permissions) + } initMessenger() bus = EventBus.getDefault() try { From 48421d6891d02961bb5ab1470a26a4b3c52d1cca Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Tue, 13 Sep 2022 11:21:43 +0200 Subject: [PATCH 2/2] make the new code a bit more readable --- .../smsmessenger/activities/MainActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt index 91df9c98..9e806688 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt @@ -159,8 +159,11 @@ class MainActivity : SimpleActivity() { if (it) { handlePermission(PERMISSION_READ_CONTACTS) { handleNotificationPermission { granted -> - if (!granted) toast(R.string.no_post_notifications_permissions) + if (!granted) { + toast(R.string.no_post_notifications_permissions) + } } + initMessenger() bus = EventBus.getDefault() try {