diff --git a/autotracker-gradle-plugin/build.gradle.kts b/autotracker-gradle-plugin/build.gradle.kts index 9c339cb..5588476 100644 --- a/autotracker-gradle-plugin/build.gradle.kts +++ b/autotracker-gradle-plugin/build.gradle.kts @@ -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") diff --git a/autotracker-gradle-plugin/src/main/kotlin/com/growingio/android/plugin/hook/HookInjectorClass.kt b/autotracker-gradle-plugin/src/main/kotlin/com/growingio/android/plugin/hook/HookInjectorClass.kt index f522689..d2f07b7 100644 --- a/autotracker-gradle-plugin/src/main/kotlin/com/growingio/android/plugin/hook/HookInjectorClass.kt +++ b/autotracker-gradle-plugin/src/main/kotlin/com/growingio/android/plugin/hook/HookInjectorClass.kt @@ -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)) diff --git a/inject-descriptor/src/main/java/com/growingio/android/descriptor/GoogleAnalyticsInjector.kt b/inject-descriptor/src/main/java/com/growingio/android/descriptor/GoogleAnalyticsInjector.kt index 785dfb8..d066949 100644 --- a/inject-descriptor/src/main/java/com/growingio/android/descriptor/GoogleAnalyticsInjector.kt +++ b/inject-descriptor/src/main/java/com/growingio/android/descriptor/GoogleAnalyticsInjector.kt @@ -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",