Skip to content

Commit

Permalink
:bugs: Fix downloading image all the time
Browse files Browse the repository at this point in the history
  • Loading branch information
paul2126 committed Dec 7, 2023
1 parent 45ae686 commit 2107979
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ class ProxyImageDownloader @Inject constructor(
) : ImageDownloader {
fun checkImage(symbolList: List<Symbol>) {
val internalDir = context.filesDir
var flag = false
for (symbol in symbolList) {
val flag = mutableListOf<Boolean>()
for (symbol in symbolList.drop(499)) { // compare after 500
internalDir.listFiles()?.forEach { file ->
// Check if the file matches your criteria
flag = file.name == "symbol_${symbol.id}.png"
flag.add(file.name == "symbol_${symbol.id}.png")
}
if (!flag && symbol.id > 500) {
val result = flag.any{ it }
if (!result && symbol.id > 500) {
symbol.imageUrl?.let { downloadImage(it, "symbol_${symbol.id}.png") }
}
}
Expand Down

0 comments on commit 2107979

Please sign in to comment.