@taole/dev-helper 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/open-diandian.umd.js +50 -1
- package/open-diandian/index.js +50 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
link_android: "intent://diandain:8888/splash#Intent;scheme=taole;package=com.tuwan.yw;S.browser_fallback_url=https://sj.qq.com/myapp/detail.htm?apkName=com.tuwan.yw;end",
|
|
13
13
|
fallback_link_ios: "https://apps.apple.com/cn/app/%E7%82%B9%E7%82%B9-%E8%AF%AD%E9%9F%B3%E5%BC%80%E9%BB%91/id1449564746",
|
|
14
14
|
fallback_link_android: 'https://m.malink.cn/s/3iQziy',
|
|
15
|
+
fallback_fin_5s: 'https://sj.qq.com/appdetail/com.tuwan.yw', // 5秒后跳转的链接(仅安卓)
|
|
15
16
|
},
|
|
16
17
|
'wx0e4a6eed634134ce': { // 兔小铲
|
|
17
18
|
app_name: '兔小铲',
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
link_android: "tuxiaochan://diandain:8888/splash",
|
|
20
21
|
fallback_link_ios: 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939',
|
|
21
22
|
fallback_link_android: 'https://m.malink.cn/s/rYNfAj',
|
|
23
|
+
fallback_fin_5s: 'https://sj.qq.com/appdetail/com.tuwan.txc',
|
|
22
24
|
},
|
|
23
25
|
'wxcd28679e4d8c1792': { // 点点狼人
|
|
24
26
|
app_name: '点点狼人',
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
link_android: "diandainwolf://diandain:8888/splash",
|
|
27
29
|
fallback_link_ios: 'https://apps.apple.com/mo/app/%E7%82%B9%E7%82%B9%E7%8B%BC%E4%BA%BA%E6%9D%80-%E8%AF%AD%E9%9F%B3%E7%A4%BE%E4%BA%A4%E6%8E%A8%E7%90%86%E6%B8%B8%E6%88%8F/id1557616226',
|
|
28
30
|
fallback_link_android: 'https://m.malink.cn/s/AJ3ueu',
|
|
31
|
+
fallback_fin_5s: 'https://sj.qq.com/appdetail/com.tuwan.game.werewolf',
|
|
29
32
|
},
|
|
30
33
|
};
|
|
31
34
|
function resolveTwKit() {
|
|
@@ -61,6 +64,9 @@
|
|
|
61
64
|
this._appInfo = null;
|
|
62
65
|
this._alink_fallback = '';
|
|
63
66
|
this._alink_link = '';
|
|
67
|
+
this._alink_fin_5s = '';
|
|
68
|
+
this._fin5sTimer = null;
|
|
69
|
+
this._fin5sVisHandler = null;
|
|
64
70
|
this._template = null;
|
|
65
71
|
this._alink = null;
|
|
66
72
|
this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
|
|
@@ -122,7 +128,37 @@
|
|
|
122
128
|
var tmplnk = document.createElement("a");
|
|
123
129
|
tmplnk.href = this._alink_fallback;
|
|
124
130
|
tmplnk.click();
|
|
125
|
-
this._log('open-diandian: wx-open-launch-app error', e);
|
|
131
|
+
this._log('open-diandian: wx-open-launch-app error, go to fallback link', e, this._alink_fallback);
|
|
132
|
+
if (this._alink_fin_5s) {
|
|
133
|
+
this._cancelFinalFallback();
|
|
134
|
+
this._fin5sVisHandler = () => {
|
|
135
|
+
if (document.hidden) {
|
|
136
|
+
this._log('open-diandian: page hidden, fallback succeeded, cancel final fallback');
|
|
137
|
+
this._cancelFinalFallback();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
document.addEventListener('visibilitychange', this._fin5sVisHandler);
|
|
141
|
+
this._log('open-diandian: schedule final fallback 5s later', this._alink_fin_5s);
|
|
142
|
+
this._fin5sTimer = setTimeout(() => {
|
|
143
|
+
this._fin5sTimer = null;
|
|
144
|
+
if (this._fin5sVisHandler) {
|
|
145
|
+
document.removeEventListener('visibilitychange', this._fin5sVisHandler);
|
|
146
|
+
this._fin5sVisHandler = null;
|
|
147
|
+
}
|
|
148
|
+
if (!this._isConnected) {
|
|
149
|
+
this._log('open-diandian: disconnected, skip final fallback');
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (document.hidden) {
|
|
153
|
+
this._log('open-diandian: page hidden when timer fired, skip final fallback');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this._log('open-diandian: final fallback go', this._alink_fin_5s);
|
|
157
|
+
var lnkFinal = document.createElement("a");
|
|
158
|
+
lnkFinal.href = this._alink_fin_5s;
|
|
159
|
+
lnkFinal.click();
|
|
160
|
+
}, 5000);
|
|
161
|
+
}
|
|
126
162
|
});
|
|
127
163
|
} else {
|
|
128
164
|
this._updateTagAttr();
|
|
@@ -190,6 +226,17 @@
|
|
|
190
226
|
this._alink.remove();
|
|
191
227
|
this._alink = null;
|
|
192
228
|
}
|
|
229
|
+
this._cancelFinalFallback();
|
|
230
|
+
}
|
|
231
|
+
_cancelFinalFallback() {
|
|
232
|
+
if (this._fin5sTimer) {
|
|
233
|
+
clearTimeout(this._fin5sTimer);
|
|
234
|
+
this._fin5sTimer = null;
|
|
235
|
+
}
|
|
236
|
+
if (this._fin5sVisHandler) {
|
|
237
|
+
document.removeEventListener('visibilitychange', this._fin5sVisHandler);
|
|
238
|
+
this._fin5sVisHandler = null;
|
|
239
|
+
}
|
|
193
240
|
}
|
|
194
241
|
_initClipboardText() {
|
|
195
242
|
// 延迟20ms执行,如果20ms后卸载了,直接不执行了
|
|
@@ -294,9 +341,11 @@
|
|
|
294
341
|
if (this._isIOS) {
|
|
295
342
|
this._alink_fallback = this._appInfo.fallback_link_ios;
|
|
296
343
|
this._alink_link = this._appInfo.link_ios || this._alink_fallback;
|
|
344
|
+
this._alink_fin_5s = '';
|
|
297
345
|
} else {
|
|
298
346
|
this._alink_fallback = this._appInfo.fallback_link_android;
|
|
299
347
|
this._alink_link = this._appInfo.link_android || this._alink_fallback;
|
|
348
|
+
this._alink_fin_5s = this._appInfo.fallback_fin_5s || '';
|
|
300
349
|
}
|
|
301
350
|
if (this._openAppTag) {
|
|
302
351
|
this._openAppTag.setAttribute('appid', this._appid);
|
package/open-diandian/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const appInfoMap = {
|
|
|
7
7
|
link_android: "intent://diandain:8888/splash#Intent;scheme=taole;package=com.tuwan.yw;S.browser_fallback_url=https://sj.qq.com/myapp/detail.htm?apkName=com.tuwan.yw;end",
|
|
8
8
|
fallback_link_ios: "https://apps.apple.com/cn/app/%E7%82%B9%E7%82%B9-%E8%AF%AD%E9%9F%B3%E5%BC%80%E9%BB%91/id1449564746",
|
|
9
9
|
fallback_link_android: 'https://m.malink.cn/s/3iQziy',
|
|
10
|
+
fallback_fin_5s: 'https://sj.qq.com/appdetail/com.tuwan.yw', // 5秒后跳转的链接(仅安卓)
|
|
10
11
|
},
|
|
11
12
|
'wx0e4a6eed634134ce': { // 兔小铲
|
|
12
13
|
app_name: '兔小铲',
|
|
@@ -14,6 +15,7 @@ const appInfoMap = {
|
|
|
14
15
|
link_android: "tuxiaochan://diandain:8888/splash",
|
|
15
16
|
fallback_link_ios: 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939',
|
|
16
17
|
fallback_link_android: 'https://m.malink.cn/s/rYNfAj',
|
|
18
|
+
fallback_fin_5s: 'https://sj.qq.com/appdetail/com.tuwan.txc',
|
|
17
19
|
},
|
|
18
20
|
'wxcd28679e4d8c1792': { // 点点狼人
|
|
19
21
|
app_name: '点点狼人',
|
|
@@ -21,6 +23,7 @@ const appInfoMap = {
|
|
|
21
23
|
link_android: "diandainwolf://diandain:8888/splash",
|
|
22
24
|
fallback_link_ios: 'https://apps.apple.com/mo/app/%E7%82%B9%E7%82%B9%E7%8B%BC%E4%BA%BA%E6%9D%80-%E8%AF%AD%E9%9F%B3%E7%A4%BE%E4%BA%A4%E6%8E%A8%E7%90%86%E6%B8%B8%E6%88%8F/id1557616226',
|
|
23
25
|
fallback_link_android: 'https://m.malink.cn/s/AJ3ueu',
|
|
26
|
+
fallback_fin_5s: 'https://sj.qq.com/appdetail/com.tuwan.game.werewolf',
|
|
24
27
|
},
|
|
25
28
|
}
|
|
26
29
|
function resolveTwKit() {
|
|
@@ -56,6 +59,9 @@ function defineTag() {
|
|
|
56
59
|
this._appInfo = null;
|
|
57
60
|
this._alink_fallback = '';
|
|
58
61
|
this._alink_link = '';
|
|
62
|
+
this._alink_fin_5s = '';
|
|
63
|
+
this._fin5sTimer = null;
|
|
64
|
+
this._fin5sVisHandler = null;
|
|
59
65
|
this._template = null;
|
|
60
66
|
this._alink = null;
|
|
61
67
|
this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
|
|
@@ -117,7 +123,37 @@ function defineTag() {
|
|
|
117
123
|
var tmplnk = document.createElement("a");
|
|
118
124
|
tmplnk.href = this._alink_fallback;
|
|
119
125
|
tmplnk.click();
|
|
120
|
-
this._log('open-diandian: wx-open-launch-app error', e);
|
|
126
|
+
this._log('open-diandian: wx-open-launch-app error, go to fallback link', e, this._alink_fallback);
|
|
127
|
+
if (this._alink_fin_5s) {
|
|
128
|
+
this._cancelFinalFallback();
|
|
129
|
+
this._fin5sVisHandler = () => {
|
|
130
|
+
if (document.hidden) {
|
|
131
|
+
this._log('open-diandian: page hidden, fallback succeeded, cancel final fallback');
|
|
132
|
+
this._cancelFinalFallback();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
document.addEventListener('visibilitychange', this._fin5sVisHandler);
|
|
136
|
+
this._log('open-diandian: schedule final fallback 5s later', this._alink_fin_5s);
|
|
137
|
+
this._fin5sTimer = setTimeout(() => {
|
|
138
|
+
this._fin5sTimer = null;
|
|
139
|
+
if (this._fin5sVisHandler) {
|
|
140
|
+
document.removeEventListener('visibilitychange', this._fin5sVisHandler);
|
|
141
|
+
this._fin5sVisHandler = null;
|
|
142
|
+
}
|
|
143
|
+
if (!this._isConnected) {
|
|
144
|
+
this._log('open-diandian: disconnected, skip final fallback');
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (document.hidden) {
|
|
148
|
+
this._log('open-diandian: page hidden when timer fired, skip final fallback');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this._log('open-diandian: final fallback go', this._alink_fin_5s);
|
|
152
|
+
var lnkFinal = document.createElement("a");
|
|
153
|
+
lnkFinal.href = this._alink_fin_5s;
|
|
154
|
+
lnkFinal.click();
|
|
155
|
+
}, 5000);
|
|
156
|
+
}
|
|
121
157
|
});
|
|
122
158
|
} else {
|
|
123
159
|
this._updateTagAttr();
|
|
@@ -185,6 +221,17 @@ function defineTag() {
|
|
|
185
221
|
this._alink.remove();
|
|
186
222
|
this._alink = null;
|
|
187
223
|
}
|
|
224
|
+
this._cancelFinalFallback();
|
|
225
|
+
}
|
|
226
|
+
_cancelFinalFallback() {
|
|
227
|
+
if (this._fin5sTimer) {
|
|
228
|
+
clearTimeout(this._fin5sTimer);
|
|
229
|
+
this._fin5sTimer = null;
|
|
230
|
+
}
|
|
231
|
+
if (this._fin5sVisHandler) {
|
|
232
|
+
document.removeEventListener('visibilitychange', this._fin5sVisHandler);
|
|
233
|
+
this._fin5sVisHandler = null;
|
|
234
|
+
}
|
|
188
235
|
}
|
|
189
236
|
_initClipboardText() {
|
|
190
237
|
// 延迟20ms执行,如果20ms后卸载了,直接不执行了
|
|
@@ -289,9 +336,11 @@ function defineTag() {
|
|
|
289
336
|
if (this._isIOS) {
|
|
290
337
|
this._alink_fallback = this._appInfo.fallback_link_ios;
|
|
291
338
|
this._alink_link = this._appInfo.link_ios || this._alink_fallback;
|
|
339
|
+
this._alink_fin_5s = '';
|
|
292
340
|
} else {
|
|
293
341
|
this._alink_fallback = this._appInfo.fallback_link_android;
|
|
294
342
|
this._alink_link = this._appInfo.link_android || this._alink_fallback;
|
|
343
|
+
this._alink_fin_5s = this._appInfo.fallback_fin_5s || '';
|
|
295
344
|
}
|
|
296
345
|
if (this._openAppTag) {
|
|
297
346
|
this._openAppTag.setAttribute('appid', this._appid);
|