NTP-29076 | Owais | removed firebase check (#14546)
This commit is contained in:
@@ -18,7 +18,6 @@ object AppServiceManager {
|
||||
lateinit var appVersionName: String
|
||||
lateinit var hypervergeAppId: String
|
||||
lateinit var hypervergeAppKey: String
|
||||
var isCoilEnabledForXml: Boolean = true
|
||||
|
||||
fun init(
|
||||
application: Application,
|
||||
@@ -29,7 +28,6 @@ object AppServiceManager {
|
||||
sslPinningKey: String,
|
||||
hypervergeAppId: String,
|
||||
hypervergeAppKey: String,
|
||||
isCoilEnabledForXml: Boolean,
|
||||
) {
|
||||
this.sslPinningKey = sslPinningKey
|
||||
this.baseUrl = baseUrl
|
||||
@@ -39,7 +37,6 @@ object AppServiceManager {
|
||||
this.hypervergeAppKey = hypervergeAppKey
|
||||
this.application = application
|
||||
this.applicationId = applicationId
|
||||
this.isCoilEnabledForXml = isCoilEnabledForXml
|
||||
}
|
||||
|
||||
fun isBaseUrlInitialized(): Boolean {
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.navi.base.AppServiceManager.application
|
||||
import com.navi.base.AppServiceManager.baseUrl
|
||||
import com.navi.base.deeplink.DeepLinkManager
|
||||
import com.navi.base.deeplink.listener.DeepLinkListener
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.model.BuildConfigDetails
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.ApiConstants
|
||||
@@ -79,7 +78,6 @@ object CommonLibManager {
|
||||
sslPinningKey = sslPinningKey,
|
||||
hypervergeAppId = hypervergeAppId,
|
||||
hypervergeAppKey = hypervergeAppKey,
|
||||
isCoilEnabledForXml = FirebaseRemoteConfigHelper.getBoolean("IS_COIL_ENABLED", true),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,16 +13,13 @@ import android.content.res.ColorStateList
|
||||
import android.graphics.Paint
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuffXfermode
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.bumptech.glide.load.DataSource
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import coil.request.ImageRequest
|
||||
import coil.request.SuccessResult
|
||||
import com.navi.analytics.utils.NaviTrackEvent
|
||||
import com.navi.base.deeplink.DeepLinkManager
|
||||
import com.navi.base.model.ImageDetail
|
||||
@@ -76,25 +73,13 @@ class RewardsAnnouncementFragment :
|
||||
url = url,
|
||||
view = ivIcon,
|
||||
listener =
|
||||
object : RequestListener<Drawable> {
|
||||
override fun onLoadFailed(
|
||||
e: GlideException?,
|
||||
model: Any?,
|
||||
target: Target<Drawable>?,
|
||||
isFirstResource: Boolean,
|
||||
): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(
|
||||
resource: Drawable?,
|
||||
model: Any?,
|
||||
target: Target<Drawable>?,
|
||||
dataSource: DataSource?,
|
||||
isFirstResource: Boolean,
|
||||
): Boolean {
|
||||
object : ImageRequest.Listener {
|
||||
override fun onSuccess(
|
||||
request: ImageRequest,
|
||||
result: SuccessResult,
|
||||
) {
|
||||
applyMarginToIcon(0)
|
||||
return false
|
||||
super.onSuccess(request, result)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -57,21 +57,12 @@ import coil.load
|
||||
import coil.request.CachePolicy
|
||||
import coil.request.ImageRequest
|
||||
import com.airbnb.lottie.LottieAnimationView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.DataSource
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import com.google.firebase.Timestamp
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import com.google.gson.Gson
|
||||
import com.navi.alfred.utils.log
|
||||
import com.navi.analytics.utils.NaviTrackEvent
|
||||
import com.navi.base.AppServiceManager
|
||||
import com.navi.base.model.ActionData
|
||||
import com.navi.base.model.CtaData
|
||||
import com.navi.base.model.GenericAnalytics
|
||||
@@ -552,67 +543,30 @@ fun loadUrlIntoImageView(
|
||||
url: String,
|
||||
view: ImageView,
|
||||
isCacheNeeded: Boolean = true,
|
||||
listener: RequestListener<Drawable>? = null,
|
||||
listener: ImageRequest.Listener? = null,
|
||||
) {
|
||||
if (AppServiceManager.isCoilEnabledForXml) {
|
||||
try {
|
||||
view.load(url) {
|
||||
this.memoryCachePolicy(CachePolicy.DISABLED)
|
||||
this.allowHardware(false)
|
||||
this.listener(
|
||||
onError = { _, _ ->
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"coil_image_load_error",
|
||||
eventValues = mapOf(Pair("image_url", url.orEmpty())),
|
||||
)
|
||||
}
|
||||
)
|
||||
if (isCacheNeeded) {
|
||||
this.networkCachePolicy(CachePolicy.ENABLED)
|
||||
this.diskCachePolicy(CachePolicy.ENABLED)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (isCacheNeeded)
|
||||
Glide.with(context)
|
||||
.load(url)
|
||||
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
||||
.listener(
|
||||
listener
|
||||
?: object : RequestListener<Drawable> {
|
||||
override fun onLoadFailed(
|
||||
e: GlideException?,
|
||||
model: Any?,
|
||||
target: Target<Drawable>?,
|
||||
isFirstResource: Boolean,
|
||||
): Boolean {
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"glide_image_load_error",
|
||||
eventValues = mapOf(Pair("image_url", url.orEmpty())),
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(
|
||||
resource: Drawable?,
|
||||
model: Any?,
|
||||
target: Target<Drawable>?,
|
||||
dataSource: DataSource?,
|
||||
isFirstResource: Boolean,
|
||||
): Boolean {
|
||||
return false
|
||||
}
|
||||
}
|
||||
try {
|
||||
view.load(url) {
|
||||
this.allowHardware(false)
|
||||
this.listener(
|
||||
onError = { request, result ->
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"coil_image_load_error",
|
||||
eventValues = mapOf(Pair("image_url", url.orEmpty())),
|
||||
)
|
||||
.into(view)
|
||||
else Glide.with(context).load(url).into(view)
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
listener?.onError(request, result)
|
||||
},
|
||||
onSuccess = { request, result -> listener?.onSuccess(request, result) },
|
||||
)
|
||||
if (isCacheNeeded) {
|
||||
this.networkCachePolicy(CachePolicy.ENABLED)
|
||||
this.diskCachePolicy(CachePolicy.ENABLED)
|
||||
} else {
|
||||
this.memoryCachePolicy(CachePolicy.DISABLED)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,66 +578,27 @@ fun loadUrlIntoImageView(
|
||||
imagePlaceholder: Drawable? =
|
||||
ResourcesCompat.getDrawable(context.resources, R.drawable.widget_image_placeholder, null),
|
||||
) {
|
||||
if (AppServiceManager.isCoilEnabledForXml) {
|
||||
try {
|
||||
view.load(url) {
|
||||
this.memoryCachePolicy(CachePolicy.DISABLED)
|
||||
this.allowHardware(false)
|
||||
this.placeholder(imagePlaceholder)
|
||||
this.listener(
|
||||
onError = { _, _ ->
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"coil_image_load_error",
|
||||
eventValues = mapOf(Pair("image_url", url.orEmpty())),
|
||||
)
|
||||
}
|
||||
)
|
||||
if (isCacheNeeded) {
|
||||
this.networkCachePolicy(CachePolicy.ENABLED)
|
||||
this.diskCachePolicy(CachePolicy.ENABLED)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (isCacheNeeded)
|
||||
Glide.with(context)
|
||||
.load(url)
|
||||
.placeholder(imagePlaceholder)
|
||||
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
||||
.addListener(
|
||||
object : RequestListener<Drawable> {
|
||||
override fun onLoadFailed(
|
||||
e: GlideException?,
|
||||
model: Any?,
|
||||
target: Target<Drawable>?,
|
||||
isFirstResource: Boolean,
|
||||
): Boolean {
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"glide_image_load_error",
|
||||
eventValues = mapOf(Pair("image_url", url.orEmpty())),
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(
|
||||
resource: Drawable?,
|
||||
model: Any?,
|
||||
target: Target<Drawable>?,
|
||||
dataSource: DataSource?,
|
||||
isFirstResource: Boolean,
|
||||
): Boolean {
|
||||
return false
|
||||
}
|
||||
}
|
||||
try {
|
||||
view.load(url) {
|
||||
this.allowHardware(false)
|
||||
this.placeholder(imagePlaceholder)
|
||||
this.listener(
|
||||
onError = { _, _ ->
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
"coil_image_load_error",
|
||||
eventValues = mapOf(Pair("image_url", url.orEmpty())),
|
||||
)
|
||||
.into(view)
|
||||
else Glide.with(context).load(url).into(view)
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
)
|
||||
if (isCacheNeeded) {
|
||||
this.networkCachePolicy(CachePolicy.ENABLED)
|
||||
this.diskCachePolicy(CachePolicy.ENABLED)
|
||||
} else {
|
||||
this.memoryCachePolicy(CachePolicy.DISABLED)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,59 +613,25 @@ fun loadDrawableFromUrl(
|
||||
height: Int? = null,
|
||||
onDrawableReady: (Drawable?) -> Unit,
|
||||
) {
|
||||
if (AppServiceManager.isCoilEnabledForXml) {
|
||||
try {
|
||||
context.imageLoader.enqueue(
|
||||
ImageRequest.Builder(context)
|
||||
.data(url)
|
||||
.listener(
|
||||
onSuccess = { request, result ->
|
||||
if (width == null || height == null) {
|
||||
onDrawableReady(result.drawable)
|
||||
return@listener
|
||||
}
|
||||
val scaledDrawable =
|
||||
scaleDrawable(
|
||||
result.drawable,
|
||||
dpToPxInInt(width),
|
||||
dpToPxInInt(height),
|
||||
)
|
||||
onDrawableReady(scaledDrawable)
|
||||
}
|
||||
)
|
||||
.build()
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Glide.with(context)
|
||||
.load(url)
|
||||
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
||||
.into(
|
||||
object : CustomTarget<Drawable>() {
|
||||
override fun onResourceReady(
|
||||
resource: Drawable,
|
||||
transition: Transition<in Drawable>?,
|
||||
) {
|
||||
if (width == null || height == null) {
|
||||
onDrawableReady(resource)
|
||||
return
|
||||
}
|
||||
val scaledDrawable =
|
||||
scaleDrawable(resource, dpToPxInInt(width), dpToPxInInt(height))
|
||||
onDrawableReady(scaledDrawable)
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: Drawable?) {
|
||||
onDrawableReady(placeholder)
|
||||
try {
|
||||
context.imageLoader.enqueue(
|
||||
ImageRequest.Builder(context)
|
||||
.data(url)
|
||||
.listener(
|
||||
onSuccess = { request, result ->
|
||||
if (width == null || height == null) {
|
||||
onDrawableReady(result.drawable)
|
||||
return@listener
|
||||
}
|
||||
val scaledDrawable =
|
||||
scaleDrawable(result.drawable, dpToPxInInt(width), dpToPxInInt(height))
|
||||
onDrawableReady(scaledDrawable)
|
||||
}
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
.build()
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user