update 插件化判断代码

This commit is contained in:
zlzw 2023-06-28 17:37:10 +08:00
parent 1a3d66553c
commit 17c2e7f795
4 changed files with 14 additions and 1 deletions

View File

@ -159,6 +159,9 @@
<meta-data
android:name="IS_UPLOAD_ERROR_LOG"
android:value="${isUploadLog}" />
<meta-data
android:name="IS_PLUGIN_MODEL"
android:value="${isPluginModel}" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${isUploadLog}" />

View File

@ -35,6 +35,8 @@ public class CommonAppConfig {
public static final boolean IS_GOOGLE_PLAY = getMetaDataBoolean("IS_GOOGLE_PLAY");
//是否开启上报错误日志功能
public static final boolean IS_UPLOAD_ERROR_LOG = getMetaDataBoolean("IS_UPLOAD_ERROR_LOG");
//是否为插件包模式
public static final boolean IS_PLUGIN_MODEL = getMetaDataBoolean("IS_PLUGIN_MODEL");
//外部sd卡
public static final String DCMI_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();

View File

@ -8,6 +8,7 @@ import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import java.io.BufferedInputStream;
@ -47,6 +48,9 @@ public class PluginManager {
}
public boolean isDownloadApk() {
if(!CommonAppConfig.IS_PLUGIN_MODEL){
return true;
}
return new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk").exists();
}
@ -54,6 +58,10 @@ public class PluginManager {
* 加载主播插件
*/
public void loadAnchorPlugin(DialogInterface.OnDismissListener dismissListener) {
if(!CommonAppConfig.IS_PLUGIN_MODEL){
dismissListener.onDismiss(null);
return;
}
new Thread(() -> {
try {
if (Arrays.asList(CommonAppContext.sInstance.getAssets().list("")).contains("anchorPlugin.apk")) {

View File

@ -216,7 +216,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
}
};
}
if (PluginManager.getInstance().isDownloadApk()) {
if (!CommonAppConfig.IS_PLUGIN_MODEL || PluginManager.getInstance().isDownloadApk()) {
PluginManager.getInstance().loadAnchorPlugin(it -> {
LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback);
});