Skip to content

Commit 730f751

Browse files
committed
Revert "Fallback to the defaultSettings if cdn cannot be reached (#231)"
This reverts commit d37d2d3.
1 parent 26b4495 commit 730f751

File tree

1 file changed

+11
-2
lines changed
  • core/src/main/java/com/segment/analytics/kotlin/core

1 file changed

+11
-2
lines changed

core/src/main/java/com/segment/analytics/kotlin/core/Settings.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,16 @@ suspend fun Analytics.checkSettings() {
9292
val settingsObj: Settings? = fetchSettings(writeKey, cdnHost)
9393

9494
withContext(analyticsDispatcher) {
95-
settingsObj?.let {
95+
96+
val systemState = store.currentState(System::class)
97+
val defaultSettings = systemState?.settings
98+
99+
100+
if (settingsObj == null) {
101+
defaultSettings?.let {
102+
update(defaultSettings)
103+
}
104+
} else {
96105
log("Dispatching update settings on ${Thread.currentThread().name}")
97106
store.dispatch(System.UpdateSettingsAction(settingsObj), System::class)
98107
update(settingsObj)
@@ -125,5 +134,5 @@ internal fun Analytics.fetchSettings(
125134
it["writekey"] = writeKey
126135
it["message"] = "Error retrieving settings"
127136
}
128-
configuration.defaultSettings
137+
null
129138
}

0 commit comments

Comments
 (0)