集成头条分包SDK
This commit is contained in:
@@ -295,6 +295,8 @@ dependencies {
|
||||
implementation project(path: ':flutter_boost')
|
||||
|
||||
implementation 'me.jessyan:autosize:1.2.1'
|
||||
|
||||
implementation files('libs/humesdk-1.0.0.aar')
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
BIN
app/libs/humesdk-1.0.0.aar
Normal file
BIN
app/libs/humesdk-1.0.0.aar
Normal file
Binary file not shown.
@@ -24,6 +24,7 @@ import com.alibaba.security.realidentity.activity.RPTakePhotoActivity;
|
||||
import com.alibaba.security.realidentity.activity.RPWebViewActivity;
|
||||
import com.alibaba.security.rp.RPSDK;
|
||||
import com.bumptech.glide.request.target.ViewTarget;
|
||||
import com.bytedance.hume.readapk.HumeSDK;
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.huawei.hms.support.common.ActivityMgr;
|
||||
import com.idlefish.flutterboost.FlutterBoost;
|
||||
@@ -171,7 +172,7 @@ public class XChatApplication extends Application {
|
||||
long startTime = System.currentTimeMillis();
|
||||
super.onCreate();
|
||||
instance = this;
|
||||
String channel = "official";
|
||||
String channel = "";
|
||||
try {
|
||||
ApplicationInfo appInfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
|
||||
channel = appInfo.metaData.getString("CHANNEL");
|
||||
@@ -181,8 +182,20 @@ public class XChatApplication extends Application {
|
||||
if (TextUtils.isEmpty(channel)) {
|
||||
channel = "official";
|
||||
}
|
||||
|
||||
BasicConfig.INSTANCE.setOriginalChannel(channel);
|
||||
|
||||
//头条分包渠道
|
||||
if (BasicConfig.INSTANCE.isByteDanceChannel()) {
|
||||
String byteDanceChannel = HumeSDK.getChannel(this);
|
||||
if (!TextUtils.isEmpty(byteDanceChannel)) {
|
||||
channel = byteDanceChannel;
|
||||
}
|
||||
}
|
||||
BasicConfig.INSTANCE.setChannel(channel);
|
||||
|
||||
LogUtils.d(channel + "");
|
||||
initEnv(channel);
|
||||
initEnv();
|
||||
|
||||
//延迟初始化云信
|
||||
NIMClient.init(this, null, options());
|
||||
@@ -315,24 +328,19 @@ public class XChatApplication extends Application {
|
||||
LinkedME.getInstance().setHandleActivity(MiddleActivity.class.getName());
|
||||
}
|
||||
|
||||
private void initEnv(String channel) {
|
||||
private void initEnv() {
|
||||
BasicConfig.INSTANCE.setAppContext(this.getApplicationContext());
|
||||
|
||||
//首先初始化环境
|
||||
Env.initEnv(BuildConfig.BUILD_TYPE, BuildConfig.DEBUG);
|
||||
|
||||
//切换生产坏境和测试环境 true/测试环境 false/生产环境
|
||||
BasicConfig.INSTANCE.setDebuggable(Env.isDebug());
|
||||
BasicConfig.INSTANCE.setChannel(channel);
|
||||
|
||||
BasicConfig.INSTANCE.setRootDir(Constants.ERBAN_DIR_NAME);
|
||||
BasicConfig.INSTANCE.setLogDir(Constants.LOG_DIR);
|
||||
BasicConfig.INSTANCE.setConfigDir(Constants.CONFIG_DIR);
|
||||
BasicConfig.INSTANCE.setVoiceDir(Constants.VOICE_DIR);
|
||||
BasicConfig.INSTANCE.setCacheDir(Constants.CACHE_DIR);
|
||||
BasicConfig.INSTANCE.setImageDir(Constants.IMAGE_CACHE_DIR);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -29,6 +29,8 @@ public enum BasicConfig {
|
||||
private File mCacheDir;
|
||||
private File mVoiceDir;
|
||||
private String channel;
|
||||
//apk的原始渠道,用于判断是不是头条,快手等渠道
|
||||
private String originalChannel;
|
||||
/*是否是审查中*/
|
||||
private boolean isCheck;
|
||||
|
||||
@@ -85,12 +87,20 @@ public enum BasicConfig {
|
||||
return channel;
|
||||
}
|
||||
|
||||
public String getOriginalChannel() {
|
||||
return originalChannel;
|
||||
}
|
||||
|
||||
public void setOriginalChannel(String originalChannel) {
|
||||
this.originalChannel = originalChannel;
|
||||
}
|
||||
|
||||
public boolean isByteDanceChannel() {
|
||||
return !TextUtils.isEmpty(channel) && channel.contains("toutiao");
|
||||
return !TextUtils.isEmpty(originalChannel) && originalChannel.contains("toutiao");
|
||||
}
|
||||
|
||||
public boolean isKwaiChannel() {
|
||||
return !TextUtils.isEmpty(channel) && channel.contains("kuaishou");
|
||||
return !TextUtils.isEmpty(originalChannel) && originalChannel.contains("kuaishou");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user