@robotical/webapp-types 3.11.4 → 3.11.6

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.
@@ -26,6 +26,7 @@ export default class ApplicationManager {
26
26
  carouselNavigatorManager: CarouselNavigatorManager;
27
27
  deviceInfo: UserDeviceInfo | undefined;
28
28
  userRoleCtx: UserRoleContextTypes | null;
29
+ lastUUIDsUsed: string[] | null;
29
30
  setUserRoleCtx(userRoleCtx: UserRoleContextTypes): void;
30
31
  private _router;
31
32
  setRouter(router: any): void;
@@ -74,6 +74,7 @@ var ApplicationManager = /** @class */ (function () {
74
74
  this.deviceInfo = undefined;
75
75
  // User role context
76
76
  this.userRoleCtx = null;
77
+ this.lastUUIDsUsed = null;
77
78
  // Callback to call when a RAFT is selected (Phone App only)
78
79
  // We need that to make sure the connection button gets the selected RAFT once the user selects one
79
80
  this.ricSelectedCb = null;
@@ -413,6 +414,7 @@ var ApplicationManager = /** @class */ (function () {
413
414
  }
414
415
  }
415
416
  if (!isPhoneApp()) return [3 /*break*/, 11];
417
+ this.lastUUIDsUsed = uuids; // Store the last used UUIDs so when the user presses "Scan Again" in the phone app connection modal, we can use them to start discovery again
416
418
  _a.label = 4;
417
419
  case 4:
418
420
  _a.trys.push([4, 9, , 10]);
@@ -711,28 +713,35 @@ var ApplicationManager = /** @class */ (function () {
711
713
  if (foundRICs.length > 0) {
712
714
  return [2 /*return*/];
713
715
  }
714
- if (!discoveredDevice._serviceUUIDs.includes(uuids[0])) return [3 /*break*/, 4];
716
+ if (!discoveredDevice._serviceUUIDs.includes(uuids[0])) return [3 /*break*/, 7];
715
717
  foundRICs.push(discoveredDevice);
716
718
  return [4 /*yield*/, this.selectRaft(discoveredDevice, RaftConnectionMethod.PHONE_BLE)];
717
719
  case 1:
718
720
  newRaft = _b.sent();
719
- if (!newRaft) return [3 /*break*/, 3];
721
+ if (!newRaft) return [3 /*break*/, 6];
720
722
  secondaryModalState.closeModal();
721
723
  this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
722
724
  afterRaftConnectedCb(newRaft);
723
725
  oldColours = newRaft._ledLcdColours;
724
726
  newRaft._ledLcdColours = [];
725
- return [4 /*yield*/, newRaft.verifyRaft()];
727
+ if (!isPhoneApp()) return [3 /*break*/, 3];
728
+ return [4 /*yield*/, newRaft.verifyRaftPhoneApp(discoveredDevice)];
726
729
  case 2:
727
730
  _b.sent();
731
+ return [3 /*break*/, 5];
732
+ case 3: return [4 /*yield*/, newRaft.verifyRaft()];
733
+ case 4:
734
+ _b.sent();
735
+ _b.label = 5;
736
+ case 5:
728
737
  newRaft._ledLcdColours = oldColours;
729
738
  newRaft.stopVerifyingRaft(true);
730
739
  raftFoundSubscriptionHelper().unsubscribe();
731
- return [3 /*break*/, 4];
732
- case 3:
740
+ return [3 /*break*/, 7];
741
+ case 6:
733
742
  foundRICs = [];
734
- _b.label = 4;
735
- case 4: return [2 /*return*/];
743
+ _b.label = 7;
744
+ case 7: return [2 /*return*/];
736
745
  }
737
746
  });
738
747
  });
@@ -10,7 +10,15 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useEffect } from "react";
14
+ import { secondaryModalState } from "../../../state-observables/modal/ModalState";
13
15
  import styles from "./styles.module.css";
14
16
  export default function ConnectingLoadingSpinnerModal(_a) {
17
+ useEffect(function () {
18
+ // close modal after 3 minutes assuming no connection will take that long
19
+ setTimeout(function () {
20
+ secondaryModalState.closeModal();
21
+ }, 180000);
22
+ }, []);
15
23
  return (_jsx("div", __assign({ className: styles.container }, { children: "This shouldn't take long!" })));
16
24
  }
@@ -147,7 +147,7 @@ function VerificationModalPhoneApp(_a) {
147
147
  setSelectedRICIdx(-1);
148
148
  setConnectedRaft(undefined);
149
149
  if (!window.applicationManager.ricSelectedCb) return [3 /*break*/, 5];
150
- return [4 /*yield*/, window.applicationManager.startDiscovery(window.applicationManager.ricSelectedCb, [ConnManager.COGUUID, ConnManager.RICUUID])];
150
+ return [4 /*yield*/, window.applicationManager.startDiscovery(window.applicationManager.ricSelectedCb, window.applicationManager.lastUUIDsUsed ? window.applicationManager.lastUUIDsUsed : [ConnManager.COGUUID, ConnManager.RICUUID])];
151
151
  case 4:
152
152
  _a.sent();
153
153
  _a.label = 5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.11.4",
3
+ "version": "3.11.6",
4
4
  "description": "Type definitions for the Application Manager",
5
5
  "main": "dist/application-manager.d.ts",
6
6
  "types": "dist/application-manager.d.ts",