@dcloudio/uni-push 0.0.1-nvue3.3040020220301001 → 3.0.0-3060520221121001
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/uni-push.es.js +132 -39
- package/dist/uni-push.plus.es.js +42 -14
- package/lib/gtpush-min.d.ts +4 -0
- package/lib/gtpush-min.js +32 -16
- package/lib/uni.plugin.js +18 -16
- package/package.json +2 -6
- package/lib/gtpush.map +0 -1
package/dist/uni-push.plus.es.js
CHANGED
@@ -1,17 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
if (
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
function initPushNotification() {
|
2
|
+
// 仅 App 端
|
3
|
+
if (typeof plus !== 'undefined' && plus.push) {
|
4
|
+
plus.globalEvent.addEventListener('newPath', ({ path }) => {
|
5
|
+
if (!path) {
|
6
|
+
return;
|
7
|
+
}
|
8
|
+
// 指定的页面为当前页面
|
9
|
+
const pages = getCurrentPages();
|
10
|
+
const currentPage = pages[pages.length - 1];
|
11
|
+
if (currentPage &&
|
12
|
+
currentPage.$page &&
|
13
|
+
currentPage.$page.fullPath === path) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
// 简单起见,先尝试 navigateTo 跳转,失败后,再尝试 tabBar 跳转
|
17
|
+
uni.navigateTo({
|
18
|
+
url: path,
|
19
|
+
fail(res) {
|
20
|
+
if (res.errMsg.indexOf('tabbar') > -1) {
|
21
|
+
uni.switchTab({
|
22
|
+
url: path,
|
23
|
+
fail(res) {
|
24
|
+
console.error(res.errMsg);
|
25
|
+
},
|
26
|
+
});
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
console.error(res.errMsg);
|
30
|
+
}
|
31
|
+
},
|
32
|
+
});
|
8
33
|
});
|
9
34
|
}
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
35
|
+
}
|
36
|
+
|
37
|
+
// @ts-expect-error
|
38
|
+
uni.invokePushCallback({
|
39
|
+
type: 'enabled',
|
40
|
+
offline: true,
|
41
|
+
});
|
42
|
+
Promise.resolve().then(() => {
|
43
|
+
initPushNotification();
|
44
|
+
plus.push.setAutoNotification && plus.push.setAutoNotification(false);
|
17
45
|
});
|