diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index c4e57e127..6b49dbc44 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -22,6 +22,7 @@ -keep class dev.jahir.frames.** { *; } +-keep class androidx.core.app.CoreComponentFactory { *; } -keep class com.google.** -keep class autovalue.shaded.com.google.** -keep class com.android.vending.billing.** diff --git a/app/src/main/kotlin/dev/jahir/frames/app/MyApplication.kt b/app/src/main/kotlin/dev/jahir/frames/app/MyApplication.kt index 93487c9ee..db62bc46e 100644 --- a/app/src/main/kotlin/dev/jahir/frames/app/MyApplication.kt +++ b/app/src/main/kotlin/dev/jahir/frames/app/MyApplication.kt @@ -1,11 +1,10 @@ package dev.jahir.frames.app -import dev.jahir.frames.ui.FramesApplication - // TODO: Remove comment marks to enable -// import com.onesignal.OneSignal // import com.onesignal.OSNotificationReceivedEvent +// import com.onesignal.OneSignal // import dev.jahir.frames.extensions.context.preferences +import dev.jahir.frames.ui.FramesApplication class MyApplication : FramesApplication(BuildConfig.ONESIGNAL_APP_ID) { override fun onCreate() { @@ -26,6 +25,6 @@ class MyApplication : FramesApplication(BuildConfig.ONESIGNAL_APP_ID) { OneSignal.unsubscribeWhenNotificationsAreDisabled(true) OneSignal.pauseInAppMessages(true) OneSignal.setLocationShared(false) - */ + */ } } diff --git a/app/src/main/kotlin/dev/jahir/frames/app/NotificationServiceExtension.kt b/app/src/main/kotlin/dev/jahir/frames/app/NotificationServiceExtension.kt index abb8b79ee..21c2db4e2 100644 --- a/app/src/main/kotlin/dev/jahir/frames/app/NotificationServiceExtension.kt +++ b/app/src/main/kotlin/dev/jahir/frames/app/NotificationServiceExtension.kt @@ -2,29 +2,30 @@ package dev.jahir.frames.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.R import dev.jahir.frames.extensions.context.color -import dev.jahir.frames.extensions.context.drawable -import dev.jahir.frames.extensions.context.preferences import dev.jahir.frames.extensions.context.hasNotificationsPermission +import dev.jahir.frames.extensions.context.preferences class NotificationServiceExtension : OSRemoteNotificationReceivedHandler { override fun remoteNotificationReceived( context: Context, notificationReceivedEvent: OSNotificationReceivedEvent ) { - if(!context.preferences.notificationsEnabled || !context.hasNotificationsPermission) { + if (!context.preferences.notificationsEnabled || !context.hasNotificationsPermission) { 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) + mutableNotification.setExtender { extender -> + extender.apply { + color = context.color(R.color.accent) + setSmallIcon(R.drawable.ic_notification) + } } notificationReceivedEvent.complete(mutableNotification) } diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 8965581e6..f51e593e8 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -8,7 +8,7 @@ object Versions { const val ksp = "$kotlin-1.0.16" // OneSignal - const val oneSignal = "4.8.6" + const val oneSignal = "4.8.7" // App const val minSdk = 21 diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro index c4e57e127..6b49dbc44 100644 --- a/library/proguard-rules.pro +++ b/library/proguard-rules.pro @@ -22,6 +22,7 @@ -keep class dev.jahir.frames.** { *; } +-keep class androidx.core.app.CoreComponentFactory { *; } -keep class com.google.** -keep class autovalue.shaded.com.google.** -keep class com.android.vending.billing.**