From 71abcea3348e368fe868c834af8da410ffe039c7 Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 23 Feb 2022 17:58:08 +0800 Subject: [PATCH] chore: build --- packages/uni-mp-alipay/dist/uni.api.esm.js | 19 +++++++++++++++++ packages/uni-mp-baidu/dist/uni.api.esm.js | 21 ++++++++++++++++++- packages/uni-mp-kuaishou/dist/uni.api.esm.js | 21 ++++++++++++++++++- packages/uni-mp-qq/dist/uni.api.esm.js | 21 ++++++++++++++++++- packages/uni-mp-weixin/dist/uni.api.esm.js | 21 ++++++++++++++++++- .../uni-quickapp-webview/dist/uni.api.esm.js | 21 ++++++++++++++++++- 6 files changed, 119 insertions(+), 5 deletions(-) diff --git a/packages/uni-mp-alipay/dist/uni.api.esm.js b/packages/uni-mp-alipay/dist/uni.api.esm.js index 02a6f1cdbb..5a318c0b67 100644 --- a/packages/uni-mp-alipay/dist/uni.api.esm.js +++ b/packages/uni-mp-alipay/dist/uni.api.esm.js @@ -920,6 +920,22 @@ function addSafeAreaInsets(fromRes, toRes) { } } +const UUID_KEY = '__DC_STAT_UUID'; +let deviceId; +function useDeviceId(global = my) { + return function addDeviceId(_, toRes) { + deviceId = deviceId || global.getStorageSync(UUID_KEY); + if (!deviceId) { + deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7); + my.setStorage({ + key: UUID_KEY, + data: deviceId, + }); + } + toRes.deviceId = deviceId; + }; +} + const redirectTo = {}; const getProvider = initGetProvider({ @@ -1052,6 +1068,9 @@ function handleNetworkInfo(fromRes, toRes) { } function handleSystemInfo(fromRes, toRes) { addSafeAreaInsets(fromRes, toRes); + useDeviceId({ + getStorageSync, + })(fromRes, toRes); let platform = fromRes.platform ? fromRes.platform.toLowerCase() : 'devtools'; if (!~['android', 'ios'].indexOf(platform)) { platform = 'devtools'; diff --git a/packages/uni-mp-baidu/dist/uni.api.esm.js b/packages/uni-mp-baidu/dist/uni.api.esm.js index 6e65dd43d9..01bd409fa9 100644 --- a/packages/uni-mp-baidu/dist/uni.api.esm.js +++ b/packages/uni-mp-baidu/dist/uni.api.esm.js @@ -920,8 +920,27 @@ function addSafeAreaInsets(fromRes, toRes) { } } +const UUID_KEY = '__DC_STAT_UUID'; +let deviceId; +function useDeviceId(global = swan) { + return function addDeviceId(_, toRes) { + deviceId = deviceId || global.getStorageSync(UUID_KEY); + if (!deviceId) { + deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7); + swan.setStorage({ + key: UUID_KEY, + data: deviceId, + }); + } + toRes.deviceId = deviceId; + }; +} + const getSystemInfo = { - returnValue: addSafeAreaInsets, + returnValue: (fromRes, toRes) => { + addSafeAreaInsets(fromRes, toRes); + useDeviceId()(fromRes, toRes); + }, }; const getSystemInfoSync = getSystemInfo; diff --git a/packages/uni-mp-kuaishou/dist/uni.api.esm.js b/packages/uni-mp-kuaishou/dist/uni.api.esm.js index 3cd1910f8d..5dd40ea097 100644 --- a/packages/uni-mp-kuaishou/dist/uni.api.esm.js +++ b/packages/uni-mp-kuaishou/dist/uni.api.esm.js @@ -920,8 +920,27 @@ function addSafeAreaInsets(fromRes, toRes) { } } +const UUID_KEY = '__DC_STAT_UUID'; +let deviceId; +function useDeviceId(global = ks) { + return function addDeviceId(_, toRes) { + deviceId = deviceId || global.getStorageSync(UUID_KEY); + if (!deviceId) { + deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7); + ks.setStorage({ + key: UUID_KEY, + data: deviceId, + }); + } + toRes.deviceId = deviceId; + }; +} + const getSystemInfo = { - returnValue: addSafeAreaInsets, + returnValue: (fromRes, toRes) => { + addSafeAreaInsets(fromRes, toRes); + useDeviceId()(fromRes, toRes); + }, }; const getSystemInfoSync = getSystemInfo; diff --git a/packages/uni-mp-qq/dist/uni.api.esm.js b/packages/uni-mp-qq/dist/uni.api.esm.js index 4b7efbb282..5b1217c354 100644 --- a/packages/uni-mp-qq/dist/uni.api.esm.js +++ b/packages/uni-mp-qq/dist/uni.api.esm.js @@ -920,8 +920,27 @@ function addSafeAreaInsets(fromRes, toRes) { } } +const UUID_KEY = '__DC_STAT_UUID'; +let deviceId; +function useDeviceId(global = qq) { + return function addDeviceId(_, toRes) { + deviceId = deviceId || global.getStorageSync(UUID_KEY); + if (!deviceId) { + deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7); + qq.setStorage({ + key: UUID_KEY, + data: deviceId, + }); + } + toRes.deviceId = deviceId; + }; +} + const getSystemInfo = { - returnValue: addSafeAreaInsets, + returnValue: (fromRes, toRes) => { + addSafeAreaInsets(fromRes, toRes); + useDeviceId()(fromRes, toRes); + }, }; const getSystemInfoSync = getSystemInfo; diff --git a/packages/uni-mp-weixin/dist/uni.api.esm.js b/packages/uni-mp-weixin/dist/uni.api.esm.js index b97ef8afab..e7d37ece52 100644 --- a/packages/uni-mp-weixin/dist/uni.api.esm.js +++ b/packages/uni-mp-weixin/dist/uni.api.esm.js @@ -884,8 +884,27 @@ function addSafeAreaInsets(fromRes, toRes) { } } +const UUID_KEY = '__DC_STAT_UUID'; +let deviceId; +function useDeviceId(global = wx) { + return function addDeviceId(_, toRes) { + deviceId = deviceId || global.getStorageSync(UUID_KEY); + if (!deviceId) { + deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7); + wx.setStorage({ + key: UUID_KEY, + data: deviceId, + }); + } + toRes.deviceId = deviceId; + }; +} + const getSystemInfo = { - returnValue: addSafeAreaInsets, + returnValue: (fromRes, toRes) => { + addSafeAreaInsets(fromRes, toRes); + useDeviceId()(fromRes, toRes); + }, }; const getSystemInfoSync = getSystemInfo; diff --git a/packages/uni-quickapp-webview/dist/uni.api.esm.js b/packages/uni-quickapp-webview/dist/uni.api.esm.js index 175d5bc042..a62e0aa716 100644 --- a/packages/uni-quickapp-webview/dist/uni.api.esm.js +++ b/packages/uni-quickapp-webview/dist/uni.api.esm.js @@ -920,8 +920,27 @@ function addSafeAreaInsets(fromRes, toRes) { } } +const UUID_KEY = '__DC_STAT_UUID'; +let deviceId; +function useDeviceId(global = qa) { + return function addDeviceId(_, toRes) { + deviceId = deviceId || global.getStorageSync(UUID_KEY); + if (!deviceId) { + deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7); + qa.setStorage({ + key: UUID_KEY, + data: deviceId, + }); + } + toRes.deviceId = deviceId; + }; +} + const getSystemInfo = { - returnValue: addSafeAreaInsets, + returnValue: (fromRes, toRes) => { + addSafeAreaInsets(fromRes, toRes); + useDeviceId()(fromRes, toRes); + }, }; const getSystemInfoSync = getSystemInfo; -- GitLab