-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
deef0e1
commit cfbbf6f
Showing
9 changed files
with
67 additions
and
49 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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