Skip to content

Commit

Permalink
fixed crash happening on the fetching config
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco committed Sep 25, 2024
1 parent 1e555e8 commit 880a73b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ class CommonRepository(val session: Session = SessionManager.requireSession) {
}

suspend fun getMobileConfigData() {
val data = MobileConfigDataEntry.with(service.getMobileConfig("https://${URL(session.account.serverUrl).host}/app-config.json"))

var data = MobileConfigDataEntry.default()
try {
data = MobileConfigDataEntry.with(service.getMobileConfig("https://${URL(session.account.serverUrl).host}/app-config.json"))
} catch (ex: Exception) {
ex.printStackTrace()
}
saveJsonToSharedPrefs(session.context, KEY_FEATURES_MOBILE, data)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ data class MobileConfigDataEntry(
featuresMobile = MobileFeatures.with(configData.featuresMobile),
)
}

fun default(): MobileConfigDataEntry {
return MobileConfigDataEntry(featuresMobile = MobileFeatures())
}
}
}

Expand Down

0 comments on commit 880a73b

Please sign in to comment.