@dcloudio/uni-mp-toutiao 3.0.0-alpha-3041320220527004 → 3.0.0-alpha-3041320220607001

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.
@@ -1,4 +1,5 @@
1
1
  import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
2
+ import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
2
3
  import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
3
4
 
4
5
  const eventChannels = {};
@@ -774,7 +775,7 @@ const getLocale = () => {
774
775
  if (app && app.$vm) {
775
776
  return app.$vm.$locale;
776
777
  }
777
- return tt.getSystemInfoSync().language || 'zh-Hans';
778
+ return normalizeLocale(tt.getSystemInfoSync().language) || LOCALE_EN;
778
779
  };
779
780
  const setLocale = (locale) => {
780
781
  const app = getApp();
@@ -887,8 +888,8 @@ function addSafeAreaInsets(fromRes, toRes) {
887
888
  }
888
889
  }
889
890
  function populateParameters(fromRes, toRes) {
890
- const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
891
- const isQuickApp = "mp-toutiao".indexOf('quickapp-webview') !== -1;
891
+ const { brand = '', model = '', system = '', language = '', theme, version, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, } = fromRes;
892
+ // const isQuickApp = "mp-toutiao".indexOf('quickapp-webview') !== -1
892
893
  // osName osVersion
893
894
  let osName = '';
894
895
  let osVersion = '';
@@ -900,24 +901,24 @@ function populateParameters(fromRes, toRes) {
900
901
  // deviceType
901
902
  let deviceType = getGetDeviceType(fromRes, model);
902
903
  // deviceModel
903
- let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
904
+ let deviceBrand = getDeviceBrand(brand);
904
905
  // hostName
905
- let _hostName = hostName || "mp-toutiao".split('-')[1]; // mp-jd
906
- {
907
- _hostName = fromRes.appName;
908
- }
906
+ let _hostName = getHostName(fromRes);
909
907
  // deviceOrientation
910
908
  let _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
911
909
  // devicePixelRatio
912
910
  let _devicePixelRatio = pixelRatio;
913
911
  // SDKVersion
914
912
  let _SDKVersion = SDKVersion;
913
+ // hostLanguage
914
+ const hostLanguage = language.replace(/_/g, '-');
915
915
  // wx.getAccountInfoSync
916
916
  const parameters = {
917
917
  appId: process.env.UNI_APP_ID,
918
918
  appName: process.env.UNI_APP_NAME,
919
919
  appVersion: process.env.UNI_APP_VERSION_NAME,
920
920
  appVersionCode: process.env.UNI_APP_VERSION_CODE,
921
+ appLanguage: getAppLanguage(hostLanguage),
921
922
  uniCompileVersion: process.env.UNI_COMPILER_VERSION,
922
923
  uniRuntimeVersion: process.env.UNI_COMPILER_VERSION,
923
924
  uniPlatform: process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM,
@@ -930,7 +931,7 @@ function populateParameters(fromRes, toRes) {
930
931
  osVersion,
931
932
  hostTheme: theme,
932
933
  hostVersion,
933
- hostLanguage: language.replace('_', '-'),
934
+ hostLanguage,
934
935
  hostName: _hostName,
935
936
  hostSDKVersion: _SDKVersion,
936
937
  hostFontSizeSetting: fontSizeSetting,
@@ -942,7 +943,7 @@ function populateParameters(fromRes, toRes) {
942
943
  ua: undefined,
943
944
  hostPackageName: undefined,
944
945
  browserName: undefined,
945
- browseVersion: undefined,
946
+ browserVersion: undefined,
946
947
  };
947
948
  extend(toRes, parameters);
948
949
  }
@@ -967,13 +968,24 @@ function getGetDeviceType(fromRes, model) {
967
968
  }
968
969
  return deviceType;
969
970
  }
970
- function getDeviceBrand(brand, model, isQuickApp = false) {
971
+ function getDeviceBrand(brand) {
971
972
  // deviceModel
972
- let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
973
- {
974
- deviceBrand = brand.toLocaleLowerCase();
973
+ let deviceBrand = brand;
974
+ if (deviceBrand) {
975
+ deviceBrand = deviceBrand.toLocaleLowerCase();
975
976
  }
976
977
  return deviceBrand;
978
+ }
979
+ function getAppLanguage(defaultLanguage) {
980
+ return getLocale ? getLocale() : defaultLanguage;
981
+ }
982
+ function getHostName(fromRes) {
983
+ const _platform = "mp-toutiao".split('-')[1];
984
+ let _hostName = fromRes.hostName || _platform; // mp-jd
985
+ {
986
+ _hostName = fromRes.appName;
987
+ }
988
+ return _hostName;
977
989
  }
978
990
 
979
991
  const getSystemInfo = {
@@ -1,6 +1,7 @@
1
1
  import { SLOT_DEFAULT_NAME, EventChannel, invokeArrayFns, ON_LOAD, ON_SHOW, ON_HIDE, ON_UNLOAD, ON_RESIZE, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_ADD_TO_FAVORITES, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, ON_READY, once, ON_LAUNCH, ON_ERROR, ON_THEME_CHANGE, ON_PAGE_NOT_FOUND, ON_UNHANDLE_REJECTION, addLeadingSlash, stringifyQuery, customizeEvent } from '@dcloudio/uni-shared';
2
2
  import { isArray, hasOwn, isFunction, extend, isPlainObject, isObject } from '@vue/shared';
3
3
  import { ref, nextTick, findComponentPropsData, toRaw, updateProps, invalidateJob, getExposeProxy, pruneComponentPropsCache } from 'vue';
4
+ import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
4
5
 
5
6
  const eventChannels = {};
6
7
  const eventChannelStack = [];
@@ -281,7 +282,7 @@ function initAppLifecycle(appOptions, vm) {
281
282
  }
282
283
  }
283
284
  function initLocale(appVm) {
284
- const locale = ref(tt.getSystemInfoSync().language || 'zh-Hans');
285
+ const locale = ref(normalizeLocale(tt.getSystemInfoSync().language) || LOCALE_EN);
285
286
  Object.defineProperty(appVm, '$locale', {
286
287
  get() {
287
288
  return locale.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-mp-toutiao",
3
- "version": "3.0.0-alpha-3041320220527004",
3
+ "version": "3.0.0-alpha-3041320220607001",
4
4
  "description": "uni-app mp-toutiao",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
24
24
  "dependencies": {
25
- "@dcloudio/uni-cli-shared": "3.0.0-alpha-3041320220527004",
26
- "@dcloudio/uni-mp-compiler": "3.0.0-alpha-3041320220527004",
27
- "@dcloudio/uni-mp-vite": "3.0.0-alpha-3041320220527004",
28
- "@dcloudio/uni-mp-vue": "3.0.0-alpha-3041320220527004",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3041320220527004",
25
+ "@dcloudio/uni-cli-shared": "3.0.0-alpha-3041320220607001",
26
+ "@dcloudio/uni-mp-compiler": "3.0.0-alpha-3041320220607001",
27
+ "@dcloudio/uni-mp-vite": "3.0.0-alpha-3041320220607001",
28
+ "@dcloudio/uni-mp-vue": "3.0.0-alpha-3041320220607001",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3041320220607001",
30
30
  "@vue/shared": "3.2.33",
31
31
  "@vue/compiler-core": "3.2.33"
32
32
  }