-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2136 from OneSignal/fix/minification_missing_stubs
[Fix] "could not be instantiated" exception when; some modules are omitted AND android.enableR8.fullMode=true
- Loading branch information
Showing
5 changed files
with
30 additions
and
13 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
8 changes: 8 additions & 0 deletions
8
...gnalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/minification/KeepStub.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,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 |
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
8 changes: 5 additions & 3 deletions
8
...signal/core/src/main/java/com/onesignal/location/internal/MisconfiguredLocationManager.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 |
---|---|---|
@@ -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!") | ||
} | ||
} |
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