Skip to content

Commit 410e6b1

Browse files
author
videopls
committed
Merge branch 'dev_mode' into dev_2.7.0_test
2 parents 8e048e7 + a1b46d1 commit 410e6b1

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VisionProgramConfigModel.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.json.JSONArray;
99
import org.json.JSONObject;
1010

11+
import java.io.File;
1112
import java.util.HashMap;
1213
import java.util.Map;
1314

@@ -23,13 +24,15 @@
2324
import cn.com.venvy.common.observer.ObservableManager;
2425
import cn.com.venvy.common.observer.VenvyObservableTarget;
2526
import cn.com.venvy.common.utils.VenvyAesUtil;
27+
import cn.com.venvy.common.utils.VenvyFileUtil;
2628
import cn.com.venvy.common.utils.VenvyLog;
2729
import cn.com.venvy.common.utils.VenvyResourceUtil;
2830
import cn.com.venvy.lua.plugin.LVCommonParamPlugin;
2931
import cn.com.videopls.pub.exception.DownloadException;
3032
import cn.com.videopls.pub.view.VideoOSLuaView;
3133

3234
import static cn.com.venvy.App.getContext;
35+
import static cn.com.venvy.PreloadLuaUpdate.LUA_CACHE_PATH;
3336
import static cn.com.venvy.common.observer.VenvyObservableTarget.Constant.CONSTANT_H5_URL;
3437
import static cn.com.venvy.common.observer.VenvyObservableTarget.Constant.CONSTANT_MSG;
3538
import static cn.com.venvy.common.observer.VenvyObservableTarget.Constant.CONSTANT_NEED_RETRY;
@@ -110,7 +113,15 @@ public void requestFinish(Request request, IResponse response) {
110113
String jsonStr = "";
111114
if (App.isIsDevMode()) {
112115
VenvyLog.d("devMode is open");
113-
// jsonStr = VenvyAssetsUtil.readFileAssets("dev_config.json",App.getContext());
116+
String jsonFilePath = VenvyFileUtil.getCachePath(App.getContext()) + LUA_CACHE_PATH + File.separator + "dev_config.json";
117+
File file = new File(jsonFilePath);
118+
if (file.exists()) {
119+
jsonStr = VenvyFileUtil.readFile(App.getContext(), jsonFilePath, null);
120+
} else {
121+
VenvyLog.e("The dev mode is open,but json file not found");
122+
return;
123+
}
124+
114125
} else {
115126
VenvyLog.d("devMode is close");
116127
jsonStr = VenvyAesUtil.decrypt(encryptData, AppSecret.getAppSecret(getPlatform()), AppSecret.getAppSecret(getPlatform()));
@@ -135,7 +146,7 @@ public void requestFinish(Request request, IResponse response) {
135146
// 开发者模式下 则是:[{url:本地filePath}, {url:本地filePath} , ...]
136147
JSONArray fileListArray = decryptData.optJSONArray("luaList");
137148
final String template = decryptData.optString("template"); // 入口lua文件名称
138-
String resCode = App.isIsDevMode() ? "-1" : decryptData.optString("resCode"); // 应答码 00-成功 01-失败
149+
String resCode = App.isIsDevMode() ? "-1" : decryptData.optString("resCode"); // 应答码 00-成功 01-失败
139150
JSONObject displayObj = decryptData.optJSONObject("display");
140151

141152
if (displayObj != null) {
@@ -175,10 +186,13 @@ public void updateError(Throwable t) {
175186
VenvyResourceUtil.getStringId(getContext(), "errorDesc")));
176187
bundle.putBoolean(CONSTANT_NEED_RETRY, false);
177188
ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_SHOW_VISION_ERROR_LOGIC, bundle);
178-
} else if(resCode.equalsIgnoreCase("-1")){
189+
} else if (resCode.equalsIgnoreCase("-1")) {
179190
// 开发者模式
180-
181-
}else {
191+
VisionProgramConfigCallback callback = getCallback();
192+
if (callback != null) {
193+
callback.downComplete(template, false);
194+
}
195+
} else {
182196
VenvyLog.e(decryptData.optString("resMsg")); // 应答信息
183197
}
184198

0 commit comments

Comments
 (0)