@taole/dev-helper 0.0.17 → 0.0.19

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.
@@ -19,8 +19,7 @@
19
19
  this._openAppTag = null;
20
20
  this._template = null;
21
21
  this._alink = null;
22
- this._isMobile =
23
- this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
22
+ this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
24
23
  this._isWechat = /MicroMessenger/i.test(navigator.userAgent);
25
24
  this._isAndroid = /Android/i.test(navigator.userAgent);
26
25
  this._isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
@@ -93,7 +92,8 @@
93
92
  window.removeEventListener("visibilitychange", this._pagehideCallback);
94
93
  setTimeout(() => {
95
94
  // console.log("3s到了22", isPageHide, Date.now() - nowTs);
96
- if (isPageHide) return;
95
+ // console.log("document.hasFocus()", document.hasFocus());
96
+ if (isPageHide || document.hasFocus()) return;
97
97
  this._alink_click_timer = null;
98
98
  // window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
99
99
  var tmplnk = document.createElement("a");
@@ -125,7 +125,7 @@
125
125
  } else if (this._alink) {
126
126
  // TODO: 如果设置了点点以外的appid,这里其实是有问题的,待后续更新优化
127
127
  if (this._isIOS) {
128
- this._alink.href = "com.tuwan.diandian://openPage?type=room&id=123";
128
+ this._alink.href = "com.tuwan.diandian://openPage";
129
129
  this._alink_fallback = "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";
130
130
  } else {
131
131
  var packageName = "com.tuwan.yw";
@@ -13,8 +13,7 @@ function defineTag() {
13
13
  this._openAppTag = null;
14
14
  this._template = null;
15
15
  this._alink = null;
16
- this._isMobile =
17
- this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
16
+ this._isApp = (window.AndroidJs && window.AndroidJs.publicInteraction) || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.AndroidJs);
18
17
  this._isWechat = /MicroMessenger/i.test(navigator.userAgent);
19
18
  this._isAndroid = /Android/i.test(navigator.userAgent);
20
19
  this._isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
@@ -87,7 +86,8 @@ function defineTag() {
87
86
  window.removeEventListener("visibilitychange", this._pagehideCallback);
88
87
  setTimeout(() => {
89
88
  // console.log("3s到了22", isPageHide, Date.now() - nowTs);
90
- if (isPageHide) return;
89
+ // console.log("document.hasFocus()", document.hasFocus());
90
+ if (isPageHide || document.hasFocus()) return;
91
91
  this._alink_click_timer = null;
92
92
  // window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
93
93
  var tmplnk = document.createElement("a");
@@ -119,7 +119,7 @@ function defineTag() {
119
119
  } else if (this._alink) {
120
120
  // TODO: 如果设置了点点以外的appid,这里其实是有问题的,待后续更新优化
121
121
  if (this._isIOS) {
122
- this._alink.href = "com.tuwan.diandian://openPage?type=room&id=123";
122
+ this._alink.href = "com.tuwan.diandian://openPage";
123
123
  this._alink_fallback = "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";
124
124
  } else {
125
125
  var packageName = "com.tuwan.yw";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npx -y rimraf dist && rollup -c",