@robotical/webapp-types 3.17.50 → 3.17.52

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.
Files changed (37) hide show
  1. package/dist-types/src/application/ApplicationManager/ApplicationManager.d.ts +13 -10
  2. package/dist-types/src/application/ApplicationManager/ApplicationManager.js +147 -76
  3. package/dist-types/src/application/RAFTs/Cog/Cog.d.ts +1 -1
  4. package/dist-types/src/application/RAFTs/Cog/Cog.js +1 -1
  5. package/dist-types/src/application/RAFTs/Marty/CalibrationManager.d.ts +1 -1
  6. package/dist-types/src/application/RAFTs/Marty/CalibrationManager.js +1 -1
  7. package/dist-types/src/application/RAFTs/Marty/Marty.d.ts +1 -1
  8. package/dist-types/src/application/RAFTs/Marty/Marty.js +1 -1
  9. package/dist-types/src/application/RAFTs/Marty/MartyWifiManager.d.ts +1 -1
  10. package/dist-types/src/application/RAFTs/Marty/MartyWifiManager.js +1 -1
  11. package/dist-types/src/application/RAFTs/Marty/notifications-manager/ReportedWarningsState.js +1 -1
  12. package/dist-types/src/application/RAFTs/RAFT.d.ts +1 -1
  13. package/dist-types/src/application/RAFTs/RAFT.js +2 -2
  14. package/dist-types/src/application/RAFTs/RAFTInterface.d.ts +1 -1
  15. package/dist-types/src/application/RAFTs/RaftObserver.d.ts +1 -1
  16. package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +1 -1
  17. package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.js +1 -2
  18. package/dist-types/src/components/modals/VerificationModal/index.js +0 -8
  19. package/dist-types/src/components/modals/VerificationModalPhoneApp/index.js +17 -32
  20. package/dist-types/src/components/oneoffs/LEDs/index.js +1 -1
  21. package/dist-types/src/types/raft.d.ts +1 -1
  22. package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.d.ts +1 -1
  23. package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.js +1 -1
  24. package/dist-types/src/wrapper-app/WrapperAppManager.d.ts +16 -7
  25. package/dist-types/src/wrapper-app/WrapperAppManager.js +225 -55
  26. package/dist-types/src/wrapper-app/communicators/WebAppCommunicator.js +3 -6
  27. package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.d.ts +1 -1
  28. package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.js +1 -1
  29. package/dist-types/src/wrapper-app/connectors/Connector.d.ts +14 -2
  30. package/dist-types/src/wrapper-app/connectors/Connector.js +25 -1
  31. package/dist-types/src/wrapper-app/connectors/ConnectorFactory.d.ts +1 -1
  32. package/dist-types/src/wrapper-app/connectors/ConnectorFactory.js +24 -3
  33. package/dist-types/src/wrapper-app/connectors/ConnectorInterface.d.ts +1 -1
  34. package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.d.ts +1 -1
  35. package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.js +1 -1
  36. package/dist-types/src/wrapper-app/utils/ColourSensorManualCalibratorMarty.d.ts +1 -1
  37. package/package.json +10 -1
@@ -7,7 +7,7 @@ import { FOUND_RAFT_ON_DISCOVERY_RESPONSE } from "../../types/phone-app-communic
7
7
  import { ColourSensorCalibrationStage } from "../../types/colour-sensor-calibration";
8
8
  import { RaftObserver } from "../RAFTs/RaftObserver";
9
9
  import { RaftInfoEvents } from "../../types/events/raft-info";
10
- import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, RaftWifiScanResults, RaftWifiConnStatus, RaftOKFail } from "@robotical/raftjs";
10
+ import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, RaftWifiScanResults, RaftWifiConnStatus, RaftOKFail } from "@robdobsn/raftjs";
11
11
  import { ConnectedRaftItem } from "../../store/SelectedRaftContext";
12
12
  import Toaster from "../../utils/Toaster";
13
13
  import AnalyticsFacade from "@robotical/appv2-analytics-gatherer";
@@ -23,6 +23,8 @@ export default class ApplicationManager {
23
23
  connectedRafts: {
24
24
  [key: string]: RAFT;
25
25
  };
26
+ private _connectPromise;
27
+ private _disconnectPromises;
26
28
  connectedRaftsContext: ConnectedRaftItem[];
27
29
  returnToMainApp: () => void;
28
30
  carouselNavigatorManager: CarouselNavigatorManager;
@@ -54,6 +56,7 @@ export default class ApplicationManager {
54
56
  getDeviceInfo(): Promise<void>;
55
57
  updateRaftNameInAllStates(raftId: string, name: string): Promise<boolean>;
56
58
  private getConnectedRaftName;
59
+ private isRaftActive;
57
60
  private addConnectedRaftToContext;
58
61
  private publishLocalVerifiedConnection;
59
62
  private confirmQrVerifiedConnection;
@@ -89,6 +92,8 @@ export default class ApplicationManager {
89
92
  * Known issue: connecting to a raft from within a platform won't add the newly connected raft to the connectedRafts hook
90
93
  */
91
94
  connectGeneric(afterRaftConnectedCb: (raft: RAFT) => void, uuids?: string[], shouldShowQrModal?: boolean): Promise<void>;
95
+ private _clearConnectPromise;
96
+ private _connectGeneric;
92
97
  /**
93
98
  * Disconnect from RAFT generic
94
99
  * This method is called from various environments (connection button, blocksjr, blocks etc.)
@@ -116,15 +121,13 @@ export default class ApplicationManager {
116
121
  */
117
122
  disconnectFromRaft(raftId: string): Promise<void>;
118
123
  /**
119
- * Removes raft from the connectedRafts list after a timeout without disconnecting as at this point
120
- * the device should already be disconnected
124
+ * Finalizes a RAFT which has already emitted its terminal disconnect event.
125
+ * Passing the source RAFT prevents a late event from deleting a replacement
126
+ * connection which happens to have the same serial/ID.
121
127
  */
122
- removeRaft(raftId: string): Promise<void>;
123
- /**
124
- * Removes raft after a certain time
125
- * Removes from the rics list after x seconds so that we can still get the last event
126
- */
127
- _removeRaft(raftId: string, timeout: number): void;
128
+ removeRaft(raftId: string, disconnectedRaft?: RAFT): Promise<void>;
129
+ private _disconnectRaft;
130
+ private _removeRaftIfCurrent;
128
131
  /**
129
132
  * Start looking for rics to connect to
130
133
  * This is used from the Phone App only
@@ -143,7 +146,7 @@ export default class ApplicationManager {
143
146
  /**
144
147
  * Stop verifying raft
145
148
  */
146
- stopVerifyingRaft(raftId: string, isCorrectRIC: boolean): Promise<void>;
149
+ stopVerifyingRaft(raftId: string, isCorrectRIC: boolean): Promise<boolean | undefined>;
147
150
  /**
148
151
  * Publishing events to observers
149
152
  * It could be either events we get from RAFT, or custom events related to the app
@@ -45,7 +45,7 @@ import VerificationModal from "../../components/modals/VerificationModal";
45
45
  import { raftFoundSubscriptionHelper } from "../RAFTs/raft-subscription-helpers";
46
46
  import { AppSentMessage } from "../../types/communication-between-apps/wrapper-communication";
47
47
  import VerificationModalPhoneApp from "../../components/modals/VerificationModalPhoneApp";
48
- import { RaftConnEvent, } from "@robotical/raftjs";
48
+ import { RaftConnEvent, } from "@robdobsn/raftjs";
49
49
  import Logger from "../../services/logger/Logger";
50
50
  import isPhoneApp from "../../utils/phone-app-communication/is-phone-app";
51
51
  import DisconnectConfirmationModal from "../../components/modals/DisconnectConfirmation";
@@ -90,6 +90,8 @@ var ApplicationManager = /** @class */ (function () {
90
90
  this._observers = {};
91
91
  // Connected RICs
92
92
  this.connectedRafts = {};
93
+ this._connectPromise = null;
94
+ this._disconnectPromises = new Map();
93
95
  this.connectedRaftsContext = [];
94
96
  this.returnToMainApp = function () { };
95
97
  // Carousel navigators
@@ -226,6 +228,9 @@ var ApplicationManager = /** @class */ (function () {
226
228
  });
227
229
  });
228
230
  };
231
+ ApplicationManager.prototype.isRaftActive = function (raft) {
232
+ return this.connectedRafts[raft.id] === raft && !this._disconnectPromises.has(raft);
233
+ };
229
234
  ApplicationManager.prototype.addConnectedRaftToContext = function (raft) {
230
235
  return __awaiter(this, void 0, void 0, function () {
231
236
  var name;
@@ -234,13 +239,16 @@ var ApplicationManager = /** @class */ (function () {
234
239
  case 0: return [4 /*yield*/, this.getConnectedRaftName(raft)];
235
240
  case 1:
236
241
  name = _a.sent();
242
+ if (!this.isRaftActive(raft)) {
243
+ return [2 /*return*/, false];
244
+ }
237
245
  this.connectedRaftContextMethods.addConnectedRaft({
238
246
  id: raft.id,
239
247
  type: raft.type,
240
248
  name: name,
241
249
  isSelected: true,
242
250
  });
243
- return [2 /*return*/];
251
+ return [2 /*return*/, true];
244
252
  }
245
253
  });
246
254
  });
@@ -489,18 +497,10 @@ var ApplicationManager = /** @class */ (function () {
489
497
  return new Marty(id);
490
498
  };
491
499
  ApplicationManager.prototype.connectGenericMarty = function (afterRaftConnectedCb) {
492
- return __awaiter(this, void 0, void 0, function () {
493
- return __generator(this, function (_a) {
494
- return [2 /*return*/, this.connectGeneric(afterRaftConnectedCb, [ConnManager.RICUUID], false)];
495
- });
496
- });
500
+ return this.connectGeneric(afterRaftConnectedCb, [ConnManager.RICUUID], false);
497
501
  };
498
502
  ApplicationManager.prototype.connectGenericCog = function (afterRaftConnectedCb) {
499
- return __awaiter(this, void 0, void 0, function () {
500
- return __generator(this, function (_a) {
501
- return [2 /*return*/, this.connectGeneric(afterRaftConnectedCb, [ConnManager.COGUUID])];
502
- });
503
- });
503
+ return this.connectGeneric(afterRaftConnectedCb, [ConnManager.COGUUID]);
504
504
  };
505
505
  /**
506
506
  * Generic Connect method
@@ -508,9 +508,31 @@ var ApplicationManager = /** @class */ (function () {
508
508
  * Known issue: connecting to a raft from within a platform won't add the newly connected raft to the connectedRafts hook
509
509
  */
510
510
  ApplicationManager.prototype.connectGeneric = function (afterRaftConnectedCb, uuids, shouldShowQrModal) {
511
+ var _this = this;
512
+ if (shouldShowQrModal === void 0) { shouldShowQrModal = true; }
513
+ if (this._connectPromise) {
514
+ return this._connectPromise;
515
+ }
516
+ if (this._disconnectPromises.size > 0) {
517
+ this.toaster.info(i18n.t("connection.wait_for_bluetooth_disconnect", {
518
+ defaultValue: "Please wait for the current Bluetooth disconnect to finish.",
519
+ }));
520
+ return Promise.resolve();
521
+ }
522
+ var connectPromise = this._connectGeneric(afterRaftConnectedCb, uuids, shouldShowQrModal);
523
+ this._connectPromise = connectPromise;
524
+ void connectPromise.then(function () { return _this._clearConnectPromise(connectPromise); }, function () { return _this._clearConnectPromise(connectPromise); });
525
+ return connectPromise;
526
+ };
527
+ ApplicationManager.prototype._clearConnectPromise = function (connectPromise) {
528
+ if (this._connectPromise === connectPromise) {
529
+ this._connectPromise = null;
530
+ }
531
+ };
532
+ ApplicationManager.prototype._connectGeneric = function (afterRaftConnectedCb, uuids, shouldShowQrModal) {
511
533
  if (shouldShowQrModal === void 0) { shouldShowQrModal = true; }
512
534
  return __awaiter(this, void 0, void 0, function () {
513
- var verificationMethod, cancelVerificationResult, isQRVerification, e_1, newRaft, e_2;
535
+ var verificationMethod, cancelVerificationResult, isQRVerification, e_1, newRaft, wasAdopted, e_2;
514
536
  var _this = this;
515
537
  return __generator(this, function (_a) {
516
538
  switch (_a.label) {
@@ -537,7 +559,7 @@ var ApplicationManager = /** @class */ (function () {
537
559
  return [2 /*return*/];
538
560
  }
539
561
  if (verificationMethod.action === "switch-to-marty") {
540
- return [2 /*return*/, this.connectGenericMarty(afterRaftConnectedCb)];
562
+ return [2 /*return*/, this._connectGeneric(afterRaftConnectedCb, [ConnManager.RICUUID], false)];
541
563
  }
542
564
  isQRVerification = false;
543
565
  if (verificationMethod.action === "qr") {
@@ -562,12 +584,15 @@ var ApplicationManager = /** @class */ (function () {
562
584
  _a.sent();
563
585
  return [3 /*break*/, 7];
564
586
  case 5: return [4 /*yield*/, window.applicationManager.startDiscovery(function (newRaft) { return __awaiter(_this, void 0, void 0, function () {
587
+ var wasAdopted;
565
588
  return __generator(this, function (_a) {
566
589
  switch (_a.label) {
567
590
  case 0: return [4 /*yield*/, this.addConnectedRaftToContext(newRaft)];
568
591
  case 1:
569
- _a.sent();
570
- afterRaftConnectedCb(newRaft);
592
+ wasAdopted = _a.sent();
593
+ if (wasAdopted && this.isRaftActive(newRaft)) {
594
+ afterRaftConnectedCb(newRaft);
595
+ }
571
596
  return [2 /*return*/];
572
597
  }
573
598
  });
@@ -592,9 +617,11 @@ var ApplicationManager = /** @class */ (function () {
592
617
  if (!newRaft) return [3 /*break*/, 15];
593
618
  return [4 /*yield*/, this.addConnectedRaftToContext(newRaft)];
594
619
  case 13:
595
- _a.sent();
596
- afterRaftConnectedCb(newRaft);
597
- if (!isQRVerification) return [3 /*break*/, 15];
620
+ wasAdopted = _a.sent();
621
+ if (wasAdopted && this.isRaftActive(newRaft)) {
622
+ afterRaftConnectedCb(newRaft);
623
+ }
624
+ if (!(wasAdopted && this.isRaftActive(newRaft) && isQRVerification)) return [3 /*break*/, 15];
598
625
  return [4 /*yield*/, this.confirmQrVerifiedConnection(newRaft)];
599
626
  case 14:
600
627
  _a.sent();
@@ -623,27 +650,32 @@ var ApplicationManager = /** @class */ (function () {
623
650
  return __generator(this, function (_a) {
624
651
  switch (_a.label) {
625
652
  case 0:
626
- _a.trys.push([0, 4, , 5]);
627
- if (!!skipConfirmation) return [3 /*break*/, 2];
628
- return [4 /*yield*/, modalState.setModal(createElement(DisconnectConfirmationModal), "Are you sure you want to disconnect from your ".concat(raft.getFriendlyName(), "?"), getModalLogoForRaftType(raft.type))];
653
+ if (!raft) {
654
+ return [2 /*return*/];
655
+ }
656
+ _a.label = 1;
629
657
  case 1:
658
+ _a.trys.push([1, 5, , 6]);
659
+ if (!!skipConfirmation) return [3 /*break*/, 3];
660
+ return [4 /*yield*/, modalState.setModal(createElement(DisconnectConfirmationModal), "Are you sure you want to disconnect from your ".concat(raft.getFriendlyName(), "?"), getModalLogoForRaftType(raft.type))];
661
+ case 2:
630
662
  confirmDisconnect = _a.sent();
631
663
  if (!confirmDisconnect) {
632
664
  return [2 /*return*/];
633
665
  }
634
- _a.label = 2;
635
- case 2: return [4 /*yield*/, window.applicationManager.disconnectFromRaft(raft.id)];
636
- case 3:
666
+ _a.label = 3;
667
+ case 3: return [4 /*yield*/, window.applicationManager.disconnectFromRaft(raft.id)];
668
+ case 4:
637
669
  _a.sent();
638
670
  if (afterRaftDisconnectedCb) {
639
671
  afterRaftDisconnectedCb();
640
672
  }
641
- return [3 /*break*/, 5];
642
- case 4:
673
+ return [3 /*break*/, 6];
674
+ case 5:
643
675
  e_3 = _a.sent();
644
676
  Logger.error(SHOW_LOGS, TAG, "Failed to disconnect from robot: ".concat(e_3));
645
- return [3 /*break*/, 5];
646
- case 5: return [2 /*return*/];
677
+ return [3 /*break*/, 6];
678
+ case 6: return [2 /*return*/];
647
679
  }
648
680
  });
649
681
  });
@@ -788,59 +820,78 @@ var ApplicationManager = /** @class */ (function () {
788
820
  * Disconnect from RAFT
789
821
  */
790
822
  ApplicationManager.prototype.disconnectFromRaft = function (raftId) {
823
+ var raft = this.connectedRafts[raftId];
824
+ if (!raft) {
825
+ return Promise.resolve();
826
+ }
827
+ return this._disconnectRaft(raft);
828
+ };
829
+ /**
830
+ * Finalizes a RAFT which has already emitted its terminal disconnect event.
831
+ * Passing the source RAFT prevents a late event from deleting a replacement
832
+ * connection which happens to have the same serial/ID.
833
+ */
834
+ ApplicationManager.prototype.removeRaft = function (raftId, disconnectedRaft) {
791
835
  return __awaiter(this, void 0, void 0, function () {
792
- var raft;
836
+ var currentRaft;
793
837
  return __generator(this, function (_a) {
794
- switch (_a.label) {
795
- case 0:
796
- this.connectedRaftContextMethods.removeConnectedRaft(raftId);
797
- raft = this.connectedRafts[raftId];
798
- if (!raft) {
799
- return [2 /*return*/];
800
- }
801
- return [4 /*yield*/, raft.disconnect()];
802
- case 1:
803
- _a.sent();
804
- this._removeRaft(raftId, 3000);
805
- return [2 /*return*/];
838
+ currentRaft = this.connectedRafts[raftId];
839
+ if (!currentRaft || (disconnectedRaft && currentRaft !== disconnectedRaft)) {
840
+ return [2 /*return*/];
841
+ }
842
+ // A user-initiated disconnect is already waiting for RAFT_DISCONNECT.
843
+ // The event is only a notification in that case, not a second command.
844
+ if (this._disconnectPromises.has(currentRaft)) {
845
+ return [2 /*return*/];
806
846
  }
847
+ this._removeRaftIfCurrent(currentRaft);
848
+ return [2 /*return*/];
807
849
  });
808
850
  });
809
851
  };
810
- /**
811
- * Removes raft from the connectedRafts list after a timeout without disconnecting as at this point
812
- * the device should already be disconnected
813
- */
814
- ApplicationManager.prototype.removeRaft = function (raftId) {
815
- return __awaiter(this, void 0, void 0, function () {
816
- var raft;
852
+ ApplicationManager.prototype._disconnectRaft = function (raft, beforeDisconnect) {
853
+ var _this = this;
854
+ var inFlightDisconnect = this._disconnectPromises.get(raft);
855
+ if (inFlightDisconnect) {
856
+ return inFlightDisconnect;
857
+ }
858
+ var operation = Promise.resolve().then(function () { return __awaiter(_this, void 0, void 0, function () {
817
859
  return __generator(this, function (_a) {
818
860
  switch (_a.label) {
819
861
  case 0:
820
- this.connectedRaftContextMethods.removeConnectedRaft(raftId);
821
- raft = this.connectedRafts[raftId];
822
- if (!raft) {
823
- return [2 /*return*/];
824
- }
825
- return [4 /*yield*/, raft.disconnect()];
862
+ _a.trys.push([0, , 3, 5]);
863
+ if (!beforeDisconnect) return [3 /*break*/, 2];
864
+ return [4 /*yield*/, beforeDisconnect()];
826
865
  case 1:
827
866
  _a.sent();
828
- this._removeRaft(raftId, 10);
829
- return [2 /*return*/];
867
+ _a.label = 2;
868
+ case 2: return [3 /*break*/, 5];
869
+ case 3: return [4 /*yield*/, raft.disconnect()];
870
+ case 4:
871
+ _a.sent();
872
+ return [7 /*endfinally*/];
873
+ case 5: return [2 /*return*/];
830
874
  }
831
875
  });
876
+ }); });
877
+ var disconnectPromise;
878
+ disconnectPromise = operation.finally(function () {
879
+ _this._removeRaftIfCurrent(raft);
880
+ if (_this._disconnectPromises.get(raft) === disconnectPromise) {
881
+ _this._disconnectPromises.delete(raft);
882
+ }
832
883
  });
884
+ // Register ownership before connector code runs. A connector may emit a
885
+ // terminal event synchronously while disconnect() is being invoked.
886
+ this._disconnectPromises.set(raft, disconnectPromise);
887
+ return disconnectPromise;
833
888
  };
834
- /**
835
- * Removes raft after a certain time
836
- * Removes from the rics list after x seconds so that we can still get the last event
837
- */
838
- ApplicationManager.prototype._removeRaft = function (raftId, timeout) {
839
- var _this = this;
840
- var ricRemovalTimeout = setTimeout(function () {
841
- delete _this.connectedRafts[raftId];
842
- clearTimeout(ricRemovalTimeout);
843
- }, timeout);
889
+ ApplicationManager.prototype._removeRaftIfCurrent = function (raft) {
890
+ if (this.connectedRafts[raft.id] !== raft) {
891
+ return;
892
+ }
893
+ delete this.connectedRafts[raft.id];
894
+ this.connectedRaftContextMethods.removeConnectedRaft(raft.id);
844
895
  };
845
896
  /**
846
897
  * Start looking for rics to connect to
@@ -892,7 +943,7 @@ var ApplicationManager = /** @class */ (function () {
892
943
  raftFoundSubscriptionHelper().subscribe(function (_a) {
893
944
  var discoveredDevice = _a.discoveredDevice;
894
945
  return __awaiter(_this, void 0, void 0, function () {
895
- var newRaft, oldColours;
946
+ var newRaft, wasAdopted, oldColours;
896
947
  return __generator(this, function (_b) {
897
948
  switch (_b.label) {
898
949
  case 0:
@@ -909,7 +960,10 @@ var ApplicationManager = /** @class */ (function () {
909
960
  secondaryModalState.closeModalWithoutAnimation();
910
961
  return [4 /*yield*/, this.addConnectedRaftToContext(newRaft)];
911
962
  case 2:
912
- _b.sent();
963
+ wasAdopted = _b.sent();
964
+ if (!wasAdopted || !this.isRaftActive(newRaft)) {
965
+ return [2 /*return*/];
966
+ }
913
967
  afterRaftConnectedCb(newRaft);
914
968
  oldColours = newRaft._ledLcdColours;
915
969
  newRaft._ledLcdColours = [];
@@ -967,15 +1021,32 @@ var ApplicationManager = /** @class */ (function () {
967
1021
  * Stop verifying raft
968
1022
  */
969
1023
  ApplicationManager.prototype.stopVerifyingRaft = function (raftId, isCorrectRIC) {
970
- var _a;
971
1024
  return __awaiter(this, void 0, void 0, function () {
972
- return __generator(this, function (_b) {
973
- switch (_b.label) {
974
- case 0: return [4 /*yield*/, ((_a = this.connectedRafts[raftId]) === null || _a === void 0 ? void 0 : _a.stopVerifyingRaft(isCorrectRIC))];
1025
+ var raft, verificationResult;
1026
+ var _this = this;
1027
+ return __generator(this, function (_a) {
1028
+ switch (_a.label) {
1029
+ case 0:
1030
+ raft = this.connectedRafts[raftId];
1031
+ if (!raft) {
1032
+ return [2 /*return*/];
1033
+ }
1034
+ if (isCorrectRIC) {
1035
+ return [2 /*return*/, raft.stopVerifyingRaft(true)];
1036
+ }
1037
+ return [4 /*yield*/, this._disconnectRaft(raft, function () { return __awaiter(_this, void 0, void 0, function () {
1038
+ return __generator(this, function (_a) {
1039
+ switch (_a.label) {
1040
+ case 0: return [4 /*yield*/, raft.stopVerifyingRaft(false)];
1041
+ case 1:
1042
+ verificationResult = _a.sent();
1043
+ return [2 /*return*/];
1044
+ }
1045
+ });
1046
+ }); })];
975
1047
  case 1:
976
- _b.sent();
977
- this._removeRaft(raftId, 3000);
978
- return [2 /*return*/];
1048
+ _a.sent();
1049
+ return [2 /*return*/, verificationResult];
979
1050
  }
980
1051
  });
981
1052
  });
@@ -3,7 +3,7 @@ import RICInterface from "../RAFTInterface";
3
3
  import { RaftTypeE } from "../../../types/raft";
4
4
  import { RICLedLcdColours } from "@robotical/roboticaljs";
5
5
  import { SimplifiedCogStateInfo } from "@robotical/roboticaljs/dist/SystemTypeCog/CogTypes";
6
- import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robotical/raftjs";
6
+ import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robdobsn/raftjs";
7
7
  import { RaftInfoEvents } from "../../../types/events/raft-info";
8
8
  import PublishedDataAnalyser from "./PublishedDataAnalyser";
9
9
  export declare class Cog extends RAFT implements RICInterface {
@@ -51,7 +51,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51
51
  };
52
52
  import RAFT from "../RAFT";
53
53
  import { RaftTypeE } from "../../../types/raft";
54
- import { RaftConnEvent, RaftPublishEvent } from "@robotical/raftjs";
54
+ import { RaftConnEvent, RaftPublishEvent } from "@robdobsn/raftjs";
55
55
  import { RaftInfoEvents } from "../../../types/events/raft-info";
56
56
  import PublishedDataAnalyser, { setButtonThresholdsUtil } from "./PublishedDataAnalyser";
57
57
  var Cog = /** @class */ (function (_super) {
@@ -1,4 +1,4 @@
1
- import { RaftOKFail } from "@robotical/raftjs";
1
+ import { RaftOKFail } from "@robdobsn/raftjs";
2
2
  import Marty from "./Marty";
3
3
  export default class CalibrationManager {
4
4
  marty: Marty;
@@ -34,7 +34,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
- import { RaftOKFail } from "@robotical/raftjs";
37
+ import { RaftOKFail } from "@robdobsn/raftjs";
38
38
  import Logger from "../../../services/logger/Logger";
39
39
  var SHOW_LOGS = true;
40
40
  var TAG = "CalibrationManager";
@@ -1,7 +1,7 @@
1
1
  import RICInterface from "../RAFTInterface";
2
2
  import { RaftTypeE } from "../../../types/raft";
3
3
  import RAFT from "../RAFT";
4
- import { RaftConnEvent, RaftPublishEvent, RaftSystemInfo, RaftUpdateEvent } from "@robotical/raftjs";
4
+ import { RaftConnEvent, RaftPublishEvent, RaftSystemInfo, RaftUpdateEvent } from "@robdobsn/raftjs";
5
5
  import { RaftInfoEvents } from "../../../types/events/raft-info";
6
6
  import { RICLedLcdColours, RICStateInfo } from "@robotical/roboticaljs";
7
7
  import { MartyWifiManager } from "./MartyWifiManager";
@@ -51,7 +51,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51
51
  };
52
52
  import { RaftTypeE } from "../../../types/raft";
53
53
  import RAFT from "../RAFT";
54
- import { RaftConnEvent, RaftPublishEvent } from "@robotical/raftjs";
54
+ import { RaftConnEvent, RaftPublishEvent } from "@robdobsn/raftjs";
55
55
  import { MartyWifiManager } from "./MartyWifiManager";
56
56
  import MartyAddonsManager from "./MartyAddonsManager";
57
57
  import CalibrationManager from "./CalibrationManager";
@@ -1,4 +1,4 @@
1
- import { RaftOKFail, RaftWifiConnStatus, RaftWifiScanResults } from "@robotical/raftjs";
1
+ import { RaftOKFail, RaftWifiConnStatus, RaftWifiScanResults } from "@robdobsn/raftjs";
2
2
  import Marty from "./Marty";
3
3
  export declare class MartyWifiManager {
4
4
  marty: Marty;
@@ -34,7 +34,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
- import { RaftWifiConnState, RaftWifiConnStatus } from "@robotical/raftjs";
37
+ import { RaftWifiConnState, RaftWifiConnStatus } from "@robdobsn/raftjs";
38
38
  import Logger from "../../../services/logger/Logger";
39
39
  var SHOW_LOGS = true;
40
40
  var TAG = "MartyWifiManager";
@@ -3,7 +3,7 @@
3
3
  * One of the main purposes of this class is to prevent duplicate warnings from being
4
4
  * displayed to the user.
5
5
  */
6
- import { RaftLog } from "@robotical/raftjs";
6
+ import { RaftLog } from "@robdobsn/raftjs";
7
7
  // we won't store these warnings in the cached warnings state, and so they won't be displayed or stored to the warranty service db, only to the general db
8
8
  var ERRORS_TO_IGNORE = [
9
9
  // eyes faulty connection
@@ -4,7 +4,7 @@ import { RaftInfoEvents } from "../../types/events/raft-info";
4
4
  import { FOUND_RAFT_ON_DISCOVERY_RESPONSE } from "../../types/phone-app-communicator";
5
5
  import RICInterface from "./RAFTInterface";
6
6
  import { RaftObserver } from "./RaftObserver";
7
- import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, RaftOKFail, RaftSystemInfo } from "@robotical/raftjs";
7
+ import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, RaftOKFail, RaftSystemInfo } from "@robdobsn/raftjs";
8
8
  import { RICLedLcdColours, RICStateInfo } from "@robotical/roboticaljs";
9
9
  import { SimplifiedCogStateInfo } from "@robotical/roboticaljs/dist/SystemTypeCog/CogTypes";
10
10
  export default class RAFT implements RICInterface {
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import { AppSentMessage } from "../../types/communication-between-apps/wrapper-communication";
38
38
  import { RaftTypeE } from "../../types/raft";
39
39
  import { RaftInfoEvents } from "../../types/events/raft-info";
40
- import { RaftConnEvent, RaftPublishEvent, } from "@robotical/raftjs";
40
+ import { RaftConnEvent, RaftPublishEvent, } from "@robdobsn/raftjs";
41
41
  import Logger from "../../services/logger/Logger";
42
42
  import randomHashGenerator from "../../utils/helpers/randomHashGenerator";
43
43
  import { addRobotNameToSerialNumber, isSerialNumberRegistered } from "../../utils/warranty-service/warranty-service-utils";
@@ -400,7 +400,7 @@ var RAFT = /** @class */ (function () {
400
400
  // this runs when the RAFT is disconnected either on its own (due to a timeout or other reasons), or by the user
401
401
  // if it's by the user, we don't really need to do anything as the applicationManager will handle the disconnection
402
402
  // if the RAFT is disconnected on its own, however, we need to remove it from the connectedRafts list
403
- return [4 /*yield*/, window.applicationManager.removeRaft(this.id)];
403
+ return [4 /*yield*/, window.applicationManager.removeRaft(this.id, this)];
404
404
  case 3:
405
405
  // this runs when the RAFT is disconnected either on its own (due to a timeout or other reasons), or by the user
406
406
  // if it's by the user, we don't really need to do anything as the applicationManager will handle the disconnection
@@ -1,5 +1,5 @@
1
1
  import { RaftTypeE } from "../../types/raft";
2
- import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robotical/raftjs";
2
+ import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robdobsn/raftjs";
3
3
  import { RaftInfoEvents } from "../../types/events/raft-info";
4
4
  import { RICLedLcdColours } from "@robotical/roboticaljs";
5
5
  export default abstract class RICInterface {
@@ -1,5 +1,5 @@
1
1
  import { RaftInfoEvents } from "../../types/events/raft-info";
2
- import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robotical/raftjs";
2
+ import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robdobsn/raftjs";
3
3
  export interface MartyObservable {
4
4
  subscribe(observer: RaftObserver, topics: Array<string>): void;
5
5
  unsubscribe(observer: RaftObserver): void;
@@ -1,4 +1,4 @@
1
- import { RaftConnEvent } from "@robotical/raftjs";
1
+ import { RaftConnEvent } from "@robdobsn/raftjs";
2
2
  var subHelpersObject = {};
3
3
  /**
4
4
  * Connection Verifying Subscription Helper
@@ -156,8 +156,7 @@ function QRContent(_a) {
156
156
  "linear_codes",
157
157
  "upc_a",
158
158
  "upc_e",
159
- ], allowMultiple: false, scanDelay: 2000, onScan: onQrCodeFound, components: {
160
- audio: true,
159
+ ], allowMultiple: false, scanDelay: 2000, sound: true, onScan: onQrCodeFound, components: {
161
160
  onOff: false,
162
161
  torch: true,
163
162
  zoom: true,
@@ -55,17 +55,13 @@ import RICSignal from "../../oneoffs/RaftSignal";
55
55
  import SimpleButton from "../../disposables/buttons/SimpleButton";
56
56
  import LEDs from "../../oneoffs/LEDs";
57
57
  import { raftConnectingSubscriptionHelper } from "../../../application/RAFTs/raft-subscription-helpers";
58
- import { useConnectedRafts } from "../../../store/SelectedRaftContext";
59
58
  import { useTranslation } from "react-i18next";
60
- var SHOW_LOGS = true;
61
- var TAG = "VerificationModal";
62
59
  function VerificationModal(_a) {
63
60
  var _this = this;
64
61
  var connectedRAFT_ = _a.connectedRAFT_;
65
62
  var _b = useState([]), randomColours = _b[0], setRandomColours = _b[1];
66
63
  // const [connectedRaft, setConnectedRaft] = useState<RAFT | undefined>(connectedRAFT_);
67
64
  var _c = useState(-200), RSSI = _c[0], setRSSI = _c[1];
68
- var removeConnectedRaft = useConnectedRafts().removeConnectedRaft;
69
65
  var t = useTranslation().t;
70
66
  useEffect(function () {
71
67
  /* Subscribe to the connectedRaft's SIGNAL strength */
@@ -84,12 +80,8 @@ function VerificationModal(_a) {
84
80
  modalState.closeModal();
85
81
  if (!connectedRAFT_)
86
82
  return [2 /*return*/];
87
- removeConnectedRaft(connectedRAFT_.id);
88
83
  return [4 /*yield*/, window.applicationManager.stopVerifyingRaft(connectedRAFT_.id, false)];
89
84
  case 1:
90
- _a.sent();
91
- return [4 /*yield*/, connectedRAFT_.disconnect()];
92
- case 2:
93
85
  _a.sent();
94
86
  return [2 /*return*/];
95
87
  }