T22/T24/T26: uploader, integration tests, and release readiness

T22 -- TelemetryUploader on package:http with MockClient standing in for
MockWebServer, tested against a real in-memory Drift database rather than a fake
DAO. Upload runs on its own timer, injected as a callback so the engine has no
opinion about HTTP and tests need no network. Config on shared_preferences with
a hand-rolled UUID v4. Still no UI for the endpoint, exactly as in the native
app. 7 tests.

T24 -- integration_test/app_test.dart, 4 tests passing on the iOS simulator.
These cover what widget tests cannot: Drift opening against real platform
storage, plugin registration, go_router driving a real Navigator, cold start.

T26 -- RELEASE-IOS.md. Usage strings are specific rather than generic, which is
the leading Guideline 5.1.1 rejection cause; privacy-label answers decided; a
pre-submission list covering the bundle-id switch back to com.rippr, the still
default app icon, a release build, and a demo video for review notes.

T25 written up as REAL-RIDE-CHECKLIST.md but outstanding by nature. Two items
decide real things: force-stopping mid-ride on Android confirms the 111 km
crash-gap bug is fixed, and parking 15 minutes mid-recording on iOS decides
whether geolocator is sufficient or the paid engine is needed.

Two prefer_initializing_formals lints suppressed with a reason: Dart forbids a
named parameter beginning with an underscore, so the suggested fix will not
compile.

178 tests passing, analyze clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-15 22:20:39 -05:00
parent d501528e69
commit a3bcd014c0
10 changed files with 732 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import 'package:drift/drift.dart' show driftRuntimeOptions;
import 'package:drift_flutter/drift_flutter.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../config/config.dart';
import '../data/database.dart';
import '../data/trip_repository.dart';
import '../domain/models.dart';
@@ -17,6 +18,7 @@ import '../recording/geolocator_location_source.dart';
import '../recording/location_source.dart';
import '../recording/recording_engine.dart';
import '../telemetry/live_telemetry.dart';
import '../telemetry/telemetry_uploader.dart';
/// The Drift database, opened against app-private storage.
///
@@ -39,10 +41,30 @@ final locationSourceProvider = Provider<LocationSource>((ref) {
return source;
});
/// Loaded once at startup; null until then so nothing blocks the first frame.
final configProvider = StateProvider<Config?>((ref) => null);
/// The uploader, or null when no endpoint is configured.
///
/// Parity note: there is still **no UI** for setting the endpoint, exactly as in the
/// native app. It is reachable only through `Config.setUploadEndpoint`.
final uploaderProvider = Provider<TelemetryUploader?>((ref) {
final config = ref.watch(configProvider);
if (config == null || config.uploadEndpoint.trim().isEmpty) return null;
final uploader = TelemetryUploader(
db: ref.watch(databaseProvider),
endpoint: config.uploadEndpoint,
deviceId: config.deviceId,
);
ref.onDispose(uploader.close);
return uploader;
});
final recordingEngineProvider = Provider<RecordingEngine>((ref) {
final engine = RecordingEngine(
repository: ref.watch(tripRepositoryProvider),
locationSource: ref.watch(locationSourceProvider),
uploadPending: () async => ref.read(uploaderProvider)?.uploadPending(),
);
ref.onDispose(engine.dispose);
return engine;
@@ -76,4 +98,6 @@ final recorderStateProvider = StreamProvider<RecorderState>((ref) {
///
/// Kept as a toggle from v2: the map must only ever be live on a visible screen, and no
/// tile is fetched while recording in the background.
final mapEnabledProvider = StateProvider<bool>((ref) => true);
final mapEnabledProvider = StateProvider<bool>(
(ref) => ref.watch(configProvider)?.mapEnabled ?? true,
);