提交 492cb704 编写于 作者: Q qiang

chore: build

上级 5f20eac5
...@@ -6484,7 +6484,7 @@ var serviceContext = (function () { ...@@ -6484,7 +6484,7 @@ var serviceContext = (function () {
weexGetSystemInfoSync(); weexGetSystemInfoSync();
const { const {
deviceBrand, deviceModel, osName, deviceBrand, deviceModel, osName,
osVersion osVersion, deviceOrientation, deviceType
} = systemInfo; } = systemInfo;
const brand = deviceBrand.toLowerCase(); const brand = deviceBrand.toLowerCase();
...@@ -6492,6 +6492,10 @@ var serviceContext = (function () { ...@@ -6492,6 +6492,10 @@ var serviceContext = (function () {
return { return {
deviceBrand: brand, deviceBrand: brand,
deviceModel, deviceModel,
devicePixelRatio: plus.screen.scale,
deviceId: deviceId$1(),
deviceOrientation,
deviceType,
brand, brand,
model: deviceModel, model: deviceModel,
system: `${osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`, system: `${osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`,
...@@ -6502,7 +6506,7 @@ var serviceContext = (function () { ...@@ -6502,7 +6506,7 @@ var serviceContext = (function () {
function getAppBaseInfo () { function getAppBaseInfo () {
weexGetSystemInfoSync(); weexGetSystemInfoSync();
const { const {
hostPackageName, hostName, osLanguage, hostPackageName, hostName,
hostVersion, hostLanguage, hostTheme, hostVersion, hostLanguage, hostTheme,
appId, appName, appVersion, appVersionCode appId, appName, appVersion, appVersionCode
} = systemInfo; } = systemInfo;
...@@ -6517,7 +6521,7 @@ var serviceContext = (function () { ...@@ -6517,7 +6521,7 @@ var serviceContext = (function () {
appVersionCode, appVersionCode,
appLanguage: uni.getLocale(), appLanguage: uni.getLocale(),
version: plus.runtime.innerVersion, version: plus.runtime.innerVersion,
language: osLanguage, language: hostLanguage,
theme: '', theme: '',
hostPackageName, hostPackageName,
hostName, hostName,
...@@ -6536,11 +6540,12 @@ var serviceContext = (function () { ...@@ -6536,11 +6540,12 @@ var serviceContext = (function () {
_initSystemInfo = true; _initSystemInfo = true;
weexGetSystemInfoSync(); weexGetSystemInfoSync();
_initSystemInfo = false; _initSystemInfo = false;
const windowInfo = getWindowInfo();
const deviceInfo = getDeviceInfo(); const deviceInfo = getDeviceInfo();
const appBaseInfo = getAppBaseInfo(); const appBaseInfo = getAppBaseInfo();
_initSystemInfo = true; _initSystemInfo = true;
const { osName, osLanguage, osVersion, pixelRatio } = systemInfo; const { osName, osLanguage, osVersion } = systemInfo;
const osLanguageSplit = osLanguage.split('-'); const osLanguageSplit = osLanguage.split('-');
const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1]; const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1];
const _osLanguage = `${osLanguageSplit[0]}${osLanguageSplitLast ? '-' + osLanguageSplitLast : ''}`; const _osLanguage = `${osLanguageSplit[0]}${osLanguageSplitLast ? '-' + osLanguageSplitLast : ''}`;
...@@ -6548,8 +6553,6 @@ var serviceContext = (function () { ...@@ -6548,8 +6553,6 @@ var serviceContext = (function () {
const extraData = { const extraData = {
errMsg: 'getSystemInfo:ok', errMsg: 'getSystemInfo:ok',
fontSizeSetting: appBaseInfo.hostFontSizeSetting, fontSizeSetting: appBaseInfo.hostFontSizeSetting,
devicePixelRatio: pixelRatio,
deviceId: deviceId$1(),
uniCompileVersion: __uniConfig.compilerVersion, uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion, uniRuntimeVersion: __uniConfig.compilerVersion,
osLanguage: _osLanguage osLanguage: _osLanguage
...@@ -6563,7 +6566,7 @@ var serviceContext = (function () { ...@@ -6563,7 +6566,7 @@ var serviceContext = (function () {
const _systemInfo = Object.assign( const _systemInfo = Object.assign(
{}, {},
systemInfo, systemInfo,
getWindowInfo(), windowInfo,
deviceInfo, deviceInfo,
appBaseInfo, appBaseInfo,
extraData extraData
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -636,9 +636,10 @@ function removeStorageSync (key) { ...@@ -636,9 +636,10 @@ function removeStorageSync (key) {
}) })
} }
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
function addSafeAreaInsets (result) { function addSafeAreaInsets (result) {
...@@ -655,8 +656,8 @@ function addSafeAreaInsets (result) { ...@@ -655,8 +656,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -673,31 +674,10 @@ function populateParameters (result) { ...@@ -673,31 +674,10 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "mp-alipay".split('-')[1]; // mp-jd let _hostName = hostName || "mp-alipay".split('-')[1]; // mp-jd
...@@ -732,7 +712,7 @@ function populateParameters (result) { ...@@ -732,7 +712,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -750,6 +730,44 @@ function populateParameters (result) { ...@@ -750,6 +730,44 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
let deviceId; let deviceId;
function addUuid (result) { function addUuid (result) {
......
...@@ -651,9 +651,10 @@ var previewImage = { ...@@ -651,9 +651,10 @@ var previewImage = {
} }
}; };
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) { ...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -706,15 +707,10 @@ function populateParameters (result) { ...@@ -706,15 +707,10 @@ function populateParameters (result) {
} }
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result);
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "mp-baidu".split('-')[1]; // mp-jd let _hostName = hostName || "mp-baidu".split('-')[1]; // mp-jd
...@@ -750,7 +746,7 @@ function populateParameters (result) { ...@@ -750,7 +746,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -768,6 +764,28 @@ function populateParameters (result) { ...@@ -768,6 +764,28 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
...@@ -480,9 +480,10 @@ var baseApi = /*#__PURE__*/Object.freeze({ ...@@ -480,9 +480,10 @@ var baseApi = /*#__PURE__*/Object.freeze({
interceptors: interceptors interceptors: interceptors
}); });
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
...@@ -513,8 +514,8 @@ function addSafeAreaInsets (result) { ...@@ -513,8 +514,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -534,31 +535,10 @@ function populateParameters (result) { ...@@ -534,31 +535,10 @@ function populateParameters (result) {
} }
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "mp-jd".split('-')[1]; // mp-jd let _hostName = hostName || "mp-jd".split('-')[1]; // mp-jd
...@@ -591,7 +571,7 @@ function populateParameters (result) { ...@@ -591,7 +571,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -609,6 +589,44 @@ function populateParameters (result) { ...@@ -609,6 +589,44 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
...@@ -651,9 +651,10 @@ var previewImage = { ...@@ -651,9 +651,10 @@ var previewImage = {
} }
}; };
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) { ...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -702,31 +703,10 @@ function populateParameters (result) { ...@@ -702,31 +703,10 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "mp-kuaishou".split('-')[1]; // mp-jd let _hostName = hostName || "mp-kuaishou".split('-')[1]; // mp-jd
...@@ -760,7 +740,7 @@ function populateParameters (result) { ...@@ -760,7 +740,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -778,6 +758,44 @@ function populateParameters (result) { ...@@ -778,6 +758,44 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
...@@ -679,12 +679,13 @@ function addSafeAreaInsets (result) { ...@@ -679,12 +679,13 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
} = result; } = result;
const isQuickApp = "mp-lark".indexOf('quickapp-webview') !== -1;
// osName osVersion // osName osVersion
let osName = ''; let osName = '';
...@@ -696,29 +697,10 @@ function populateParameters (result) { ...@@ -696,29 +697,10 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
{
deviceBrand = brand.toLocaleLowerCase();
}
// hostName // hostName
let _hostName = hostName || "mp-lark".split('-')[1]; // mp-jd let _hostName = hostName || "mp-lark".split('-')[1]; // mp-jd
...@@ -752,7 +734,7 @@ function populateParameters (result) { ...@@ -752,7 +734,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -770,6 +752,39 @@ function populateParameters (result) { ...@@ -770,6 +752,39 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
...@@ -651,9 +651,10 @@ var previewImage = { ...@@ -651,9 +651,10 @@ var previewImage = {
} }
}; };
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) { ...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -702,31 +703,10 @@ function populateParameters (result) { ...@@ -702,31 +703,10 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "mp-qq".split('-')[1]; // mp-jd let _hostName = hostName || "mp-qq".split('-')[1]; // mp-jd
...@@ -760,7 +740,7 @@ function populateParameters (result) { ...@@ -760,7 +740,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -778,6 +758,44 @@ function populateParameters (result) { ...@@ -778,6 +758,44 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
...@@ -679,12 +679,13 @@ function addSafeAreaInsets (result) { ...@@ -679,12 +679,13 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
} = result; } = result;
const isQuickApp = "mp-toutiao".indexOf('quickapp-webview') !== -1;
// osName osVersion // osName osVersion
let osName = ''; let osName = '';
...@@ -696,29 +697,10 @@ function populateParameters (result) { ...@@ -696,29 +697,10 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
{
deviceBrand = brand.toLocaleLowerCase();
}
// hostName // hostName
let _hostName = hostName || "mp-toutiao".split('-')[1]; // mp-jd let _hostName = hostName || "mp-toutiao".split('-')[1]; // mp-jd
...@@ -752,7 +734,7 @@ function populateParameters (result) { ...@@ -752,7 +734,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -770,6 +752,39 @@ function populateParameters (result) { ...@@ -770,6 +752,39 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
...@@ -546,9 +546,10 @@ var previewImage = { ...@@ -546,9 +546,10 @@ var previewImage = {
} }
}; };
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
...@@ -579,8 +580,8 @@ function addSafeAreaInsets (result) { ...@@ -579,8 +580,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -597,38 +598,17 @@ function populateParameters (result) { ...@@ -597,38 +598,17 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "mp-weixin".split('-')[1]; // mp-jd let _hostName = hostName || "mp-weixin".split('-')[1]; // mp-jd
{ {
if (environment) { if (environment) {
_hostName = environment; _hostName = environment;
} else if (result.host) { } else if (result.host && result.host.env) {
_hostName = result.host.env; _hostName = result.host.env;
} }
} }
...@@ -661,7 +641,7 @@ function populateParameters (result) { ...@@ -661,7 +641,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -679,6 +659,44 @@ function populateParameters (result) { ...@@ -679,6 +659,44 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
...@@ -695,6 +713,57 @@ var showActionSheet = { ...@@ -695,6 +713,57 @@ var showActionSheet = {
} }
}; };
var getAppBaseInfo = {
returnValue: function (result) {
const { version, language, SDKVersion, theme } = result;
let _hostName = "mp-weixin".split('-')[1]; // mp-jd
{
if (result.host && result.host.env) {
_hostName = result.host.env;
}
}
Object.assign(result, {
hostVersion: version,
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: SDKVersion,
hostTheme: theme,
appId: process.env.UNI_APP_ID,
appName: process.env.UNI_APP_NAME,
appVersion: process.env.UNI_APP_VERSION_NAME,
appVersionCode: process.env.UNI_APP_VERSION_CODE
});
}
};
var getDeviceInfo = {
returnValue: function (result) {
const { brand, model } = result;
const deviceType = getGetDeviceType(result, model);
const deviceBrand = getDeviceBrand(brand, model);
useDeviceId(result);
Object.assign(result, {
deviceType,
deviceBrand,
deviceModel: model
});
}
};
var getWindowInfo = {
returnValue: function (result) {
addSafeAreaInsets(result);
Object.assign(result, {
windowTop: 0,
windowBottom: 0
});
}
};
// import navigateTo from 'uni-helpers/navigate-to' // import navigateTo from 'uni-helpers/navigate-to'
const protocols = { const protocols = {
...@@ -703,7 +772,10 @@ const protocols = { ...@@ -703,7 +772,10 @@ const protocols = {
previewImage, previewImage,
getSystemInfo, getSystemInfo,
getSystemInfoSync: getSystemInfo, getSystemInfoSync: getSystemInfo,
showActionSheet showActionSheet,
getAppBaseInfo,
getDeviceInfo,
getWindowInfo
}; };
const todos = [ const todos = [
'vibrate', 'vibrate',
......
...@@ -480,9 +480,10 @@ var baseApi = /*#__PURE__*/Object.freeze({ ...@@ -480,9 +480,10 @@ var baseApi = /*#__PURE__*/Object.freeze({
interceptors: interceptors interceptors: interceptors
}); });
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
...@@ -513,8 +514,8 @@ function addSafeAreaInsets (result) { ...@@ -513,8 +514,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -531,31 +532,10 @@ function populateParameters (result) { ...@@ -531,31 +532,10 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "mp-xhs".split('-')[1]; // mp-jd let _hostName = hostName || "mp-xhs".split('-')[1]; // mp-jd
...@@ -588,7 +568,7 @@ function populateParameters (result) { ...@@ -588,7 +568,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -606,6 +586,44 @@ function populateParameters (result) { ...@@ -606,6 +586,44 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
...@@ -651,9 +651,10 @@ var previewImage = { ...@@ -651,9 +651,10 @@ var previewImage = {
} }
}; };
function getDeviceBrand (model) { function _getDeviceBrand (model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' } if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) { return 'apple' }
if (/windows/gi.test(model)) { return 'microsoft' } if (/windows/gi.test(model)) { return 'microsoft' }
return ''
} }
const UUID_KEY = '__DC_STAT_UUID'; const UUID_KEY = '__DC_STAT_UUID';
...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) { ...@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) { function populateParameters (result) {
const { const {
brand, model, system, brand = '', model = '', system = '',
language, theme, version, language = '', theme, version,
hostName, platform, fontSizeSetting, hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation, SDKVersion, pixelRatio, deviceOrientation,
environment environment
...@@ -702,31 +703,10 @@ function populateParameters (result) { ...@@ -702,31 +703,10 @@ function populateParameters (result) {
let hostVersion = version; let hostVersion = version;
// deviceType // deviceType
let deviceType = result.deviceType || 'phone'; const deviceType = getGetDeviceType(result, model);
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
// deviceModel // deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase(); const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName // hostName
let _hostName = hostName || "quickapp-webview".split('-')[1]; // mp-jd let _hostName = hostName || "quickapp-webview".split('-')[1]; // mp-jd
...@@ -759,7 +739,7 @@ function populateParameters (result) { ...@@ -759,7 +739,7 @@ function populateParameters (result) {
osVersion, osVersion,
hostTheme: theme, hostTheme: theme,
hostVersion, hostVersion,
hostLanguage: language.split('_', '-'), hostLanguage: language.replace('_', '-'),
hostName: _hostName, hostName: _hostName,
hostSDKVersion: _SDKVersion, hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting, hostFontSizeSetting: fontSizeSetting,
...@@ -777,6 +757,44 @@ function populateParameters (result) { ...@@ -777,6 +757,44 @@ function populateParameters (result) {
Object.assign(result, parameters); Object.assign(result, parameters);
} }
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc'
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break
}
}
}
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = { var getSystemInfo = {
returnValue: function (result) { returnValue: function (result) {
useDeviceId(result); useDeviceId(result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册