Skip to content

Commit 092688f

Browse files
committed
更新
1 parent 0160c03 commit 092688f

12 files changed

+80
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.13.15(2019-12-24)
2+
* 修复:修复使用批量发送方式发送数据时,网络从无网切换到有网时,数据无法发送的问题
3+
* 优化:onLaunch onShow 生命周期函数中,参数对象中获取不到scene值时的处理逻辑
4+
15
## 1.13.14(2019-12-02)
26
* 修复:参数中同时带有 scene 与渠道信息时,无法解析渠道信息
37
* 修复:多场景下扫描普通二维码时 q 参数的渠道解析逻辑

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2019 sensors-analytics / sdk
189+
Copyright 2020 sensors-analytics / sdk
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
请参见 [CHANGELOG.md](CHANGELOG.md)
2222

2323
## 开源社区
24-
神策正在组建开源社区,所以相应的源码也会放在 Github 上,针对微信小程序 SDK 源码的问题请不要在 Github 上提问。
25-
请加微信 free__dom ,备注开源社区,我会拉你暂时到微信群中讨论。
26-
在开源社区组建完成后,会转移到开源社区中讨论。
24+
神策正在组建开源社区,所以相应的源码也会放在 GitHub 上。
25+
针对微信小程序 SDK 源码的问题请不要在 GitHub 上提问,请加微信号 free__dom (两个下划线)私聊。
26+
如果是咨询神策收费,以及 SDK 使用问题,请扫码加入神策官方 SDK QQ 讨论群:<br><br>
27+
![ QQ 讨论群](https://raw.githubusercontent.com/sensorsdata/sa-sdk-android/master/docs/qrCode.jpeg)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sa-sdk-miniprogram",
3-
"version": "1.13.14",
3+
"version": "1.13.15",
44
"description": "sensorsdata miniprogram sdk",
55
"main": "sensorsdata.min.js",
66
"scripts": {

sensorsdata.custom.es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata.custom.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata.full.es6.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,15 @@ var ArrayProto = Array.prototype,
9494
slice = ArrayProto.slice,
9595
toString = ObjProto.toString,
9696
hasOwnProperty = ObjProto.hasOwnProperty,
97-
LIB_VERSION = '1.13.14',
97+
LIB_VERSION = '1.13.15',
9898
LIB_NAME = 'MiniProgram';
9999

100100
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
101101
var latest_source_channel = ['$latest_utm_source', '$latest_utm_medium', '$latest_utm_campaign', '$latest_utm_content', '$latest_utm_term', 'latest_sa_utm'];
102102

103103
var mp_scene = {
104-
1001: '发现栏小程序主入口,“最近使用”列表',
104+
1000: '其他',
105+
1001: '发现栏小程序主入口,「最近使用」列表(基础库2.2.4版本起包含「我的小程序」列表)',
105106
1005: '顶部搜索框的搜索结果页',
106107
1006: '发现栏小程序主入口搜索框的搜索结果页',
107108
1007: '单人聊天会话中的小程序消息卡片',
@@ -159,6 +160,7 @@ var mp_scene = {
159160
1081: '客服消息下发的文字链',
160161
1082: '公众号会话下发的文字链',
161162
1084: '朋友圈广告原生页',
163+
1088: '会话中查看系统消息,打开小程序',
162164
1089: '微信聊天主界面下拉',
163165
1090: '长按小程序右上角菜单唤出最近使用历史',
164166
1091: '公众号文章商品卡片',
@@ -171,11 +173,16 @@ var mp_scene = {
171173
1103: '发现栏小程序主入口,“我的小程序”列表',
172174
1104: '微信聊天主界面下拉,“我的小程序”栏',
173175
1106: '聊天主界面下拉,从顶部搜索结果页,打开小程序',
176+
1107: '订阅消息,打开小程序',
177+
1113: '安卓手机负一屏,打开小程序(三星',
178+
1114: '安卓手机侧边栏,打开小程序(三星)',
174179
1124: '扫“一物一码”打开小程序',
175180
1125: '长按图片识别“一物一码”',
176181
1126: '扫描手机相册中选取的“一物一码”',
177182
1129: '微信爬虫访问',
178-
1131: '浮窗打开小程序'
183+
1131: '浮窗打开小程序',
184+
1146: '地理位置信息打开出行类小程序',
185+
1148: '卡包-交通卡,打开小程序'
179186
};
180187

181188

@@ -669,7 +676,7 @@ _.getObjFromQuery = function(str) {
669676
var obj = {};
670677
if (query && query[1]) {
671678
_.each(query[1].split('&'), function(value) {
672-
var arr = value.split('=');
679+
arr = value.split('=');
673680
if (arr[0] && arr[1]) {
674681
obj[arr[0]] = arr[1];
675682
}
@@ -1307,6 +1314,14 @@ sa.init = function(obj) {
13071314
this.hasInit = true;
13081315
sa.setPara(obj);
13091316
if (sa.para.batch_send) {
1317+
wx.getStorage({
1318+
key: 'sensors_mp_prepare_data',
1319+
complete(res) {
1320+
var queue = res.data && _.isArray(res.data) ? res.data : [];
1321+
sa.store.mem.mdata = queue.concat(sa.store.mem.mdata);
1322+
sa.sendStrategy.syncStorage = true;
1323+
}
1324+
});
13101325
sa.sendStrategy.batchInterval();
13111326
}
13121327
sa.initialState.storeIsComplete = true;
@@ -1388,6 +1403,7 @@ sa.dataQueue = _.autoExeQueue();
13881403
sa.sendStrategy = {
13891404
dataHasSend: true,
13901405
dataHasChange: false,
1406+
syncStorage: false,
13911407
onAppHide: function() {
13921408
if (sa.para.batch_send) {
13931409
this.batchSend();
@@ -1441,6 +1457,9 @@ sa.sendStrategy = {
14411457
data: 'data_list=' + encodeURIComponent(_.base64Encode(option.data)),
14421458
success: function() {
14431459
option.success(option.len);
1460+
},
1461+
fail: function() {
1462+
option.fail();
14441463
}
14451464
});
14461465
} else {
@@ -1456,11 +1475,15 @@ sa.sendStrategy = {
14561475
this.wxrequest({
14571476
data: data,
14581477
len: len,
1459-
success: this.batchRemove.bind(this)
1478+
success: this.batchRemove.bind(this),
1479+
fail: this.sendFail.bind(this)
14601480
});
14611481
}
14621482
}
14631483
},
1484+
sendFail: function() {
1485+
this.dataHasSend = true;
1486+
},
14641487
batchRemove: function(len) {
14651488
sa.store.mem.clear(len);
14661489
this.dataHasSend = true;
@@ -1479,10 +1502,13 @@ sa.sendStrategy = {
14791502
}
14801503

14811504
this.dataHasChange = false;
1482-
sa._.setStorageSync('sensors_mp_prepare_data', sa.store.mem.mdata);
1505+
if (this.syncStorage) {
1506+
sa._.setStorageSync('sensors_mp_prepare_data', sa.store.mem.mdata);
1507+
}
14831508
}
14841509
},
14851510
batchInterval: function() {
1511+
14861512
var _this = this;
14871513

14881514
function loopWrite() {
@@ -1641,7 +1667,6 @@ sa.autoTrackCustom = {
16411667

16421668
sa.setLatestChannel(utms.pre2);
16431669

1644-
para.scene = para.scene || '未取到值';
16451670
prop.$scene = _.getMPScene(para.scene);
16461671
sa.registerApp({
16471672
$latest_scene: prop.$scene
@@ -1671,7 +1696,6 @@ sa.autoTrackCustom = {
16711696

16721697
sa.setLatestChannel(utms.pre2);
16731698

1674-
para.scene = para.scene || '未取到值';
16751699
prop.$scene = _.getMPScene(para.scene);
16761700
sa.registerApp({
16771701
$latest_scene: prop.$scene

sensorsdata.full.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,15 @@ var ArrayProto = Array.prototype,
9494
slice = ArrayProto.slice,
9595
toString = ObjProto.toString,
9696
hasOwnProperty = ObjProto.hasOwnProperty,
97-
LIB_VERSION = '1.13.14',
97+
LIB_VERSION = '1.13.15',
9898
LIB_NAME = 'MiniProgram';
9999

100100
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
101101
var latest_source_channel = ['$latest_utm_source', '$latest_utm_medium', '$latest_utm_campaign', '$latest_utm_content', '$latest_utm_term', 'latest_sa_utm'];
102102

103103
var mp_scene = {
104-
1001: '发现栏小程序主入口,“最近使用”列表',
104+
1000: '其他',
105+
1001: '发现栏小程序主入口,「最近使用」列表(基础库2.2.4版本起包含「我的小程序」列表)',
105106
1005: '顶部搜索框的搜索结果页',
106107
1006: '发现栏小程序主入口搜索框的搜索结果页',
107108
1007: '单人聊天会话中的小程序消息卡片',
@@ -159,6 +160,7 @@ var mp_scene = {
159160
1081: '客服消息下发的文字链',
160161
1082: '公众号会话下发的文字链',
161162
1084: '朋友圈广告原生页',
163+
1088: '会话中查看系统消息,打开小程序',
162164
1089: '微信聊天主界面下拉',
163165
1090: '长按小程序右上角菜单唤出最近使用历史',
164166
1091: '公众号文章商品卡片',
@@ -171,11 +173,16 @@ var mp_scene = {
171173
1103: '发现栏小程序主入口,“我的小程序”列表',
172174
1104: '微信聊天主界面下拉,“我的小程序”栏',
173175
1106: '聊天主界面下拉,从顶部搜索结果页,打开小程序',
176+
1107: '订阅消息,打开小程序',
177+
1113: '安卓手机负一屏,打开小程序(三星',
178+
1114: '安卓手机侧边栏,打开小程序(三星)',
174179
1124: '扫“一物一码”打开小程序',
175180
1125: '长按图片识别“一物一码”',
176181
1126: '扫描手机相册中选取的“一物一码”',
177182
1129: '微信爬虫访问',
178-
1131: '浮窗打开小程序'
183+
1131: '浮窗打开小程序',
184+
1146: '地理位置信息打开出行类小程序',
185+
1148: '卡包-交通卡,打开小程序'
179186
};
180187

181188

@@ -669,7 +676,7 @@ _.getObjFromQuery = function(str) {
669676
var obj = {};
670677
if (query && query[1]) {
671678
_.each(query[1].split('&'), function(value) {
672-
var arr = value.split('=');
679+
arr = value.split('=');
673680
if (arr[0] && arr[1]) {
674681
obj[arr[0]] = arr[1];
675682
}
@@ -1307,6 +1314,14 @@ sa.init = function(obj) {
13071314
this.hasInit = true;
13081315
sa.setPara(obj);
13091316
if (sa.para.batch_send) {
1317+
wx.getStorage({
1318+
key: 'sensors_mp_prepare_data',
1319+
complete(res) {
1320+
var queue = res.data && _.isArray(res.data) ? res.data : [];
1321+
sa.store.mem.mdata = queue.concat(sa.store.mem.mdata);
1322+
sa.sendStrategy.syncStorage = true;
1323+
}
1324+
});
13101325
sa.sendStrategy.batchInterval();
13111326
}
13121327
sa.initialState.storeIsComplete = true;
@@ -1388,6 +1403,7 @@ sa.dataQueue = _.autoExeQueue();
13881403
sa.sendStrategy = {
13891404
dataHasSend: true,
13901405
dataHasChange: false,
1406+
syncStorage: false,
13911407
onAppHide: function() {
13921408
if (sa.para.batch_send) {
13931409
this.batchSend();
@@ -1441,6 +1457,9 @@ sa.sendStrategy = {
14411457
data: 'data_list=' + encodeURIComponent(_.base64Encode(option.data)),
14421458
success: function() {
14431459
option.success(option.len);
1460+
},
1461+
fail: function() {
1462+
option.fail();
14441463
}
14451464
});
14461465
} else {
@@ -1456,11 +1475,15 @@ sa.sendStrategy = {
14561475
this.wxrequest({
14571476
data: data,
14581477
len: len,
1459-
success: this.batchRemove.bind(this)
1478+
success: this.batchRemove.bind(this),
1479+
fail: this.sendFail.bind(this)
14601480
});
14611481
}
14621482
}
14631483
},
1484+
sendFail: function() {
1485+
this.dataHasSend = true;
1486+
},
14641487
batchRemove: function(len) {
14651488
sa.store.mem.clear(len);
14661489
this.dataHasSend = true;
@@ -1479,10 +1502,13 @@ sa.sendStrategy = {
14791502
}
14801503

14811504
this.dataHasChange = false;
1482-
sa._.setStorageSync('sensors_mp_prepare_data', sa.store.mem.mdata);
1505+
if (this.syncStorage) {
1506+
sa._.setStorageSync('sensors_mp_prepare_data', sa.store.mem.mdata);
1507+
}
14831508
}
14841509
},
14851510
batchInterval: function() {
1511+
14861512
var _this = this;
14871513

14881514
function loopWrite() {
@@ -1641,7 +1667,6 @@ sa.autoTrackCustom = {
16411667

16421668
sa.setLatestChannel(utms.pre2);
16431669

1644-
para.scene = para.scene || '未取到值';
16451670
prop.$scene = _.getMPScene(para.scene);
16461671
sa.registerApp({
16471672
$latest_scene: prop.$scene
@@ -1671,7 +1696,6 @@ sa.autoTrackCustom = {
16711696

16721697
sa.setLatestChannel(utms.pre2);
16731698

1674-
para.scene = para.scene || '未取到值';
16751699
prop.$scene = _.getMPScene(para.scene);
16761700
sa.registerApp({
16771701
$latest_scene: prop.$scene

sensorsdata.min.es6.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)