Skip to content

Commit

Permalink
fix: GoogleAnalyticsInject add appOptOut method (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
styluo authored Jul 7, 2022
1 parent d326e89 commit 2e664cd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autotracker-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ val testPluginImplementation: Configuration by configurations.creating {
}

ext {
set("releaseVersion", "3.4.0")
set("releaseVersionCode", 30400)
set("releaseVersion", "3.4.1-SNAPSHOT")
set("releaseVersionCode", 30401)
set("agp_version", "7.2.1")
set("low_agp_version", "4.2.2")
set("kotlin_version", "1.6.21")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public object HookInjectorClass {
TARGET_HOOK_CLASSES.add(HookData("com/google/firebase/analytics/FirebaseAnalytics","setAnalyticsCollectionEnabled","(Z)V","com/growingio/android/analytics/firebase/FirebaseAnalyticsInjector","setAnalyticsCollectionEnabled","(Z)V",true))
TARGET_HOOK_CLASSES.add(HookData("com/google/android/gms/analytics/GoogleAnalytics","newTracker","(I)Lcom/google/android/gms/analytics/Tracker;","com/growingio/android/analytics/google/GoogleAnalyticsInjector","newTracker","(Lcom/google/android/gms/analytics/Tracker;Lcom/google/android/gms/analytics/GoogleAnalytics;I)V",true))
TARGET_HOOK_CLASSES.add(HookData("com/google/android/gms/analytics/GoogleAnalytics","newTracker","(Ljava/lang/String;)Lcom/google/android/gms/analytics/Tracker;","com/growingio/android/analytics/google/GoogleAnalyticsInjector","newTracker","(Lcom/google/android/gms/analytics/Tracker;Lcom/google/android/gms/analytics/GoogleAnalytics;Ljava/lang/String;)V",true))
TARGET_HOOK_CLASSES.add(HookData("com/google/android/gms/analytics/GoogleAnalytics","setAppOptOut","(Z)V","com/growingio/android/analytics/google/GoogleAnalyticsInjector","setAppOptOut","(Lcom/google/android/gms/analytics/GoogleAnalytics;Z)V",true))
TARGET_HOOK_CLASSES.add(HookData("com/google/android/gms/analytics/Tracker","set","(Ljava/lang/String;Ljava/lang/String;)V","com/growingio/android/analytics/google/GoogleAnalyticsInjector","set","(Lcom/google/android/gms/analytics/Tracker;Ljava/lang/String;Ljava/lang/String;)V",true))
TARGET_HOOK_CLASSES.add(HookData("com/google/android/gms/analytics/Tracker","send","(Ljava/util/Map;)V","com/growingio/android/analytics/google/GoogleAnalyticsInjector","send","(Lcom/google/android/gms/analytics/Tracker;Ljava/util/Map;)V",true))
TARGET_HOOK_CLASSES.add(HookData("com/google/android/gms/analytics/Tracker","setClientId","(Ljava/lang/String;)V","com/growingio/android/analytics/google/GoogleAnalyticsInjector","setClientId","(Lcom/google/android/gms/analytics/Tracker;Ljava/lang/String;)V",true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ interface GoogleAnalyticsInjector {
)
fun newTracker(measurementId: String)

@Inject(
targetClazz = "com/google/android/gms/analytics/GoogleAnalytics",
targetMethod = "setAppOptOut",
targetMethodDesc = "(Z)V",
injectMethod = "setAppOptOut",
injectMethodDesc = "(Lcom/google/android/gms/analytics/GoogleAnalytics;Z)V",
isAfter = true,
type = 0
)
fun setAppOptOut(optOut: Boolean)

@Inject(
targetClazz = "com/google/android/gms/analytics/Tracker",
targetMethod = "set",
Expand Down

0 comments on commit 2e664cd

Please sign in to comment.