-
HI, So I've been updating my fork with the changes from 110.2 (I was previously on 109). In my fork I sometimes need to replace the URL in the current tab with a local file url of a file in the app bundle to show that the site is blocked. In 109 and earlier I was able to easily replace the FavIcon shown in the tab bar with my own one by modifying UIImageView.setImageAndBackground(forIcon icon: Favicon?, website: URL?, completion: @escaping () -> Void) similar to this: func setImageAndBackground(forIcon icon: Favicon?, website: URL?, completion: @escaping () -> Void) {
......
backgroundColor = nil
let defaults = fallbackFavicon(forUrl: website)
if let url = website, url.scheme == "file" {
// It's our block page, so grab our favicon.
if let ourFavicon = UIImage(contentsOfFile: URL.ourBlockPageFavicon.path) {
self.image = ourFavicon
finish(bgColor: nil)
return
}
// Otherwise leave it to the default handling below
}
if let url = website, let bundledIcon = FaviconFetcher.getBundledIcon(forUrl: url) {
........ With 110, I can't find a simple place to do this, I've tried going down the rabbit whole of the new async FavIcon handling but without success as it's so hard to follow along. As such, the icon used for my block page is now this meaningless "F" symbol instead: I am guessing that somewhere there is a fallback to just using the first character of the url ('f' for my File URL) and generating an image from that. Can someone suggest the best place to modify to get my own icon back in the tab. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello! Indeed, there is a fallback whenever we can't fetch favicons for a website and we take the first letter to generate a default favicon. This is done in class |
Beta Was this translation helpful? Give feedback.
Hello! Indeed, there is a fallback whenever we can't fetch favicons for a website and we take the first letter to generate a default favicon. This is done in class
LetterImageGenerator
. I guess what you want is to have a check before we enter in thisLetterImageGenerator
, so that would be in theImageHandler
(default implementation withDefaultImageHandler
). Hope this helps for your use case!