@dcloudio/vue-cli-plugin-uni 2.0.2-alpha-3080720230627002 → 2.0.2-alpha-3081120230718001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/env.js CHANGED
@@ -25,6 +25,7 @@ const {
25
25
  isEnableUniPushV1,
26
26
  isEnableUniPushV2,
27
27
  isUniPushOffline,
28
+ hasPushModule,
28
29
  isEnableSecureNetwork
29
30
  } = require('@dcloudio/uni-cli-shared/lib/manifest')
30
31
 
@@ -54,6 +55,10 @@ if (isEnableUniPushV2(manifestJsonObj, process.env.UNI_PLATFORM)) {
54
55
  process.env.UNI_PUSH_V1 = true
55
56
  }
56
57
 
58
+ if (hasPushModule(manifestJsonObj)) {
59
+ process.env.UNI_PUSH_MODULE = true
60
+ }
61
+
57
62
  // 初始化全局插件对象
58
63
  global.uniPlugin = require('@dcloudio/uni-cli-shared/lib/plugin').init()
59
64
 
@@ -128,7 +133,7 @@ if (!process.env.UNI_CLOUD_PROVIDER && process.env.UNI_CLOUD_SPACES) {
128
133
  }
129
134
  }))
130
135
  }
131
- } catch (e) { }
136
+ } catch (e) {}
132
137
  }
133
138
 
134
139
  // 安全网络
@@ -256,7 +261,7 @@ if (process.env.UNI_PLATFORM === 'h5') {
256
261
  try {
257
262
  const modules = require('@dcloudio/uni-h5/lib/modules.json')
258
263
  process.UNI_USER_APIS = parseUserApis(treeShaking.modules || [], modules)
259
- } catch (e) { }
264
+ } catch (e) {}
260
265
  }
261
266
  }
262
267
  if (optimization.prefetch) {
@@ -485,7 +490,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
485
490
  console.log(warningMsg)
486
491
  }
487
492
  }
488
- } catch (e) { }
493
+ } catch (e) {}
489
494
  }
490
495
  if (process.env.NODE_ENV !== 'production') { // 运行模式性能提示
491
496
  let perfMsg = uniI18n.__('pluginUni.runDebugMode')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.2-alpha-3080720230627002",
3
+ "version": "2.0.2-alpha-3081120230718001",
4
4
  "description": "uni-app plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "author": "fxy060608",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@dcloudio/uni-stat": "^2.0.2-alpha-3080720230627002",
20
+ "@dcloudio/uni-stat": "^2.0.2-alpha-3081120230718001",
21
21
  "buffer-json": "^2.0.0",
22
22
  "clone-deep": "^4.0.1",
23
23
  "cross-env": "^5.2.0",
@@ -41,5 +41,5 @@
41
41
  "copy-webpack-plugin": ">=5",
42
42
  "postcss": ">=7"
43
43
  },
44
- "gitHead": "1aa8e6560f01a401217e22264c09268d4784724d"
44
+ "gitHead": "272eebd2fb9d108926bef37e81ad2270fa2dd63d"
45
45
  }
@@ -0,0 +1,44 @@
1
+ function initPushNotification() {
2
+ // 仅 App 端
3
+ if (typeof plus !== 'undefined' && plus.push) {
4
+ plus.globalEvent.addEventListener('newPath', ({ path }) => {
5
+ if (!path) {
6
+ return;
7
+ }
8
+ // 指定的页面为当前页面
9
+ const pages = getCurrentPages();
10
+ const currentPage = pages[pages.length - 1];
11
+ if (currentPage &&
12
+ currentPage.$page &&
13
+ currentPage.$page.fullPath === path) {
14
+ return;
15
+ }
16
+ // 简单起见,先尝试 navigateTo 跳转,失败后,再尝试 tabBar 跳转
17
+ uni.navigateTo({
18
+ url: path,
19
+ fail(res) {
20
+ if (res.errMsg.indexOf('tabbar') > -1) {
21
+ uni.switchTab({
22
+ url: path,
23
+ fail(res) {
24
+ console.error(res.errMsg);
25
+ },
26
+ });
27
+ }
28
+ else {
29
+ console.error(res.errMsg);
30
+ }
31
+ },
32
+ });
33
+ });
34
+ }
35
+ }
36
+
37
+ // @ts-expect-error
38
+ uni.invokePushCallback({
39
+ type: 'enabled',
40
+ offline: true,
41
+ });
42
+ Promise.resolve().then(() => {
43
+ initPushNotification();
44
+ });