@cpzxrobot/sdk 1.3.18 → 1.3.19
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/dist/index.js +8 -0
- package/dist/mobile_platform.js +6 -7
- package/dist/web_platform.js +3 -0
- package/dist/windows_platform.js +6 -13
- package/index.ts +8 -0
- package/mobile_platform.ts +6 -8
- package/package.json +1 -1
- package/platform_interface.ts +1 -0
- package/web_platform.ts +3 -0
- package/windows_platform.ts +7 -13
package/dist/index.js
CHANGED
|
@@ -310,6 +310,14 @@ class Cpzxrobot {
|
|
|
310
310
|
console.warn("platform not ready, title will be set later");
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
+
addMessage(message) {
|
|
314
|
+
if (this.platform) {
|
|
315
|
+
this.platform.addMessage(message);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
console.warn("platform not ready, message will be set later");
|
|
319
|
+
}
|
|
320
|
+
}
|
|
313
321
|
}
|
|
314
322
|
exports.Cpzxrobot = Cpzxrobot;
|
|
315
323
|
Cpzxrobot.factorySelectorLoaded = false;
|
package/dist/mobile_platform.js
CHANGED
|
@@ -10,13 +10,12 @@ class MobilePlatform {
|
|
|
10
10
|
this.port = null;
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
this.platform = window.flutter_inappwebview;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, false);
|
|
13
|
+
}
|
|
14
|
+
addMessage(message) {
|
|
15
|
+
if (message.id != undefined) {
|
|
16
|
+
const callback = this.sseCallbacks[message.id];
|
|
17
|
+
callback === null || callback === void 0 ? void 0 : callback(message.data);
|
|
18
|
+
}
|
|
20
19
|
}
|
|
21
20
|
getToken() {
|
|
22
21
|
return "";
|
package/dist/web_platform.js
CHANGED
package/dist/windows_platform.js
CHANGED
|
@@ -7,19 +7,12 @@ class WindwosMiniAppPlatform {
|
|
|
7
7
|
this.token = "";
|
|
8
8
|
this.appCode = "";
|
|
9
9
|
this.baseURL = "";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const callback = this.sseCallbacks[event.data.id];
|
|
17
|
-
callback === null || callback === void 0 ? void 0 : callback(event.data.data);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}, false);
|
|
10
|
+
}
|
|
11
|
+
addMessage(message) {
|
|
12
|
+
if (message.id != undefined) {
|
|
13
|
+
const callback = this.sseCallbacks[message.id];
|
|
14
|
+
callback === null || callback === void 0 ? void 0 : callback(message.data);
|
|
15
|
+
}
|
|
23
16
|
}
|
|
24
17
|
getToken() {
|
|
25
18
|
return "";
|
package/index.ts
CHANGED
|
@@ -319,6 +319,14 @@ export class Cpzxrobot {
|
|
|
319
319
|
console.warn("platform not ready, title will be set later");
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
+
|
|
323
|
+
addMessage(message: any){
|
|
324
|
+
if (this.platform) {
|
|
325
|
+
this.platform.addMessage(message);
|
|
326
|
+
} else {
|
|
327
|
+
console.warn("platform not ready, message will be set later");
|
|
328
|
+
}
|
|
329
|
+
}
|
|
322
330
|
}
|
|
323
331
|
|
|
324
332
|
export default function (
|
package/mobile_platform.ts
CHANGED
|
@@ -15,14 +15,12 @@ export class MobilePlatform implements PlatformInterface {
|
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
this.platform = window.flutter_inappwebview;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}, false);
|
|
18
|
+
}
|
|
19
|
+
addMessage(message: any): void {
|
|
20
|
+
if (message.id != undefined) {
|
|
21
|
+
const callback = this.sseCallbacks[message.id];
|
|
22
|
+
callback?.(message.data);
|
|
23
|
+
}
|
|
26
24
|
}
|
|
27
25
|
getToken(): string {
|
|
28
26
|
return "";
|
package/package.json
CHANGED
package/platform_interface.ts
CHANGED
|
@@ -9,6 +9,7 @@ export abstract class PlatformInterface {
|
|
|
9
9
|
this.appCode = appCode;
|
|
10
10
|
this.baseURL = baseURL;
|
|
11
11
|
}
|
|
12
|
+
abstract addMessage(message: any): void;
|
|
12
13
|
abstract getToken(): string;
|
|
13
14
|
abstract setToken(token: string): void;
|
|
14
15
|
abstract getSelectedFarmFromMiniApp(): Promise<any>;
|
package/web_platform.ts
CHANGED
|
@@ -14,6 +14,9 @@ export class WebPlatform implements PlatformInterface {
|
|
|
14
14
|
this._selectedFarm = selectedFarm;
|
|
15
15
|
this._selectedUnit = selectedUnit;
|
|
16
16
|
}
|
|
17
|
+
addMessage(message: any): void {
|
|
18
|
+
throw new Error("Method not implemented.");
|
|
19
|
+
}
|
|
17
20
|
getToken(): string {
|
|
18
21
|
return this.token;
|
|
19
22
|
}
|
package/windows_platform.ts
CHANGED
|
@@ -9,19 +9,13 @@ export class WindwosMiniAppPlatform implements PlatformInterface {
|
|
|
9
9
|
baseURL: string = "";
|
|
10
10
|
|
|
11
11
|
constructor() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
callback?.(event.data.data);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}, false);
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
addMessage(message: any): void {
|
|
15
|
+
if (message.id != undefined) {
|
|
16
|
+
const callback = this.sseCallbacks[message.id];
|
|
17
|
+
callback?.(message.data);
|
|
18
|
+
}
|
|
25
19
|
}
|
|
26
20
|
getToken(): string {
|
|
27
21
|
return "";
|