TP-31019 | Fix show loader (#7016)
This commit is contained in:
committed by
GitHub Enterprise
parent
bfa032c3cc
commit
b08a86f982
@@ -101,12 +101,23 @@ fun Float.getLesserMultiple(x: Int): Float {
|
||||
}
|
||||
}
|
||||
|
||||
val showLoaderWhenGetSet = mutableSetOf("/pre-quotes/")
|
||||
val doNotShowLoaderWhenPostSet = mutableSetOf(USER_DEVICE_DATA_LOCATION_API, USER_DEVICE_DATA_APP_API, "/v1/cards/")
|
||||
|
||||
fun isDataNeedsToUpdate(method: String, url: String): Boolean {
|
||||
return method != "GET"
|
||||
&& url.contains(USER_DEVICE_DATA_LOCATION_API).not()
|
||||
&& url.contains(USER_DEVICE_DATA_APP_API).not()
|
||||
&& url.contains("/v1/cards/").not()
|
||||
&& url.contains("/pre-quotes/").not()
|
||||
if (method == "GET") {
|
||||
return isContains(showLoaderWhenGetSet, url)
|
||||
}
|
||||
return !isContains(doNotShowLoaderWhenPostSet, url)
|
||||
}
|
||||
|
||||
private fun isContains(map: MutableSet<String>, key: String): Boolean {
|
||||
map.forEach { value ->
|
||||
if (key.contains(value)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun isSameResponse(newResponse: Any?, oldResponse: Any?): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user