Skip to content

Commit 3399b65

Browse files
author
lucas
committed
SDK 跳转Lua 的协议中加入miniAppId
1 parent 0e24620 commit 3399b65

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

VideoOS/LuaViewSDK/src/cn/com/venvy/lua/view/VenvyLVWebView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private String getDeveloperUserId(Globals globals) {
145145
try {
146146
JSONObject dataObj = new JSONObject(dataParams.get("data"));
147147
JSONObject miniAppInfoObj = dataObj.optJSONObject("miniAppInfo");
148-
developerUserId = miniAppInfoObj.optString("developerUserId");
148+
developerUserId = miniAppInfoObj != null ? miniAppInfoObj.optString("developerUserId") : "";
149149
} catch (Exception e) {
150150
e.printStackTrace();
151151
}

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/utils/VenvySchemeUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class VenvySchemeUtil {
1818

1919
public static final String QUERY_PARAMETER_TEMPLATE = "template";
2020
public static final String QUERY_PARAMETER_ID = "id";
21+
public static final String QUERY_MINIAPP_ID = "miniAppId";
2122
public static final String QUERY_PARAMETER_PRIORITY = "priority";
2223
public static final String QUERY_PARAMETER_EVENT_TYPE = "eventType";
2324
public static final String QUERY_PARAMETER_ACTION_TYPE = "actionType";

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/webview/JsBridge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ public void getStorageData(final String jsParams) {
353353
VenvyUIUtil.runOnUIThread(new Runnable() {
354354
@Override
355355
public void run() {
356-
callJsFunction(VenvyPreferenceHelper.getString(mContext, mDeveloperUserId, key, ""), jsParams);
356+
callJsFunction(VenvyPreferenceHelper.getString(mContext, TextUtils.isEmpty(mDeveloperUserId) ? "" : mDeveloperUserId, key, ""), jsParams);
357357
}
358358
});
359359

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ public void successful(Object result, String miniAppInfo, final ServiceQueryAdsI
182182

183183
// miniAppInfo
184184
if (!TextUtils.isEmpty(miniAppInfo)) {
185-
jsonObject.put(CONSTANT_MINI_APP_INFO, new JSONObject(miniAppInfo));
185+
JSONObject miniAppJson = new JSONObject(miniAppInfo);
186+
jsonObject.put(CONSTANT_MINI_APP_INFO, miniAppJson);
187+
builder.appendQueryParameter(VenvySchemeUtil.QUERY_MINIAPP_ID,miniAppJson.getString("miniAppId"));
188+
}else{
189+
builder.appendQueryParameter(VenvySchemeUtil.QUERY_MINIAPP_ID,"");
186190
}
187191
skipParams.put(CONSTANT_DATA, jsonObject.toString());
188192
} catch (JSONException e) {

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,19 @@ public void launchDesktopProgram(String targetName, String miniAppInfo, String v
279279
addView(programViewDesktop, getChildCount() - 1);// 上层还有
280280
if (!TextUtils.isEmpty(targetName)) {
281281
programViewDesktop.setVisibility(VISIBLE);
282-
Uri uri = Uri.parse("LuaView://desktopLuaView?template=" + targetName + "&id=" + targetName.substring(0, targetName.lastIndexOf(".")));
283-
// HashMap<String, String> params = new HashMap<>();
284-
// params.put(VenvyObservableTarget.Constant.CONSTANT_MINI_APP_INFO, miniAppInfo);// miniAppInfo
285-
// params.put(VenvyObservableTarget.Constant.CONSTANT_VIDEO_MODE_TYPE, videoModeType);// videoModeType
286-
287282
JSONObject jsonObject = new JSONObject();
283+
Uri uri = null;
288284
try {
289-
jsonObject.put(VenvyObservableTarget.Constant.CONSTANT_MINI_APP_INFO, new JSONObject(miniAppInfo));// miniAppInfo
285+
JSONObject miniAppInfoJson = new JSONObject(TextUtils.isEmpty(miniAppInfo) ? "{}" : miniAppInfo);
286+
uri = Uri.parse("LuaView://desktopLuaView?template=" + targetName + "&miniAppId=" + miniAppInfoJson.getString("miniAppId") + "&id=" + targetName.substring(0, targetName.lastIndexOf(".")));
287+
jsonObject.put(VenvyObservableTarget.Constant.CONSTANT_MINI_APP_INFO, miniAppInfoJson);// miniAppInfo
290288
jsonObject.put(VenvyObservableTarget.Constant.CONSTANT_VIDEO_MODE_TYPE, videoModeType);// videoModeType
291289
} catch (JSONException e) {
292290
e.printStackTrace();
293291
}
294292

295-
HashMap<String,String> finalParams = new HashMap<>();
296-
finalParams.put("data",jsonObject.toString());
293+
HashMap<String, String> finalParams = new HashMap<>();
294+
finalParams.put("data", jsonObject.toString());
297295
programViewDesktop.navigation(uri, finalParams, null);
298296
}
299297

0 commit comments

Comments
 (0)