-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2075a10
commit 429c080
Showing
7 changed files
with
68 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
12 changes: 0 additions & 12 deletions
12
app/src/main/kotlin/dev/jahir/blueprint/app/NotificationService.kt
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
app/src/main/kotlin/dev/jahir/blueprint/app/NotificationServiceExtension.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dev.jahir.blueprint.app | ||
|
||
/* TODO: Remove comment marks to enable | ||
import android.content.Context | ||
import androidx.core.app.NotificationCompat | ||
import com.onesignal.OSNotificationReceivedEvent | ||
import com.onesignal.OneSignal.OSRemoteNotificationReceivedHandler | ||
import dev.jahir.frames.extensions.context.color | ||
import dev.jahir.frames.extensions.context.drawable | ||
import dev.jahir.frames.extensions.context.preferences | ||
class NotificationServiceExtension : OSRemoteNotificationReceivedHandler { | ||
override fun remoteNotificationReceived( | ||
context: Context, | ||
notificationReceivedEvent: OSNotificationReceivedEvent | ||
) { | ||
if(!context.preferences.notificationsEnabled) { | ||
notificationReceivedEvent.complete(null) | ||
return | ||
} | ||
val notification = notificationReceivedEvent.notification | ||
val mutableNotification = notification.mutableCopy() | ||
mutableNotification.setExtender { builder: NotificationCompat.Builder -> | ||
builder.color = context.color(R.color.accent) | ||
builder.setSmallIcon(R.drawable.ic_notification) | ||
} | ||
notificationReceivedEvent.complete(mutableNotification) | ||
} | ||
} | ||
*/ |
This file contains 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