提交 43d10d6c 编写于 作者: DCloud_JSON's avatar DCloud_JSON

新增 unipush 的channel相关配置,防止应用被避免被限量推送、静默推送(静音且需下拉系统通知栏才可见通知内容)

上级 454d67ad
export default {
uniPush: {
// 消息渠道设置,避免被限量推送、静默推送(静音且需下拉系统通知栏才可见通知内容)详情文档:https://doc.dcloud.net.cn/uniCloud/uni-cloud-push/api.html#channel
channel:{
// 渠道id
id: "114240",
// 消息渠道描述,会显示在手机系统关于当前应用的通知设置中
desc: "客服消息"
}
}
}
\ No newline at end of file
import config from '@/uni_modules/uni-im/common/config.js';
import $state from '@/uni_modules/uni-im/sdk/state/index.js'; import $state from '@/uni_modules/uni-im/sdk/state/index.js';
import $methods from '@/uni_modules/uni-im/sdk/methods/index.js'; import $methods from '@/uni_modules/uni-im/sdk/methods/index.js';
import {init as initIndexDB} from '@/uni_modules/uni-im/sdk/ext/indexDB.js'; import {init as initIndexDB} from '@/uni_modules/uni-im/sdk/ext/indexDB.js';
...@@ -15,6 +16,7 @@ import onSocketStateChange from './onSocketStateChange' ...@@ -15,6 +16,7 @@ import onSocketStateChange from './onSocketStateChange'
import imData from './imData' import imData from './imData'
import onlyOneWebTab from './onlyOneWebTab' import onlyOneWebTab from './onlyOneWebTab'
// #ifdef APP // #ifdef APP
// import sqlite from './sqlite.js' // import sqlite from './sqlite.js'
// #endif // #endif
...@@ -165,8 +167,8 @@ export default async function (initParam) { ...@@ -165,8 +167,8 @@ export default async function (initParam) {
plugin.setCustomPushChannel( plugin.setCustomPushChannel(
{ {
// soundName: "pushsound", // soundName: "pushsound",
channelId: "114240", channelId: config.uniPush.channel.id,
channelDesc: "客服消息", channelDesc: config.uniPush.channel.desc,
enableLights: true, enableLights: true,
enableVibration: true, enableVibration: true,
importance: 4, importance: 4,
......
import config from '@/uni_modules/uni-im/common/config.js';
import $utils from '@/uni_modules/uni-im/sdk/utils/index.js'; import $utils from '@/uni_modules/uni-im/sdk/utils/index.js';
import $extensions from '@/uni_modules/uni-im/sdk/methods/extensions.js'; import $extensions from '@/uni_modules/uni-im/sdk/methods/extensions.js';
import $state from '../state/index.js'; import $state from '../state/index.js';
...@@ -193,9 +194,13 @@ msgEvent.onMsg(async res=>{ ...@@ -193,9 +194,13 @@ msgEvent.onMsg(async res=>{
icon = downloadFileRes[1]?.tempFilePath icon = downloadFileRes[1]?.tempFilePath
} }
} }
plus.push.createMessage(content, payload, { uni.createPushMessage({
title, title,
icon content,
payload,
icon,
channelId: config.uniPush.channel.id,
category: 'IM',
}) })
} else if (conversation_id != $state.currentConversationId) { } else if (conversation_id != $state.currentConversationId) {
// uni.showToast({ // uni.showToast({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册