Skip to content

Commit

Permalink
Release 4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dengshiwei committed Apr 3, 2024
1 parent 8c951e1 commit df55686
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ plugins {

ext {
agpVersion = '7.3.1' //used for compile
pluginVersion = '4.0.1' //plugin version
pluginVersion = '4.0.2' //plugin version
}
4 changes: 2 additions & 2 deletions sa-agp-legacy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ java {


dependencies {
implementation 'commons-io:commons-io:2.11.0'
implementation 'commons-codec:commons-codec:1.15'
implementation 'commons-io:commons-io:2.4'
implementation 'commons-codec:commons-codec:1.10'
implementation project(path: ':sa-agp-compat')
compileOnly("com.android.tools.build:gradle-api:${rootProject.ext.agpVersion}")
compileOnly("com.android.tools.build:gradle:${rootProject.ext.agpVersion}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ import com.sensorsdata.analytics.android.gradle.AsmCompatFactory

object V73AGPContextImpl : AGPContext {
override var asmCompatFactory: AsmCompatFactory? = null
}

}
1 change: 0 additions & 1 deletion sa-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies {
implementation 'org.ow2.asm:asm-analysis:9.1'
implementation 'org.ow2.asm:asm-util:9.1'
implementation 'org.ow2.asm:asm-tree:9.1'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.google.code.gson:gson:2.10'
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.sensorsdata.analytics.android.plugin.common

object VersionConstant {
//Plugin Version
const val VERSION = "4.0.1"
const val VERSION = "4.0.2"
// MIN SDK Version
const val MIN_SDK_VERSION = "6.6.9"
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ class SensorsAnalyticsWebViewMethodVisitor(
val ownerPosition = newLocal(Type.getObjectType(owner))
storeLocal(ownerPosition)
positionList.add(ownerPosition)
//将局部变量表中的数据压入操作数栈中触发原有的方法
positionList.reversed().forEach { tmp ->
loadLocal(tmp)
}
super.visitMethodInsn(opcode, owner, name, desc, itf)
//处理 Dcloud 中 WebView 的写法,缩小范围为 AdaWebView
if (isDCloud(owner, classNameAnalytics.className)) {
hookDCloud(positionList, name, desc)
Expand All @@ -97,6 +92,11 @@ class SensorsAnalyticsWebViewMethodVisitor(
val newDesc = SAUtils.appendDescBeforeGiven(desc, VIEW_DESC)
mv.visitMethodInsn(INVOKESTATIC, JS_BRIDGE_API, name, newDesc, false)
}
//将局部变量表中的数据压入操作数栈中触发原有的方法
positionList.reversed().forEach { tmp ->
loadLocal(tmp)
}
super.visitMethodInsn(opcode, owner, name, desc, itf)
return
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sensorsdata.analytics.android.plugin.manager

import com.sensorsdata.analytics.android.gradle.AGPVersion
import com.sensorsdata.analytics.android.plugin.configs.SAConfigHookHelper
import com.sensorsdata.analytics.android.plugin.extension.SAExtension
import com.sensorsdata.analytics.android.plugin.utils.Logger
Expand Down Expand Up @@ -80,6 +81,9 @@ class SAPluginManager(private val project: Project) {
isAndroidTV =
(getOrDefault("sensorsAnalytics.isAndroidTv", "false") as String).toBoolean()
asmVersion = getOrDefault("sensorsAnalytics.asmVersion", "ASM7") as String
if (AGPVersion.CURRENT_AGP_VERSION >= AGPVersion(8, 0, 0)) {
asmVersion = "ASM9"
}
}
}

Expand Down Expand Up @@ -107,5 +111,5 @@ class SAPluginManager(private val project: Project) {
}

enum class SAModule {
AUTOTRACK, PUSH, WEB_VIEW
AUTOTRACK, PUSH, WEB_VIEW, REACT_NATIVE
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.sensorsdata.analytics.android.plugin.utils

import org.apache.commons.io.IOUtils
import org.objectweb.asm.Opcodes
import java.io.InputStream

object SAUtils {
fun isPublic(access: Int): Boolean {
Expand Down Expand Up @@ -54,16 +52,6 @@ object SAUtils {
return 0
}

fun toByteArrayAndAutoCloseStream(input: InputStream): ByteArray {
try {
return input.readBytes()
} catch (e: Exception) {
throw e
} finally {
IOUtils.closeQuietly(input)
}
}

/**
* 获取 LOAD 或 STORE 的相反指令,例如 ILOAD => ISTORE,ASTORE => ALOAD
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.sensorsdata.analytics.android.plugin.viewclick
import com.sensorsdata.analytics.android.plugin.ClassNameAnalytics
import com.sensorsdata.analytics.android.plugin.configs.SensorsAnalyticsHookConfig
import com.sensorsdata.analytics.android.plugin.fragment.SensorsFragmentHookConfig
import com.sensorsdata.analytics.android.plugin.manager.SAModule
import com.sensorsdata.analytics.android.plugin.manager.SAPackageManager
import com.sensorsdata.analytics.android.plugin.manager.SAPluginManager
import com.sensorsdata.analytics.android.plugin.utils.Logger.warn
Expand Down Expand Up @@ -460,7 +461,7 @@ class SensorsAutoTrackMethodVisitor(
isHasTracked = true
return
}
if (handleRN()) {
if (pluginManager.isModuleEnable(SAModule.REACT_NATIVE) && handleRN()) {
isHasTracked = true
return
}
Expand Down

0 comments on commit df55686

Please sign in to comment.