@foundbyte/uni-libs 0.0.14 → 0.0.15

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.
@@ -0,0 +1,8 @@
1
+ //#region src/enums/platform/index.d.ts
2
+ declare enum EUniPlatform {
3
+ android = "android",
4
+ ios = "ios",
5
+ harmony = "harmony",
6
+ }
7
+ //#endregion
8
+ export { EUniPlatform };
@@ -0,0 +1,10 @@
1
+ //#region src/enums/platform/index.ts
2
+ let EUniPlatform = /* @__PURE__ */ function(EUniPlatform$1) {
3
+ EUniPlatform$1["android"] = "android";
4
+ EUniPlatform$1["ios"] = "ios";
5
+ EUniPlatform$1["harmony"] = "harmony";
6
+ return EUniPlatform$1;
7
+ }({});
8
+
9
+ //#endregion
10
+ export { EUniPlatform };
package/es/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { ECaller } from "./enums/sdk/index.js";
6
6
  import { EVenueSimpleTypes, EVenueTypes } from "./enums/sub/enjoy/index.js";
7
7
  import { EFoodPackageType, EFoodsModuleType } from "./enums/sub/foods/index.js";
8
8
  import { EHotelType } from "./enums/sub/hotel/index.js";
9
+ import { EUniPlatform } from "./enums/platform/index.js";
9
10
  import { IOneTravelSDKConfig } from "./types/one-travel-service/index.js";
10
11
  import { getQueryParameters, isEmpty, query2url } from "./utils/common/index.js";
11
12
  import { ActivityCalendarDetailPageParams, getActivityCalendarDetailPage } from "./utils/pages/activity-calendar/index.js";
@@ -13,7 +14,7 @@ import { WebviewPageParams, getWebviewPage } from "./utils/pages/webview/index.j
13
14
  import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
14
15
  import { getMoviePage } from "./utils/pages/movie/index.js";
15
16
  import { EMessagesType, navigateBack, navigateTo, postMessage, redirectTo } from "./utils/web-view/index.js";
16
- import { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS } from "./utils/uni-env/index.js";
17
+ import { getSystemInfoSync, isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS } from "./utils/uni-env/index.js";
17
18
  import { checkAndRequestNativeAppPermission } from "./utils/native-app/index.js";
18
19
  import { OneTravelSDK } from "./entry.js";
19
- export { ActivityCalendarDetailPageParams, BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType, EVenueSimpleTypes, EVenueTypes, IOneTravelSDKConfig, OneTravelSDK, WebviewPageParams, app_permission, checkAndRequestNativeAppPermission, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebviewPage, isAndroid, isApp, isEmpty, isH5, isHarmony, isWeixin, isiOS, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes };
20
+ export { ActivityCalendarDetailPageParams, BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, IOneTravelSDKConfig, OneTravelSDK, WebviewPageParams, app_permission, checkAndRequestNativeAppPermission, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getSystemInfoSync, getWebviewPage, isAndroid, isApp, isEmpty, isH5, isHarmony, isWeixin, isiOS, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes };
package/es/index.js CHANGED
@@ -6,14 +6,15 @@ import { ECaller } from "./enums/sdk/index.js";
6
6
  import { EVenueSimpleTypes, EVenueTypes } from "./enums/sub/enjoy/index.js";
7
7
  import { EFoodPackageType, EFoodsModuleType } from "./enums/sub/foods/index.js";
8
8
  import { EHotelType } from "./enums/sub/hotel/index.js";
9
+ import { EUniPlatform } from "./enums/platform/index.js";
9
10
  import { getQueryParameters, isEmpty, query2url } from "./utils/common/index.js";
10
11
  import { getActivityCalendarDetailPage } from "./utils/pages/activity-calendar/index.js";
11
12
  import { getWebviewPage } from "./utils/pages/webview/index.js";
12
13
  import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
13
14
  import { getMoviePage } from "./utils/pages/movie/index.js";
14
15
  import { EMessagesType, navigateBack, navigateTo, postMessage, redirectTo } from "./utils/web-view/index.js";
15
- import { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS } from "./utils/uni-env/index.js";
16
+ import { getSystemInfoSync, isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS } from "./utils/uni-env/index.js";
16
17
  import { checkAndRequestNativeAppPermission } from "./utils/native-app/index.js";
17
18
  import { OneTravelSDK } from "./entry.js";
18
19
 
19
- export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType, EVenueSimpleTypes, EVenueTypes, OneTravelSDK, app_permission, checkAndRequestNativeAppPermission, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebviewPage, isAndroid, isApp, isEmpty, isH5, isHarmony, isWeixin, isiOS, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes };
20
+ export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, OneTravelSDK, app_permission, checkAndRequestNativeAppPermission, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getSystemInfoSync, getWebviewPage, isAndroid, isApp, isEmpty, isH5, isHarmony, isWeixin, isiOS, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes };
@@ -29,5 +29,28 @@ declare const isAndroid: () => boolean;
29
29
  * @returns
30
30
  */
31
31
  declare const isiOS: () => boolean;
32
+ declare function getSystemInfoSync(): UniApp.GetSystemInfoResult | {
33
+ pixelRatio: number;
34
+ screenWidth: number;
35
+ screenHeight: number;
36
+ windowWidth: number;
37
+ windowHeight: number;
38
+ statusBarHeight: number;
39
+ windowTop: number;
40
+ windowBottom: number;
41
+ safeArea: UniApp.SafeArea;
42
+ safeAreaInsets: UniApp.SafeAreaInsets;
43
+ screenTop: number;
44
+ deviceBrand?: string;
45
+ deviceModel: string;
46
+ deviceId: string;
47
+ deviceType: string;
48
+ devicePixelRatio: number;
49
+ deviceOrientation: "portrait" | "landscape";
50
+ brand?: string;
51
+ model: string;
52
+ system: string;
53
+ platform: string;
54
+ };
32
55
  //#endregion
33
- export { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS };
56
+ export { getSystemInfoSync, isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS };
@@ -1,3 +1,5 @@
1
+ import { EUniPlatform } from "../../enums/platform/index.js";
2
+
1
3
  //#region src/utils/uni-env/index.ts
2
4
  /**
3
5
  * 是否是web环境
@@ -33,15 +35,23 @@ const isApp = () => {
33
35
  * @returns
34
36
  */
35
37
  const isAndroid = () => {
36
- return true;
38
+ if (isApp() && getSystemInfoSync().platform === EUniPlatform.android) return true;
39
+ return false;
37
40
  };
38
41
  /**
39
42
  * 是否是iOS
40
43
  * @returns
41
44
  */
42
45
  const isiOS = () => {
43
- return true;
46
+ if (isApp() && getSystemInfoSync().platform === EUniPlatform.ios) return true;
47
+ return false;
44
48
  };
49
+ function getSystemInfoSync() {
50
+ return {
51
+ ...uni.getDeviceInfo(),
52
+ ...uni.getWindowInfo()
53
+ };
54
+ }
45
55
 
46
56
  //#endregion
47
- export { isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS };
57
+ export { getSystemInfoSync, isAndroid, isApp, isH5, isHarmony, isWeixin, isiOS };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@foundbyte/uni-libs",
3
3
  "description": "FoundByte Uni Libs",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "0.0.14",
5
+ "version": "0.0.15",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",