88import org .json .JSONArray ;
99import org .json .JSONObject ;
1010
11+ import java .io .File ;
1112import java .util .HashMap ;
1213import java .util .Map ;
1314
2324import cn .com .venvy .common .observer .ObservableManager ;
2425import cn .com .venvy .common .observer .VenvyObservableTarget ;
2526import cn .com .venvy .common .utils .VenvyAesUtil ;
27+ import cn .com .venvy .common .utils .VenvyFileUtil ;
2628import cn .com .venvy .common .utils .VenvyLog ;
2729import cn .com .venvy .common .utils .VenvyResourceUtil ;
2830import cn .com .venvy .lua .plugin .LVCommonParamPlugin ;
2931import cn .com .videopls .pub .exception .DownloadException ;
3032import cn .com .videopls .pub .view .VideoOSLuaView ;
3133
3234import static cn .com .venvy .App .getContext ;
35+ import static cn .com .venvy .PreloadLuaUpdate .LUA_CACHE_PATH ;
3336import static cn .com .venvy .common .observer .VenvyObservableTarget .Constant .CONSTANT_H5_URL ;
3437import static cn .com .venvy .common .observer .VenvyObservableTarget .Constant .CONSTANT_MSG ;
3538import 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