incyclist-services 1.4.13 → 1.4.15

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.
@@ -111,15 +111,15 @@ let Activity = (() => {
111
111
  return !!this.info.details;
112
112
  }
113
113
  getTitle() {
114
- var _b;
114
+ var _b, _c, _d, _e, _f, _g;
115
115
  let title = this.info.summary.title;
116
116
  if (title === model_1.DEFAULT_ACTIVITY_TITLE) {
117
- if ((_b = this.details.route) === null || _b === void 0 ? void 0 : _b.title) {
118
- title = this.details.route.title;
117
+ if ((_c = (_b = this.details) === null || _b === void 0 ? void 0 : _b.route) === null || _c === void 0 ? void 0 : _c.title) {
118
+ title = (_d = this.details) === null || _d === void 0 ? void 0 : _d.route.title;
119
119
  }
120
120
  else {
121
- title = this.details.route.name;
122
- const route = (0, routes_1.useRouteList)().getRouteDescription(this.details.route.id);
121
+ title = (_e = this.details) === null || _e === void 0 ? void 0 : _e.route.name;
122
+ const route = (0, routes_1.useRouteList)().getRouteDescription((_g = (_f = this.details) === null || _f === void 0 ? void 0 : _f.route) === null || _g === void 0 ? void 0 : _g.id);
123
123
  if (route) {
124
124
  title = route.title;
125
125
  }
@@ -341,12 +341,12 @@ let ActivityListService = (() => {
341
341
  const points = logs.map(p => { var _a; return ({ lat: p.lat, lng: (_a = p.lng) !== null && _a !== void 0 ? _a : p.lon }); });
342
342
  const props = {
343
343
  title: this.selected.getTitle(),
344
- distance: activity.distance,
345
- duration: activity.time,
344
+ distance: activity === null || activity === void 0 ? void 0 : activity.distance,
345
+ duration: activity === null || activity === void 0 ? void 0 : activity.time,
346
346
  elevation: this.selected.getElevation(),
347
- startPos: activity.segment ? undefined : activity.startPos,
348
- segment: activity.segment,
349
- started: new Date(activity.startTime),
347
+ startPos: (activity === null || activity === void 0 ? void 0 : activity.segment) ? undefined : activity === null || activity === void 0 ? void 0 : activity.startPos,
348
+ segment: activity === null || activity === void 0 ? void 0 : activity.segment,
349
+ started: activity ? new Date(activity.startTime) : undefined,
350
350
  showMap: true,
351
351
  points,
352
352
  activity,
@@ -601,6 +601,7 @@ let DeviceRideService = (() => {
601
601
  return;
602
602
  ai.ivToCheck = (0, timers_1.setInterval)(() => { check(); }, 1000);
603
603
  ai.isHealthy = true;
604
+ ai.isRestarting = false;
604
605
  if (ai.dataStatus !== undefined && ai.dataStatus !== 'green') {
605
606
  ai.dataStatus = 'green';
606
607
  const { enabledCapabilities } = this.getEnabledCapabilities(ai);
@@ -628,19 +629,21 @@ let DeviceRideService = (() => {
628
629
  prepareReconnect(unhealthy) {
629
630
  return __awaiter(this, void 0, void 0, function* () {
630
631
  var _a;
631
- this.logEvent({ message: 'prepareReconnect', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData });
632
- this.reconnectBusy = true;
633
- if (unhealthy.isRestarting)
632
+ this.logEvent({ message: 'prepareReconnect', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData, isRestarting: unhealthy.isRestarting });
633
+ if (unhealthy.isRestarting) {
634
+ this.logEvent({ message: 'skipped reconnect - device already restarting', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData });
634
635
  return;
636
+ }
635
637
  yield (0, sleep_1.sleep)(1000);
636
638
  if (unhealthy.isHealthy || unhealthy.isRestarting) {
637
639
  this.logEvent({ message: 'skipped reconnect', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData });
638
640
  return;
639
641
  }
640
- this.logEvent({ message: 'reconnect confirmed', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData });
641
642
  const ifName = unhealthy.adapter.getInterface();
642
643
  const adapters = (_a = this.rideAdapters) === null || _a === void 0 ? void 0 : _a.filter(ai => ai.adapter.getInterface() === ifName);
643
- if (!adapters.find(ai => ai.isHealthy) && adapters.length > 1) {
644
+ const stillHealthy = adapters.filter(ai => ai.isHealthy);
645
+ this.logEvent({ message: 'reconnect confirmed', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData, stillHealthy: stillHealthy === null || stillHealthy === void 0 ? void 0 : stillHealthy.length, onSameInterface: adapters.length });
646
+ if (!(stillHealthy === null || stillHealthy === void 0 ? void 0 : stillHealthy.length) && adapters.length > 1) {
644
647
  yield this.reconnectInterface(ifName, adapters);
645
648
  }
646
649
  else {
@@ -790,7 +793,6 @@ let DeviceRideService = (() => {
790
793
  }
791
794
  if (success) {
792
795
  this.startHealthCheck(unhealthy);
793
- unhealthy.isRestarting = false;
794
796
  unhealthy.isStarted = true;
795
797
  }
796
798
  else {
@@ -798,6 +800,7 @@ let DeviceRideService = (() => {
798
800
  yield (0, sleep_1.sleep)(1000);
799
801
  }
800
802
  } while (!stopRequested && !success);
803
+ unhealthy.isRestarting = false;
801
804
  this.emit('stop-adapter-confirmed', unhealthy.udid);
802
805
  });
803
806
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.26"
6
6
  },
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "axios": "^1.7.7",
45
- "incyclist-devices": "^2.3.8",
45
+ "incyclist-devices": "^2.3.13",
46
46
  "promise.any": "^2.0.6",
47
47
  "semver": "^7.6.3",
48
48
  "tcx-builder": "^1.1.1",