incyclist-services 1.7.116 → 1.7.118
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.
- package/lib/cjs/activities/base/repo/db.js +1 -1
- package/lib/cjs/activities/page/service.js +31 -1
- package/lib/cjs/activities/ride/service.js +1 -2
- package/lib/esm/activities/base/repo/db.js +1 -1
- package/lib/esm/activities/page/service.js +31 -1
- package/lib/esm/activities/ride/service.js +1 -2
- package/lib/types/activities/page/service.d.ts +5 -1
- package/lib/types/activities/page/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -223,7 +223,7 @@ let ActivitiesRepository = (() => {
|
|
|
223
223
|
return info;
|
|
224
224
|
}
|
|
225
225
|
search(criteria) {
|
|
226
|
-
let result = this.activities
|
|
226
|
+
let result = this.activities;
|
|
227
227
|
result = this.checkIdFilter(result, criteria);
|
|
228
228
|
result = this.checkHashFilter(result, criteria);
|
|
229
229
|
result = this.checkStartPosFilter(result, criteria);
|
|
@@ -41,6 +41,7 @@ const pages_1 = require("../../base/pages");
|
|
|
41
41
|
const list_1 = require("../list");
|
|
42
42
|
const sleep_1 = require("../../utils/sleep");
|
|
43
43
|
const workouts_1 = require("../../workouts");
|
|
44
|
+
const devices_1 = require("../../devices");
|
|
44
45
|
let ActivitiesPageService = (() => {
|
|
45
46
|
let _classDecorators = [decorators_1.Singleton];
|
|
46
47
|
let _classDescriptor;
|
|
@@ -50,14 +51,17 @@ let ActivitiesPageService = (() => {
|
|
|
50
51
|
let _instanceExtraInitializers = [];
|
|
51
52
|
let _getActivityList_decorators;
|
|
52
53
|
let _getWorkoutList_decorators;
|
|
54
|
+
let _getDevicePairing_decorators;
|
|
53
55
|
var ActivitiesPageService = class extends _classSuper {
|
|
54
56
|
static { _classThis = this; }
|
|
55
57
|
static {
|
|
56
58
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
57
59
|
_getActivityList_decorators = [decorators_1.Injectable];
|
|
58
60
|
_getWorkoutList_decorators = [decorators_1.Injectable];
|
|
61
|
+
_getDevicePairing_decorators = [decorators_1.Injectable];
|
|
59
62
|
__esDecorate(this, null, _getActivityList_decorators, { kind: "method", name: "getActivityList", static: false, private: false, access: { has: obj => "getActivityList" in obj, get: obj => obj.getActivityList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
60
63
|
__esDecorate(this, null, _getWorkoutList_decorators, { kind: "method", name: "getWorkoutList", static: false, private: false, access: { has: obj => "getWorkoutList" in obj, get: obj => obj.getWorkoutList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
64
|
+
__esDecorate(this, null, _getDevicePairing_decorators, { kind: "method", name: "getDevicePairing", static: false, private: false, access: { has: obj => "getDevicePairing" in obj, get: obj => obj.getDevicePairing }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
61
65
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
62
66
|
ActivitiesPageService = _classThis = _classDescriptor.value;
|
|
63
67
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -161,6 +165,18 @@ let ActivitiesPageService = (() => {
|
|
|
161
165
|
return { activityId, attachedWorkout: null };
|
|
162
166
|
}
|
|
163
167
|
}
|
|
168
|
+
onRideAgain(route) {
|
|
169
|
+
try {
|
|
170
|
+
const pairing = this.getDevicePairing();
|
|
171
|
+
const readyToStart = pairing.isReadyToStart();
|
|
172
|
+
this.logEvent({ message: 'Attempting to start a ride again', id: route?.id, title: route?.title, readyToStart });
|
|
173
|
+
const next = readyToStart ? '/rideDeviceOK' : '/pairingStart';
|
|
174
|
+
this.moveTo(next);
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
this.logError(err, 'onRideAgain');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
164
180
|
onClearWorkoutSelection() {
|
|
165
181
|
try {
|
|
166
182
|
this.getWorkoutList().unselect();
|
|
@@ -170,10 +186,21 @@ let ActivitiesPageService = (() => {
|
|
|
170
186
|
this.logError(err, 'onClearWorkoutSelection');
|
|
171
187
|
}
|
|
172
188
|
}
|
|
189
|
+
async onDeleteActivity(id) {
|
|
190
|
+
try {
|
|
191
|
+
return await this.getActivityList().delete(id);
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
this.logError(err, 'onDeleteActivity');
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
173
198
|
updatePageDisplay() {
|
|
174
199
|
this.getPageObserver()?.emit('page-update');
|
|
175
200
|
}
|
|
176
|
-
onStateUpdate() {
|
|
201
|
+
onStateUpdate(state) {
|
|
202
|
+
if (state)
|
|
203
|
+
this.listState = state;
|
|
177
204
|
this.updatePageDisplay();
|
|
178
205
|
}
|
|
179
206
|
startEventListener() {
|
|
@@ -196,6 +223,9 @@ let ActivitiesPageService = (() => {
|
|
|
196
223
|
getWorkoutList() {
|
|
197
224
|
return (0, workouts_1.useWorkoutList)();
|
|
198
225
|
}
|
|
226
|
+
getDevicePairing() {
|
|
227
|
+
return (0, devices_1.useDevicePairing)();
|
|
228
|
+
}
|
|
199
229
|
};
|
|
200
230
|
return ActivitiesPageService = _classThis;
|
|
201
231
|
})();
|
|
@@ -534,8 +534,7 @@ let ActivityRideService = (() => {
|
|
|
534
534
|
if (this.state === 'idle' || !this.observer)
|
|
535
535
|
return;
|
|
536
536
|
if (this.state !== 'completed') {
|
|
537
|
-
this.stop();
|
|
538
|
-
await new Promise(done => { this.observer.on('completed', done); });
|
|
537
|
+
await this.stop();
|
|
539
538
|
}
|
|
540
539
|
this.getRepo().delete(this.activity.id);
|
|
541
540
|
this.state = 'idle';
|
|
@@ -220,7 +220,7 @@ let ActivitiesRepository = (() => {
|
|
|
220
220
|
return info;
|
|
221
221
|
}
|
|
222
222
|
search(criteria) {
|
|
223
|
-
let result = this.activities
|
|
223
|
+
let result = this.activities;
|
|
224
224
|
result = this.checkIdFilter(result, criteria);
|
|
225
225
|
result = this.checkHashFilter(result, criteria);
|
|
226
226
|
result = this.checkStartPosFilter(result, criteria);
|
|
@@ -38,6 +38,7 @@ import { IncyclistPageService } from "../../base/pages";
|
|
|
38
38
|
import { useActivityList } from "../list";
|
|
39
39
|
import { sleep } from "../../utils/sleep";
|
|
40
40
|
import { useWorkoutList } from "../../workouts";
|
|
41
|
+
import { useDevicePairing } from "../../devices";
|
|
41
42
|
let ActivitiesPageService = (() => {
|
|
42
43
|
let _classDecorators = [Singleton];
|
|
43
44
|
let _classDescriptor;
|
|
@@ -47,14 +48,17 @@ let ActivitiesPageService = (() => {
|
|
|
47
48
|
let _instanceExtraInitializers = [];
|
|
48
49
|
let _getActivityList_decorators;
|
|
49
50
|
let _getWorkoutList_decorators;
|
|
51
|
+
let _getDevicePairing_decorators;
|
|
50
52
|
var ActivitiesPageService = class extends _classSuper {
|
|
51
53
|
static { _classThis = this; }
|
|
52
54
|
static {
|
|
53
55
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
54
56
|
_getActivityList_decorators = [Injectable];
|
|
55
57
|
_getWorkoutList_decorators = [Injectable];
|
|
58
|
+
_getDevicePairing_decorators = [Injectable];
|
|
56
59
|
__esDecorate(this, null, _getActivityList_decorators, { kind: "method", name: "getActivityList", static: false, private: false, access: { has: obj => "getActivityList" in obj, get: obj => obj.getActivityList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
57
60
|
__esDecorate(this, null, _getWorkoutList_decorators, { kind: "method", name: "getWorkoutList", static: false, private: false, access: { has: obj => "getWorkoutList" in obj, get: obj => obj.getWorkoutList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
61
|
+
__esDecorate(this, null, _getDevicePairing_decorators, { kind: "method", name: "getDevicePairing", static: false, private: false, access: { has: obj => "getDevicePairing" in obj, get: obj => obj.getDevicePairing }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
58
62
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
59
63
|
ActivitiesPageService = _classThis = _classDescriptor.value;
|
|
60
64
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -158,6 +162,18 @@ let ActivitiesPageService = (() => {
|
|
|
158
162
|
return { activityId, attachedWorkout: null };
|
|
159
163
|
}
|
|
160
164
|
}
|
|
165
|
+
onRideAgain(route) {
|
|
166
|
+
try {
|
|
167
|
+
const pairing = this.getDevicePairing();
|
|
168
|
+
const readyToStart = pairing.isReadyToStart();
|
|
169
|
+
this.logEvent({ message: 'Attempting to start a ride again', id: route?.id, title: route?.title, readyToStart });
|
|
170
|
+
const next = readyToStart ? '/rideDeviceOK' : '/pairingStart';
|
|
171
|
+
this.moveTo(next);
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
this.logError(err, 'onRideAgain');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
161
177
|
onClearWorkoutSelection() {
|
|
162
178
|
try {
|
|
163
179
|
this.getWorkoutList().unselect();
|
|
@@ -167,10 +183,21 @@ let ActivitiesPageService = (() => {
|
|
|
167
183
|
this.logError(err, 'onClearWorkoutSelection');
|
|
168
184
|
}
|
|
169
185
|
}
|
|
186
|
+
async onDeleteActivity(id) {
|
|
187
|
+
try {
|
|
188
|
+
return await this.getActivityList().delete(id);
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
this.logError(err, 'onDeleteActivity');
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
170
195
|
updatePageDisplay() {
|
|
171
196
|
this.getPageObserver()?.emit('page-update');
|
|
172
197
|
}
|
|
173
|
-
onStateUpdate() {
|
|
198
|
+
onStateUpdate(state) {
|
|
199
|
+
if (state)
|
|
200
|
+
this.listState = state;
|
|
174
201
|
this.updatePageDisplay();
|
|
175
202
|
}
|
|
176
203
|
startEventListener() {
|
|
@@ -193,6 +220,9 @@ let ActivitiesPageService = (() => {
|
|
|
193
220
|
getWorkoutList() {
|
|
194
221
|
return useWorkoutList();
|
|
195
222
|
}
|
|
223
|
+
getDevicePairing() {
|
|
224
|
+
return useDevicePairing();
|
|
225
|
+
}
|
|
196
226
|
};
|
|
197
227
|
return ActivitiesPageService = _classThis;
|
|
198
228
|
})();
|
|
@@ -528,8 +528,7 @@ let ActivityRideService = (() => {
|
|
|
528
528
|
if (this.state === 'idle' || !this.observer)
|
|
529
529
|
return;
|
|
530
530
|
if (this.state !== 'completed') {
|
|
531
|
-
this.stop();
|
|
532
|
-
await new Promise(done => { this.observer.on('completed', done); });
|
|
531
|
+
await this.stop();
|
|
533
532
|
}
|
|
534
533
|
this.getRepo().delete(this.activity.id);
|
|
535
534
|
this.state = 'idle';
|
|
@@ -2,6 +2,7 @@ import { IncyclistPageService } from "../../base/pages";
|
|
|
2
2
|
import { ActivitiesPageDisplayProps, ActivityDetailsProps, IActivitiesPageService } from "./types";
|
|
3
3
|
import { IObserver } from "../../types";
|
|
4
4
|
import { ActivityListDisplayProperties } from "../list";
|
|
5
|
+
import { RouteInfo } from "../../routes/base/types";
|
|
5
6
|
export declare class ActivitiesPageService extends IncyclistPageService implements IActivitiesPageService {
|
|
6
7
|
protected updateStateHandler: any;
|
|
7
8
|
protected listState: ActivityListDisplayProperties | undefined;
|
|
@@ -16,12 +17,15 @@ export declare class ActivitiesPageService extends IncyclistPageService implemen
|
|
|
16
17
|
onOpenActivity(id: string | null): void;
|
|
17
18
|
onCloseActivity(): void;
|
|
18
19
|
getActivityDetailsProps(activityId: string): ActivityDetailsProps;
|
|
20
|
+
onRideAgain(route?: RouteInfo): void;
|
|
19
21
|
onClearWorkoutSelection(): void;
|
|
22
|
+
onDeleteActivity(id: string): Promise<boolean>;
|
|
20
23
|
protected updatePageDisplay(): void;
|
|
21
|
-
protected onStateUpdate(): void;
|
|
24
|
+
protected onStateUpdate(state?: ActivityListDisplayProperties): void;
|
|
22
25
|
protected startEventListener(): void;
|
|
23
26
|
protected stopEventListener(final?: boolean): void;
|
|
24
27
|
getActivityList(): import("../list").ActivityListService;
|
|
25
28
|
protected getWorkoutList(): import("../../workouts").WorkoutListService;
|
|
29
|
+
protected getDevicePairing(): import("../../devices").DevicePairingService;
|
|
26
30
|
}
|
|
27
31
|
export declare const getActivitiesPageService: () => ActivitiesPageService;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IPageService } from "../../base/pages";
|
|
2
2
|
import { ActivityInfoUI } from "../base";
|
|
3
3
|
import { AttachedWorkoutProps } from "../../routes/page/types";
|
|
4
|
+
import { RouteInfo } from "../../routes/base/types";
|
|
4
5
|
export interface ActivitiesPageDisplayProps {
|
|
5
6
|
loading: boolean;
|
|
6
7
|
activities?: Array<ActivityInfoUI>;
|
|
@@ -15,4 +16,6 @@ export interface IActivitiesPageService extends IPageService {
|
|
|
15
16
|
getPageDisplayProps(): ActivitiesPageDisplayProps;
|
|
16
17
|
getActivityDetailsProps(activityId: string): ActivityDetailsProps;
|
|
17
18
|
onClearWorkoutSelection(): void;
|
|
19
|
+
onRideAgain(route?: RouteInfo): void;
|
|
20
|
+
onDeleteActivity(id: string): Promise<boolean>;
|
|
18
21
|
}
|