Skip to content

Commit cda44c7

Browse files
author
videopls
committed
Merge branch 'dev_2.9.0'
2 parents dbd37b7 + 55e3804 commit cda44c7

File tree

12 files changed

+102
-50
lines changed

12 files changed

+102
-50
lines changed

VideoOS/LuaViewSDK/src/cn/com/venvy/lua/plugin/LVVideoPlugin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static class GetExtendJSONString extends VarArgFunction {
7575

7676
@Override
7777
public Varargs invoke(Varargs args) {
78-
return mPlatform != null && mPlatform.getPlatformInfo().getExtendJSONString() != null ? LuaValue.valueOf(mPlatform.getPlatformInfo().getExtendJSONString()) : LuaValue.NIL;
78+
return mPlatform != null && mPlatform.getPlatformInfo() != null && mPlatform.getPlatformInfo().getExtendDict() != null && mPlatform.getPlatformInfo().getExtendDict().size() > 0 ? LuaUtil.toTable(mPlatform.getPlatformInfo().getExtendDict()) : LuaValue.NIL;
7979
}
8080
}
8181

@@ -403,8 +403,8 @@ public Varargs invoke(Varargs args) {
403403
if (!TextUtils.isEmpty(platformInfo.getVideoCategory())) {
404404
table.set("category", platformInfo.getVideoCategory());
405405
}
406-
if (!TextUtils.isEmpty(platformInfo.getExtendJSONString())) {
407-
table.set("extendJSONString", platformInfo.getExtendJSONString());
406+
if (platformInfo.getExtendDict() != null && platformInfo.getExtendDict().size() > 0) {
407+
table.set("extendDict", LuaUtil.toTable(platformInfo.getExtendDict()));
408408
}
409409
return table;
410410
}

VideoOS/LuaViewSDK/src/com/taobao/luaview/userdata/kit/UDApplet.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ public Varargs invoke(Varargs args) {
246246
if (targetType.equalsIgnoreCase("1")) {
247247
builder.setLinkUrl(linkData.optString("linkUrl"));
248248
} else if (targetType.equalsIgnoreCase("2")) {
249+
builder.setLinkUrl(linkData.optString("linkUrl"));
249250
builder.setDeepLink(linkData.optString("deepLink"));
250251
}
251252
WidgetInfo widgetInfo = builder.build();

VideoOS/VenvyLibrary/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ android {
44
compileSdkVersion 29
55
buildToolsVersion '28.0.3'
66
defaultConfig {
7-
minSdkVersion 19
7+
minSdkVersion 16
88
targetSdkVersion 28
99

1010
javaCompileOptions {

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/CacheConstants.java

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

11+
import java.util.ArrayList;
12+
1113
import cn.com.venvy.common.utils.VenvyPreferenceHelper;
1214

1315
/**
@@ -29,13 +31,14 @@ public class CacheConstants {
2931
* @param id
3032
*/
3133
public static void putVisionProgramId(Context context, String fileName, @NonNull String id) {
34+
3235
String data = VenvyPreferenceHelper.getString(context, fileName, RECENT_MINI_APP_ID, "[]");
3336
try {
3437
JSONArray array = new JSONArray(data);
3538
// 判断数据是否之前存在
3639
boolean isContains = false;
3740
for (int i = 0, len = array.length(); i < len; i++) {
38-
isContains = ((String) array.get(i)).equals(id);
41+
isContains = ((String) array.opt(i)).equals(id);
3942
if (isContains) {
4043
array.remove(i);
4144
array.put(id);
@@ -49,23 +52,36 @@ public static void putVisionProgramId(Context context, String fileName, @NonNull
4952
}
5053
array.put(id);
5154
}
55+
5256
VenvyPreferenceHelper.putString(context, fileName, RECENT_MINI_APP_ID, array.toString());
5357
} catch (JSONException e) {
5458
e.printStackTrace();
5559
}
5660
}
5761

62+
private static JSONArray reverse(JSONArray jsonArray) throws JSONException {
63+
for (int i = 0; i < jsonArray.length() / 2; i++) {
64+
Object temp = jsonArray.opt(i);
65+
jsonArray.put(i,jsonArray.opt(jsonArray.length() - 1 - i));
66+
jsonArray.put(jsonArray.length() - 1 - i, temp);
67+
}
68+
return jsonArray;
69+
}
70+
5871
/**
5972
* 获取最近使用的所有的小程序的id 集合
6073
*
6174
* @param context
6275
* @return
6376
*/
6477
public static String getVisionProgramId(Context context, String fileName) {
65-
return VenvyPreferenceHelper.getString(context, fileName, RECENT_MINI_APP_ID, "{}");
78+
try {
79+
return reverse(new JSONArray(VenvyPreferenceHelper.getString(context, fileName, RECENT_MINI_APP_ID, "[]"))).toString();
80+
} catch (JSONException e) {
81+
return "[]";
82+
}
6683
}
6784

68-
6985
private static JSONArray removeDuplicates(JSONArray array, String id) throws JSONException {
7086
boolean isContains;
7187
for (int i = 0, len = array.length(); i < len; i++) {

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/PlatformInfo.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import android.os.Parcel;
44
import android.os.Parcelable;
55

6+
import java.util.Map;
7+
68
import cn.com.venvy.common.interf.ScreenStatus;
79
import cn.com.venvy.common.interf.VideoType;
810

@@ -25,7 +27,7 @@ public class PlatformInfo implements Parcelable {
2527
private ScreenStatus mDirection;
2628
private VideoType mVideoType;
2729
private final String mVideoCategory;
28-
private final String mExtendJSONString;
30+
private Map mExtendDict;
2931
private final String mCustomerPackageName;
3032
private final String mFileProviderAuth;
3133

@@ -43,7 +45,7 @@ private PlatformInfo(Builder builder) {
4345
mDirection = builder.mInitDirection == null ? ScreenStatus.SMALL_VERTICAL : builder.mInitDirection;
4446
mVideoType = builder.mVideoType == null ? VideoType.VIDEOOS : builder.mVideoType;
4547
mVideoCategory = builder.videoCategory;
46-
mExtendJSONString = builder.extendJsonString;
48+
mExtendDict = builder.extendDict;
4749
mCustomerPackageName = builder.mCustomerPackageName;
4850
mFileProviderAuth = builder.fileProviderAuth;
4951
}
@@ -54,8 +56,8 @@ public void updateDirection(ScreenStatus status) {
5456
}
5557
}
5658

57-
public String getExtendJSONString() {
58-
return mExtendJSONString;
59+
public Map getExtendDict() {
60+
return mExtendDict;
5961
}
6062

6163
public String getVideoCategory() {
@@ -134,7 +136,7 @@ public static class Builder {
134136
private ScreenStatus mInitDirection;
135137
private VideoType mVideoType;
136138
private String videoCategory;
137-
private String extendJsonString;
139+
private Map extendDict;
138140
private String mCustomerPackageName;
139141
private String fileProviderAuth;
140142

@@ -143,8 +145,8 @@ public Builder setCustomerPackageName(String mCustomerPackageName) {
143145
return this;
144146
}
145147

146-
public Builder setExtendJSONString(String extendJsonString) {
147-
this.extendJsonString = extendJsonString;
148+
public Builder setExtendDict(Map extendDict) {
149+
this.extendDict = extendDict;
148150
return this;
149151
}
150152

@@ -256,7 +258,7 @@ public void writeToParcel(Parcel dest, int flags) {
256258
dest.writeInt(this.mDirection == null ? -1 : this.mDirection.getId());
257259
dest.writeInt(this.mVideoType == null ? 0 : this.mVideoType.getId());
258260
dest.writeString(this.mVideoCategory);
259-
dest.writeString(this.mExtendJSONString);
261+
dest.writeMap(this.mExtendDict);
260262
dest.writeString(this.mCustomerPackageName);
261263
dest.writeString(this.mFileProviderAuth);
262264
}
@@ -276,7 +278,7 @@ protected PlatformInfo(Parcel in) {
276278
this.mDirection = tmpMInitDirection == -1 ? ScreenStatus.SMALL_VERTICAL : ScreenStatus.getStatusById(tmpMInitDirection);
277279
this.mVideoType = tmpMInitDirection == -1 ? VideoType.VIDEOOS : VideoType.getStatusById(tmpMInitDirection);
278280
this.mVideoCategory = in.readString();
279-
this.mExtendJSONString = in.readString();
281+
in.readMap(this.mExtendDict,Map.class.getClassLoader());
280282
this.mCustomerPackageName = in.readString();
281283
this.mFileProviderAuth = in.readString();
282284
}

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/statistics/StatisticDCUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public static String obtainFlowStatisticJson(int type, StatisticsInfoBean.FileIn
101101
}
102102

103103

104+
104105
public static String obtainFlowStatisticJson(int type, List<DownloadTask> downloadTaskList, int downLoadStage) throws JSONException {
105106
JSONArray fileInfoArray = new JSONArray();
106107
JSONObject tmpObj = null;

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/statistics/VenvyStatisticsManager.java

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ public final class VenvyStatisticsManager {
2323
public static final int PRELOAD_FLOW = 5;
2424
public static final int OPEN_PAGE = 6;
2525
public static final int CLOSE_PAGE = 7;
26+
public static final int PAGE_NAME = 8;
2627

2728
private Platform platform;
29+
2830
private VenvyStatisticsManager() {
2931

3032
}
@@ -42,25 +44,27 @@ public void init(Platform platform) {
4244
}
4345

4446
public void submitCommonTrack(int type, JSONObject jsonObj) {
45-
if(jsonObj == null){
47+
if (jsonObj == null) {
4648
return;
4749
}
4850
if (VenvyStatisticsManager.AB_APPLET_TRACK == type) {
4951
submitABAppletTrackStatisticsInfo(jsonObj);
5052
} else if (VenvyStatisticsManager.USER_ACTION == type) {
5153
submitUserActionStatisticsInfo(jsonObj);
52-
}else if (VenvyStatisticsManager.VISUAL_SWITCH_COUNT == type) {
54+
} else if (VenvyStatisticsManager.VISUAL_SWITCH_COUNT == type) {
5355
submitVisualSwitchStatisticsInfo(jsonObj);
54-
}else if (VenvyStatisticsManager.PLAY_CONFIRM == type) {
56+
} else if (VenvyStatisticsManager.PLAY_CONFIRM == type) {
5557
submitPlayConfirmStatisticsInfo(jsonObj);
56-
}else if (VenvyStatisticsManager.PRELOAD_FLOW == type) {
58+
} else if (VenvyStatisticsManager.PRELOAD_FLOW == type) {
5759
submitPreLoadFlowStatisticsInfo(jsonObj);
58-
}else if (VenvyStatisticsManager.OPEN_PAGE == type || VenvyStatisticsManager.CLOSE_PAGE == type) {
59-
executeThread(jsonObj.toString());
60+
} else if (VenvyStatisticsManager.OPEN_PAGE == type
61+
|| VenvyStatisticsManager.CLOSE_PAGE == type
62+
|| VenvyStatisticsManager.PAGE_NAME == type) {
63+
submitABAppletTrackStatisticsInfo(type, jsonObj);
6064
}
6165
}
6266

63-
private void submitPreLoadFlowStatisticsInfo(JSONObject jsonObj){
67+
private void submitPreLoadFlowStatisticsInfo(JSONObject jsonObj) {
6468
try {
6569
String dataJson = StatisticDCUtils.obtainPreLoadFlowStatisticsJson(VenvyStatisticsManager.PRELOAD_FLOW, jsonObj);
6670
executeThread(dataJson);
@@ -69,7 +73,7 @@ private void submitPreLoadFlowStatisticsInfo(JSONObject jsonObj){
6973
}
7074
}
7175

72-
private void submitPlayConfirmStatisticsInfo(JSONObject jsonObj){
76+
private void submitPlayConfirmStatisticsInfo(JSONObject jsonObj) {
7377
try {
7478
String dataJson = StatisticDCUtils.obtainPlayConfirmStatisticsJson(VenvyStatisticsManager.PLAY_CONFIRM, jsonObj);
7579
executeThread(dataJson);
@@ -78,7 +82,7 @@ private void submitPlayConfirmStatisticsInfo(JSONObject jsonObj){
7882
}
7983
}
8084

81-
private void submitVisualSwitchStatisticsInfo(JSONObject jsonObj){
85+
private void submitVisualSwitchStatisticsInfo(JSONObject jsonObj) {
8286
try {
8387
String dataJson = StatisticDCUtils.obtainVisualSwitchStatisticsJson(VenvyStatisticsManager.VISUAL_SWITCH_COUNT, jsonObj);
8488
executeThread(dataJson);
@@ -105,14 +109,23 @@ private void submitABAppletTrackStatisticsInfo(JSONObject jsonObj) {
105109
}
106110
}
107111

112+
private void submitABAppletTrackStatisticsInfo(int type, JSONObject jsonObj) {
113+
try {
114+
String dataJson = StatisticDCUtils.obtainABAppletTrackStatisticsJson(type, jsonObj);
115+
executeThread(dataJson);
116+
} catch (JSONException e) {
117+
e.printStackTrace();
118+
}
119+
}
120+
108121
private void executeThread(String dataJson) {
109-
if(!TextUtils.isEmpty(dataJson) && platform != null){
110-
ThreadManager.getInstance().createLongPool().execute(new AsyncStatisticsRunnable(platform,dataJson));
122+
if (!TextUtils.isEmpty(dataJson) && platform != null) {
123+
ThreadManager.getInstance().createLongPool().execute(new AsyncStatisticsRunnable(platform, dataJson));
111124
}
112125
}
113126

114127
public void submitVisualSwitchStatisticsInfo(String onOrOff) {
115-
if(TextUtils.isEmpty(onOrOff) || platform == null){
128+
if (TextUtils.isEmpty(onOrOff) || platform == null) {
116129
return;
117130
}
118131
try {
@@ -123,20 +136,20 @@ public void submitVisualSwitchStatisticsInfo(String onOrOff) {
123136
}
124137
}
125138

126-
public void submitFileStatisticsInfo(List<DownloadTask> downloadTaskList ,int downLoadStage) {
127-
if(downloadTaskList == null || downloadTaskList.size() <= 0 || platform == null){
139+
public void submitFileStatisticsInfo(List<DownloadTask> downloadTaskList, int downLoadStage) {
140+
if (downloadTaskList == null || downloadTaskList.size() <= 0 || platform == null) {
128141
return;
129142
}
130143
try {
131-
String dataJson = StatisticDCUtils.obtainFlowStatisticJson(VenvyStatisticsManager.PRELOAD_FLOW,downloadTaskList,downLoadStage);
144+
String dataJson = StatisticDCUtils.obtainFlowStatisticJson(VenvyStatisticsManager.PRELOAD_FLOW, downloadTaskList, downLoadStage);
132145
executeThread(dataJson);
133146
} catch (JSONException e) {
134147
e.printStackTrace();
135148
}
136149
}
137150

138-
public void submitFileStatisticsInfo(StatisticsInfoBean.FileInfoBean fileInfoBean , int downLoadStage) {
139-
if(fileInfoBean == null || platform == null){
151+
public void submitFileStatisticsInfo(StatisticsInfoBean.FileInfoBean fileInfoBean, int downLoadStage) {
152+
if (fileInfoBean == null || platform == null) {
140153
return;
141154
}
142155
try {

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public class JsBridge implements VenvyObserver {
6565
private BaseRequestConnect mBaseRequestConnect;
6666
protected Context mContext;
6767
protected String ssid = System.currentTimeMillis() + "";
68+
6869
private WebViewCloseListener mWebViewCloseListener;
6970
//是否禁止打开支付宝app true:禁止;false:打开支付宝
7071
public boolean payDisabled;
@@ -278,7 +279,7 @@ public void openAds(String jsParams) {
278279
trackData.putString(VenvyObservableTarget.Constant.CONSTANT_DOWNLOAD_API, downAPI);
279280
trackData.putStringArray("isTrackLinks", toStringArray(downloadTrackLink.optJSONArray("isTrackLinks")));
280281
trackData.putStringArray("dsTrackLinks", toStringArray(downloadTrackLink.optJSONArray("dsTrackLinks")));
281-
trackData.putStringArray("dfTrackLinks",toStringArray(downloadTrackLink.optJSONArray("dfTrackLinks")));
282+
trackData.putStringArray("dfTrackLinks", toStringArray(downloadTrackLink.optJSONArray("dfTrackLinks")));
282283
trackData.putStringArray("instTrackLinks", toStringArray(downloadTrackLink.optJSONArray("instTrackLinks")));
283284
trackData.putString("launchPlanId", jsonObject.optString("launchPlanId"));
284285
ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_DOWNLOAD_TASK, trackData);
@@ -290,11 +291,17 @@ public void openAds(String jsParams) {
290291
if (targetType.equalsIgnoreCase("1")) {
291292
builder.setLinkUrl(linkData.optString("linkUrl"));
292293
} else if (targetType.equalsIgnoreCase("2")) {
294+
builder.setLinkUrl(linkData.optString("linkUrl"));
293295
builder.setDeepLink(linkData.optString("deepLink"));
294296
}
295-
WidgetInfo widgetInfo = builder.build();
297+
final WidgetInfo widgetInfo = builder.build();
296298
if (mPlatform.getWidgetClickListener() != null) {
297-
mPlatform.getWidgetClickListener().onClick(widgetInfo);
299+
VenvyUIUtil.runOnUIThread(new Runnable() {
300+
@Override
301+
public void run() {
302+
mPlatform.getWidgetClickListener().onClick(widgetInfo);
303+
}
304+
});
298305
}
299306
}
300307
}
@@ -851,12 +858,23 @@ private JSONObject getVideoInfo() {
851858

852859
try {
853860
if (mPlatform != null) {
854-
jsonObject.put("videoID", mPlatform.getPlatformInfo().getVideoId());
861+
if(mPlatform.getPlatformInfo() != null){
862+
if(!TextUtils.isEmpty(mPlatform.getPlatformInfo().getVideoId())){
863+
jsonObject.put("videoID", mPlatform.getPlatformInfo().getVideoId());
864+
}
865+
if (!TextUtils.isEmpty(mPlatform.getPlatformInfo().getVideoCategory())) {
866+
jsonObject.put("category", mPlatform.getPlatformInfo().getVideoCategory());
867+
}
868+
if (mPlatform.getPlatformInfo().getExtendDict() != null && mPlatform.getPlatformInfo().getExtendDict().size() > 0) {
869+
jsonObject.put("extendDict", new JSONObject(mPlatform.getPlatformInfo().getExtendDict()));
870+
}
871+
}
855872
IMediaControlListener mediaControlListener = mPlatform.getMediaControlListener();
856873
if (mediaControlListener != null) {
857874
jsonObject.put("title", TextUtils.isEmpty(mediaControlListener.getVideoTitle()) ? "" : mediaControlListener.getVideoTitle());
858875
jsonObject.put("episode", TextUtils.isEmpty(mediaControlListener.getVideoEpisode()) ? "" : mediaControlListener.getVideoEpisode());
859876
}
877+
860878
}
861879
} catch (JSONException e) {
862880
e.printStackTrace();

VideoOS/venvy_pub/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ android {
44
buildToolsVersion '28.0.3'
55

66
defaultConfig {
7-
minSdkVersion 19
7+
minSdkVersion 16
88
targetSdkVersion 28
99
javaCompileOptions {
1010
annotationProcessorOptions {

0 commit comments

Comments
 (0)