Skip to content

Commit 61ad470

Browse files
committed
Update Constants #1
- Remove environment variable constants.
1 parent af3e574 commit 61ad470

File tree

2 files changed

+33
-26
lines changed

2 files changed

+33
-26
lines changed

lib/src/codelessly_config.dart

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ class CodelesslyConfig with EquatableMixin {
7878
/// ```
7979
final bool debugLog;
8080

81+
/// The client type identifier for this instance.
82+
final String clientType;
83+
84+
/// The Firebase project ID for this instance.
85+
final String firebaseProjectId;
86+
8187
/// Creates a new instance of [CodelesslyConfig].
8288
///
8389
/// [authToken] is the token required to authenticate and initialize the SDK.
@@ -93,12 +99,12 @@ class CodelesslyConfig with EquatableMixin {
9399
this.automaticallySendCrashReports = false,
94100
this.isPreview = false,
95101
this.preload = true,
96-
97-
// Firebase.
98102
FirebaseOptions? firebaseOptions,
99103
this.firebaseInstanceName = kCodelesslyFirebaseApp,
100-
this.firebaseCloudFunctionsBaseURL = defaultFirebaseCloudFunctionsBaseURL,
101-
this.baseURL = defaultBaseURL,
104+
this.firebaseCloudFunctionsBaseURL = kProdCloudFunctionsBaseURL,
105+
this.baseURL = kProdBaseURL,
106+
this.clientType = 'default_client',
107+
this.firebaseProjectId = kProdFirebaseProjectId,
102108
PublishSource? publishSource,
103109
this.debugLog = false,
104110
}) : firebaseOptions =
@@ -119,6 +125,8 @@ class CodelesslyConfig with EquatableMixin {
119125
String? firebaseCloudFunctionsBaseURL,
120126
String? baseURL,
121127
String? firebaseInstanceName,
128+
String? clientType,
129+
String? firebaseProjectId,
122130
PublishSource? publishSource,
123131
}) =>
124132
CodelesslyConfig(
@@ -133,6 +141,8 @@ class CodelesslyConfig with EquatableMixin {
133141
firebaseCloudFunctionsBaseURL ?? this.firebaseCloudFunctionsBaseURL,
134142
baseURL: baseURL ?? this.baseURL,
135143
firebaseInstanceName: firebaseInstanceName ?? this.firebaseInstanceName,
144+
clientType: clientType ?? this.clientType,
145+
firebaseProjectId: firebaseProjectId ?? this.firebaseProjectId,
136146
publishSource: publishSource ?? this.publishSource,
137147
);
138148

@@ -147,6 +157,8 @@ class CodelesslyConfig with EquatableMixin {
147157
firebaseCloudFunctionsBaseURL,
148158
baseURL,
149159
firebaseInstanceName,
160+
clientType,
161+
firebaseProjectId,
150162
publishSource,
151163
];
152164
}

lib/src/constants.dart

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,56 @@
11
const String clientType = String.fromEnvironment('client_type');
22

3+
/// The unique identifier for the Codelessly Firebase app instance.
34
const String kCodelesslyFirebaseApp = 'codelessly';
45

5-
const String defaultFirebaseProjectId = String.fromEnvironment(
6-
'firebase_project_id',
7-
defaultValue: prodFirebaseProjectId,
8-
);
9-
10-
const String defaultFirebaseCloudFunctionsBaseURL = String.fromEnvironment(
11-
'cloud_functions_base_url',
12-
defaultValue: prodFirebaseCloudFunctionsBaseURL,
13-
);
14-
15-
const String defaultBaseURL = String.fromEnvironment(
16-
'base_url',
17-
defaultValue: prodBaseUrl,
18-
);
19-
20-
const String prodFirebaseProjectId = 'codeless-app';
21-
const String prodFirebaseCloudFunctionsBaseURL =
6+
/// Production environment constants
7+
const String kProdFirebaseProjectId = 'codeless-app';
8+
const String kProdCloudFunctionsBaseURL =
229
'https://us-central1-codeless-app.cloudfunctions.net';
23-
const String prodBaseUrl = 'https://app.codelessly.com';
10+
const String kProdBaseURL = 'https://app.codelessly.com';
11+
12+
/// Editor identifier constant
2413
const String kCodelesslyEditor = 'codelessly_editor';
2514

26-
const defaultErrorMessage =
27-
'We encountered some error while rendering this page! '
28-
'We are working on it to fix it as soon as possible.';
15+
/// Default error message for rendering failures
16+
const String defaultErrorMessage = 'Error rendering page.';
2917

18+
/// Cache-related constants
3019
const String cacheBoxName = 'cache';
3120
const String cacheFilesBoxName = 'cache_files';
3221
const String authCacheKey = 'auth';
3322

23+
/// Model cache keys
3424
const String publishModelCacheKey = 'publish_layout_model';
3525
const String previewModelCacheKey = 'preview_layout_model';
3626
const String templateModelCacheKey = 'template_layout_model';
3727

28+
/// Font cache keys
3829
const String publishFontsCacheKey = 'publish_fonts';
3930
const String previewFontsCacheKey = 'preview_fonts';
4031
const String templateFontsCacheKey = 'template_fonts';
4132

33+
/// API cache keys
4234
const String publishApisCacheKey = 'publish_apis';
4335
const String previewApisCacheKey = 'preview_apis';
4436
const String templateApisCacheKey = 'template_apis';
4537

38+
/// Variable cache keys
4639
const String publishVariablesCacheKey = 'publish_variables';
4740
const String previewVariablesCacheKey = 'preview_variables';
4841
const String templateVariablesCacheKey = 'template_variables';
4942

43+
/// Condition cache keys
5044
const String publishConditionsCacheKey = 'publish_conditions';
5145
const String previewConditionsCacheKey = 'preview_conditions';
5246
const String templateConditionsCacheKey = 'template_conditions';
5347

48+
/// Path constants
5449
const String publishPath = 'publish';
5550
const String previewPath = 'publish_preview';
5651
const String templatesPath = 'templates';
5752

58-
/// STAT TRACKING
53+
/// Stats tracking constants
5954
const String statsCollection = 'stats';
6055
const String lostStatsDoc = '_lost';
6156
const String viewsField = 'views';

0 commit comments

Comments
 (0)