Add mobile reliability fixes, Bahasa Indonesia UI, and continue OCR accuracy tuning
Reliability/PoC hardening: dedupe uploads by file_hash, surface editor sync failures instead of a false success SnackBar with a retry-without-re-OCR path, bound the OCR pipeline fetches with timeouts, share a single ApiClient/Dio instance app-wide, tune capture JPEG quality, and add an opt-in docker-compose.demo.yml for a production-mode run ahead of client demos. Translate all Flutter-side user-facing text (screens, validators, SnackBars, the printed delivery receipt, and shared API error messages) to Bahasa Indonesia. Also includes in-progress OCR parser/accuracy-tuning work from the same session: table column/unit normalization fixes, store/customer master data, accuracy history log, and test-image renaming/cleanup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eRAsLqN9Sg1b9YPz22Lxz
This commit is contained in:
1 parent
095dd4cb8b
commit
4808a798fb
78 files changed
+8069
-584
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../config/app_config.dart';
|
||||
|
||||
@@ -43,26 +44,26 @@ class ApiClient {
|
||||
// Standardized Error Interceptor
|
||||
_dio.interceptors.add(InterceptorsWrapper(
|
||||
onError: (DioException e, handler) {
|
||||
String errorMessage = 'An unexpected error occurred';
|
||||
if (e.type == DioExceptionType.connectionTimeout ||
|
||||
String errorMessage = 'Terjadi kesalahan yang tidak terduga';
|
||||
if (e.type == DioExceptionType.connectionTimeout ||
|
||||
e.type == DioExceptionType.receiveTimeout) {
|
||||
errorMessage = 'Connection timed out. Please try again.';
|
||||
errorMessage = 'Koneksi timeout. Silakan coba lagi.';
|
||||
} else if (e.response != null) {
|
||||
// Standardized HTTP error formatting
|
||||
final statusCode = e.response?.statusCode;
|
||||
String serverMsg = 'Unknown';
|
||||
String serverMsg = 'Tidak diketahui';
|
||||
final responseData = e.response?.data;
|
||||
if (responseData is Map) {
|
||||
serverMsg = responseData['message'] ?? 'Unknown';
|
||||
serverMsg = responseData['message'] ?? 'Tidak diketahui';
|
||||
} else if (responseData is String) {
|
||||
// Truncate raw string if it's a long HTML page
|
||||
serverMsg = responseData.length > 100
|
||||
? '${responseData.substring(0, 100)}...'
|
||||
serverMsg = responseData.length > 100
|
||||
? '${responseData.substring(0, 100)}...'
|
||||
: responseData;
|
||||
}
|
||||
errorMessage = 'Server error ($statusCode): $serverMsg';
|
||||
errorMessage = 'Kesalahan server ($statusCode): $serverMsg';
|
||||
} else if (e.type == DioExceptionType.connectionError) {
|
||||
errorMessage = 'No internet connection.';
|
||||
errorMessage = 'Tidak ada koneksi internet.';
|
||||
}
|
||||
|
||||
final customError = DioException(
|
||||
@@ -82,3 +83,7 @@ class ApiClient {
|
||||
|
||||
Dio get client => _dio;
|
||||
}
|
||||
|
||||
// Single shared instance so every screen/notifier reuses the same Dio HTTP client
|
||||
// (connection keep-alive) instead of paying a fresh TCP/TLS handshake per call site.
|
||||
final apiClientProvider = Provider<ApiClient>((ref) => ApiClient());
|
||||
Reference in new issue
Block a user