import 'package:flutter/material.dart'; class CommonConstants { static String apiProto = 'https'; static String apiHost = 'app.sendico.io'; // static String apiProto = const String.fromEnvironment('API_PROTO', defaultValue: 'http'); // static String apiHost = const String.fromEnvironment('API_HOST', defaultValue: 'localhost'); // static String apiHost = 'localhost'; // static String apiHost = '10.0.2.2'; static String apiEndpoint = '/api/v1'; static String amplitudeSecret = 'c3d75b3e2520d708440acbb16b923e79'; static String amplitudeServerZone = 'EU'; static String posthogApiKey = ''; static String posthogHost = 'https://eu.i.posthog.com'; static Locale defaultLocale = const Locale('en'); static String defaultCurrency = 'EUR'; static int defaultDimensionLength = 500; static String clientId = ''; static String wsProto = 'ws'; static String wsEndpoint = '/ws'; static Color themeColor = Color.fromARGB(255, 80, 63, 224); static String nilObjectRef = '000000000000000000000000'; // Public getters for shared properties static String get serviceUrl => '$apiProto://$apiHost'; static String get apiUrl => '$serviceUrl$apiEndpoint'; static String get wsUrl => '$wsProto://$apiHost$apiEndpoint$wsEndpoint'; static const String accessTokenStorageKey = 'access_token'; static const String refreshTokenStorageKey = 'refresh_token'; static const String currentOrgKey = 'current_org'; static const String deviceIdStorageKey = 'device_id'; // Method to apply the configuration, called by platform-specific implementations static void applyConfiguration(Map configJson) { apiProto = configJson['apiProto'] ?? apiProto; apiHost = configJson['apiHost'] ?? apiHost; apiEndpoint = configJson['apiEndpoint'] ?? apiEndpoint; amplitudeSecret = configJson['amplitudeSecret'] ?? amplitudeSecret; amplitudeServerZone = configJson['amplitudeServerZone'] ?? amplitudeServerZone; posthogApiKey = configJson['posthogApiKey'] ?? posthogApiKey; posthogHost = configJson['posthogHost'] ?? posthogHost; defaultLocale = Locale(configJson['defaultLocale'] ?? defaultLocale.languageCode); defaultCurrency = configJson['defaultCurrency'] ?? defaultCurrency; wsProto = configJson['wsProto'] ?? wsProto; wsEndpoint = configJson['wsEndpoint'] ?? wsEndpoint; defaultDimensionLength = configJson['defaultDimensionLength'] ?? defaultDimensionLength; clientId = configJson['clientId'] ?? clientId; if (configJson.containsKey('themeColor')) { themeColor = Color(int.parse(configJson['themeColor'])); } } }