@taole/dev-helper 0.1.9 → 0.1.10

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.
@@ -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,8 @@
61
64
  this._appInfo = null;
62
65
  this._alink_fallback = '';
63
66
  this._alink_link = '';
67
+ this._alink_fin_5s = '';
68
+ this._fin5sTimer = null;
64
69
  this._template = null;
65
70
  this._alink = null;
66
71
  this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
@@ -122,7 +127,24 @@
122
127
  var tmplnk = document.createElement("a");
123
128
  tmplnk.href = this._alink_fallback;
124
129
  tmplnk.click();
125
- this._log('open-diandian: wx-open-launch-app error', e);
130
+ this._log('open-diandian: wx-open-launch-app error, go to fallback link', e, this._alink_fallback);
131
+ if (this._alink_fin_5s) {
132
+ if (this._fin5sTimer) {
133
+ clearTimeout(this._fin5sTimer);
134
+ }
135
+ this._log('open-diandian: schedule final fallback 5s later', this._alink_fin_5s);
136
+ this._fin5sTimer = setTimeout(() => {
137
+ this._fin5sTimer = null;
138
+ if (!this._isConnected) {
139
+ this._log('open-diandian: disconnected, skip final fallback');
140
+ return;
141
+ }
142
+ this._log('open-diandian: final fallback go', this._alink_fin_5s);
143
+ var lnkFinal = document.createElement("a");
144
+ lnkFinal.href = this._alink_fin_5s;
145
+ lnkFinal.click();
146
+ }, 5000);
147
+ }
126
148
  });
127
149
  } else {
128
150
  this._updateTagAttr();
@@ -190,6 +212,10 @@
190
212
  this._alink.remove();
191
213
  this._alink = null;
192
214
  }
215
+ if (this._fin5sTimer) {
216
+ clearTimeout(this._fin5sTimer);
217
+ this._fin5sTimer = null;
218
+ }
193
219
  }
194
220
  _initClipboardText() {
195
221
  // 延迟20ms执行,如果20ms后卸载了,直接不执行了
@@ -294,9 +320,11 @@
294
320
  if (this._isIOS) {
295
321
  this._alink_fallback = this._appInfo.fallback_link_ios;
296
322
  this._alink_link = this._appInfo.link_ios || this._alink_fallback;
323
+ this._alink_fin_5s = '';
297
324
  } else {
298
325
  this._alink_fallback = this._appInfo.fallback_link_android;
299
326
  this._alink_link = this._appInfo.link_android || this._alink_fallback;
327
+ this._alink_fin_5s = this._appInfo.fallback_fin_5s || '';
300
328
  }
301
329
  if (this._openAppTag) {
302
330
  this._openAppTag.setAttribute('appid', this._appid);
@@ -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,8 @@ 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;
59
64
  this._template = null;
60
65
  this._alink = null;
61
66
  this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
@@ -117,7 +122,24 @@ function defineTag() {
117
122
  var tmplnk = document.createElement("a");
118
123
  tmplnk.href = this._alink_fallback;
119
124
  tmplnk.click();
120
- this._log('open-diandian: wx-open-launch-app error', e);
125
+ this._log('open-diandian: wx-open-launch-app error, go to fallback link', e, this._alink_fallback);
126
+ if (this._alink_fin_5s) {
127
+ if (this._fin5sTimer) {
128
+ clearTimeout(this._fin5sTimer);
129
+ }
130
+ this._log('open-diandian: schedule final fallback 5s later', this._alink_fin_5s);
131
+ this._fin5sTimer = setTimeout(() => {
132
+ this._fin5sTimer = null;
133
+ if (!this._isConnected) {
134
+ this._log('open-diandian: disconnected, skip final fallback');
135
+ return;
136
+ }
137
+ this._log('open-diandian: final fallback go', this._alink_fin_5s);
138
+ var lnkFinal = document.createElement("a");
139
+ lnkFinal.href = this._alink_fin_5s;
140
+ lnkFinal.click();
141
+ }, 5000);
142
+ }
121
143
  });
122
144
  } else {
123
145
  this._updateTagAttr();
@@ -185,6 +207,10 @@ function defineTag() {
185
207
  this._alink.remove();
186
208
  this._alink = null;
187
209
  }
210
+ if (this._fin5sTimer) {
211
+ clearTimeout(this._fin5sTimer);
212
+ this._fin5sTimer = null;
213
+ }
188
214
  }
189
215
  _initClipboardText() {
190
216
  // 延迟20ms执行,如果20ms后卸载了,直接不执行了
@@ -289,9 +315,11 @@ function defineTag() {
289
315
  if (this._isIOS) {
290
316
  this._alink_fallback = this._appInfo.fallback_link_ios;
291
317
  this._alink_link = this._appInfo.link_ios || this._alink_fallback;
318
+ this._alink_fin_5s = '';
292
319
  } else {
293
320
  this._alink_fallback = this._appInfo.fallback_link_android;
294
321
  this._alink_link = this._appInfo.link_android || this._alink_fallback;
322
+ this._alink_fin_5s = this._appInfo.fallback_fin_5s || '';
295
323
  }
296
324
  if (this._openAppTag) {
297
325
  this._openAppTag.setAttribute('appid', this._appid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npx -y rimraf dist && rollup -c",