@dcloudio/uni-push 3.0.0-alpha-3050220220719002 → 3.0.0-alpha-3050320220727002

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.
@@ -100,6 +100,28 @@ e?.onClose(t);
100
100
 
101
101
  var GtPush = /*@__PURE__*/getDefaultExportFromCjs(gtpushMin);
102
102
 
103
+ function initPushNotification() {
104
+ // 仅 App 端
105
+ if (typeof plus !== 'undefined' && plus.push) {
106
+ plus.push.addEventListener('click', (result) => {
107
+ // @ts-expect-error
108
+ uni.invokePushCallback({
109
+ type: 'click',
110
+ message: result,
111
+ });
112
+ });
113
+ uni.onPushMessage((res) => {
114
+ if (res.type === 'receive' &&
115
+ res.data &&
116
+ res.data.force_notification) {
117
+ // 创建通知栏
118
+ uni.createPushMessage(res.data);
119
+ res.stopped = true;
120
+ }
121
+ });
122
+ }
123
+ }
124
+
103
125
  // if (process.env.UNI_PUSH_DEBUG) {
104
126
  // GtPush.setDebugMode(true)
105
127
  // }
@@ -119,6 +141,7 @@ if (!appid) {
119
141
  });
120
142
  }
121
143
  else {
144
+ initPushNotification();
122
145
  GtPush.init({
123
146
  appid,
124
147
  onError: (res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-push",
3
- "version": "3.0.0-alpha-3050220220719002",
3
+ "version": "3.0.0-alpha-3050320220727002",
4
4
  "description": "@dcloudio/uni-push",
5
5
  "main": "lib/uni-push.js",
6
6
  "module": "lib/uni-push.js",
@@ -20,6 +20,6 @@
20
20
  },
21
21
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
22
22
  "dependencies": {
23
- "@dcloudio/uni-cli-shared": "3.0.0-alpha-3050220220719002"
23
+ "@dcloudio/uni-cli-shared": "3.0.0-alpha-3050320220727002"
24
24
  }
25
25
  }