提交 5b9c619f 编写于 作者: fxy060608's avatar fxy060608

feat(push): plus.push.setAutoNotification

上级 4559fff3
Promise.resolve().then(() => {
plus.push.setAutoNotification && plus.push.setAutoNotification(false);
const info = plus.push.getClientInfo();
if (info.clientid) {
// @ts-expect-error
......
......@@ -9,24 +9,9 @@ import {
let cid
let cidErrMsg
function normalizePushMessage (type, message) {
function normalizePushMessage (message) {
try {
const res = JSON.parse(message)
if (type === 'receive') {
if (res.payload) {
if (res.aps) {
res.payload.aps = res.aps
}
return res.payload
}
} else if (type === 'click') {
delete res.type
delete res.__UUID__
delete res.appid
if (res.aps && res.aps.alert) {
res.title = res.aps.alert.title
}
}
return JSON.parse(message)
} catch (e) {}
return message
}
......@@ -42,14 +27,14 @@ export function invokePushCallback (
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'receive',
data: normalizePushMessage('receive', args.message)
data: normalizePushMessage(args.message)
})
})
} else if (args.type === 'click') {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'click',
data: normalizePushMessage('click', args.message)
data: normalizePushMessage(args.message)
})
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册