fix: handle null pointer exception in AppFeaturesPrefs
The `getAppConfig()` was crashing for some learners with network connectivity issues.
Fixes:
@@ -18,7 +18,9 @@ class AppFeaturesPrefs @Inject constructor(@ApplicationContext context: Context)
}
private fun getAppConfig(): AppConfig {
- return Gson().fromJson(pref.getString(PrefManager.Key.APP_CONFIG), AppConfig::class.java)
+ return pref.getString(PrefManager.Key.APP_CONFIG)?.let {
+ Gson().fromJson(it, AppConfig::class.java)
+ } ?: AppConfig()
}
private fun getIAPConfig() = getAppConfig().iapConfig
