Request notification permission on Android 13

This commit is contained in:
Moez Bhatti
2022-12-13 13:31:22 -05:00
parent c4e07c2181
commit cc819b3ac4
9 changed files with 108 additions and 27 deletions
@@ -57,6 +57,7 @@ import com.moez.QKSMS.util.GlideApp
import com.moez.QKSMS.util.PhoneNumberUtils
import com.moez.QKSMS.util.Preferences
import com.moez.QKSMS.util.tryOrNull
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Singleton
@@ -94,6 +95,11 @@ class NotificationManagerImpl @Inject constructor(
return
}
if (!permissions.hasNotifications()) {
Timber.w("Cannot update notification because we don't have the notification permission")
return
}
val messages = messageRepo.getUnreadUnseenMessages(threadId)
// If there are no messages to be displayed, make sure that the notification is dismissed