feat : local location loading

This commit is contained in:
2025-08-19 11:56:04 +03:30
parent 7c3c1280b2
commit b2f26cdffd
4 changed files with 24 additions and 20 deletions

View File

@@ -10,6 +10,6 @@ abstract class LivestockRepository {
Future<bool> createTaggingLiveStock({required LivestockData data});
/* Future<List<LatLng>> getLocations();
Future<void> addLocations(List<LatLng> latList);*/
Future<List<LatLng>> getLocations();
Future<void> addLocations(List<LatLng> latList);
}

View File

@@ -1,4 +1,3 @@
import 'package:latlong2/latlong.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/data/services/network_status.dart';
import 'package:rasadyar_livestock/data/data_source/local/tmp/tmp_local_data-source.dart';
@@ -11,8 +10,9 @@ import 'livestock_repository.dart';
class LivestockRepositoryImp implements LivestockRepository {
final LivestockRemoteDataSource livestockRemote;
final TmpLocalDataSource tmpLocalDataSource;
LivestockRepositoryImp({required this.livestockRemote});
LivestockRepositoryImp({required this.livestockRemote,required this.tmpLocalDataSource});
@override
Future<LocationDetails?> getLocationDetails({
@@ -29,7 +29,7 @@ class LivestockRepositoryImp implements LivestockRepository {
Future<bool> createTaggingLiveStock({required LivestockData data}) async {
return await livestockRemote.createTaggingLiveStock(data: data);
}
/*
@override
Future<List<LatLng>> getLocations() async {
if (NetworkStatus().isConnected.value) {
@@ -47,17 +47,17 @@ class LivestockRepositoryImp implements LivestockRepository {
LatLng(35.832000, 50.956055),
];
} else {
*//*var res = await tmpLocalDataSource.getLocations();
var res = await tmpLocalDataSource.getLocations();
return res.map((e) => LatLng(e.lat ?? 0.0, e.long ?? 0.0)).toList();*//*
return res.map((e) => LatLng(e.lat ?? 0.0, e.long ?? 0.0)).toList();
}
}
@override
Future<void> addLocations(List<LatLng> latList) async {
*//* await tmpLocalDataSource.addLocations(
await tmpLocalDataSource.addLocations(
latList.map((e) => TmpLocations(lat: e.latitude, long: e.longitude)).toList(),
);*//*
);
iLog("it is done");
}*/
}
}