Skip to content

Commit

Permalink
Make clear distinction in between old and new cache and index switch
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham1g5 committed Jan 6, 2025
1 parent 32d554e commit 3aa36bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/org/commcare/tasks/EntityLoaderHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.commcare.tasks
import android.util.Pair
import io.reactivex.functions.Cancellable
import org.commcare.activities.EntitySelectActivity
import org.commcare.cases.entity.AsyncNodeEntityFactory
import org.commcare.cases.entity.Entity
import org.commcare.cases.entity.EntityLoadingProgressListener
import org.commcare.cases.entity.EntityStorageCache
Expand Down Expand Up @@ -30,9 +31,13 @@ class EntityLoaderHelper(

init {
evalCtx.addFunctionHandler(EntitySelectActivity.getHereFunctionHandler())
if (detail.useAsyncStrategy() || detail.shouldCache()) {
if (detail.shouldCache()) {
val entityStorageCache: EntityStorageCache = CommCareEntityStorageCache("case")
factory = AndroidAsyncNodeEntityFactory(detail, sessionDatum, evalCtx, entityStorageCache)
} else if (detail.useAsyncStrategy()) {
// legacy cache and index
val entityStorageCache: EntityStorageCache = CommCareEntityStorageCache("case")
factory = AsyncNodeEntityFactory(detail, evalCtx, entityStorageCache)
} else {
factory = NodeEntityFactory(detail, evalCtx)
if (DeveloperPreferences.collectAndDisplayEntityTraces()) {
Expand Down

0 comments on commit 3aa36bf

Please sign in to comment.