@ray-js/lock-sdk 1.2.0-beta.17 → 1.2.0-beta.18

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,12 +1,23 @@
1
- import { addEvents } from "../../../feature/state/platform-routing";
1
+ import { addEvents, removeEvents, } from "../../../feature/state/platform-routing";
2
2
  import { initState } from "../../../feature/state/init-state";
3
- import { registerRuntime } from "../../../runtime/registry";
3
+ import { clearStateForRuntime } from "../../../feature/state/clear";
4
+ import { registerRuntime, unregisterRuntime, getRegisteredRuntimeCount, } from "../../../runtime/registry";
4
5
  import { buildFitSDKInstance } from "../build-instance";
5
6
  import { createBootstrappedRuntime } from "./bootstrap";
6
7
  export async function bootstrapRegisteredFitInstance(options) {
7
8
  const runtime = await createBootstrappedRuntime(options);
8
9
  registerRuntime(runtime);
9
- addEvents(runtime);
10
- await initState(runtime);
11
- return { runtime, instance: buildFitSDKInstance(runtime) };
10
+ try {
11
+ addEvents(runtime);
12
+ await initState(runtime);
13
+ return { runtime, instance: buildFitSDKInstance(runtime) };
14
+ }
15
+ catch (error) {
16
+ unregisterRuntime(runtime.devId);
17
+ clearStateForRuntime(runtime);
18
+ if (getRegisteredRuntimeCount() === 0) {
19
+ removeEvents();
20
+ }
21
+ throw error;
22
+ }
12
23
  }
@@ -1,12 +1,23 @@
1
- import { addEvents } from "../../../feature/state/platform-routing";
1
+ import { addEvents, removeEvents, } from "../../../feature/state/platform-routing";
2
2
  import { initState } from "../../../feature/state/init-state";
3
- import { registerRuntime } from "../../../runtime/registry";
3
+ import { clearStateForRuntime } from "../../../feature/state/clear";
4
+ import { registerRuntime, unregisterRuntime, getRegisteredRuntimeCount, } from "../../../runtime/registry";
4
5
  import { buildLockSDKInstance, } from "../build-instance";
5
6
  import { createBootstrappedRuntime } from "./bootstrap";
6
7
  export async function bootstrapRegisteredLockInstance(options) {
7
8
  const runtime = await createBootstrappedRuntime(options);
8
9
  registerRuntime(runtime);
9
- addEvents(runtime);
10
- await initState(runtime);
11
- return { runtime, instance: buildLockSDKInstance(runtime) };
10
+ try {
11
+ addEvents(runtime);
12
+ await initState(runtime);
13
+ return { runtime, instance: buildLockSDKInstance(runtime) };
14
+ }
15
+ catch (error) {
16
+ unregisterRuntime(runtime.devId);
17
+ clearStateForRuntime(runtime);
18
+ if (getRegisteredRuntimeCount() === 0) {
19
+ removeEvents();
20
+ }
21
+ throw error;
22
+ }
12
23
  }
@@ -90,8 +90,14 @@ const globalHandleBleChange = ({ deviceId, status }) => {
90
90
  devId: deviceId,
91
91
  data: { status, registered: !!rt },
92
92
  });
93
- if (!rt || status !== "CONNECTED") {
94
- return;
93
+ if (rt) {
94
+ updateOnlineType(rt);
95
+ if (status === "CONNECTED") {
96
+ void syncRemoteSerectKey(rt);
97
+ autoSyncTemp(rt);
98
+ void syncT0(rt);
99
+ void syncOfflineDps(rt);
100
+ }
95
101
  }
96
102
  };
97
103
  const globalHandleAppShow = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.0-beta.17",
3
+ "version": "1.2.0-beta.18",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"