Connect Flutter phone auth and Android platform

This commit is contained in:
Hamza-Ayed
2026-10-04 01:44:07 +03:00
parent 5b90da6b18
commit 98490a17e6
44 changed files with 1271 additions and 168 deletions
+12 -3
View File
@@ -245,7 +245,11 @@ class DatabaseService extends GetxService {
}
/// Atomically persist a finished workout, its segments, and its sync outbox item.
Future<void> saveCompletedWorkout(Workout workout, String payload) async {
Future<void> saveCompletedWorkout(
Workout workout,
String payload, {
bool queueForSync = true,
}) async {
await _db.transaction((txn) async {
final saved = await txn.query(
'workouts',
@@ -286,6 +290,8 @@ class DatabaseService extends GetxService {
await txn.insert('workout_segments', values);
}
if (!queueForSync) return;
final queued = await txn.query(
'sync_queue',
columns: ['id', 'status'],
@@ -438,10 +444,13 @@ class DatabaseService extends GetxService {
}
/// Get all queued items
Future<List<Map<String, dynamic>>> getPendingSyncs() async {
Future<List<Map<String, dynamic>>> getPendingSyncs(
{bool includeExhausted = false}) async {
return await _db.query(
'sync_queue',
where: "status IN ('queued', 'failed') AND retry_count < 5",
where: includeExhausted
? "status IN ('queued', 'failed')"
: "status IN ('queued', 'failed') AND retry_count < 5",
orderBy: 'created_at ASC',
);
}