@skyvexsoftware/stratos-sdk 0.15.2 → 0.16.0
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.
|
@@ -19,6 +19,12 @@ type UseTrackingSessionReturn = {
|
|
|
19
19
|
isPaused: boolean;
|
|
20
20
|
/** True when the flight was paused due to simulator disconnection. */
|
|
21
21
|
simDisconnected: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* True while the sim is dropped mid-flight and the shell is silently waiting
|
|
24
|
+
* for it to reconnect (the flight stays active). Drives the "reconnecting…"
|
|
25
|
+
* recovery dialog.
|
|
26
|
+
*/
|
|
27
|
+
reconnecting: boolean;
|
|
22
28
|
currentFlight: CurrentFlight | null;
|
|
23
29
|
pendingRecovery: RecoverableFlight | null;
|
|
24
30
|
elapsedTime: number;
|
|
@@ -32,6 +38,10 @@ type UseTrackingSessionReturn = {
|
|
|
32
38
|
success: boolean;
|
|
33
39
|
error?: string;
|
|
34
40
|
}>;
|
|
41
|
+
/** Pilot-reported online network for the current flight ("offline" when none selected). */
|
|
42
|
+
network: string;
|
|
43
|
+
/** Set the pilot-reported online network. Resolves false when no flight is in progress. */
|
|
44
|
+
setNetwork: (network: string) => Promise<boolean>;
|
|
35
45
|
recoverFlight: () => Promise<boolean>;
|
|
36
46
|
dismissRecovery: () => Promise<boolean>;
|
|
37
47
|
isLoading: boolean;
|
|
@@ -55,6 +55,7 @@ export function useTrackingSession() {
|
|
|
55
55
|
flight: payload.flight,
|
|
56
56
|
pendingRecovery: payload.pendingRecovery,
|
|
57
57
|
simDisconnected: payload.simDisconnected,
|
|
58
|
+
reconnecting: payload.reconnecting,
|
|
58
59
|
});
|
|
59
60
|
};
|
|
60
61
|
// Refetch on socket connect — catches flights started before the UI loaded
|
|
@@ -71,6 +72,7 @@ export function useTrackingSession() {
|
|
|
71
72
|
const currentFlight = stateData?.flight ?? null;
|
|
72
73
|
const pendingRecovery = stateData?.pendingRecovery ?? null;
|
|
73
74
|
const simDisconnected = stateData?.simDisconnected ?? false;
|
|
75
|
+
const reconnecting = stateData?.reconnecting ?? false;
|
|
74
76
|
const startFlight = useCallback(async (plan, options) => {
|
|
75
77
|
const result = await api("/start", "POST", { flightPlan: plan, options });
|
|
76
78
|
return result.data;
|
|
@@ -87,6 +89,12 @@ export function useTrackingSession() {
|
|
|
87
89
|
const result = await api("/end", "POST", { status });
|
|
88
90
|
return { success: result.success, error: result.error };
|
|
89
91
|
}, []);
|
|
92
|
+
const setNetwork = useCallback(async (network) => {
|
|
93
|
+
const result = await api("/network", "POST", {
|
|
94
|
+
network,
|
|
95
|
+
});
|
|
96
|
+
return result.success;
|
|
97
|
+
}, []);
|
|
90
98
|
const recoverFlight = useCallback(async () => {
|
|
91
99
|
const result = await api("/recover", "POST");
|
|
92
100
|
if (result.success) {
|
|
@@ -146,6 +154,7 @@ export function useTrackingSession() {
|
|
|
146
154
|
isTracking: isActive,
|
|
147
155
|
isPaused: flight?.status === "paused",
|
|
148
156
|
simDisconnected,
|
|
157
|
+
reconnecting,
|
|
149
158
|
currentFlight: flight,
|
|
150
159
|
pendingRecovery,
|
|
151
160
|
elapsedTime,
|
|
@@ -154,6 +163,8 @@ export function useTrackingSession() {
|
|
|
154
163
|
pauseFlight,
|
|
155
164
|
resumeFlight,
|
|
156
165
|
endFlight,
|
|
166
|
+
network: flight?.network ?? "offline",
|
|
167
|
+
setNetwork,
|
|
157
168
|
recoverFlight,
|
|
158
169
|
dismissRecovery,
|
|
159
170
|
isLoading,
|
|
@@ -64,6 +64,11 @@ export type CurrentFlight = {
|
|
|
64
64
|
updatesSent: number;
|
|
65
65
|
updateIntervalMs: number;
|
|
66
66
|
comments: FlightComment[];
|
|
67
|
+
/**
|
|
68
|
+
* Pilot-reported online network for this flight (e.g. "vatsim").
|
|
69
|
+
* "offline" by default; resets on every flight start.
|
|
70
|
+
*/
|
|
71
|
+
network: string;
|
|
67
72
|
lastError: string | null;
|
|
68
73
|
};
|
|
69
74
|
/** Comment attached to an active flight */
|
|
@@ -120,6 +125,13 @@ export type FlightManagerPayload = {
|
|
|
120
125
|
pendingRecovery: RecoverableFlight | null;
|
|
121
126
|
/** True when the flight was paused due to simulator disconnection. */
|
|
122
127
|
simDisconnected: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* True while the sim is dropped mid-flight and we are silently waiting for it
|
|
130
|
+
* to come back (the "reconnecting" pending state). The flight stays active;
|
|
131
|
+
* the shell surfaces the recovery dialog off this flag so a genuine crash can
|
|
132
|
+
* never resume silently without the pilot seeing it.
|
|
133
|
+
*/
|
|
134
|
+
reconnecting: boolean;
|
|
123
135
|
timestamp: number;
|
|
124
136
|
};
|
|
125
137
|
/** Result returned from startFlight */
|