Skip to content

Commit

Permalink
feat: [ANDROAPP-6479] fix crash when logging out (#3812)
Browse files Browse the repository at this point in the history
  • Loading branch information
xavimolloy authored Oct 7, 2024
1 parent 3a0096e commit 7c4a6e8
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.dhis2.commons.featureconfig.model.Feature
import org.dhis2.commons.featureconfig.model.FeatureOptions
import org.dhis2.commons.featureconfig.model.FeatureState
import org.hisp.dhis.android.core.D2
import timber.log.Timber
import javax.inject.Inject

class FeatureConfigRepositoryImpl @Inject constructor(
Expand Down Expand Up @@ -41,12 +42,17 @@ class FeatureConfigRepositoryImpl @Inject constructor(
}

override fun isFeatureEnable(feature: Feature): Boolean {
return if (localDataStore.value(feature.name).blockingExists()) {
localDataStore.value(feature.name).blockingGet()?.value()?.toBooleanStrictOrNull()
?: false
} else {
d2.settingModule().generalSetting()
.hasExperimentalFeature(feature.name).blockingGet()
return try {
if (localDataStore.value(feature.name).blockingExists()) {
localDataStore.value(feature.name).blockingGet()?.value()?.toBooleanStrictOrNull()
?: false
} else {
d2.settingModule().generalSetting()
.hasExperimentalFeature(feature.name).blockingGet()
}
} catch (e: Exception) {
Timber.d(e.message)
false
}
}

Expand Down

0 comments on commit 7c4a6e8

Please sign in to comment.