mapbox-navigation-ios
                                
                                 mapbox-navigation-ios copied to clipboard
                                
                                    mapbox-navigation-ios copied to clipboard
                            
                            
                            
                        Replace ImageCache, DataCache with URLCache
Description
This pr is to fix #3841 by replacing ImageCache, DataCache with URLCache.
Implementation
For DataCache,  it's only used for the speech caching from the result of SpeechSynthesizer.audioData(with:completionHandler:)  from MapboxSpeech. It only receives the data and error information. So the URLCache is not capable in this case.
For the ImageCache, when used in ImageRepository, it's only responsible for the JunctionView update, and it already supports the local disk caching. So it won't be changed.
In SpriteRepository, the previous spriteCache, legacyCache and infoCache is replaced with the derivedCache as ImageCache and requestCache of a URLCache.  The requestCache is used to store downloaded Sprite image, Sprite Info and single legacy shields. The derivedCache is used to store the generated generic shields, exit views and the single sprite shield icon.
Right now the ImageDownload and ImageDownloader are updated to more generic RequestDownload and RequestDownloader. The ImageRepository and SpriteRepository  will be responsible for generating urlRequest and converting data to image.
Screenshots or Gifs
Breaking Changes in MapboxNavigation
Breaking API Changes
DataCache
- removed method: clearMemory()inDataCache
- removed method: clearDisk(completion:)inDataCache
- removed method: store(_:forKey:toDisk:completion:)inDataCache
store(_:forKey:toDisk:completion:)
- removed method: store(_:forKey:toDisk:completion:)
clearMemory()
- removed method: clearMemory()
Don't forget to add a changelog entry.
Don't forget to add a changelog entry.
Because the SpriteRepository is not public, the newly added cache type is internal. There won't be any changes to users. I'm not sure what to add to the changelog.
@ShanMa1991, sorry, looks like https://github.com/mapbox/mapbox-navigation-ios/pull/4004 brought multiple conflicts with your current PR. Would you be able to resolve them? (let me know if any help is needed)
@MaximAlien Thanks for the reminder, currently it's rebased to catch the change from #4004
Breaking Changes in MapboxNavigation
Breaking API Changes
NavigationViewControllerDelegate
- removed method: navigationViewController(_:didSelect:)inNavigationViewControllerDelegate