Skip to content

Commit

Permalink
Merge branch 'feature/maidian-20220714'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Android/config.gradle
  • Loading branch information
RealOnlyone committed Jan 4, 2023
2 parents b89f86c + b5b6baf commit fc0473c
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 24 deletions.
3 changes: 2 additions & 1 deletion Android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ local.properties
/.idea/workspace.xml
.DS_Store
/build
/*/build
/captures
.externalNativeBuild
.idea/
.project
.classpath
.settings/
/*/*.iml
/*/*/*.iml
/*/*/*.iml
3 changes: 2 additions & 1 deletion Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:$gradlePluginVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"

// MavenCentral
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.30"
if (runType == 1) {
classpath "io.github.didi.dokit:dokitx-plugin:$dokitPluginVersion"
}

// classpath "com.didiglobal.booster:booster-task-compression-pngquant:${rootProject.ext.android["booster_version"]}"

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// classpath "com.didiglobal.booster:booster-gradle-plugin:3.3.1"
// classpath "com.didiglobal.booster:booster-task-analyser:3.3.1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ class DoKitPluginConfigProcessor(val project: Project) : VariantProcessor {
val parser = SAXParserFactory.newInstance().newSAXParser()
val handler = DoKitComponentHandler()
"App Manifest path====>$manifest".println()
parser.parse(manifest, handler)
try {
parser.parse(manifest, handler)
} catch (e: Exception) {
e.printStackTrace()
"===processDebugManifest task error. ${manifest.absoluteFile}".println()
}
"App PackageName is====>${handler.appPackageName}".println()
"App Application path====>${handler.applications}".println()
DoKitExtUtil.setAppPackageName(handler.appPackageName)
Expand Down
7 changes: 4 additions & 3 deletions Android/config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ext {
//0:发布到到本地localRepoURL仓库
//1:发布到滴滴内部仓库 一般不建议使用 如果需要发布到滴滴内网仓库需要将版本号改得比较大 假如版本号跟jcenter上的一致会由于缓存导致没法下载最新的jcenter的线上代码
//2:发布到maven_central远程仓库
archives_type: 1,
archives_type: 0,
//0:依赖dokit本地module运行
//1:依赖dokit远程aar运行
run_type : 0,
Expand All @@ -12,8 +12,9 @@ ext {
run_env : 1,
//是否使用本地仓库,需要使用绝对路径,仓库地址在 local.properties 中添加 LOCAL_REPOSITORY_URL
use_local : true,
group_id : 'io.github.didi.dokit',
version : '3.6.1.700'
// group_id : 'io.github.didi.dokit',
group_id : 'com.didichuxing.doraemonkit',
version : '3.7.0.5'
]

android = [compileSdkVersion : 29,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ class DoKitPluginConfigProcessor(val project: Project) : VariantProcessor {
val parser = SAXParserFactory.newInstance().newSAXParser()
val handler = DoKitComponentHandler()
"App Manifest path====>$manifest".println()
parser.parse(manifest, handler)
try {
parser.parse(manifest, handler)
} catch (e: Exception) {
e.printStackTrace()
"===processDebugManifest task error. ${manifest.absoluteFile}".println()
}
"App PackageName is====>${handler.appPackageName}".println()
"App Application path====>${handler.applications}".println()
DoKitExtUtil.setAppPackageName(handler.appPackageName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import com.didichuxing.doraemonkit.kit.network.okhttp.interceptor.AbsDoKitInterc
import com.didichuxing.doraemonkit.kit.test.mock.MockManager
import com.didichuxing.doraemonkit.kit.test.utils.RandomIdentityUtil
import com.didichuxing.doraemonkit.util.LogHelper
import io.ktor.http.*
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.runBlocking
import okhttp3.*
import java.io.IOException
import java.util.*
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
Expand Down
4 changes: 1 addition & 3 deletions Android/dokit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ configurations.all {
// }
}
}
repositories {
mavenCentral()
}




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,19 @@ public static class EventBean {
* 埋点记录时间
*/
private String time;
/**
* 页面ID
*/
private String pageId;
/**
* 业务专区名称/功能名称
*/
private String businessName;

EventBean(String eventName) {
EventBean(String eventName, String pageId, String businessName) {
this.eventName = eventName;
this.pageId = pageId;
this.businessName = businessName;
this.time = "" + TimeUtils.getNowMills();
}

Expand All @@ -84,13 +94,14 @@ String getTime() {
return time;
}


@Override
public String toString() {
return "EventBean{" +
", eventName='" + eventName + '\'' +
", time=" + time +
'}';
"eventName='" + eventName + '\'' +
", time='" + time + '\'' +
", pageId='" + pageId + '\'' +
", businessName='" + businessName + '\'' +
'}';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,23 @@ public static DataPickManager getInstance() {
return DataPickManager.Holder.INSTANCE;
}


public void addData(@NonNull String eventName) {
addData(eventName, "");
}

public void addData(@NonNull String eventName, @NonNull String pageId) {
addData(eventName, pageId,"");
}

/**
* 添加埋点数据
*
* @param eventName
*/
public void addData(@NonNull String eventName) {
public void addData(@NonNull String eventName, @NonNull String pageId,String businessName) {

DataPickBean.EventBean eventBean = new DataPickBean.EventBean(eventName);
DataPickBean.EventBean eventBean = new DataPickBean.EventBean(eventName, pageId,businessName);
if (events != null) {
events.add(eventBean);
//链表数据大于10s 上传数据
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.didichuxing.doraemonkit.datapick;

import android.app.Activity;

import com.didichuxing.doraemonkit.util.ActivityUtils;

/**
* didi Create on 2022/7/14 .
* <p>
* Copyright (c) 2022/7/14 by didiglobal.com.
*
* @author <a href="[email protected]">zhangjun</a>
* @version 1.0
* @Date 2022/7/14 2:57 下午
* @Description 用一句话说明文件功能
*/

public class DataPickUtils {


private static String mDoKitHomeClickPage = "";

private DataPickUtils() {
}

public static String getCurrentPage() {
Activity activity = ActivityUtils.getTopActivity();
if (activity != null) {
return activity.getClass().getName();
}
return "";
}


public static void setDoKitHomeClickPage(String pageId) {
mDoKitHomeClickPage = pageId;
}

public static String getDoKitHomeClickPage() {
return mDoKitHomeClickPage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal class NormalDoKitViewManager : AbsDoKitViewManager() {
private val context: Context get() = DoKitEnv.requireApp()

/**
*
* 每个Activity中dokitView的集合 用户手动移除和页面销毁时都需要remove
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import androidx.fragment.app.Fragment;

import com.didichuxing.doraemonkit.DoKit;
import com.didichuxing.doraemonkit.datapick.DataPickUtils;
import com.didichuxing.doraemonkit.util.ActivityUtils;
import com.didichuxing.doraemonkit.util.ToastUtils;
import com.didichuxing.doraemonkit.R;
Expand Down Expand Up @@ -118,7 +119,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mScalpelFrameLayout.setLayerInteractionEnabled(true);
}
//发送埋点
DataPickManager.getInstance().addData("dokit_sdk_ui_ck_widget_3d");
DataPickManager.getInstance().addData("dokit_sdk_ui_ck_widget_3d", DataPickUtils.getCurrentPage());
} else {
if (mScalpelFrameLayout != null) {
mScalpelFrameLayout.setLayerInteractionEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.didichuxing.doraemonkit.DoKit
import com.didichuxing.doraemonkit.R
import com.didichuxing.doraemonkit.config.FloatIconConfig
import com.didichuxing.doraemonkit.datapick.DataPickManager
import com.didichuxing.doraemonkit.datapick.DataPickUtils
import com.didichuxing.doraemonkit.kit.core.AbsDoKitView
import com.didichuxing.doraemonkit.kit.core.DoKitViewLayoutParams

Expand All @@ -28,9 +29,13 @@ class MainIconDoKitView : AbsDoKitView() {
doKitView?.id = R.id.float_icon_id
//设置icon 点击事件
doKitView?.setOnClickListener { //统计入口
DataPickManager.getInstance().addData("dokit_sdk_home_ck_entry")
val pageId = DataPickUtils.getCurrentPage()
DataPickUtils.setDoKitHomeClickPage(pageId)
DataPickManager.getInstance().addData("dokit_sdk_home_ck_entry", pageId)
DoKit.showToolPanel()
}

// DataPickManager.getInstance().addData("dokit_sdk_home_show", DataPickUtils.getCurrentPage())
}

override fun onCreateView(context: Context, view: FrameLayout): View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.didichuxing.doraemonkit.DoKit
import com.didichuxing.doraemonkit.R
import com.didichuxing.doraemonkit.datapick.DataPickManager
import com.didichuxing.doraemonkit.datapick.DataPickUtils
import com.didichuxing.doraemonkit.kit.core.AbsDoKitView
import com.didichuxing.doraemonkit.kit.core.DoKitManager
import com.didichuxing.doraemonkit.kit.core.DoKitViewLayoutParams
Expand Down Expand Up @@ -129,9 +130,9 @@ class ToolPanelDoKitView : AbsDoKitView() {

//添加埋点
if (it.isInnerKit && !TextUtils.isEmpty(it.innerKitId())) {
DataPickManager.getInstance().addData(it.innerKitId())
DataPickManager.getInstance().addData(it.innerKitId(), DataPickUtils.getDoKitHomeClickPage(), multiKitItem.name)
} else {
DataPickManager.getInstance().addData("dokit_sdk_business_ck")
DataPickManager.getInstance().addData("dokit_sdk_business_ck", DataPickUtils.getDoKitHomeClickPage(), multiKitItem.name)
}

}
Expand Down
2 changes: 1 addition & 1 deletion Android/upload_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ RES="\033[0m"
./gradlew :dokit-pthread-hook:assembleRelease --stacktrace
./gradlew :dokit-gps-mock:assembleRelease --stacktrace
#publish
./gradlew :dokit-plugin:publish --stacktrace
./gradlew :dokit:publish --stacktrace
./gradlew :dokit-no-op:publish --stacktrace
./gradlew :dokit-okhttp-api:publish --stacktrace
./gradlew :dokit-okhttp-v3:publish --stacktrace
./gradlew :dokit-okhttp-v4:publish --stacktrace
./gradlew :dokit-plugin:publish --stacktrace
./gradlew :dokit-ft:publish --stacktrace
./gradlew :dokit-test:publish --stacktrace
./gradlew :dokit-autotest:publish --stacktrace
Expand Down

0 comments on commit fc0473c

Please sign in to comment.