Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
32a84553
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,发现更多精彩内容 >>
提交
32a84553
编写于
6月 22, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(push): add enabled event
上级
bb602168
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
268 addition
and
113 deletion
+268
-113
packages/playground/uts/unpackage/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/TestModule.kt.map
...iplugin/android/src/io/dcloud/uniplugin/TestModule.kt.map
+0
-1
packages/playground/uts/unpackage/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/log.kt.map
...test-uniplugin/android/src/io/dcloud/uniplugin/log.kt.map
+0
-1
packages/playground/uts/unpackage/nativeplugins/test-uniplugin/android/src/test.kt.map
...kage/nativeplugins/test-uniplugin/android/src/test.kt.map
+0
-1
packages/uni-api/src/service/plugin/push.ts
packages/uni-api/src/service/plugin/push.ts
+27
-11
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+42
-15
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+19
-9
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+20
-9
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+20
-9
packages/uni-mp-kuaishou/dist/uni.api.esm.js
packages/uni-mp-kuaishou/dist/uni.api.esm.js
+20
-9
packages/uni-mp-lark/dist/uni.api.esm.js
packages/uni-mp-lark/dist/uni.api.esm.js
+20
-9
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+20
-9
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+20
-9
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+20
-9
packages/uni-push/dist/uni-push.es.js
packages/uni-push/dist/uni-push.es.js
+4
-0
packages/uni-push/dist/uni-push.plus.es.js
packages/uni-push/dist/uni-push.plus.es.js
+4
-0
packages/uni-push/lib/uni.plugin.js
packages/uni-push/lib/uni.plugin.js
+1
-1
packages/uni-push/src/index.ts
packages/uni-push/src/index.ts
+5
-0
packages/uni-push/src/plugin/index.ts
packages/uni-push/src/plugin/index.ts
+1
-1
packages/uni-push/src/plus.ts
packages/uni-push/src/plus.ts
+4
-0
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+20
-9
scripts/test.js
scripts/test.js
+1
-1
未找到文件。
packages/playground/uts/unpackage/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/TestModule.kt.map
已删除
100644 → 0
浏览文件 @
bb602168
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/TestModule.uts"],"names":["TestModule","UniModule","TAG","UniJSMethod","uiThread","testAsyncFunc","options","callback","log","data","JSONObject","invoke","testSyncFunc","onActivityResult","requestCode","resultCode","REQUEST_CODE","hasExtra","getStringExtra"],"mappings":"AAAA;AAAA,OAAmB,sBAAwB,CAAC;AAC5C,OAAuB,+BAAiC,CAAC;AACzD,OAAsB,yCAA2C,CAAC;AAClE,OAAwB,+CAAiD,CAAC;AAC1E,OAA0B,6CAA+C,CAAC;AAC1E,OAAgB,2BAAO,CAAC;AACT,WAAMA,UAAU,GAASC,SAAS,EAAE;IACjDC,SAAAA,GAAG,GAAG,YAAY,CAAC;IAGnB,CAACC,WAAW,CAAC,CAAEC,QAAQ,GAAE,IAAI,CAAE,CAAC;IAAA,SAChCC,aAAa,CAACC,OAAmB,EAAV,UAAU,EAAEC,QAAwB,EAAb,aAAa,CAAA,EAAE;QAC3DC,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,yBAAyB,CAAC,CAAC;QACzC,IAAIK,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAME,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;YAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAC9BF,QAAQ,CAACI,MAAM,CAACF,IAAI,CAAC,CAAC;;;IAI1B,CAACN,WAAW,CAAC,CAAEC,QAAQ,GAAE,KAAK,CAAE,CAAC;IAAA,SACjCQ,YAAY,CAACN,OAAmB,EAAV,UAAU,GAAG,UAAU,CAAC;QAC5C,IAAMG,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;QAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;QAC5B,OAAOA,IAAI,CAAC;;IAEd,aAASI,gBAAgB,CAACC,WAAgB,EAAH,GAAG,EAAEC,UAAe,EAAH,GAAG,EAAEN,IAAY,EAAN,MAAM,EAAE;QACzE,IAAIK,WAAW,IAAId,UAAU,CAACgB,YAAY,IAAIP,IAAI,CAACQ,QAAQ,CAAC,SAAS,CAAC,EAAE;YACtET,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,wBAAY,GAAGO,IAAI,CAACS,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;;QAC9D,MAAM;YACL,KAAK,CAACL,gBAAgB,CAACC,WAAW,EAAEC,UAAU,EAAEN,IAAI,CAAC,CAAC;;;;QAtB1D,IAAOO,YAAY,GAAG,IAAI,CAAC;;CAyB5B"}
\ No newline at end of file
packages/playground/uts/unpackage/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/log.kt.map
已删除
100644 → 0
浏览文件 @
bb602168
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/log.uts"],"names":["log","tag","msg","Log","e"],"mappings":"AAAA;AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,GAAEC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
packages/playground/uts/unpackage/nativeplugins/test-uniplugin/android/src/test.kt.map
已删除
100644 → 0
浏览文件 @
bb602168
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/test.uts"],"names":["log","tag","msg","Log","e"],"mappings":"AAAA;AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,CAACC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
packages/uni-api/src/service/plugin/push.ts
浏览文件 @
32a84553
import
{
defineAsyncApi
}
from
'
../../helpers/api
'
interface
OnPushCidCallback
{
interface
OnPushEnabledCallback
{
type
:
'
enabled
'
}
interface
OnPushClientIdCallback
{
type
:
'
clientId
'
cid
:
string
errMsg
?:
string
...
...
@@ -23,6 +27,8 @@ interface OnPushClickCallback {
let
cid
:
string
|
undefined
let
cidErrMsg
:
string
|
undefined
let
enabled
:
boolean
|
undefined
function
normalizePushMessage
(
message
:
unknown
)
{
try
{
return
JSON
.
parse
(
message
as
string
)
as
Record
<
string
,
any
>
...
...
@@ -35,12 +41,15 @@ function normalizePushMessage(message: unknown) {
*/
export
function
invokePushCallback
(
args
:
|
OnPushCidCallback
|
OnPushEnabledCallback
|
OnPushClientIdCallback
|
OnPushLineStateCallback
|
OnPushMsgCallback
|
OnPushClickCallback
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
cidErrMsg
=
args
.
errMsg
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
)
...
...
@@ -74,16 +83,23 @@ const API_GET_PUSH_CLIENT_ID = 'getPushClientId'
export
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
?:
string
,
errMsg
?:
string
)
=>
{
if
(
cid
)
{
resolve
({
cid
})
}
else
{
reject
(
errMsg
)
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
cid
=
''
cidErrMsg
=
'
unipush is not enabled
'
}
getPushCidCallbacks
.
push
((
cid
?:
string
,
errMsg
?:
string
)
=>
{
if
(
cid
)
{
resolve
({
cid
})
}
else
{
reject
(
errMsg
)
}
})
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
)
}
})
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
))
}
}
)
...
...
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
32a84553
...
...
@@ -11074,6 +11074,7 @@ const getLaunchOptionsSync = defineSyncApi(API_GET_LAUNCH_OPTIONS_SYNC, () => {
let cid;
let cidErrMsg;
let enabled;
function normalizePushMessage(message) {
try {
return JSON.parse(message);
...
...
@@ -11086,7 +11087,10 @@ function normalizePushMessage(message) {
* @param args
*/
function invokePushCallback(args) {
if (args.type === 'clientId') {
if (args.type === 'enabled') {
enabled = true;
}
else if (args.type === 'clientId') {
cid = args.cid;
cidErrMsg = args.errMsg;
invokeGetPushCidCallbacks(cid, args.errMsg);
...
...
@@ -11117,17 +11121,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
if (cid) {
resolve({ cid });
}
else {
reject(errMsg);
Promise.resolve().then(() => {
if (typeof enabled === 'undefined') {
enabled = false;
cid = '';
cidErrMsg = 'unipush is not enabled';
}
getPushCidCallbacks.push((cid, errMsg) => {
if (cid) {
resolve({ cid });
}
else {
reject(errMsg);
}
});
if (typeof cid !== 'undefined') {
invokeGetPushCidCallbacks(cid, cidErrMsg);
}
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
@@ -16428,7 +16439,7 @@ const providers = {
services.forEach(({ id }) => {
provider.push(id);
});
callback(null, provider);
callback(null, provider
, services
);
}, (err) => {
err = err;
callback(err);
...
...
@@ -16441,7 +16452,7 @@ const providers = {
services.forEach(({ id }) => {
provider.push(id);
});
callback(null, provider);
callback(null, provider
, services
);
}, (err) => {
callback(err);
});
...
...
@@ -16452,14 +16463,15 @@ const providers = {
services.forEach(({ id }) => {
provider.push(id);
});
callback(null, provider);
callback(null, provider
, services
);
}, (err) => {
callback(err);
});
},
push(callback) {
if (typeof weex !== 'undefined' || typeof plus !== 'undefined') {
callback(null, [plus.push.getClientInfo().id]);
const clientInfo = plus.push.getClientInfo();
callback(null, [clientInfo.id], [clientInfo]);
}
else {
callback(null, []);
...
...
@@ -16468,14 +16480,29 @@ const providers = {
};
const getProvider = defineAsyncApi(API_GET_PROVIDER, ({ service }, { resolve, reject }) => {
if (providers[service]) {
providers[service]((err, provider) => {
providers[service]((err, provider
= [], providers = []
) => {
if (err) {
reject(err.message);
}
else {
resolve({
service,
// 5+ PlusShareShareService['id'] 类型错误
provider: provider,
providers: providers.map((provider) => {
const returnProvider = {};
if (isPlainObject(provider)) {
for (const key in provider) {
if (Object.hasOwnProperty.call(provider, key)) {
const item = provider[key];
if (!isFunction(item) && typeof item !== 'undefined') {
returnProvider[key] = item;
}
}
}
}
return returnProvider;
}),
});
}
});
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
32a84553
...
...
@@ -4584,6 +4584,7 @@ const getLaunchOptionsSync = /* @__PURE__ */ defineSyncApi(API_GET_LAUNCH_OPTION
});
let cid;
let cidErrMsg;
let enabled;
function normalizePushMessage(message) {
try {
return JSON.parse(message);
...
...
@@ -4592,7 +4593,9 @@ function normalizePushMessage(message) {
return message;
}
function invokePushCallback(args) {
if (args.type === "clientId") {
if (args.type === "enabled") {
enabled = true;
} else if (args.type === "clientId") {
cid = args.cid;
cidErrMsg = args.errMsg;
invokeGetPushCidCallbacks(cid, args.errMsg);
...
...
@@ -4621,16 +4624,23 @@ function invokeGetPushCidCallbacks(cid2, errMsg) {
}
const API_GET_PUSH_CLIENT_ID = "getPushClientId";
const getPushClientId = /* @__PURE__ */ defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid2, errMsg) => {
if (cid2) {
resolve({ cid: cid2 });
} else {
reject(errMsg);
Promise.resolve().then(() => {
if (typeof enabled === "undefined") {
enabled = false;
cid = "";
cidErrMsg = "unipush is not enabled";
}
getPushCidCallbacks.push((cid2, errMsg) => {
if (cid2) {
resolve({ cid: cid2 });
} else {
reject(errMsg);
}
});
if (typeof cid !== "undefined") {
invokeGetPushCidCallbacks(cid, cidErrMsg);
}
});
if (typeof cid !== "undefined") {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
});
const onPushMessageCallbacks = [];
const onPushMessage = (fn) => {
...
...
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -649,6 +649,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -661,7 +662,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -692,17 +696,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -649,6 +649,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -661,7 +662,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -692,17 +696,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
packages/uni-mp-kuaishou/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -649,6 +649,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -661,7 +662,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -692,17 +696,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
packages/uni-mp-lark/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -649,6 +649,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -661,7 +662,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -692,17 +696,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -649,6 +649,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -661,7 +662,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -692,17 +696,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -649,6 +649,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -661,7 +662,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -692,17 +696,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -613,6 +613,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -625,7 +626,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -656,17 +660,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
packages/uni-push/dist/uni-push.es.js
浏览文件 @
32a84553
...
...
@@ -103,6 +103,10 @@ var GtPush = /*@__PURE__*/getDefaultExportFromCjs(gtpushMin);
// if (process.env.UNI_PUSH_DEBUG) {
// GtPush.setDebugMode(true)
// }
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
});
const
appid
=
process
.
env
.
UNI_APP_ID
;
if
(
!
appid
)
{
Promise
.
resolve
().
then
(()
=>
{
...
...
packages/uni-push/dist/uni-push.plus.es.js
浏览文件 @
32a84553
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
});
Promise
.
resolve
().
then
(()
=>
{
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
);
const
info
=
plus
.
push
.
getClientInfo
();
...
...
packages/uni-push/lib/uni.plugin.js
浏览文件 @
32a84553
...
...
@@ -45,7 +45,7 @@ var index = () => [
}
if
(
isEnable
)
{
return
{
code
:
code
+
`;import '@dcloudio/uni-push';`
,
code
:
`import '@dcloudio/uni-push';`
+
code
,
map
:
null
,
};
}
...
...
packages/uni-push/src/index.ts
浏览文件 @
32a84553
...
...
@@ -4,6 +4,11 @@ import GtPush from '../lib/gtpush-min'
// GtPush.setDebugMode(true)
// }
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
})
const
appid
=
process
.
env
.
UNI_APP_ID
!
if
(
!
appid
)
{
Promise
.
resolve
().
then
(()
=>
{
...
...
packages/uni-push/src/plugin/index.ts
浏览文件 @
32a84553
...
...
@@ -50,7 +50,7 @@ export default () => [
}
if
(
isEnable
)
{
return
{
code
:
code
+
`;import '@dcloudio/uni-push';`
,
code
:
`import '@dcloudio/uni-push';`
+
code
,
map
:
null
,
}
}
...
...
packages/uni-push/src/plus.ts
浏览文件 @
32a84553
// @ts-expect-error
uni
.
invokePushCallback
({
type
:
'
enabled
'
,
})
Promise
.
resolve
().
then
(()
=>
{
plus
.
push
.
setAutoNotification
&&
plus
.
push
.
setAutoNotification
(
false
)
const
info
=
plus
.
push
.
getClientInfo
()
...
...
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
32a84553
...
...
@@ -649,6 +649,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let
cid
;
let
cidErrMsg
;
let
enabled
;
function
normalizePushMessage
(
message
)
{
try
{
return
JSON
.
parse
(
message
);
...
...
@@ -661,7 +662,10 @@ function normalizePushMessage(message) {
* @param args
*/
function
invokePushCallback
(
args
)
{
if
(
args
.
type
===
'
clientId
'
)
{
if
(
args
.
type
===
'
enabled
'
)
{
enabled
=
true
;
}
else
if
(
args
.
type
===
'
clientId
'
)
{
cid
=
args
.
cid
;
cidErrMsg
=
args
.
errMsg
;
invokeGetPushCidCallbacks
(
cid
,
args
.
errMsg
);
...
...
@@ -692,17 +696,24 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
}
const
API_GET_PUSH_CLIENT_ID
=
'
getPushClientId
'
;
const
getPushClientId
=
defineAsyncApi
(
API_GET_PUSH_CLIENT_ID
,
(
_
,
{
resolve
,
reject
})
=>
{
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
Promise
.
resolve
().
then
(()
=>
{
if
(
typeof
enabled
===
'
undefined
'
)
{
enabled
=
false
;
cid
=
''
;
cidErrMsg
=
'
unipush is not enabled
'
;
}
else
{
reject
(
errMsg
);
getPushCidCallbacks
.
push
((
cid
,
errMsg
)
=>
{
if
(
cid
)
{
resolve
({
cid
});
}
else
{
reject
(
errMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
);
}
});
if
(
typeof
cid
!==
'
undefined
'
)
{
Promise
.
resolve
().
then
(()
=>
invokeGetPushCidCallbacks
(
cid
,
cidErrMsg
));
}
});
const
onPushMessageCallbacks
=
[];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
...
...
scripts/test.js
浏览文件 @
32a84553
...
...
@@ -10,7 +10,7 @@ runBuild(UtsTarget.KOTLIN, {
},
output
:
{
dir
:
path
.
resolve
(
projectDir
,
'
unpackage/nativeplugins/test-uniplugin
'
),
sourceMap
:
tru
e
,
sourceMap
:
fals
e
,
inlineSourcesContent
:
false
,
},
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录