incyclist-services 1.7.85 → 1.7.86

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.
@@ -832,6 +832,12 @@ let DevicePairingService = (() => {
832
832
  this.logEvent({ message: 'device could not be added', reason: 'add() failed' });
833
833
  return;
834
834
  }
835
+ const deletedCapabilities = (this.state.deleted || [])
836
+ .filter(e => e.udid === udid)
837
+ .map(e => e.capability);
838
+ deletedCapabilities.forEach(capability => {
839
+ this.getDeviceConfiguration().delete(udid, capability, true);
840
+ });
835
841
  const adapter = this.getDeviceConfiguration().getAdapter(udid);
836
842
  if (adapter) {
837
843
  adapter.onScanStart();
@@ -1411,7 +1417,7 @@ let DevicePairingService = (() => {
1411
1417
  c.value = undefined;
1412
1418
  c.connectState = undefined;
1413
1419
  }
1414
- this.getDeviceConfiguration().delete(udid, capability, shouldEmit);
1420
+ this.getDeviceConfiguration().delete(udid, capability, true);
1415
1421
  this.addToDeletedList(capability, udid);
1416
1422
  this.emitStateChange({ capabilities: this.state.capabilities });
1417
1423
  }
@@ -1446,13 +1452,6 @@ let DevicePairingService = (() => {
1446
1452
  const c = this.getCapability(capability);
1447
1453
  this.state.deleted.push({ capability: c.capability, udid });
1448
1454
  }
1449
- removeFromDeletedList(capability, udid) {
1450
- const c = this.getCapability(capability);
1451
- const idx = this.state.deleted.findIndex(e => e.capability === c.capability && e.udid === udid);
1452
- if (idx === -1)
1453
- return;
1454
- this.state.deleted.splice(idx, 1);
1455
- }
1456
1455
  isOnDeletedList(c, udid) {
1457
1456
  const capability = this.getCapability(c);
1458
1457
  return this.state.deleted.some(e => e.capability === capability.capability && e.udid === udid);
@@ -134,11 +134,13 @@ function concatPaths(path, path2, position, wayId) {
134
134
  }
135
135
  if (position === 'after') {
136
136
  append.shift();
137
- path.push(...append);
137
+ append.forEach(p => path.push(p));
138
138
  }
139
139
  else {
140
140
  path.shift();
141
- path.unshift(...append);
141
+ const newPath = append.concat(path);
142
+ path.length = 0;
143
+ newPath.forEach(p => path.push(p));
142
144
  }
143
145
  }
144
146
  function splitAtPointInfo(way, split) {
@@ -115,8 +115,8 @@ function formatRange(low, high, unit, rangePrefix = '') {
115
115
  const v = high ?? low;
116
116
  return v === undefined ? '' : `${Math.round(v)}${unit}`;
117
117
  }
118
- function getStepTargetText(step, ftp, powerOverrideWatts) {
119
- const { min: minPower, max: maxPower } = powerOverrideWatts ?? resolvePowerWatts(step.power, ftp);
118
+ function getStepTargetText(step, ftp) {
119
+ const { min: minPower, max: maxPower } = resolvePowerWatts(step.power, ftp);
120
120
  const ascending = step.steady || step.cooldown === false;
121
121
  const lowPower = ascending ? minPower : maxPower;
122
122
  const highPower = ascending ? maxPower : minPower;
@@ -427,7 +427,7 @@ let WorkoutRidePageService = (() => {
427
427
  if (!limits)
428
428
  return empty;
429
429
  const currentStep = {
430
- label: (0, graph_1.getStepTargetText)(limits.step ?? {}, ftp, { min: limits.minPower, max: limits.maxPower }),
430
+ label: (0, graph_1.getStepTargetText)(limits.step ?? {}, ftp),
431
431
  targetPower: limits.targetPower ?? null,
432
432
  duration: limits.duration,
433
433
  remaining: limits.remaining,
@@ -456,7 +456,7 @@ let WorkoutRidePageService = (() => {
456
456
  const title = wo.title ?? '';
457
457
  if (!limits)
458
458
  return { text: title, mode: wo.mode ?? null };
459
- const target = (0, graph_1.getStepTargetText)(limits.step ?? {}, wo.ftp, { min: limits.minPower, max: limits.maxPower });
459
+ const target = (0, graph_1.getStepTargetText)(limits.step ?? {}, wo.ftp);
460
460
  const duration = (0, graph_1.getStepDuration)({ duration: limits.duration });
461
461
  const text = title ? `${target} for ${duration} - ${title}` : `${target} for ${duration}`;
462
462
  return { text, mode: wo.mode ?? null };
@@ -826,6 +826,12 @@ let DevicePairingService = (() => {
826
826
  this.logEvent({ message: 'device could not be added', reason: 'add() failed' });
827
827
  return;
828
828
  }
829
+ const deletedCapabilities = (this.state.deleted || [])
830
+ .filter(e => e.udid === udid)
831
+ .map(e => e.capability);
832
+ deletedCapabilities.forEach(capability => {
833
+ this.getDeviceConfiguration().delete(udid, capability, true);
834
+ });
829
835
  const adapter = this.getDeviceConfiguration().getAdapter(udid);
830
836
  if (adapter) {
831
837
  adapter.onScanStart();
@@ -1405,7 +1411,7 @@ let DevicePairingService = (() => {
1405
1411
  c.value = undefined;
1406
1412
  c.connectState = undefined;
1407
1413
  }
1408
- this.getDeviceConfiguration().delete(udid, capability, shouldEmit);
1414
+ this.getDeviceConfiguration().delete(udid, capability, true);
1409
1415
  this.addToDeletedList(capability, udid);
1410
1416
  this.emitStateChange({ capabilities: this.state.capabilities });
1411
1417
  }
@@ -1440,13 +1446,6 @@ let DevicePairingService = (() => {
1440
1446
  const c = this.getCapability(capability);
1441
1447
  this.state.deleted.push({ capability: c.capability, udid });
1442
1448
  }
1443
- removeFromDeletedList(capability, udid) {
1444
- const c = this.getCapability(capability);
1445
- const idx = this.state.deleted.findIndex(e => e.capability === c.capability && e.udid === udid);
1446
- if (idx === -1)
1447
- return;
1448
- this.state.deleted.splice(idx, 1);
1449
- }
1450
1449
  isOnDeletedList(c, udid) {
1451
1450
  const capability = this.getCapability(c);
1452
1451
  return this.state.deleted.some(e => e.capability === capability.capability && e.udid === udid);
@@ -98,11 +98,13 @@ export function concatPaths(path, path2, position, wayId) {
98
98
  }
99
99
  if (position === 'after') {
100
100
  append.shift();
101
- path.push(...append);
101
+ append.forEach(p => path.push(p));
102
102
  }
103
103
  else {
104
104
  path.shift();
105
- path.unshift(...append);
105
+ const newPath = append.concat(path);
106
+ path.length = 0;
107
+ newPath.forEach(p => path.push(p));
106
108
  }
107
109
  }
108
110
  export function splitAtPointInfo(way, split) {
@@ -107,8 +107,8 @@ function formatRange(low, high, unit, rangePrefix = '') {
107
107
  const v = high ?? low;
108
108
  return v === undefined ? '' : `${Math.round(v)}${unit}`;
109
109
  }
110
- export function getStepTargetText(step, ftp, powerOverrideWatts) {
111
- const { min: minPower, max: maxPower } = powerOverrideWatts ?? resolvePowerWatts(step.power, ftp);
110
+ export function getStepTargetText(step, ftp) {
111
+ const { min: minPower, max: maxPower } = resolvePowerWatts(step.power, ftp);
112
112
  const ascending = step.steady || step.cooldown === false;
113
113
  const lowPower = ascending ? minPower : maxPower;
114
114
  const highPower = ascending ? maxPower : minPower;
@@ -424,7 +424,7 @@ let WorkoutRidePageService = (() => {
424
424
  if (!limits)
425
425
  return empty;
426
426
  const currentStep = {
427
- label: getStepTargetText(limits.step ?? {}, ftp, { min: limits.minPower, max: limits.maxPower }),
427
+ label: getStepTargetText(limits.step ?? {}, ftp),
428
428
  targetPower: limits.targetPower ?? null,
429
429
  duration: limits.duration,
430
430
  remaining: limits.remaining,
@@ -453,7 +453,7 @@ let WorkoutRidePageService = (() => {
453
453
  const title = wo.title ?? '';
454
454
  if (!limits)
455
455
  return { text: title, mode: wo.mode ?? null };
456
- const target = getStepTargetText(limits.step ?? {}, wo.ftp, { min: limits.minPower, max: limits.maxPower });
456
+ const target = getStepTargetText(limits.step ?? {}, wo.ftp);
457
457
  const duration = getStepDuration({ duration: limits.duration });
458
458
  const text = title ? `${target} for ${duration} - ${title}` : `${target} for ${duration}`;
459
459
  return { text, mode: wo.mode ?? null };
@@ -137,7 +137,6 @@ export declare class DevicePairingService extends IncyclistService {
137
137
  protected _stopDeviceSelection(changed: boolean): Promise<void>;
138
138
  private numberOfSelectedCababilities;
139
139
  protected addToDeletedList(capability: IncyclistCapability | CapabilityData, udid: string): void;
140
- protected removeFromDeletedList(capability: IncyclistCapability | CapabilityData, udid: string): void;
141
140
  protected isOnDeletedList(c: IncyclistCapability | CapabilityData, udid: string): boolean;
142
141
  mappedCapability(c: CapabilityInformation): CapabilityData;
143
142
  protected mappedCapabilities(capabilities: DeviceConfigurationInfo): Array<CapabilityData>;
@@ -4,10 +4,7 @@ import { WorkoutGraphPlanBar, WorkoutGraphSeriesOptions } from "./types";
4
4
  export declare const WORKOUT_ZONE_COLORS: string[];
5
5
  export declare function getStepDuration(step: StepDefinition): string;
6
6
  export declare function getStepPower(step: StepDefinition, ftp?: number): string;
7
- export declare function getStepTargetText(step: StepDefinition, ftp?: number, powerOverrideWatts?: {
8
- min?: number;
9
- max?: number;
10
- }): string;
7
+ export declare function getStepTargetText(step: StepDefinition, ftp?: number): string;
11
8
  export interface FlattenedStep {
12
9
  step: Step;
13
10
  start: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.7.85",
3
+ "version": "1.7.86",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },