refactor: formatting
This commit is contained in:
@@ -43,12 +43,12 @@ class InputValidationService {
|
||||
|
||||
try {
|
||||
final uri = Uri.parse(urlToValidate);
|
||||
|
||||
|
||||
// Validate scheme
|
||||
if (!uri.hasScheme || (uri.scheme != 'http' && uri.scheme != 'https')) {
|
||||
return 'Use http:// or https:// only';
|
||||
}
|
||||
|
||||
|
||||
// Validate host
|
||||
if (!uri.hasAuthority || uri.host.isEmpty) {
|
||||
return 'Please enter a server address (e.g., 192.168.1.10:3000)';
|
||||
@@ -65,7 +65,6 @@ class InputValidationService {
|
||||
if (_isIPAddress(uri.host) && !_isValidIPAddress(uri.host)) {
|
||||
return 'Invalid IP address format (use 192.168.1.10)';
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
return 'Invalid server address format';
|
||||
}
|
||||
@@ -82,7 +81,7 @@ class InputValidationService {
|
||||
static bool _isValidIPAddress(String ip) {
|
||||
final parts = ip.split('.');
|
||||
if (parts.length != 4) return false;
|
||||
|
||||
|
||||
for (final part in parts) {
|
||||
final num = int.tryParse(part);
|
||||
if (num == null || num < 0 || num > 255) return false;
|
||||
|
||||
@@ -16,7 +16,9 @@ class OptimizedStorageService {
|
||||
required FlutterSecureStorage secureStorage,
|
||||
required SharedPreferences prefs,
|
||||
}) : _prefs = prefs,
|
||||
_secureCredentialStorage = SecureCredentialStorage(instance: secureStorage);
|
||||
_secureCredentialStorage = SecureCredentialStorage(
|
||||
instance: secureStorage,
|
||||
);
|
||||
|
||||
// Optimized key names with versioning
|
||||
static const String _authTokenKey = 'auth_token_v3';
|
||||
|
||||
@@ -74,7 +74,9 @@ class PersistentStreamingService with WidgetsBindingObserver {
|
||||
|
||||
_connectivitySubscription?.cancel();
|
||||
_connectivityService = service;
|
||||
_connectivitySubscription = service.isConnected.listen(_handleConnectivityChange);
|
||||
_connectivitySubscription = service.isConnected.listen(
|
||||
_handleConnectivityChange,
|
||||
);
|
||||
}
|
||||
|
||||
void _handleConnectivityChange(bool connected) {
|
||||
|
||||
@@ -336,10 +336,12 @@ class PlatformService {
|
||||
// on Android 15+. Only control icon brightness; colors come from theme + EdgeToEdge.
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
statusBarIconBrightness:
|
||||
isDarkContent ? Brightness.dark : Brightness.light,
|
||||
systemNavigationBarIconBrightness:
|
||||
isDarkContent ? Brightness.dark : Brightness.light,
|
||||
statusBarIconBrightness: isDarkContent
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
systemNavigationBarIconBrightness: isDarkContent
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
// Do NOT set status/navigation bar colors on Android.
|
||||
),
|
||||
);
|
||||
|
||||
@@ -9,10 +9,12 @@ class SecureCredentialStorage {
|
||||
late final FlutterSecureStorage _secureStorage;
|
||||
|
||||
SecureCredentialStorage({FlutterSecureStorage? instance}) {
|
||||
_secureStorage = instance ?? FlutterSecureStorage(
|
||||
aOptions: _getAndroidOptions(),
|
||||
iOptions: _getIOSOptions(),
|
||||
);
|
||||
_secureStorage =
|
||||
instance ??
|
||||
FlutterSecureStorage(
|
||||
aOptions: _getAndroidOptions(),
|
||||
iOptions: _getIOSOptions(),
|
||||
);
|
||||
}
|
||||
|
||||
static const String _credentialsKey = 'user_credentials_v2';
|
||||
|
||||
@@ -16,7 +16,9 @@ class StorageService {
|
||||
required SharedPreferences prefs,
|
||||
}) : _secureStorage = secureStorage,
|
||||
_prefs = prefs,
|
||||
_secureCredentialStorage = SecureCredentialStorage(instance: secureStorage);
|
||||
_secureCredentialStorage = SecureCredentialStorage(
|
||||
instance: secureStorage,
|
||||
);
|
||||
|
||||
// Secure storage keys
|
||||
static const String _authTokenKey = 'auth_token';
|
||||
|
||||
@@ -26,4 +26,4 @@ final toolsServiceProvider = Provider<ToolsService?>((ref) {
|
||||
final apiService = ref.watch(apiServiceProvider);
|
||||
if (apiService == null) return null;
|
||||
return ToolsService(apiService);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user