incyclist-services 1.6.7 → 1.6.8

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.
@@ -94,6 +94,7 @@ let ActiveRidesService = (() => {
94
94
  }
95
95
  init(session, maxLength = 10) {
96
96
  this.maxLength = maxLength;
97
+ this.logEvent({ message: 'init active rides list', session });
97
98
  try {
98
99
  if (this.observer) {
99
100
  this.observer.stop({ immediately: true });
@@ -545,6 +546,7 @@ let ActiveRidesService = (() => {
545
546
  }
546
547
  onDisconnect() {
547
548
  this.getMessageQueue().onDisconnect();
549
+ this.isSubscribed = false;
548
550
  }
549
551
  onConnect(props) {
550
552
  return __awaiter(this, void 0, void 0, function* () {
@@ -643,7 +645,12 @@ let ActiveRidesService = (() => {
643
645
  const items = yield this.getApi().getBySessionId(sessionId);
644
646
  if (!items.length)
645
647
  return;
646
- const item = items[0];
648
+ let item = items[0];
649
+ if (item.sessionId !== sessionId) {
650
+ item = items.find(i => i.sessionId === sessionId);
651
+ if (!item)
652
+ return;
653
+ }
647
654
  const others = (_a = this.others) !== null && _a !== void 0 ? _a : [];
648
655
  const localItem = others.find(e => e.sessionId === sessionId);
649
656
  if (localItem) {
@@ -666,7 +673,7 @@ let ActiveRidesService = (() => {
666
673
  }
667
674
  onActivityUpdateEvent(session, payload) {
668
675
  return __awaiter(this, void 0, void 0, function* () {
669
- var _a, _b, _c, _d, _e, _f;
676
+ var _a, _b, _c, _d, _e, _f, _g;
670
677
  try {
671
678
  if (session === this.session)
672
679
  return;
@@ -696,7 +703,9 @@ let ActiveRidesService = (() => {
696
703
  currentSpeed: payload.speed,
697
704
  currentLap: payload.lap
698
705
  };
699
- this.addActiveRide(entry);
706
+ if (!existing) {
707
+ this.addActiveRide(entry);
708
+ }
700
709
  }
701
710
  if (prevActive === 0) {
702
711
  this.isStarted = true;
@@ -704,7 +713,8 @@ let ActiveRidesService = (() => {
704
713
  }
705
714
  else {
706
715
  this.isStarted = true;
707
- this.logEvent({ message: 'group ride user joined', active: this.others.length + 1, activityId: (_e = this.activity) === null || _e === void 0 ? void 0 : _e.id, route: (_f = this.activity.route) === null || _f === void 0 ? void 0 : _f.title, routeHash: this.getRouteHash() });
716
+ this.logEvent({ message: 'group ride user joined', active: this.others.length + 1, activityId: (_e = this.activity) === null || _e === void 0 ? void 0 : _e.id, route: (_f = this.activity.route) === null || _f === void 0 ? void 0 : _f.title, routeHash: this.getRouteHash(),
717
+ remote: { uuid: (_g = item.user) === null || _g === void 0 ? void 0 : _g.id, session: item.sessionId } });
708
718
  }
709
719
  }
710
720
  }
@@ -229,6 +229,8 @@ class VideoSyncHelper extends service_1.IncyclistService {
229
229
  var _a, _b, _c, _d;
230
230
  if (this.isStopped || this.rlvStatus.timeRequested)
231
231
  return;
232
+ if (!(updates === null || updates === void 0 ? void 0 : updates.length))
233
+ return;
232
234
  try {
233
235
  const tsStart = Date.now();
234
236
  const totalDistance = this.route.description.distance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
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.8.2",
45
- "incyclist-devices": "^2.4.12",
45
+ "incyclist-devices": "^2.4.13",
46
46
  "promise.any": "^2.0.6",
47
47
  "semver": "^7.6.3",
48
48
  "tcx-builder": "^1.1.1",