incyclist-services 1.7.116 → 1.7.117
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.
|
@@ -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,6 +186,15 @@ 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
|
}
|
|
@@ -196,6 +221,9 @@ let ActivitiesPageService = (() => {
|
|
|
196
221
|
getWorkoutList() {
|
|
197
222
|
return (0, workouts_1.useWorkoutList)();
|
|
198
223
|
}
|
|
224
|
+
getDevicePairing() {
|
|
225
|
+
return (0, devices_1.useDevicePairing)();
|
|
226
|
+
}
|
|
199
227
|
};
|
|
200
228
|
return ActivitiesPageService = _classThis;
|
|
201
229
|
})();
|
|
@@ -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,6 +183,15 @@ 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
|
}
|
|
@@ -193,6 +218,9 @@ let ActivitiesPageService = (() => {
|
|
|
193
218
|
getWorkoutList() {
|
|
194
219
|
return useWorkoutList();
|
|
195
220
|
}
|
|
221
|
+
getDevicePairing() {
|
|
222
|
+
return useDevicePairing();
|
|
223
|
+
}
|
|
196
224
|
};
|
|
197
225
|
return ActivitiesPageService = _classThis;
|
|
198
226
|
})();
|
|
@@ -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
24
|
protected onStateUpdate(): 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
|
}
|