Skip to content

Commit d2ccbf6

Browse files
feat: server config initial
1 parent 13d2caf commit d2ccbf6

File tree

6 files changed

+31
-0
lines changed

6 files changed

+31
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## XX.XX.XX
2+
* Extended server configuration capabilities of the SDK.
3+
14
## 25.1.1
25
* Removed Android v1 embedding support
36

android/src/main/java/ly/count/dart/countly_flutter/CountlyFlutterPlugin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,11 @@ private void populateConfig(JSONObject _config) throws JSONException {
16361636
if (_config.has("starRatingTextDismiss")) {
16371637
this.config.setStarRatingTextDismiss(_config.getString("starRatingTextDismiss"));
16381638
}
1639+
1640+
if (_config.has("providedServerConfig")) {
1641+
this.config.setServerConfiguration(_config.getString("providedServerConfig"));
1642+
}
1643+
16391644
// APM ------------------------------------------------
16401645
if (_config.has("trackAppStartTime")) {
16411646
this.config.apm.enableAppStartTimeTracking();

ios/Classes/CountlyFlutterPlugin.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,11 @@ - (void)populateConfig:(NSDictionary *)_config {
16441644
[config.apm setAppStartTimestampOverride:[startTSOverride longLongValue]];
16451645
}
16461646

1647+
NSString *providedServerConfig = _config[@"providedServerConfig"];
1648+
if(providedServerConfig) {
1649+
config.serverConfiguration = providedServerConfig;
1650+
}
1651+
16471652
// Internal Limits ---------------------
16481653
NSNumber *maxKeyLength = _config[@"maxKeyLength"];
16491654
if (maxKeyLength) {

lib/src/countly_config.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class CountlyConfig {
4444
bool _enableAllConsents = false;
4545
bool _autoEnrollABOnDownload = false;
4646
int? _requestDropAgeHours;
47+
String? _providedServerConfig;
4748

4849
/// instance of CountlyConfigApm
4950
final CountlyConfigApm _countlyConfigApmInstance = CountlyConfigApm();
@@ -134,6 +135,8 @@ class CountlyConfig {
134135

135136
int? get requestDropAgeHours => _requestDropAgeHours;
136137

138+
String? get providedServerConfig => _providedServerConfig;
139+
137140
/// getter for CountlyConfigApm instance that is used to access CountlyConfigApm methods
138141
CountlyConfigApm get apm => _countlyConfigApmInstance;
139142

@@ -371,4 +374,12 @@ class CountlyConfig {
371374
_requestDropAgeHours = dropAgeHours;
372375
return this;
373376
}
377+
378+
/// Set the provided server config
379+
/// [String serverConfiguration] - provided server config
380+
/// This is used to provide the server config in case the server config is not available in the initializion time
381+
CountlyConfig setServerConfiguration(String serverConfiguration) {
382+
_providedServerConfig = serverConfiguration;
383+
return this;
384+
}
374385
}

lib/src/countly_flutter.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,6 +2209,11 @@ class Countly {
22092209
countlyConfig['requestDropAgeHours'] = config.requestDropAgeHours;
22102210
}
22112211

2212+
if (config.providedServerConfig != null) {
2213+
log('"_configToJson", value provided for providedServerConfig: [${config.providedServerConfig}]', logLevel: LogLevel.INFO);
2214+
countlyConfig['providedServerConfig'] = config.providedServerConfig;
2215+
}
2216+
22122217
/// Experimental ---------------------------
22132218
if (config.experimental.visibilityTracking) {
22142219
log('"_configToJson", value provided for visibilityTracking: [${config.experimental.visibilityTracking}]', logLevel: LogLevel.INFO);

lib/src/web/countly_flutter_plugin.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,8 @@ class CountlyFlutterPlugin {
613613
configMap['remote_config'] = allowInterop((JSAny? error, JSAny? remoteConfigs) => _notifyRemoteConfigDownloadCallback(error, remoteConfigs, true, requestIDGlobalCallback)).jsify();
614614
}
615615

616+
configMap['server_configuration'] = config['providedServerConfig'];
617+
616618
configMap.removeWhere((key, value) => value == null);
617619

618620
if (config['disableLocation'] != null && config['disableLocation'] == true) {

0 commit comments

Comments
 (0)