@robotical/webapp-types 3.10.0 → 3.10.1
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:
|
|
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*/,
|
|
401
|
-
_a.label =
|
|
402
|
-
case
|
|
403
|
-
_a.trys.push([
|
|
404
|
-
if (!isQRVerification) return [3 /*break*/,
|
|
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
|
|
416
|
+
case 5:
|
|
409
417
|
_a.sent();
|
|
410
|
-
return [3 /*break*/,
|
|
411
|
-
case
|
|
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*/,
|
|
423
|
-
case
|
|
424
|
-
case
|
|
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 =
|
|
427
|
-
case
|
|
428
|
-
_a.trys.push([
|
|
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
|
|
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*/,
|
|
437
|
-
case
|
|
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*/,
|
|
441
|
-
case
|
|
448
|
+
return [3 /*break*/, 15];
|
|
449
|
+
case 15:
|
|
442
450
|
secondaryModalState.closeModal();
|
|
443
|
-
_a.label =
|
|
444
|
-
case
|
|
451
|
+
_a.label = 16;
|
|
452
|
+
case 16: return [2 /*return*/];
|
|
445
453
|
}
|
|
446
454
|
});
|
|
447
455
|
});
|