@robotical/webapp-types 0.6.59 → 0.6.61
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.
|
@@ -47,7 +47,7 @@ export default class ApplicationManager {
|
|
|
47
47
|
* Disconnect from RAFT generic
|
|
48
48
|
* This method is called from various environments (connection button, blocksjr, blocks etc.)
|
|
49
49
|
*/
|
|
50
|
-
disconnectGeneric(raft: RAFT, afterRaftDisconnectedCb?: () => void): Promise<void>;
|
|
50
|
+
disconnectGeneric(raft: RAFT, afterRaftDisconnectedCb?: () => void, skipConfirmation?: boolean): Promise<void>;
|
|
51
51
|
/**
|
|
52
52
|
* Selects a RAFT in Phone's verification modal
|
|
53
53
|
*/
|
|
@@ -187,31 +187,34 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
187
187
|
* Disconnect from RAFT generic
|
|
188
188
|
* This method is called from various environments (connection button, blocksjr, blocks etc.)
|
|
189
189
|
*/
|
|
190
|
-
ApplicationManager.prototype.disconnectGeneric = function (raft, afterRaftDisconnectedCb) {
|
|
190
|
+
ApplicationManager.prototype.disconnectGeneric = function (raft, afterRaftDisconnectedCb, skipConfirmation) {
|
|
191
|
+
if (skipConfirmation === void 0) { skipConfirmation = false; }
|
|
191
192
|
return __awaiter(this, void 0, void 0, function () {
|
|
192
193
|
var confirmDisconnect, e_3;
|
|
193
194
|
return __generator(this, function (_a) {
|
|
194
195
|
switch (_a.label) {
|
|
195
196
|
case 0:
|
|
196
|
-
_a.trys.push([0,
|
|
197
|
+
_a.trys.push([0, 4, , 5]);
|
|
198
|
+
if (!!skipConfirmation) return [3 /*break*/, 2];
|
|
197
199
|
return [4 /*yield*/, modalState.setModal(createElement(DisconnectConfirmationModal), "Are you sure you want to disconnect from your ".concat(raft.getFriendlyName(), "?"))];
|
|
198
200
|
case 1:
|
|
199
201
|
confirmDisconnect = _a.sent();
|
|
200
202
|
if (!confirmDisconnect) {
|
|
201
203
|
return [2 /*return*/];
|
|
202
204
|
}
|
|
203
|
-
|
|
204
|
-
case 2:
|
|
205
|
+
_a.label = 2;
|
|
206
|
+
case 2: return [4 /*yield*/, window.applicationManager.disconnectFromRaft(raft.id)];
|
|
207
|
+
case 3:
|
|
205
208
|
_a.sent();
|
|
206
209
|
if (afterRaftDisconnectedCb) {
|
|
207
210
|
afterRaftDisconnectedCb();
|
|
208
211
|
}
|
|
209
|
-
return [3 /*break*/,
|
|
210
|
-
case
|
|
212
|
+
return [3 /*break*/, 5];
|
|
213
|
+
case 4:
|
|
211
214
|
e_3 = _a.sent();
|
|
212
215
|
Logger.error(SHOW_LOGS, TAG, "Failed to disconnect from robot: ".concat(e_3));
|
|
213
|
-
return [3 /*break*/,
|
|
214
|
-
case
|
|
216
|
+
return [3 /*break*/, 5];
|
|
217
|
+
case 5: return [2 /*return*/];
|
|
215
218
|
}
|
|
216
219
|
});
|
|
217
220
|
});
|
|
@@ -284,7 +284,8 @@ var RAFT = /** @class */ (function () {
|
|
|
284
284
|
case RaftConnEvent.CONN_VERIFIED_CORRECT:
|
|
285
285
|
window.applicationManager.analyticsManager.logEvent("connection", { raftType: this.type, systemInfo: this.systemInfo });
|
|
286
286
|
break;
|
|
287
|
-
case RaftConnEvent.CONN_DISCONNECTED:
|
|
287
|
+
case RaftConnEvent.CONN_DISCONNECTED: // this runs when the RAFT is disconnected on its own (due to a timeout or other reasons)
|
|
288
|
+
window.applicationManager.disconnectGeneric(this, function () { }, true); // disconnects the RAFT and removes it from the connectedRafts list
|
|
288
289
|
window.applicationManager.analyticsManager.logEvent("disconnection", { raftType: this.type });
|
|
289
290
|
break;
|
|
290
291
|
case RaftConnEvent.CONN_ISSUE_DETECTED:
|