@@ -47,6 +47,8 @@ public class VideoOSLuaView extends VideoOSBaseView {
4747
4848 private static final String INIT_SCRIPT = "Init_ScriptBundle" ;
4949 private static final String LOCAL_LUA_PATH = "lua/" ;
50+ private static final String KEY_MINIAPPID = "miniAppId" ;
51+ private static final String KEY_APPLETID = "appletId" ;
5052 private volatile LuaView mLuaView ;
5153 private boolean hasCallShowFunction = false ;
5254 public static ScriptBundle sScriptBundle ;
@@ -212,20 +214,27 @@ private void runLuaFile(final LuaView luaView, final String luaName, final Objec
212214 if (TextUtils .isEmpty (luaName )) {
213215 return ;
214216 }
215- // if (luaName.contains("os_video_figureStarList_hotspot.lua")) {
216- // runLua(luaView, luaName, valueData);
217- // return;
218- // }
217+ String miniAppId = "" ;
218+ if (valueData instanceof HashMap ) {
219+ HashMap params = (HashMap ) valueData ;
220+ if (params != null && params .size () >= 0 ) {
221+ if (params .containsKey (KEY_MINIAPPID )) {
222+ miniAppId = params .get (KEY_MINIAPPID ) == null ? "" : String .valueOf (params .get (KEY_MINIAPPID ));
223+ } else if (params .containsKey (KEY_APPLETID )) {
224+ miniAppId = params .get (KEY_APPLETID ) == null ? "" : String .valueOf (params .get (KEY_APPLETID ));
225+ }
226+ }
227+ }
219228 if (sScriptBundle == null ) {
220229 sScriptBundle = initScriptBundle (VenvyFileUtil .getCachePath (VideoOSLuaView .this .getContext ()) + PreloadLuaUpdate .LUA_CACHE_PATH );
221230 if (sScriptBundle != null ) {
222- luaView .loadScriptBundle (sScriptBundle , luaName ,
231+ luaView .loadScriptBundle (sScriptBundle , TextUtils . isEmpty ( miniAppId ) ? luaName : miniAppId + File . separator + luaName ,
223232 new LuaCallbackImpl (valueData ));
224233 } else {
225234 runLua (luaView , luaName , valueData );
226235 }
227236 } else {
228- luaView .loadScriptBundle (sScriptBundle , luaName , new LuaCallbackImpl (valueData ));
237+ luaView .loadScriptBundle (sScriptBundle , TextUtils . isEmpty ( miniAppId ) ? luaName : miniAppId + File . separator + luaName , new LuaCallbackImpl (valueData ));
229238 }
230239 }
231240
@@ -297,8 +306,9 @@ private ScriptBundle initScriptBundle(String luaPath) {
297306 for (File childFile : file .listFiles ()) {
298307 if (TextUtils .equals ("lua" , VenvyFileUtil .getExtension (childFile .getName ()))) {
299308 byte [] data = getBytes (childFile .getPath ());
309+ String fileAbsolutePath = file .getAbsolutePath ();
300310 ScriptFile scriptFile = new ScriptFile (null ,
301- file . getAbsolutePath (), childFile .getName (), data );
311+ fileAbsolutePath , fileAbsolutePath . substring ( fileAbsolutePath . lastIndexOf ( "/" ) + 1 , fileAbsolutePath . length ()) + File . separator + childFile .getName (), data );
302312 scriptBundle .addScript (scriptFile );
303313 }
304314 }
0 commit comments