57 lines
2.3 KiB
Dart
57 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:pshared/config/apply.dart';
|
|
|
|
class CommonConstants {
|
|
static String apiProto = 'http';
|
|
static String apiHost = 'localhost:8080';
|
|
static String apiEndpoint = '/api/v1';
|
|
static String posthogApiKey =
|
|
'phc_lVhbruaZpxiQxppHBJpL36ARnPlkqbCewv6cauoceTN';
|
|
static String posthogHost = 'https://eu.i.posthog.com';
|
|
static Locale defaultLocale = const Locale('en');
|
|
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<String, dynamic> configJson) {
|
|
applyCommonConfiguration(
|
|
configJson,
|
|
currentApiProto: apiProto,
|
|
setApiProto: (value) => apiProto = value,
|
|
currentApiHost: apiHost,
|
|
setApiHost: (value) => apiHost = value,
|
|
currentApiEndpoint: apiEndpoint,
|
|
setApiEndpoint: (value) => apiEndpoint = value,
|
|
currentPosthogApiKey: posthogApiKey,
|
|
setPosthogApiKey: (value) => posthogApiKey = value,
|
|
currentPosthogHost: posthogHost,
|
|
setPosthogHost: (value) => posthogHost = value,
|
|
currentDefaultLocale: defaultLocale,
|
|
setDefaultLocale: (value) => defaultLocale = value,
|
|
currentWsProto: wsProto,
|
|
setWsProto: (value) => wsProto = value,
|
|
currentWsEndpoint: wsEndpoint,
|
|
setWsEndpoint: (value) => wsEndpoint = value,
|
|
currentDefaultDimensionLength: defaultDimensionLength,
|
|
setDefaultDimensionLength: (value) => defaultDimensionLength = value,
|
|
currentClientId: clientId,
|
|
setClientId: (value) => clientId = value,
|
|
currentThemeColor: themeColor,
|
|
setThemeColor: (value) => themeColor = value,
|
|
);
|
|
}
|
|
}
|