@robotical/webapp-types 3.10.0 → 3.10.2

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.
@@ -71,7 +71,7 @@ export default class ApplicationManager {
71
71
  * This method is called from various environments (connection button, blocksjr, blocks etc.)
72
72
  * Known issue: connecting to a raft from within a platform won't add the newly connected raft to the connectedRafts hook
73
73
  */
74
- connectGeneric(afterRaftConnectedCb: (raft: RAFT) => void, uuids?: string[]): Promise<void>;
74
+ connectGeneric(afterRaftConnectedCb: (raft: RAFT) => void, uuids?: string[], shouldShowQrModal?: boolean): Promise<void>;
75
75
  /**
76
76
  * Disconnect from RAFT generic
77
77
  * This method is called from various environments (connection button, blocksjr, blocks etc.)
@@ -359,7 +359,7 @@ var ApplicationManager = /** @class */ (function () {
359
359
  ApplicationManager.prototype.connectGenericMarty = function (afterRaftConnectedCb) {
360
360
  return __awaiter(this, void 0, void 0, function () {
361
361
  return __generator(this, function (_a) {
362
- return [2 /*return*/, this.connectGeneric(afterRaftConnectedCb, [ConnManager.RICUUID])];
362
+ return [2 /*return*/, this.connectGeneric(afterRaftConnectedCb, [ConnManager.RICUUID], false)];
363
363
  });
364
364
  });
365
365
  };
@@ -375,15 +375,23 @@ var ApplicationManager = /** @class */ (function () {
375
375
  * This method is called from various environments (connection button, blocksjr, blocks etc.)
376
376
  * Known issue: connecting to a raft from within a platform won't add the newly connected raft to the connectedRafts hook
377
377
  */
378
- ApplicationManager.prototype.connectGeneric = function (afterRaftConnectedCb, uuids) {
378
+ ApplicationManager.prototype.connectGeneric = function (afterRaftConnectedCb, uuids, shouldShowQrModal) {
379
+ if (shouldShowQrModal === void 0) { shouldShowQrModal = true; }
379
380
  return __awaiter(this, void 0, void 0, function () {
380
381
  var specificUUIDs, isQRVerification, e_1, newRaft, e_2;
381
382
  var _this = this;
382
383
  return __generator(this, function (_a) {
383
384
  switch (_a.label) {
384
- case 0: return [4 /*yield*/, modalState.setModal(createElement(LEDLightsOrQRVerificationModal), "Verification Method")];
385
+ case 0:
386
+ if (!shouldShowQrModal) return [3 /*break*/, 2];
387
+ return [4 /*yield*/, modalState.setModal(createElement(LEDLightsOrQRVerificationModal), "Verification Method")];
385
388
  case 1:
386
389
  specificUUIDs = _a.sent();
390
+ return [3 /*break*/, 3];
391
+ case 2:
392
+ specificUUIDs = [];
393
+ _a.label = 3;
394
+ case 3:
387
395
  isQRVerification = false;
388
396
  if (specificUUIDs === false) {
389
397
  return [2 /*return*/];
@@ -397,51 +405,51 @@ var ApplicationManager = /** @class */ (function () {
397
405
  uuids = [ConnManager.COGUUID, ConnManager.RICUUID];
398
406
  }
399
407
  }
400
- if (!isPhoneApp()) return [3 /*break*/, 9];
401
- _a.label = 2;
402
- case 2:
403
- _a.trys.push([2, 7, , 8]);
404
- if (!isQRVerification) return [3 /*break*/, 4];
408
+ if (!isPhoneApp()) return [3 /*break*/, 11];
409
+ _a.label = 4;
410
+ case 4:
411
+ _a.trys.push([4, 9, , 10]);
412
+ if (!isQRVerification) return [3 /*break*/, 6];
405
413
  secondaryModalState.setModal(createElement(ConnectingLoadingSpinnerModal, {}), "Connecting...", false);
406
414
  this.ricSelectedCb = null;
407
415
  return [4 /*yield*/, window.applicationManager.startDiscoveryWithoutVerification(uuids, afterRaftConnectedCb)];
408
- case 3:
416
+ case 5:
409
417
  _a.sent();
410
- return [3 /*break*/, 6];
411
- case 4: return [4 /*yield*/, window.applicationManager.startDiscovery(function (newRaft) {
418
+ return [3 /*break*/, 8];
419
+ case 6: return [4 /*yield*/, window.applicationManager.startDiscovery(function (newRaft) {
412
420
  _this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
413
421
  afterRaftConnectedCb(newRaft);
414
422
  }, uuids)];
415
- case 5:
416
- _a.sent();
417
- _a.label = 6;
418
- case 6: return [3 /*break*/, 8];
419
423
  case 7:
424
+ _a.sent();
425
+ _a.label = 8;
426
+ case 8: return [3 /*break*/, 10];
427
+ case 9:
420
428
  e_1 = _a.sent();
421
429
  Logger.error(SHOW_LOGS, TAG, "Failed to start discovery: ".concat(e_1));
422
- return [3 /*break*/, 8];
423
- case 8: return [3 /*break*/, 14];
424
- case 9:
430
+ return [3 /*break*/, 10];
431
+ case 10: return [3 /*break*/, 16];
432
+ case 11:
425
433
  secondaryModalState.setModal(createElement(ConnectingLoadingSpinnerModal, {}), "Connecting...", false);
426
- _a.label = 10;
427
- case 10:
428
- _a.trys.push([10, 12, , 13]);
434
+ _a.label = 12;
435
+ case 12:
436
+ _a.trys.push([12, 14, , 15]);
429
437
  return [4 /*yield*/, window.applicationManager.connectToRIC(RaftConnectionMethod.WEB_BLE, uuids, isQRVerification)];
430
- case 11:
438
+ case 13:
431
439
  newRaft = _a.sent();
432
440
  if (newRaft) {
433
441
  this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
434
442
  afterRaftConnectedCb(newRaft);
435
443
  }
436
- return [3 /*break*/, 13];
437
- case 12:
444
+ return [3 /*break*/, 15];
445
+ case 14:
438
446
  e_2 = _a.sent();
439
447
  Logger.error(SHOW_LOGS, TAG, "Failed to connect to new robot: ".concat(e_2));
440
- return [3 /*break*/, 13];
441
- case 13:
448
+ return [3 /*break*/, 15];
449
+ case 15:
442
450
  secondaryModalState.closeModal();
443
- _a.label = 14;
444
- case 14: return [2 /*return*/];
451
+ _a.label = 16;
452
+ case 16: return [2 /*return*/];
445
453
  }
446
454
  });
447
455
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.10.0",
3
+ "version": "3.10.2",
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",