Created
May 13, 2025 08:44
-
-
Save LloydBlv/8037d8c6c65aaadc3a374e5183422ddd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface PushHandler { | |
fun handle(message: PushMessage) | |
} | |
class DefaultPushHandler @Inject constructor( | |
private val notificationFactory: NotificationFactory, | |
private val deeplinkParser: DeeplinkParser, | |
@ApplicationContext private val context: Context | |
) : PushHandler { | |
override fun handle(message: PushMessage) { | |
val notification = notificationFactory.createNotification(context, message) | |
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) | |
== PackageManager.PERMISSION_GRANTED) { | |
NotificationManagerCompat.from(context).notify(1001, notification) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment