Skip to content

Commit

Permalink
fix remote result bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Idrees committed Dec 5, 2022
1 parent 4f4b3b2 commit 96066d0
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ai.bom.firebase.lib.config

import ai.bom.firebase.lib.BuildConfig
import android.content.Context
import android.util.Log
import androidx.annotation.Keep
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings
Expand Down Expand Up @@ -42,9 +43,14 @@ class RemoteConfigDate(private val remoteTopic: String) {
fun getRemoteConfig(context: Context, listener: ((Any?) -> Unit)) {
getInstance()?.reset()
getInstance()?.fetchAndActivate()
?.addOnCompleteListener { _ ->
val value = getRemoteConfig(context)
listener.invoke(value)
?.addOnCompleteListener { task ->
Log.e("RemoteConfigNew*", "status : ${task.isSuccessful}")
if (task.isSuccessful) {
val value = getRemoteConfig(context)
listener.invoke(value)
} else {
listener.invoke(getRemoteConfig(context))
}
}
}
}
Expand Down

0 comments on commit 96066d0

Please sign in to comment.