提交 0a202cc6 编写于 作者: fxy060608's avatar fxy060608

fix(push): getPushClientId

上级 3a4a8305
...@@ -111,7 +111,9 @@ function initPushNotification() { ...@@ -111,7 +111,9 @@ function initPushNotification() {
}); });
}); });
uni.onPushMessage((res) => { uni.onPushMessage((res) => {
if (res.type === 'receive' && res.data && res.data.force_notification) { if (res.type === 'receive' &&
res.data &&
res.data.force_notification) {
// 创建通知栏 // 创建通知栏
uni.createPushMessage(res.data); uni.createPushMessage(res.data);
res.stopped = true; res.stopped = true;
......
// @ts-expect-error // @ts-expect-error
uni.invokePushCallback({ uni.invokePushCallback({
type: 'enabled', type: 'enabled',
offline: true,
}); });
Promise.resolve().then(() => { Promise.resolve().then(() => {
plus.push.setAutoNotification && plus.push.setAutoNotification(false); plus.push.setAutoNotification && plus.push.setAutoNotification(false);
plus.push.getClientInfoAsync((info) => {
if (info.clientid) {
// @ts-expect-error
uni.invokePushCallback({
type: 'clientId',
cid: info.clientid,
});
}
}, (res) => {
// @ts-expect-error
uni.invokePushCallback({
type: 'clientId',
cid: '',
errMsg: res.code + ': ' + res.message,
});
});
plus.push.addEventListener('click', (result) => { plus.push.addEventListener('click', (result) => {
// @ts-expect-error // @ts-expect-error
uni.invokePushCallback({ uni.invokePushCallback({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册