SDWebImageSwiftUI: WebImage can not use Custom SDWebImageManager
I want to use WebImage with Firebase Storage API.
For that, WebImage needs to be able to use Custom SDWebImageManager with modified loader.
In the sd_internalSetImageWithURL method of SDWebImage, the following code is used to use Custom SDWebImageManager set in the context.
SDWebImageManager *manager = context[SDWebImageContextCustomManager];
if (!manager) {
manager = [SDWebImageManager sharedManager];
}
However, ImageManager of SDWebImageSwiftUI always uses the default SDWebImageManager by the following code.
var manager = SDWebImageManager.shared
I hope to add the following code to the load method in the ImageManager so that the manager set in the context can be used.
if let customManager = context?[.customManager] as? SDWebImageManager {
manager = customManager
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20
@Dwite FirebaseUI release v8.5.1, which added the built-in support for any “gs://” URL. You don’t need the hack I talked above. This dirty work handled by framework.
@dreampiggy hello friend I’m confused about this simple code:
When I run this I get blank images. If I remove the first line I get a Code=-1002 “unsupported URL” error. Could you please help me?
I know this looks strange and difficult (You can write a wrapper API), so this is why I create PR for Firebase Team to add a better API to supports
gs://URL built-in. However seems they forgot to release new version. 😢Seems, FirebaseStorage UI does not release new version which contains those fix code…Need to fire issues to them. I can fire one as well.
@dreampiggy I have added you as a contributor to my project, it’s almost empty, just the code with the web image + Firebase storage
Here is an example URL
gs://stickerland-smartfox.appspot.com/ChristisRisen_stickers/CAACAgIAAxkBAAIWll9SL_vXzeNSk1NjK8B-XeWWvMECAALcyQEAAWOLRgy0EthwY9D3JRsE.webp@dreampiggy even if I change the order, the problem still exists. If I remove the SDWebImageDownloader.shared completely
There are no errors in logs, but images won’t appear and all
WebImage.onFailureare called with empty errordomain: nil - code: 0@Dwite Your loaders array order is wrong…It’s a priority queue. So it should be
SDWebImageDownloader(The default loader), actually will handler any URL, whatever it use HTTP/FTP, or any custom Scheme (gs://is one)