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
4 changes: 3 additions & 1 deletion OneSignalSDK/onesignal/core/consumer-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@

-keepclassmembers class com.onesignal.common.** { *; }

-keep class ** implements com.onesignal.common.modules.IModule { *; }
-keepclassmembers @com.onesignal.core.internal.minification.KeepStub class * { <init>(...); }

-keep class ** implements com.onesignal.common.modules.IModule { *; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.onesignal.core.internal.minification

/**
* Purpose: Use on stub classes that are expected to always exists when
* aggressive minification is enabled on the app.
* - Such as android.enableR8.fullMode.
*/
annotation class KeepStub
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.onesignal.inAppMessages.internal

import com.onesignal.core.internal.minification.KeepStub
import com.onesignal.inAppMessages.IInAppMessageClickListener
import com.onesignal.inAppMessages.IInAppMessageLifecycleListener
import com.onesignal.inAppMessages.IInAppMessagesManager

/**
* The misconfigured IAMManager is an implementation of [IInAppMessagesManager] that warns the user they
* have not included the appropriate IAM module.
* The misconfigured IAMManager is an implementation of [IInAppMessagesManager]
* that warns the dev they have not included the appropriate IAM module.
*/
@KeepStub
internal class MisconfiguredIAMManager : IInAppMessagesManager {
override var paused: Boolean
get() = throw EXCEPTION
Expand Down Expand Up @@ -35,7 +37,7 @@ internal class MisconfiguredIAMManager : IInAppMessagesManager {
override fun removeClickListener(listener: IInAppMessageClickListener) = throw EXCEPTION

companion object {
private val EXCEPTION: Throwable get() =
private val EXCEPTION get() =
Exception(
"Must include gradle module com.onesignal:InAppMessages in order to use this functionality!",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package com.onesignal.location.internal

import com.onesignal.core.internal.minification.KeepStub
import com.onesignal.location.ILocationManager

/**
* The misconfigured IAMManager is an implementation of [ILocationManager] that warns the user they
* The misconfigured IAMManager is an implementation of [ILocationManager] that warns the dev they
* have not included the appropriate location module.
*/
@KeepStub
internal class MisconfiguredLocationManager : ILocationManager {
override var isShared: Boolean
get() = throw EXCEPTION
set(value) = throw EXCEPTION

override suspend fun requestPermission(): Boolean = throw EXCEPTION
override suspend fun requestPermission() = throw EXCEPTION

companion object {
private val EXCEPTION = Exception("Must include gradle module com.onesignal:Location in order to use this functionality!")
private val EXCEPTION get() = Exception("Must include gradle module com.onesignal:Location in order to use this functionality!")
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
package com.onesignal.notifications.internal

import com.onesignal.core.internal.minification.KeepStub
import com.onesignal.notifications.INotificationClickListener
import com.onesignal.notifications.INotificationLifecycleListener
import com.onesignal.notifications.INotificationsManager
import com.onesignal.notifications.IPermissionObserver

/**
* The misconfigured NotificationsManager is an implementation of [INotificationsManager] that warns the user they
* have not included the appropriate notifications module.
* The misconfigured NotificationsManager is an implementation of
* [INotificationsManager] that warns the dev they have not included the
* appropriate notifications module.
*/
@KeepStub
internal class MisconfiguredNotificationsManager : INotificationsManager {
override val permission: Boolean
override val permission
get() = throw EXCEPTION
override val canRequestPermission: Boolean
override val canRequestPermission
get() = throw EXCEPTION

override suspend fun requestPermission(fallbackToSettings: Boolean): Boolean = throw EXCEPTION
override suspend fun requestPermission(fallbackToSettings: Boolean) = throw EXCEPTION

override fun removeNotification(id: Int) = throw EXCEPTION

Expand All @@ -36,6 +39,6 @@ internal class MisconfiguredNotificationsManager : INotificationsManager {
override fun removeClickListener(listener: INotificationClickListener) = throw EXCEPTION

companion object {
private val EXCEPTION = Exception("Must include gradle module com.onesignal:Notification in order to use this functionality!")
private val EXCEPTION get() = Exception("Must include gradle module com.onesignal:Notification in order to use this functionality!")
}
}