Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
6e931a91
U
uni-app
项目概览
genary
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6e931a91
编写于
7月 14, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(push): revert
上级
0ea54487
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
57 addition
and
227 deletion
+57
-227
packages/uni-api/src/service/plugin/push.ts
packages/uni-api/src/service/plugin/push.ts
+4
-10
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+4
-9
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+4
-8
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+4
-9
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+4
-9
packages/uni-mp-kuaishou/dist/uni.api.esm.js
packages/uni-mp-kuaishou/dist/uni.api.esm.js
+4
-9
packages/uni-mp-lark/dist/uni.api.esm.js
packages/uni-mp-lark/dist/uni.api.esm.js
+4
-9
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+4
-9
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+4
-9
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+4
-9
packages/uni-push/dist/uni-push.es.js
packages/uni-push/dist/uni-push.es.js
+0
-46
packages/uni-push/dist/uni-push.plus.es.js
packages/uni-push/dist/uni-push.plus.es.js
+0
-36
packages/uni-push/src/index.ts
packages/uni-push/src/index.ts
+0
-12
packages/uni-push/src/plus.ts
packages/uni-push/src/plus.ts
+0
-3
packages/uni-push/src/route.ts
packages/uni-push/src/route.ts
+13
-31
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+4
-9
未找到文件。
packages/uni-api/src/service/plugin/push.ts
浏览文件 @
6e931a91
...
@@ -54,17 +54,12 @@ export function invokePushCallback(
...
@@ -54,17 +54,12 @@ export function invokePushCallback(
cidErrMsg
=
args
.
errMsg
cidErrMsg
=
args
.
errMsg
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
)
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
)
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
:
OnPushMessageSuccess
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
}
})
onPushMessageCallbacks
[
i
](
msg
)
})
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
}
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
callback
({
callback
({
...
@@ -111,7 +106,6 @@ export const getPushClientId = defineAsyncApi(
...
@@ -111,7 +106,6 @@ export const getPushClientId = defineAsyncApi(
interface
OnPushMessageSuccess
{
interface
OnPushMessageSuccess
{
type
:
'
click
'
|
'
receive
'
type
:
'
click
'
|
'
receive
'
data
:
unknown
data
:
unknown
stopped
?:
boolean
}
}
type
OnPushMessageCallback
=
(
result
:
OnPushMessageSuccess
)
=>
void
type
OnPushMessageCallback
=
(
result
:
OnPushMessageSuccess
)
=>
void
...
...
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
6e931a91
...
@@ -11096,17 +11096,12 @@ function invokePushCallback(args) {
...
@@ -11096,17 +11096,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks(cid, args.errMsg);
invokeGetPushCidCallbacks(cid, args.errMsg);
}
}
else if (args.type === 'pushMsg') {
else if (args.type === 'pushMsg') {
for (let i = 0; i < onPushMessageCallbacks.length; i++)
{
onPushMessageCallbacks.forEach((callback) =>
{
c
onst msg =
{
c
allback(
{
type: 'receive',
type: 'receive',
data: normalizePushMessage(args.message),
data: normalizePushMessage(args.message),
};
});
onPushMessageCallbacks[i](msg);
});
if (msg.stopped) {
// 消息被中断,比如页面直达的 push 信息
break;
}
}
}
}
else if (args.type === 'click') {
else if (args.type === 'click') {
onPushMessageCallbacks.forEach((callback) => {
onPushMessageCallbacks.forEach((callback) => {
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
6e931a91
...
@@ -4625,16 +4625,12 @@ function invokePushCallback(args) {
...
@@ -4625,16 +4625,12 @@ function invokePushCallback(args) {
cidErrMsg = args.errMsg;
cidErrMsg = args.errMsg;
invokeGetPushCidCallbacks(cid, args.errMsg);
invokeGetPushCidCallbacks(cid, args.errMsg);
} else if (args.type === "pushMsg") {
} else if (args.type === "pushMsg") {
for (let i = 0; i < onPushMessageCallbacks.length; i++)
{
onPushMessageCallbacks.forEach((callback) =>
{
c
onst msg =
{
c
allback(
{
type: "receive",
type: "receive",
data: normalizePushMessage(args.message)
data: normalizePushMessage(args.message)
};
});
onPushMessageCallbacks[i](msg);
});
if (msg.stopped) {
break;
}
}
} else if (args.type === "click") {
} else if (args.type === "click") {
onPushMessageCallbacks.forEach((callback) => {
onPushMessageCallbacks.forEach((callback) => {
callback({
callback({
...
...
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
packages/uni-mp-kuaishou/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
packages/uni-mp-lark/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -635,17 +635,12 @@ function invokePushCallback(args) {
...
@@ -635,17 +635,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
packages/uni-push/dist/uni-push.es.js
浏览文件 @
6e931a91
...
@@ -100,41 +100,6 @@ e?.onClose(t);
...
@@ -100,41 +100,6 @@ e?.onClose(t);
var
GtPush
=
/*@__PURE__*/
getDefaultExportFromCjs
(
gtpushMin
);
var
GtPush
=
/*@__PURE__*/
getDefaultExportFromCjs
(
gtpushMin
);
function
initPushRoute
()
{
// @ts-expect-error
uni
.
onPushMessage
((
res
)
=>
{
if
(
res
.
data
&&
res
.
data
.
path
)
{
if
(
res
.
type
===
'
click
'
)
{
const
url
=
res
.
data
.
path
;
// 优先使用 navigateTo
uni
.
navigateTo
({
url
,
fail
(
result
)
{
// 说明是 tabBar 页面,必须使用 switchTab
if
(
result
.
errMsg
.
indexOf
(
'
tabbar
'
))
{
uni
.
switchTab
({
url
,
});
}
},
});
}
else
if
(
res
.
type
===
'
receive
'
)
{
// 仅 App 端
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
// 创建通知栏,并屏蔽消息的继续传递
plus
.
push
.
createMessage
(
res
.
data
.
content
,
JSON
.
stringify
(
res
.
data
.
payload
),
{
title
:
res
.
data
.
title
,
path
:
res
.
data
.
path
,
});
// 内部属性,停止传播
res
.
stopped
=
true
;
}
}
}
});
}
// if (process.env.UNI_PUSH_DEBUG) {
// if (process.env.UNI_PUSH_DEBUG) {
// GtPush.setDebugMode(true)
// GtPush.setDebugMode(true)
// }
// }
...
@@ -187,15 +152,4 @@ else {
...
@@ -187,15 +152,4 @@ else {
});
});
},
},
});
});
initPushRoute
();
// 不用条件编译。App端仍需监听
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
plus
.
push
.
addEventListener
(
'
click
'
,
(
result
)
=>
{
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
click
'
,
message
:
result
,
});
});
}
}
}
packages/uni-push/dist/uni-push.plus.es.js
浏览文件 @
6e931a91
function
initPushRoute
()
{
// @ts-expect-error
uni
.
onPushMessage
((
res
)
=>
{
if
(
res
.
data
&&
res
.
data
.
path
)
{
if
(
res
.
type
===
'
click
'
)
{
const
url
=
res
.
data
.
path
;
// 优先使用 navigateTo
uni
.
navigateTo
({
url
,
fail
(
result
)
{
// 说明是 tabBar 页面,必须使用 switchTab
if
(
result
.
errMsg
.
indexOf
(
'
tabbar
'
))
{
uni
.
switchTab
({
url
,
});
}
},
});
}
else
if
(
res
.
type
===
'
receive
'
)
{
// 仅 App 端
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
// 创建通知栏,并屏蔽消息的继续传递
plus
.
push
.
createMessage
(
res
.
data
.
content
,
JSON
.
stringify
(
res
.
data
.
payload
),
{
title
:
res
.
data
.
title
,
path
:
res
.
data
.
path
,
});
// 内部属性,停止传播
res
.
stopped
=
true
;
}
}
}
});
}
// @ts-expect-error
// @ts-expect-error
uni
.
invokePushCallback
({
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
type
:
'
enabled
'
,
});
});
initPushRoute
();
Promise
.
resolve
().
then
(()
=>
{
Promise
.
resolve
().
then
(()
=>
{
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
);
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
);
const
info
=
plus
.
push
.
getClientInfo
();
const
info
=
plus
.
push
.
getClientInfo
();
...
...
packages/uni-push/src/index.ts
浏览文件 @
6e931a91
import
GtPush
from
'
../lib/gtpush-min
'
import
GtPush
from
'
../lib/gtpush-min
'
import
{
initPushRoute
}
from
'
./route
'
// if (process.env.UNI_PUSH_DEBUG) {
// if (process.env.UNI_PUSH_DEBUG) {
// GtPush.setDebugMode(true)
// GtPush.setDebugMode(true)
...
@@ -54,15 +53,4 @@ if (!appid) {
...
@@ -54,15 +53,4 @@ if (!appid) {
})
})
},
},
})
})
initPushRoute
()
// 不用条件编译。App端仍需监听
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
plus
.
push
.
addEventListener
(
'
click
'
,
(
result
)
=>
{
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
click
'
,
message
:
result
,
})
})
}
}
}
packages/uni-push/src/plus.ts
浏览文件 @
6e931a91
import
{
initPushRoute
}
from
'
./route
'
// @ts-expect-error
// @ts-expect-error
uni
.
invokePushCallback
({
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
type
:
'
enabled
'
,
})
})
initPushRoute
()
Promise
.
resolve
().
then
(()
=>
{
Promise
.
resolve
().
then
(()
=>
{
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
)
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
)
const
info
=
plus
.
push
.
getClientInfo
()
const
info
=
plus
.
push
.
getClientInfo
()
...
...
packages/uni-push/src/route.ts
浏览文件 @
6e931a91
...
@@ -7,41 +7,23 @@ interface OnPushMessageSuccess {
...
@@ -7,41 +7,23 @@ interface OnPushMessageSuccess {
forceNotification
?:
boolean
forceNotification
?:
boolean
path
?:
string
path
?:
string
}
}
stopped
?:
boolean
}
}
export
function
initPushRoute
()
{
export
function
initPushRoute
()
{
// @ts-expect-error
// @ts-expect-error
uni
.
onPushMessage
((
res
:
OnPushMessageSuccess
)
=>
{
uni
.
onPushMessage
((
res
:
OnPushMessageSuccess
)
=>
{
if
(
res
.
data
&&
res
.
data
.
path
)
{
if
(
res
.
data
&&
res
.
data
.
path
&&
res
.
type
===
'
receive
'
)
{
if
(
res
.
type
===
'
click
'
)
{
// 仅 App 端
const
url
=
res
.
data
.
path
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
// 优先使用 navigateTo
// 创建通知栏,并屏蔽消息的继续传递
uni
.
navigateTo
({
plus
.
push
.
createMessage
(
url
,
res
.
data
.
content
,
fail
(
result
)
{
JSON
.
stringify
(
res
.
data
.
payload
),
// 说明是 tabBar 页面,必须使用 switchTab
{
if
(
result
.
errMsg
.
indexOf
(
'
tabbar
'
))
{
title
:
res
.
data
.
title
,
uni
.
switchTab
({
forceNotification
:
true
,
url
,
path
:
res
.
data
.
path
,
})
}
as
any
}
)
},
})
}
else
if
(
res
.
type
===
'
receive
'
)
{
// 仅 App 端
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
push
)
{
// 创建通知栏,并屏蔽消息的继续传递
plus
.
push
.
createMessage
(
res
.
data
.
content
,
JSON
.
stringify
(
res
.
data
.
payload
),
{
title
:
res
.
data
.
title
,
path
:
res
.
data
.
path
,
}
as
any
)
// 内部属性,停止传播
res
.
stopped
=
true
}
}
}
}
}
})
})
...
...
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
6e931a91
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
...
@@ -671,17 +671,12 @@ function invokePushCallback(args) {
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
}
}
else
if
(
args
.
type
===
'
pushMsg
'
)
{
else
if
(
args
.
type
===
'
pushMsg
'
)
{
for
(
let
i
=
0
;
i
<
onPushMessageCallbacks
.
length
;
i
++
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
c
onst
msg
=
{
c
allback
(
{
type
:
'
receive
'
,
type
:
'
receive
'
,
data
:
normalizePushMessage
(
args
.
message
),
data
:
normalizePushMessage
(
args
.
message
),
};
});
onPushMessageCallbacks
[
i
](
msg
);
});
if
(
msg
.
stopped
)
{
// 消息被中断,比如页面直达的 push 信息
break
;
}
}
}
}
else
if
(
args
.
type
===
'
click
'
)
{
else
if
(
args
.
type
===
'
click
'
)
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
onPushMessageCallbacks
.
forEach
((
callback
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录