Skip to content

Instantly share code, notes, and snippets.

@LloydBlv
Created May 13, 2025 08:44
Show Gist options
  • Save LloydBlv/8037d8c6c65aaadc3a374e5183422ddd to your computer and use it in GitHub Desktop.
Save LloydBlv/8037d8c6c65aaadc3a374e5183422ddd to your computer and use it in GitHub Desktop.
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