From b7b858dbf385cdd1fe1ab8a3f3ee8586fa850d5d Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 25 Mar 2023 21:39:55 -0700 Subject: [PATCH] Fix compile error when SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE=0 (#2346) --- Sparkle/SUUpdateAlert.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index bafa5890..ecd36ea6 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -322,17 +322,19 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE BOOL javaScriptEnabled = [_host boolForInfoDictionaryKey:SUEnableJavaScriptKey]; +#if DOWNLOADER_XPC_SERVICE_EMBEDDED // WKWebView has a bug where it won't work in loading local HTML content in sandboxed apps that do not have an outgoing network entitlement // FB6993802: https://twitter.com/sindresorhus/status/1160577243929878528 | https://github.com/feedback-assistant/reports/issues/1 // If the developer is using the downloader XPC service, they are very most likely are a) sandboxed b) do not use outgoing network entitlement. // In this case, fall back to legacy WebKit view. // (In theory it is possible for a non-sandboxed app or sandboxed app with outgoing network entitlement to use the XPC service, it's just pretty unlikely. And falling back to a legacy web view would not be too harmful in those cases). BOOL useWKWebView = !SPUXPCServiceIsEnabled(SUEnableDownloaderServiceKey); - - if (useWKWebView) { - _releaseNotesView = [[SUWKWebView alloc] initWithColorStyleSheetLocation:colorStyleURL fontFamily:defaultFontFamily fontPointSize:defaultFontSize javaScriptEnabled:javaScriptEnabled]; - } else { + if (!useWKWebView) { _releaseNotesView = [[SULegacyWebView alloc] initWithColorStyleSheetLocation:colorStyleURL fontFamily:defaultFontFamily fontPointSize:defaultFontSize javaScriptEnabled:javaScriptEnabled]; + } else +#endif + { + _releaseNotesView = [[SUWKWebView alloc] initWithColorStyleSheetLocation:colorStyleURL fontFamily:defaultFontFamily fontPointSize:defaultFontSize javaScriptEnabled:javaScriptEnabled]; } }