Feat: check if the image was blurred, attempt to reload if it is done; refactoring of ImageProvider code

This commit is contained in:
Pieter Vander Vennet 2024-09-28 02:04:14 +02:00
parent 590591dd31
commit 4650170db4
14 changed files with 224 additions and 190 deletions

View file

@ -414,6 +414,29 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
return items
}
/**
* Deduplicates the given array based on some ID-properties.
* Removes all falsey values
* @param arr
* @param toKey
* @constructor
*/
public static DedupOnId<T>(arr: T[], toKey: ((t:T) => string) ): T[]{
const uniq: T[] = []
const seen = new Set<string>()
for (const img of arr) {
if(!img){
continue
}
const k = toKey(img)
if (!seen.has(k)) {
seen.add(k)
uniq.push(img)
}
}
return uniq
}
/**
* Finds all duplicates in a list of strings
*