Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ internal class NotificationGenerationWorkManager : INotificationGenerationWorkMa

class NotificationGenerationWorker(context: Context, workerParams: WorkerParameters) : CoroutineWorker(context, workerParams) {
override suspend fun doWork(): Result {
if (!OneSignal.isInitialized) {
return Result.failure()
if (!OneSignal.initWithContext(applicationContext)) {
return Result.success()
}

val notificationProcessor: INotificationGenerationProcessor = OneSignal.getService()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ internal class ReceiveReceiptWorkManager(
}

class ReceiveReceiptWorker(context: Context, workerParams: WorkerParameters) : CoroutineWorker(context, workerParams) {
private var receiveReceiptProcessor: IReceiveReceiptProcessor = OneSignal.getService()

override suspend fun doWork(): Result {
val inputData = inputData
if (!OneSignal.initWithContext(applicationContext)) {
return Result.success()
}

val notificationId = inputData.getString(OS_NOTIFICATION_ID)!!
val appId = inputData.getString(OS_APP_ID)!!
val subscriptionId = inputData.getString(OS_SUBSCRIPTION_ID)!!

val receiveReceiptProcessor = OneSignal.getService<IReceiveReceiptProcessor>()
receiveReceiptProcessor.sendReceiveReceipt(appId, subscriptionId, notificationId)
return Result.success()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import com.onesignal.notifications.internal.registration.impl.IPushRegistratorCa
class ADMMessageHandler : ADMMessageHandlerBase("ADMMessageHandler") {
override fun onMessage(intent: Intent) {
val context = applicationContext
if (!OneSignal.initWithContext(context)) {
return
}

val bundle = intent.extras

val bundleProcessor = OneSignal.getService<INotificationBundleProcessor>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ class ADMMessageHandlerJob : ADMMessageHandlerJobBase() {
context: Context?,
intent: Intent?,
) {
val bundle = intent?.extras

if (context == null) {
return
}
if (!OneSignal.initWithContext(context.applicationContext)) {
return
}
val bundleProcessor = OneSignal.getService<INotificationBundleProcessor>()

val bundle = intent?.extras

bundleProcessor.processBundleFromReceiver(context!!, bundle!!)
}

Expand Down