diff --git a/app/lib/domain/services/generic_website.dart b/app/lib/domain/services/generic_website.dart index 2da0724a..15e225f9 100644 --- a/app/lib/domain/services/generic_website.dart +++ b/app/lib/domain/services/generic_website.dart @@ -346,59 +346,23 @@ class GenericWebsiteService extends _$GenericWebsiteService { return cachedIcon; } - // ignore: only_use_keep_alive_inside_keep_alive - final result = await ref.read( - pageInfoProvider(url, isImageRequest: true).future, - ); + if (ref.mounted) { + // ignore: only_use_keep_alive_inside_keep_alive + final result = await ref.read( + pageInfoProvider(url, isImageRequest: true).future, + ); - if (result.favicon case final BrowserIcon favicon) { - //If it was a `isImageRequest` hit, we need to cache it at this point - if (!_browserIconCache.contains(url.origin)) { - _browserIconCache.set(url.origin, favicon); + if (result.favicon case final BrowserIcon favicon) { + //If it was a `isImageRequest` hit, we need to cache it at this point + if (!_browserIconCache.contains(url.origin)) { + _browserIconCache.set(url.origin, favicon); + } + + return favicon; } - - return favicon; } } return null; } - - // Future tryUpgradeToHttps(Uri httpUri) async { - // if (httpUri.isScheme('https')) { - // return httpUri; - // } else if (httpUri.isScheme('http')) { - // final cached = _httpsCache[httpUri.host]; - // if (cached != null) { - // return cached ? httpUri.replace(scheme: 'https') : null; - // } - - // var sslAvailable = false; - - // try { - // final context = SecurityContext.defaultContext; - - // final socket = await SecureSocket.connect( - // httpUri.host, - // 443, - // context: context, - // timeout: const Duration(seconds: 3), - // ); - - // await socket.close(); - - // sslAvailable = true; - // } catch (_) { - // sslAvailable = false; - // } - - // _httpsCache[httpUri.host] = sslAvailable; - - // if (sslAvailable) { - // return httpUri.replace(scheme: 'https'); - // } - // } - - // return null; - // } } diff --git a/app/lib/domain/services/generic_website.g.dart b/app/lib/domain/services/generic_website.g.dart index 7807b5b6..2b556015 100644 --- a/app/lib/domain/services/generic_website.g.dart +++ b/app/lib/domain/services/generic_website.g.dart @@ -42,7 +42,7 @@ final class GenericWebsiteServiceProvider } String _$genericWebsiteServiceHash() => - r'c20897405a4d31983a22d61e955ffb7430d06a54'; + r'9bc32261abd76a79efb57f6d27832e949cb495a6'; abstract class _$GenericWebsiteService extends $Notifier { void build();