diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 71801f6ae7c21715966ab73fd738eda8a2afdef5..4f101c80d4035c45efa6774e9d3930cd9f4468d8 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -40,7 +40,7 @@ const camelize = cached((str) => { return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '') }); -const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; +const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; const CONTEXT_API_RE = /^create|Manager$/; @@ -145,7 +145,7 @@ function upx2px (number, newDeviceWidth) { } // 不支持的 API 列表 -const TODOS = [ +const todos = [ 'saveImageToPhotosAlbum', 'getRecorderManager', 'getBackgroundAudioManager', @@ -170,7 +170,6 @@ const TODOS = [ 'hideTabBarRedDot', 'setBackgroundColor', 'setBackgroundTextStyle', - 'startPullDownRefresh', 'createIntersectionObserver', 'authorize', 'openSetting', @@ -191,6 +190,11 @@ const TODOS = [ 'offWindowResize' ]; +// 存在兼容性的 API 列表 +const canIUses = [ + 'startPullDownRefresh' +]; + function _handleNetworkInfo (result) { switch (result.networkType) { case 'NOTREACHABLE': @@ -462,7 +466,7 @@ const protocols = { // 需要做转换的 API 列表 requestPayment: { name: 'tradePay', args: { - orderInfo: 'orderStr' + orderInfo: 'tradeNO' } }, getBLEDeviceServices: { @@ -503,11 +507,7 @@ const protocols = { // 需要做转换的 API 列表 brightness: 'value' } } -}; - -TODOS.forEach(todoApi => { - protocols[todoApi] = false; -}); +}; const CALLBACKS = ['success', 'fail', 'cancel', 'complete']; @@ -586,7 +586,7 @@ function wrapper (methodName, method) { const todoApis = Object.create(null); -const TODOS$1 = [ +const TODOS = [ 'subscribePush', 'unsubscribePush', 'onPush', @@ -607,7 +607,7 @@ function createTodoApi (name) { } } -TODOS$1.forEach(function (name) { +TODOS.forEach(function (name) { todoApis[name] = createTodoApi(name); }); @@ -655,12 +655,8 @@ function getStorageSync (key) { const result = my.getStorageSync({ key }); - // 不知道会不会出现 success 为 false 情况,暂时这样处理下。 - if (result.success) { - return result.data || '' - } else { - return '' - } + // 支付宝平台会返回一个 success 值,但是目前测试的结果这个始终是 true。当没有存储数据的时候,其它平台会返回空字符串。 + return result.data !== null ? result.data : '' } function removeStorageSync (key) { return my.removeStorageSync({ @@ -1547,6 +1543,17 @@ function createComponent (vueOptions) { return initComponent(componentOptions, vueOptions) } +todos.forEach(todoApi => { + protocols[todoApi] = false; +}); + +canIUses.forEach(canIUseApi => { + const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi; + if (!my.canIUse(apiName)) { + protocols[canIUseApi] = false; + } +}); + let uni = {}; if (typeof Proxy !== 'undefined') { diff --git a/packages/uni-mp-alipay/package.json b/packages/uni-mp-alipay/package.json index 001c626f40c337e81c781240f61d081b17d625d4..4ec8aa306c5deb8c3211310fbbd5f7f996d88fed 100644 --- a/packages/uni-mp-alipay/package.json +++ b/packages/uni-mp-alipay/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-alipay", - "version": "0.0.801", + "version": "0.0.802", "description": "uni-app mp-alipay", "main": "dist/index.js", "scripts": { diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index 4fccafcc4cf78f4056501fecfe648afcd382e7f7..e144b83584d1997ef07da02b8105d2aff00001b2 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -40,7 +40,7 @@ const camelize = cached((str) => { return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '') }); -const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; +const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; const CONTEXT_API_RE = /^create|Manager$/; @@ -145,7 +145,7 @@ function upx2px (number, newDeviceWidth) { } // 不支持的 API 列表 -const TODOS = [ +const todos = [ 'hideKeyboard', 'onGyroscopeChange', 'startGyroscope', @@ -178,6 +178,9 @@ const TODOS = [ 'offWindowResize' ]; +// 存在兼容性的 API 列表 +const canIUses = []; + function createTodoMethod (contextName, methodName) { return function unsupported () { console.error(`百度小程序 ${contextName}暂不支持${methodName}`); @@ -237,11 +240,7 @@ const protocols = { showShareMenu: { name: 'openShare' } -}; - -TODOS.forEach(todoApi => { - protocols[todoApi] = false; -}); +}; const CALLBACKS = ['success', 'fail', 'cancel', 'complete']; @@ -320,7 +319,7 @@ function wrapper (methodName, method) { const todoApis = Object.create(null); -const TODOS$1 = [ +const TODOS = [ 'subscribePush', 'unsubscribePush', 'onPush', @@ -341,7 +340,7 @@ function createTodoApi (name) { } } -TODOS$1.forEach(function (name) { +TODOS.forEach(function (name) { todoApis[name] = createTodoApi(name); }); @@ -1159,6 +1158,17 @@ function createComponent (vueOptions) { return initComponent$1(componentOptions, vueOptions) } +todos.forEach(todoApi => { + protocols[todoApi] = false; +}); + +canIUses.forEach(canIUseApi => { + const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi; + if (!swan.canIUse(apiName)) { + protocols[canIUseApi] = false; + } +}); + let uni = {}; if (typeof Proxy !== 'undefined') { diff --git a/packages/uni-mp-baidu/package.json b/packages/uni-mp-baidu/package.json index d6fd93c41b6b1163dbca42df6117fe323bf0a628..99be9a84be41f4419bf6e8dae7f543d2604bc39b 100644 --- a/packages/uni-mp-baidu/package.json +++ b/packages/uni-mp-baidu/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-baidu", - "version": "0.0.827", + "version": "0.0.828", "description": "uni-app mp-baidu", "main": "dist/index.js", "scripts": { diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index cc3a154fcd798ce7ba5ba987fafacde361bee02c..833c081be14724467fe89a806926ba2f06d8e577 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -40,7 +40,7 @@ const camelize = cached((str) => { return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '') }); -const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; +const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; const CONTEXT_API_RE = /^create|Manager$/; @@ -145,7 +145,7 @@ function upx2px (number, newDeviceWidth) { } // 不支持的 API 列表 -const TODOS = [ +const todos = [ 'hideKeyboard', 'onSocketOpen', 'onSocketError', @@ -227,6 +227,9 @@ const TODOS = [ 'offWindowResize' ]; +// 存在兼容性的 API 列表 +const canIUses = []; + // 需要做转换的 API 列表 const protocols = { chooseImage: { @@ -298,11 +301,7 @@ const protocols = { requestPayment: { orderInfo: 'data' } -}; - -TODOS.forEach(todoApi => { - protocols[todoApi] = false; -}); +}; const CALLBACKS = ['success', 'fail', 'cancel', 'complete']; @@ -381,7 +380,7 @@ function wrapper (methodName, method) { const todoApis = Object.create(null); -const TODOS$1 = [ +const TODOS = [ 'subscribePush', 'unsubscribePush', 'onPush', @@ -402,7 +401,7 @@ function createTodoApi (name) { } } -TODOS$1.forEach(function (name) { +TODOS.forEach(function (name) { todoApis[name] = createTodoApi(name); }); @@ -1166,6 +1165,17 @@ function createComponent (vueOptions) { return initComponent$1(componentOptions, vueOptions) } +todos.forEach(todoApi => { + protocols[todoApi] = false; +}); + +canIUses.forEach(canIUseApi => { + const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi; + if (!tt.canIUse(apiName)) { + protocols[canIUseApi] = false; + } +}); + let uni = {}; if (typeof Proxy !== 'undefined') { diff --git a/packages/uni-mp-toutiao/package.json b/packages/uni-mp-toutiao/package.json index d8d06b67208bfc5f5f36d1e616360815d8f7f19a..6f9e579958bb4ec2c16c9c5d7a20f45449d9e21b 100644 --- a/packages/uni-mp-toutiao/package.json +++ b/packages/uni-mp-toutiao/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-toutiao", - "version": "0.0.325", + "version": "0.0.326", "description": "uni-app mp-toutiao", "main": "dist/index.js", "scripts": { diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index c8a57b73bc9475f5db2443d762ff2b0d68fa79f1..f8c8ce162655cad4d5ec2c713adb7476d4d8ddd4 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -40,7 +40,7 @@ const camelize = cached((str) => { return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '') }); -const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; +const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; const CONTEXT_API_RE = /^create|Manager$/; @@ -144,7 +144,9 @@ function upx2px (number, newDeviceWidth) { return number < 0 ? -result : result } -var protocols = {}; +const protocols = {}; +const todos = []; +const canIUses = []; const CALLBACKS = ['success', 'fail', 'cancel', 'complete']; @@ -1004,6 +1006,17 @@ function createComponent (vueOptions) { return initComponent(componentOptions, vueOptions) } +todos.forEach(todoApi => { + protocols[todoApi] = false; +}); + +canIUses.forEach(canIUseApi => { + const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi; + if (!wx.canIUse(apiName)) { + protocols[canIUseApi] = false; + } +}); + let uni = {}; if (typeof Proxy !== 'undefined') { diff --git a/packages/uni-mp-weixin/package.json b/packages/uni-mp-weixin/package.json index 29fc3fa9ea6c9b0c96e61008e5040c300586b69f..921ee811318792f38aa5fbebb61c016b776417b5 100644 --- a/packages/uni-mp-weixin/package.json +++ b/packages/uni-mp-weixin/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-weixin", - "version": "0.0.949", + "version": "0.0.950", "description": "uni-app mp-weixin", "main": "dist/index.js", "scripts": {