Skip to content

Commit

Permalink
fix(Android):fix dokit-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
HeyCFarmer committed May 13, 2022
1 parent 1d8ee67 commit b9c35fc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ object DoKitExtUtil {

var HAS_DOKIT_TCP_HOOK_DJ = false

var DOKIT_GPS_MOCK_INCLUDE = false

/**
* 三方库版本信息
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CommClassTransformer : AbsClassTransformer() {
}

//gps字节码操作
if (DoKitExtUtil.commExt.gpsSwitch) {
if (DoKitExtUtil.commExt.gpsSwitch && DoKitExtUtil.DOKIT_GPS_MOCK_INCLUDE) {
//系统 gpsStatus hook
klass.methods.forEach { method ->
method.instructions?.iterator()?.asIterable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class DoKitPluginConfigProcessor(val project: Project) : VariantProcessor {
if (thirdLibInfo.variant.contains("dokitx-tcp-hook-dj")) {
DoKitExtUtil.HAS_DOKIT_TCP_HOOK_DJ = true
}

if (thirdLibInfo.variant.contains("dokitx-gps-mock") || thirdLibInfo.variant.contains("dokit-gps-mock")){
DoKitExtUtil.DOKIT_GPS_MOCK_INCLUDE = true;
}
// "thirdLibInfo.variant===>${thirdLibInfo.variant}".println()
DoKitExtUtil.THIRD_LIB_INFOS.add(thirdLibInfo)
} else if (variants.size == 4) {
Expand All @@ -77,6 +81,11 @@ class DoKitPluginConfigProcessor(val project: Project) : VariantProcessor {
if (thirdLibInfo.variant.contains("dokitx-tcp-hook-dj")) {
DoKitExtUtil.HAS_DOKIT_TCP_HOOK_DJ = true
}

if (thirdLibInfo.variant.contains("dokitx-gps-mock") || thirdLibInfo.variant.contains("dokit-gps-mock")){
DoKitExtUtil.DOKIT_GPS_MOCK_INCLUDE = true;
}

// "thirdLibInfo.variant===>${thirdLibInfo.variant}".println()
DoKitExtUtil.THIRD_LIB_INFOS.add(thirdLibInfo)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ object DoKitExtUtil {

var HAS_DOKIT_TCP_HOOK_DJ = false

var DOKIT_GPS_MOCK_INCLUDE = false

/**
* 三方库版本信息
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CommClassTransformer : AbsClassTransformer() {
}

//gps字节码操作
if (DoKitExtUtil.commExt.gpsSwitch) {
if (DoKitExtUtil.commExt.gpsSwitch && DoKitExtUtil.DOKIT_GPS_MOCK_INCLUDE) {
//系统 gpsStatus hook
klass.methods.forEach { method ->
method.instructions?.iterator()?.asIterable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class DoKitPluginConfigProcessor(val project: Project) : VariantProcessor {
if (thirdLibInfo.variant.contains("dokitx-tcp-hook-dj")) {
DoKitExtUtil.HAS_DOKIT_TCP_HOOK_DJ = true
}

if (thirdLibInfo.variant.contains("dokitx-gps-mock") || thirdLibInfo.variant.contains("dokit-gps-mock")){
DoKitExtUtil.DOKIT_GPS_MOCK_INCLUDE = true;
}
// "thirdLibInfo.variant===>${thirdLibInfo.variant}".println()
DoKitExtUtil.THIRD_LIB_INFOS.add(thirdLibInfo)
} else if (variants.size == 4) {
Expand All @@ -77,6 +81,11 @@ class DoKitPluginConfigProcessor(val project: Project) : VariantProcessor {
if (thirdLibInfo.variant.contains("dokitx-tcp-hook-dj")) {
DoKitExtUtil.HAS_DOKIT_TCP_HOOK_DJ = true
}

if (thirdLibInfo.variant.contains("dokitx-gps-mock") || thirdLibInfo.variant.contains("dokit-gps-mock")){
DoKitExtUtil.DOKIT_GPS_MOCK_INCLUDE = true;
}

// "thirdLibInfo.variant===>${thirdLibInfo.variant}".println()
DoKitExtUtil.THIRD_LIB_INFOS.add(thirdLibInfo)
}
Expand Down

0 comments on commit b9c35fc

Please sign in to comment.