forked from MapComplete/MapComplete
		
	Fix: actually show mapillary-images
This commit is contained in:
		
							parent
							
								
									1505c9e904
								
							
						
					
					
						commit
						9d35c7a3b3
					
				
					 1 changed files with 7 additions and 9 deletions
				
			
		| 
						 | 
					@ -2,7 +2,7 @@ import { Mapillary } from "./Mapillary"
 | 
				
			||||||
import { WikimediaImageProvider } from "./WikimediaImageProvider"
 | 
					import { WikimediaImageProvider } from "./WikimediaImageProvider"
 | 
				
			||||||
import { Imgur } from "./Imgur"
 | 
					import { Imgur } from "./Imgur"
 | 
				
			||||||
import GenericImageProvider from "./GenericImageProvider"
 | 
					import GenericImageProvider from "./GenericImageProvider"
 | 
				
			||||||
import { ImmutableStore, Store, UIEventSource } from "../UIEventSource"
 | 
					import { ImmutableStore, Store, Stores } from "../UIEventSource"
 | 
				
			||||||
import ImageProvider, { ProvidedImage } from "./ImageProvider"
 | 
					import ImageProvider, { ProvidedImage } from "./ImageProvider"
 | 
				
			||||||
import { WikidataImageProvider } from "./WikidataImageProvider"
 | 
					import { WikidataImageProvider } from "./WikidataImageProvider"
 | 
				
			||||||
import Panoramax from "./Panoramax"
 | 
					import Panoramax from "./Panoramax"
 | 
				
			||||||
| 
						 | 
					@ -36,8 +36,8 @@ export default class AllImageProviders {
 | 
				
			||||||
    public static apiUrls: string[] = [].concat(
 | 
					    public static apiUrls: string[] = [].concat(
 | 
				
			||||||
        ...AllImageProviders.imageAttributionSources.map((src) => src.apiUrls())
 | 
					        ...AllImageProviders.imageAttributionSources.map((src) => src.apiUrls())
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    public static defaultKeys = [].concat(
 | 
					    public static defaultKeys: string[] = [].concat(
 | 
				
			||||||
        AllImageProviders.imageAttributionSources.map((provider) => provider.defaultKeyPrefixes)
 | 
					        ...AllImageProviders.imageAttributionSources.map((provider) => provider.defaultKeyPrefixes)
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    private static providersByName = {
 | 
					    private static providersByName = {
 | 
				
			||||||
        imgur: Imgur.singleton,
 | 
					        imgur: Imgur.singleton,
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,6 @@ export default class AllImageProviders {
 | 
				
			||||||
            return this._cachedImageStores[cachekey]
 | 
					            return this._cachedImageStores[cachekey]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const source = new UIEventSource([])
 | 
					 | 
				
			||||||
        const allSources: Store<ProvidedImage[]>[] = []
 | 
					        const allSources: Store<ProvidedImage[]>[] = []
 | 
				
			||||||
        for (const imageProvider of AllImageProviders.imageAttributionSources) {
 | 
					        for (const imageProvider of AllImageProviders.imageAttributionSources) {
 | 
				
			||||||
            /*
 | 
					            /*
 | 
				
			||||||
| 
						 | 
					@ -132,12 +131,11 @@ export default class AllImageProviders {
 | 
				
			||||||
            const prefixes = tagKey ?? imageProvider.defaultKeyPrefixes
 | 
					            const prefixes = tagKey ?? imageProvider.defaultKeyPrefixes
 | 
				
			||||||
            const singleSource = tags.bindD((tags) => imageProvider.getRelevantUrls(tags, prefixes))
 | 
					            const singleSource = tags.bindD((tags) => imageProvider.getRelevantUrls(tags, prefixes))
 | 
				
			||||||
            allSources.push(singleSource)
 | 
					            allSources.push(singleSource)
 | 
				
			||||||
            singleSource.addCallbackAndRunD((_) => {
 | 
					 | 
				
			||||||
                const all: ProvidedImage[] = [].concat(...allSources.map((source) => source.data))
 | 
					 | 
				
			||||||
                const dedup = Utils.DedupOnId(all, (i) => i?.id ?? i?.url)
 | 
					 | 
				
			||||||
                source.set(dedup)
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        const source = Stores.fromStoresArray(allSources).map(result => {
 | 
				
			||||||
 | 
					            const all = [].concat(...result)
 | 
				
			||||||
 | 
					            return Utils.DedupOnId(all, (i) => i?.id ?? i?.url)
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
        this._cachedImageStores[cachekey] = source
 | 
					        this._cachedImageStores[cachekey] = source
 | 
				
			||||||
        return source
 | 
					        return source
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue