Skip to content

Commit

Permalink
Add rules to allow reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
mscwilson committed Jan 24, 2024
1 parent eda0557 commit 85e3b1c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 41 deletions.
5 changes: 5 additions & 0 deletions snowplow-demo-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':snowplow-android-tracker')

implementation 'com.google.android.gms:play-services-appset:16.0.2'
implementation 'com.google.android.gms:play-services-ads:22.6.0'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation "com.android.installreferrer:installreferrer:2.2"

implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.0.0"
Expand Down
24 changes: 9 additions & 15 deletions snowplow-demo-compose/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,17 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# Fixes R8 full mode bug
# Fixes R8 full mode crash
# Also see https://github.com/square/retrofit/issues/3751
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

## Please add these rules to your existing keep rules in order to suppress warnings.
## This is generated automatically by the Android Gradle plugin.
#-dontwarn com.android.installreferrer.api.InstallReferrerClient$Builder
#-dontwarn com.android.installreferrer.api.InstallReferrerClient
#-dontwarn com.android.installreferrer.api.InstallReferrerStateListener
#-dontwarn org.bouncycastle.jsse.BCSSLParameters
#-dontwarn org.bouncycastle.jsse.BCSSLSocket
#-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
#-dontwarn org.conscrypt.Conscrypt$Version
#-dontwarn org.conscrypt.Conscrypt
#-dontwarn org.conscrypt.ConscryptHostnameVerifier
#-dontwarn org.openjsse.javax.net.ssl.SSLParameters
#-dontwarn org.openjsse.javax.net.ssl.SSLSocket
#-dontwarn org.openjsse.net.ssl.OpenJSSE
# Reflection for the appSetId
-keep class com.google.android.gms.appset.AppSet { *; }
-keep class com.google.android.gms.appset.AppSetIdInfo { *; }
-keep class com.google.android.gms.internal.appset.zzr { *; }
-keep class com.google.android.gms.tasks.Tasks { *; }

# Reflection for the AAID (AndroidIdfa)
-keep class com.google.android.gms.ads.identifier.** { *; }
5 changes: 4 additions & 1 deletion snowplow-demo-compose/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Snowplowandroidtracker">
<!-- Sample Ad Manager app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
<activity
android:name=".MainActivity"
android:exported="true"
Expand All @@ -24,5 +28,4 @@
</intent-filter>
</activity>
</application>

</manifest>
11 changes: 10 additions & 1 deletion snowplow-demo-kotlin/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

# Reflection for the appSetId
-keep class com.google.android.gms.appset.AppSet { *; }
-keep class com.google.android.gms.appset.AppSetIdInfo { *; }
-keep class com.google.android.gms.internal.appset.zzr { *; }
-keep class com.google.android.gms.tasks.Tasks { *; }

# Reflection for the AAID (AndroidIdfa)
-keep class com.google.android.gms.ads.identifier.** { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,28 @@ object TrackerEvents {
)

fun trackAll(tracker: TrackerController) {


trackDeepLink(tracker)
tracker.track(ScreenEnd())
// trackPageView(tracker)
// trackStructuredEvent(tracker)
// trackScreenView(tracker)
// trackTimings(tracker)
// trackSelfDescribingEvent(tracker)
// trackConsentGranted(tracker)
// trackConsentWithdrawn(tracker)
// trackMessageNotification(tracker)
//
// // Ecommerce events
// trackAddToCart(tracker)
// trackRemoveFromCart(tracker)
// trackCheckoutStep(tracker)
// trackProductView(tracker)
// trackProductListView(tracker)
// trackProductListClick(tracker)
// trackPromotionView(tracker)
// trackPromotionClick(tracker)
// trackTransaction(tracker)
// trackTransactionError(tracker)
// trackRefund(tracker)
trackPageView(tracker)
trackStructuredEvent(tracker)
trackScreenView(tracker)
trackTimings(tracker)
trackSelfDescribingEvent(tracker)
trackConsentGranted(tracker)
trackConsentWithdrawn(tracker)
trackMessageNotification(tracker)

// Ecommerce events
trackAddToCart(tracker)
trackRemoveFromCart(tracker)
trackCheckoutStep(tracker)
trackProductView(tracker)
trackProductListView(tracker)
trackProductListClick(tracker)
trackPromotionView(tracker)
trackPromotionClick(tracker)
trackTransaction(tracker)
trackTransactionError(tracker)
trackRefund(tracker)
}

private fun trackDeepLink(tracker: TrackerController) {
Expand Down

0 comments on commit 85e3b1c

Please sign in to comment.