@ray-js/ray-ipc-utils 1.1.0-beta-8 → 1.1.0-beta-10

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.
package/lib/index.d.ts CHANGED
@@ -12,26 +12,27 @@ declare const IpcUtils: {
12
12
  getInitUtmTid: () => string;
13
13
  getDevInfo: <T_6>(deviceId: string) => Promise<import("./kit/interface").IRes<T_6>>;
14
14
  getNativeStorage: <T_7>(key: string) => Promise<import("./kit/interface").IRes<T_7>>;
15
- setNativeStorage: <T_8>(key: string, data: T_8) => Promise<import("./kit/interface").IRes<T_8>>;
15
+ setNativeStorage: <T_8>(key: string, data: string) => Promise<import("./kit/interface").IRes<T_8>>;
16
16
  removeNativeStorage: <T_9>(key: string) => Promise<import("./kit/interface").IRes<T_9>>;
17
17
  publishDps: <T_10>(deviceId: string, dps: any) => Promise<import("./kit/interface").IRes<T_10>>;
18
- getDpStateValue: (deviceId: string, dpCode: string) => Promise<import("./kit/interface").IRes<T>>;
19
- getDpIdByCode: (deviceId: string, dpCode: string) => Promise<import("./kit/interface").IRes<T>>;
20
- goToMiniProgramByShortLink: <T_11>(url: string, position?: string) => Promise<import("./kit/interface").IRes<T_11>>;
21
- getVideoBitrateKbps: <T_12>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_12>>;
18
+ getDpStateValue: <T_11>(deviceId: string, dpCode: string) => Promise<import("./kit/interface").IRes<T_11>>;
19
+ getDpIdByCode: <T_12>(deviceId: string, dpCode: string) => Promise<import("./kit/interface").IRes<T_12>>;
20
+ goToMiniProgramByShortLink: <T_13>(url: string, position?: string) => Promise<import("./kit/interface").IRes<T_13>>;
21
+ getVideoBitrateKbps: <T_14>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_14>>;
22
22
  networkStatusDidChangedEvent: (callback: any) => void;
23
- getMobileOrientation: <T_13>() => Promise<import("./kit/interface").IRes<T_13>>;
24
- jumpToWebView: <T_14>(url: string) => Promise<import("./kit/interface").IRes<T_14>>;
25
- setScreenOrientation: <T_15>(pageOrientation: string) => Promise<import("./kit/interface").IRes<T_15>>;
26
- isSupportFloatWindow: <T_16>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_16>>;
27
- openFloatWindow: <T_17>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_17>>;
28
- isSupportedTalk: <T_18>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_18>>;
29
- getCurrentSupportedTalkMode: <T_19>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_19>>;
30
- goToIpcPageNativeRoute: (url: string, deviceId: string, theme?: "dark" | "light", extraParams?: {
23
+ offNetworkStatusDidChangedEvent: (callback: any) => void;
24
+ getMobileOrientation: <T_15>() => Promise<import("./kit/interface").IRes<T_15>>;
25
+ jumpToWebView: <T_16>(url: string) => Promise<import("./kit/interface").IRes<T_16>>;
26
+ setScreenOrientation: <T_17>(pageOrientation: string) => Promise<import("./kit/interface").IRes<T_17>>;
27
+ isSupportFloatWindow: <T_18>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_18>>;
28
+ openFloatWindow: <T_19>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_19>>;
29
+ isSupportedTalk: <T_20>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_20>>;
30
+ getCurrentSupportedTalkMode: <T_21>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_21>>;
31
+ goToIpcPageNativeRoute: <T_22>(url: string, deviceId: string, theme?: "dark" | "light", extraParams?: {
31
32
  [key: string]: any;
32
- } | undefined, isGeneral?: false | undefined) => Promise<import("./kit/interface").IRes<T>>;
33
- goToGeneralHelpMini: () => Promise<import("./kit/interface").IRes<T>>;
34
- goToIpcHelpMini: (errCode: number, deviceId: string, helpNum: number, helpFeedBack: boolean, brandColor?: string) => Promise<import("./kit/interface").IRes<T>>;
33
+ } | undefined, isGeneral?: false | undefined) => Promise<import("./kit/interface").IRes<T_22>>;
34
+ goToGeneralHelpMini: <T_23>() => Promise<import("./kit/interface").IRes<T_23>>;
35
+ goToIpcHelpMini: <T_24>(errCode: number, deviceId: string, helpNum: number, helpFeedBack: boolean, brandColor?: string) => Promise<import("./kit/interface").IRes<T_24>>;
35
36
  getIsSupportedCloudStorageSync: (deviceId: string) => Promise<{
36
37
  code: number;
37
38
  data: boolean;
@@ -41,8 +42,9 @@ declare const IpcUtils: {
41
42
  data: boolean;
42
43
  msg: string | boolean | import("./kit/interface").IApiError | undefined;
43
44
  }>;
44
- requestWifiSignal: <T_20>(deviceId: string, dps?: {}) => Promise<import("./kit/interface").IRes<T_20>>;
45
- wakeUpDevice: <T_21>(deviceId: string, dps?: {}) => Promise<import("./kit/interface").IRes<T_21>>;
45
+ ipcTTTOperatorLog: <T_25>(ipcLogString: string) => Promise<import("./kit/interface").IRes<T_25>>;
46
+ requestWifiSignal: <T_26>(deviceId: string, dps?: {}) => Promise<import("./kit/interface").IRes<T_26>>;
47
+ wakeUpDevice: <T_27>(deviceId: string, dps?: {}) => Promise<import("./kit/interface").IRes<T_27>>;
46
48
  useTrafficViewTip: () => boolean;
47
49
  };
48
50
  export default IpcUtils;
@@ -51,6 +51,7 @@ export const wakeUpDevice = function (deviceId) {
51
51
  success: res => {
52
52
  console.log('res===wakeUpDevice success', res);
53
53
  resolve({
54
+ code: 0,
54
55
  data: res
55
56
  });
56
57
  },
@@ -16,7 +16,7 @@ export declare const getNativeStorage: <T>(key: string) => Promise<IRes<T>>;
16
16
  * @param key 保存的key属性
17
17
  *
18
18
  */
19
- export declare const setNativeStorage: <T>(key: string, data: T) => Promise<IRes<T>>;
19
+ export declare const setNativeStorage: <T>(key: string, data: string) => Promise<IRes<T>>;
20
20
  /**
21
21
  * 清除本地缓存
22
22
  * @param key 保存的key属性
@@ -34,13 +34,13 @@ export declare const publishDps: <T>(deviceId: string, dps: any) => Promise<IRes
34
34
  * @param key 保存的key属性
35
35
  *
36
36
  */
37
- export declare const getDpStateValue: (deviceId: string, dpCode: string) => Promise<IRes<T>>;
37
+ export declare const getDpStateValue: <T>(deviceId: string, dpCode: string) => Promise<IRes<T>>;
38
38
  /**
39
39
  * 根据DPCode获取DpId
40
40
  * @param key 保存的key属性
41
41
  *
42
42
  */
43
- export declare const getDpIdByCode: (deviceId: string, dpCode: string) => Promise<IRes<T>>;
43
+ export declare const getDpIdByCode: <T>(deviceId: string, dpCode: string) => Promise<IRes<T>>;
44
44
  /**
45
45
  * 通过短链形式跳转小程序
46
46
  * @param url 小程序链接
@@ -56,6 +56,7 @@ export declare const goToMiniProgramByShortLink: <T>(url: string, position?: str
56
56
  */
57
57
  export declare const getVideoBitrateKbps: <T>(deviceId: string, extendParam?: {}) => Promise<IRes<T>>;
58
58
  export declare const networkStatusDidChangedEvent: (callback: any) => void;
59
+ export declare const offNetworkStatusDidChangedEvent: (callback: any) => void;
59
60
  /**
60
61
  * 获取手机当前横竖屏状态
61
62
  * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
@@ -106,13 +107,13 @@ export declare const getCurrentSupportedTalkMode: <T>(deviceId: string, extendPa
106
107
  * @param {boolean} isGeneral 是否为通用页面,IPC原生业务页面不用传, 默认false
107
108
  *
108
109
  */
109
- export declare const goToIpcPageNativeRoute: (url: string, deviceId: string, theme?: 'dark' | 'light', extraParams?: {
110
+ export declare const goToIpcPageNativeRoute: <T>(url: string, deviceId: string, theme?: 'dark' | 'light', extraParams?: {
110
111
  [key: string]: any;
111
112
  } | undefined, isGeneral?: false) => Promise<IRes<T>>;
112
113
  /**
113
114
  * 跳转 通用帮助反馈小程序
114
115
  */
115
- export declare const goToGeneralHelpMini: () => Promise<IRes<T>>;
116
+ export declare const goToGeneralHelpMini: <T>() => Promise<IRes<T>>;
116
117
  /**
117
118
  * 跳转 Ipc帮助反馈小程序
118
119
  * @param {number} errCode 错误码
@@ -121,9 +122,9 @@ export declare const goToGeneralHelpMini: () => Promise<IRes<T>>;
121
122
  * @param {boolean} helpFeedBack 是否是反馈
122
123
  * @param {string} brandColor 品牌色
123
124
  */
124
- export declare const goToIpcHelpMini: (errCode: number, deviceId: string, helpNum: number, helpFeedBack: boolean, brandColor?: string) => Promise<IRes<T>>;
125
+ export declare const goToIpcHelpMini: <T>(errCode: number, deviceId: string, helpNum: number, helpFeedBack: boolean, brandColor?: string) => Promise<IRes<T>>;
125
126
  /**
126
- *
127
+ * 获取是否支持云存储
127
128
  * @param deviceId 设备id
128
129
  * @returns true/false
129
130
  */
@@ -136,3 +137,9 @@ export declare const getIsSupportedCloudStorageSync: (deviceId: string) => Promi
136
137
  data: boolean;
137
138
  msg: string | boolean | import("../interface").IApiError | undefined;
138
139
  }>;
140
+ /**
141
+ * 预埋业务日志
142
+ * @param ipcLogString 日志字符串
143
+ * @returns true/false
144
+ */
145
+ export declare const ipcTTTOperatorLog: <T>(ipcLogString: string) => Promise<IRes<T>>;
@@ -82,7 +82,7 @@ export const setNativeStorage = (key, data) => {
82
82
  success: res => {
83
83
  resolve({
84
84
  code: 0,
85
- data: res || true
85
+ data: res
86
86
  });
87
87
  },
88
88
  fail: err => {
@@ -115,7 +115,7 @@ export const removeNativeStorage = key => {
115
115
  success: res => {
116
116
  resolve({
117
117
  code: 0,
118
- data: res || true
118
+ data: res
119
119
  });
120
120
  },
121
121
  fail: err => {
@@ -327,6 +327,9 @@ export const getVideoBitrateKbps = function (deviceId) {
327
327
  export const networkStatusDidChangedEvent = callback => {
328
328
  ty.onNetworkStatusChange(callback);
329
329
  };
330
+ export const offNetworkStatusDidChangedEvent = callback => {
331
+ ty.offNetworkStatusChange(callback);
332
+ };
330
333
 
331
334
  /**
332
335
  * 获取手机当前横竖屏状态
@@ -736,7 +739,7 @@ export const goToIpcHelpMini = async function (errCode, deviceId, helpNum, helpF
736
739
  };
737
740
 
738
741
  /**
739
- *
742
+ * 获取是否支持云存储
740
743
  * @param deviceId 设备id
741
744
  * @returns true/false
742
745
  */
@@ -766,4 +769,38 @@ export const getIsSupportedCloudStorageSync = async deviceId => {
766
769
  data: false,
767
770
  msg: msg
768
771
  };
772
+ };
773
+
774
+ /**
775
+ * 预埋业务日志
776
+ * @param ipcLogString 日志字符串
777
+ * @returns true/false
778
+ */
779
+ export const ipcTTTOperatorLog = ipcLogString => {
780
+ return new Promise(resolve => {
781
+ try {
782
+ ty.ipc.ipcTTTOperatorLog({
783
+ ipcLogString,
784
+ success: res => {
785
+ console.log(res, 'res');
786
+ resolve({
787
+ code: 0,
788
+ data: res
789
+ });
790
+ },
791
+ fail: error => {
792
+ console.log(error, 'error');
793
+ resolve({
794
+ code: -1,
795
+ msg: error
796
+ });
797
+ }
798
+ });
799
+ } catch (err) {
800
+ resolve({
801
+ code: -1,
802
+ msg: String(err)
803
+ });
804
+ }
805
+ });
769
806
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-utils",
3
- "version": "1.1.0-beta-8",
3
+ "version": "1.1.0-beta-10",
4
4
  "description": "IPC 工具库",
5
5
  "main": "lib/index",
6
6
  "files": [