feat: finalize AI analyzer, sync endpoints, and stabilize builds
This commit is contained in:
@@ -47,7 +47,19 @@ abstract class AuthRepository {
|
||||
// File mock di-generate via: flutter pub run build_runner build
|
||||
// Untuk demo tanpa build_runner, kita buat manual mock di bawah
|
||||
|
||||
class MockAuthRepository extends Mock implements AuthRepository {}
|
||||
class MockAuthRepository extends Mock implements AuthRepository {
|
||||
@override
|
||||
Future<Either<Failure, UserEntity>> login(String? email, String? password) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(#login, [email, password]),
|
||||
returnValue: Future<Either<Failure, UserEntity>>.value(
|
||||
const Left(AuthFailure('Repository belum di-stub')),
|
||||
),
|
||||
returnValueForMissingStub: Future<Either<Failure, UserEntity>>.value(
|
||||
const Left(AuthFailure('Repository belum di-stub')),
|
||||
),
|
||||
) as Future<Either<Failure, UserEntity>>;
|
||||
}
|
||||
|
||||
// ---------- Use case ----------
|
||||
|
||||
|
||||
@@ -98,19 +98,20 @@ class ObstacleAnalyzer {
|
||||
};
|
||||
|
||||
/// Pilih obstacle paling prioritas (Very Close > Close > Medium > Far).
|
||||
DetectionResult? prioritize(List<DetectionResult> detections) {
|
||||
if (detections.isEmpty) return null;
|
||||
const order = [
|
||||
'Very Close (< 1m)',
|
||||
'Close (1-2m)',
|
||||
'Medium (2-4m)',
|
||||
'Far (> 4m)',
|
||||
];
|
||||
detections.sort((a, b) => order
|
||||
.indexOf(a.estimatedDistance)
|
||||
.compareTo(order.indexOf(b.estimatedDistance)));
|
||||
return detections.first;
|
||||
}
|
||||
DetectionResult? prioritize(List<DetectionResult> detections) {
|
||||
if (detections.isEmpty) return null;
|
||||
const order = [
|
||||
'Very Close (< 1m)',
|
||||
'Close (1-2m)',
|
||||
'Medium (2-4m)',
|
||||
'Far (> 4m)',
|
||||
];
|
||||
final sorted = List<DetectionResult>.of(detections);
|
||||
sorted.sort((a, b) => order
|
||||
.indexOf(a.estimatedDistance)
|
||||
.compareTo(order.indexOf(b.estimatedDistance)));
|
||||
return sorted.first;
|
||||
}
|
||||
|
||||
/// Filter deteksi berdasarkan confidence threshold.
|
||||
List<DetectionResult> filterByConfidence(
|
||||
|
||||
@@ -48,7 +48,33 @@ abstract class RegisterRepository {
|
||||
});
|
||||
}
|
||||
|
||||
class MockRegisterRepository extends Mock implements RegisterRepository {}
|
||||
class MockRegisterRepository extends Mock implements RegisterRepository {
|
||||
@override
|
||||
Future<Either<Failure, UserEntity>> register({
|
||||
String? email,
|
||||
String? password,
|
||||
String? displayName,
|
||||
String? role,
|
||||
}) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#register,
|
||||
const [],
|
||||
{
|
||||
#email: email,
|
||||
#password: password,
|
||||
#displayName: displayName,
|
||||
#role: role,
|
||||
},
|
||||
),
|
||||
returnValue: Future<Either<Failure, UserEntity>>.value(
|
||||
const Left(ServerFailure('Repository belum di-stub')),
|
||||
),
|
||||
returnValueForMissingStub: Future<Either<Failure, UserEntity>>.value(
|
||||
const Left(ServerFailure('Repository belum di-stub')),
|
||||
),
|
||||
) as Future<Either<Failure, UserEntity>>;
|
||||
}
|
||||
|
||||
// ---------- Use case ----------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user