@tsachit/react-native-geo-service 1.0.4 → 1.0.5
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/README.md +3 -1
- package/lib/GeoDebugPanel.js +11 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -349,7 +349,8 @@ await RNGeoService.stop(); // panel hides automatically
|
|
|
349
349
|
|
|
350
350
|
| Minimized | Opened |
|
|
351
351
|
|--------|-------------|
|
|
352
|
-
| <img width="349" height="261" alt="image" src="https://github.com/user-attachments/assets/a6b43b93-7a93-485d-a68d-f4e4fe658011" /> | <img width="
|
|
352
|
+
| <img width="349" height="261" alt="image" src="https://github.com/user-attachments/assets/a6b43b93-7a93-485d-a68d-f4e4fe658011" /> | <img width="321" height="325" alt="image" src="https://github.com/user-attachments/assets/8715d657-0984-46c3-bf38-d782968ddc99" /> |
|
|
353
|
+
|
|
353
354
|
|
|
354
355
|
### Debug panel behaviour
|
|
355
356
|
|
|
@@ -359,6 +360,7 @@ The panel is a **draggable, minimizable floating overlay** that starts minimized
|
|
|
359
360
|
- **Drag** by holding the striped header bar
|
|
360
361
|
- **Minimize** with the ⊖ button — collapses back to the 📍 circle
|
|
361
362
|
- **Geopoints updates in real time** on every location event — no need to wait for the poll interval
|
|
363
|
+
- **"↺ Reset stats"** at the bottom right clears all accumulated data; Geopoints, elapsed time, battery drain, and the start timestamp all reset to zero
|
|
362
364
|
|
|
363
365
|
**Metrics shown** (all values are cumulative across app restarts — see [GeoSessionStore](#geosessionstore)):
|
|
364
366
|
|
package/lib/GeoDebugPanel.js
CHANGED
|
@@ -177,6 +177,8 @@ const GeoDebugPanel = ({ pollInterval = 30000 }) => {
|
|
|
177
177
|
});
|
|
178
178
|
// Live count updated on every location event so Geopoints doesn't wait for the poll
|
|
179
179
|
const [realtimeCount, setRealtimeCount] = (0, react_1.useState)(0);
|
|
180
|
+
// Native updateCount value at the last reset — subtracted so the display starts from 0
|
|
181
|
+
const countBaseline = (0, react_1.useRef)(0);
|
|
180
182
|
const initialY = SCREEN_HEIGHT - PANEL_ESTIMATED_HEIGHT - PILL_INITIAL_BOTTOM_MARGIN;
|
|
181
183
|
const pan = (0, react_1.useRef)(new react_native_1.Animated.ValueXY({ x: 8, y: initialY })).current;
|
|
182
184
|
const lastPos = (0, react_1.useRef)({ x: 8, y: initialY });
|
|
@@ -219,10 +221,13 @@ const GeoDebugPanel = ({ pollInterval = 30000 }) => {
|
|
|
219
221
|
catch (_) { }
|
|
220
222
|
}), []);
|
|
221
223
|
const handleReset = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
224
|
+
var _a;
|
|
222
225
|
yield GeoSessionStore_1.GeoSessionStore.clear();
|
|
223
226
|
setStoreData({ accumulated: { updateCount: 0, elapsedSeconds: 0, gpsActiveSeconds: 0, drain: 0 }, lastSnapshot: null, trackingStartedAt: null });
|
|
227
|
+
// Capture current native count as baseline so post-reset display starts from 0
|
|
228
|
+
countBaseline.current = (_a = info === null || info === void 0 ? void 0 : info.updateCount) !== null && _a !== void 0 ? _a : 0;
|
|
224
229
|
setRealtimeCount(0);
|
|
225
|
-
}), []);
|
|
230
|
+
}), [info]);
|
|
226
231
|
(0, react_1.useEffect)(() => {
|
|
227
232
|
// Load accumulated history on mount
|
|
228
233
|
GeoSessionStore_1.GeoSessionStore.load().then(setStoreData).catch(() => { });
|
|
@@ -257,9 +262,11 @@ const GeoDebugPanel = ({ pollInterval = 30000 }) => {
|
|
|
257
262
|
const sessionGpsActive = (_b = info === null || info === void 0 ? void 0 : info.gpsActiveSeconds) !== null && _b !== void 0 ? _b : 0;
|
|
258
263
|
const sessionDrain = (_c = info === null || info === void 0 ? void 0 : info.drainSinceStart) !== null && _c !== void 0 ? _c : 0;
|
|
259
264
|
const level = (_d = info === null || info === void 0 ? void 0 : info.level) !== null && _d !== void 0 ? _d : -1;
|
|
260
|
-
//
|
|
261
|
-
//
|
|
262
|
-
|
|
265
|
+
// Subtract baseline so the count restarts from 0 after a reset.
|
|
266
|
+
// Use the higher of the adjusted native count vs the live subscription count
|
|
267
|
+
// so we never show a number lower than what the native side knows about.
|
|
268
|
+
const nativeCountSinceReset = Math.max(0, ((_e = info === null || info === void 0 ? void 0 : info.updateCount) !== null && _e !== void 0 ? _e : 0) - countBaseline.current);
|
|
269
|
+
const sessionUpdates = Math.max(nativeCountSinceReset, realtimeCount);
|
|
263
270
|
// Combine current session with accumulated history from previous sessions
|
|
264
271
|
const acc = storeData.accumulated;
|
|
265
272
|
const elapsed = acc.elapsedSeconds + sessionElapsed;
|
package/package.json
CHANGED