Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 1019b73

Browse files
authored
Bye Catalina (#1501)
Task/Issue URL: https://app.asana.com/0/0/1205143041156358/f CC: **Description**: This PR represents a last build for users of Catalina and first few Big Sur versions (< 11.4).
1 parent 27e3163 commit 1019b73

File tree

11 files changed

+397
-154
lines changed

11 files changed

+397
-154
lines changed

DuckDuckGo.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@
5252
1D69C553291302F200B75945 /* BWVault.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D69C552291302F200B75945 /* BWVault.swift */; };
5353
1D6A492029CF7A490011DF74 /* NSPopoverExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6A491F29CF7A490011DF74 /* NSPopoverExtension.swift */; };
5454
1D6A492129CF7A490011DF74 /* NSPopoverExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6A491F29CF7A490011DF74 /* NSPopoverExtension.swift */; };
55+
1D76760E2A9CE4F000DA0BD7 /* SupportedOsChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */; };
5556
1D77921828FDC54C00BE0210 /* FaviconReferenceCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D77921728FDC54C00BE0210 /* FaviconReferenceCacheTests.swift */; };
5657
1D77921A28FDC79800BE0210 /* FaviconStoringMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D77921928FDC79800BE0210 /* FaviconStoringMock.swift */; };
58+
1D8057C82A83CAEE00F4FED6 /* SupportedOsChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */; };
59+
1D8057C92A83CB3C00F4FED6 /* SupportedOsChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */; };
5760
1D8B7D6A2A38BF050045C6F6 /* FireproofDomainsStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BBF1712744CE36004F850E /* FireproofDomainsStoreMock.swift */; };
5861
1D8B7D6B2A38BF060045C6F6 /* FireproofDomainsStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BBF1712744CE36004F850E /* FireproofDomainsStoreMock.swift */; };
5962
1DA6D0FD2A1FF9A100540406 /* HTTPCookie.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DA6D0FC2A1FF9A100540406 /* HTTPCookie.swift */; };
@@ -2942,6 +2945,7 @@
29422945
1D77921728FDC54C00BE0210 /* FaviconReferenceCacheTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconReferenceCacheTests.swift; sourceTree = "<group>"; };
29432946
1D77921928FDC79800BE0210 /* FaviconStoringMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconStoringMock.swift; sourceTree = "<group>"; };
29442947
1D77921C28FFF27C00BE0210 /* RunningApplicationCheck.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunningApplicationCheck.swift; sourceTree = "<group>"; };
2948+
1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportedOsChecker.swift; sourceTree = "<group>"; };
29452949
1DA6D0FC2A1FF9A100540406 /* HTTPCookie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPCookie.swift; sourceTree = "<group>"; };
29462950
1DA6D0FF2A1FF9DC00540406 /* HTTPCookieTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPCookieTests.swift; sourceTree = "<group>"; };
29472951
1DB9617929F1D06D00CF5568 /* InternalUserDeciderMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalUserDeciderMock.swift; sourceTree = "<group>"; };
@@ -4294,6 +4298,14 @@
42944298
path = RunningApplication;
42954299
sourceTree = "<group>";
42964300
};
4301+
1D8057C62A83CAD500F4FED6 /* OsVersion */ = {
4302+
isa = PBXGroup;
4303+
children = (
4304+
1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */,
4305+
);
4306+
path = OsVersion;
4307+
sourceTree = "<group>";
4308+
};
42974309
313AED9F287CAC5A00E1E8F4 /* UI */ = {
42984310
isa = PBXGroup;
42994311
children = (
@@ -6266,6 +6278,7 @@
62666278
AA80EC52256BE33A007083E7 /* Localizables */,
62676279
1D43EAFF291D7D280065E5D6 /* Logging */,
62686280
85AC3B3325DA828900C7D2AA /* Network */,
6281+
1D8057C62A83CAD500F4FED6 /* OsVersion */,
62696282
4BB88B4E25B7BA20006F6B06 /* Utilities */,
62706283
1D77921B28FFF26100BE0210 /* RunningApplication */,
62716284
AA86491424D831C4001BABEE /* View */,
@@ -8693,6 +8706,7 @@
86938706
3192A00D2A4C4CFF0084EA89 /* ChromiumDataImporter.swift in Sources */,
86948707
3192A00E2A4C4CFF0084EA89 /* LegacyWebKitDownloadDelegate.swift in Sources */,
86958708
3192A00F2A4C4CFF0084EA89 /* WKBackForwardListItemViewModel.swift in Sources */,
8709+
1D76760E2A9CE4F000DA0BD7 /* SupportedOsChecker.swift in Sources */,
86968710
3192A0102A4C4CFF0084EA89 /* BWNotRespondingAlert.swift in Sources */,
86978711
3192A0112A4C4CFF0084EA89 /* DebugUserScript.swift in Sources */,
86988712
3192A0122A4C4CFF0084EA89 /* RecentlyClosedTab.swift in Sources */,
@@ -9272,6 +9286,7 @@
92729286
3706FAB4293F65D500E42796 /* NSPopUpButtonExtension.swift in Sources */,
92739287
3706FAB5293F65D500E42796 /* ConfigurationManager.swift in Sources */,
92749288
3706FAB6293F65D500E42796 /* YoutubePlayerUserScript.swift in Sources */,
9289+
1D8057C92A83CB3C00F4FED6 /* SupportedOsChecker.swift in Sources */,
92759290
373D9B4929EEAC1B00381FDD /* SyncMetadataDatabase.swift in Sources */,
92769291
3706FAB7293F65D500E42796 /* PixelParameters.swift in Sources */,
92779292
3706FAB8293F65D500E42796 /* FaviconImageCache.swift in Sources */,
@@ -10414,6 +10429,7 @@
1041410429
4BE65485271FCD7B008D1D63 /* LoginFaviconView.swift in Sources */,
1041510430
4B0511CA262CAA5A00F6079C /* FireproofDomainsViewController.swift in Sources */,
1041610431
AA4D700725545EF800C3411E /* URLEventHandler.swift in Sources */,
10432+
1D8057C82A83CAEE00F4FED6 /* SupportedOsChecker.swift in Sources */,
1041710433
AA92127725ADA07900600CD4 /* WKWebViewExtension.swift in Sources */,
1041810434
AAAB9114288EB1D600A057A9 /* CleanThisHistoryMenuItem.swift in Sources */,
1041910435
B6A9E499261474120067D1B9 /* TimedPixel.swift in Sources */,

DuckDuckGo/AppDelegate/UpdateController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ final class UpdateController: NSObject {
3838
}
3939

4040
func checkForUpdates(_ sender: Any!) {
41+
if !SupportedOSChecker.isCurrentOSReceivingUpdates {
42+
showNotSupportedInfo()
43+
}
44+
4145
NSApp.windows.forEach {
4246
if let controller = $0.windowController, "\(type(of: controller))" == "SUUpdateAlert" {
4347
$0.orderFrontRegardless()
@@ -65,6 +69,13 @@ final class UpdateController: NSObject {
6569
#endif
6670
}
6771

72+
private func showNotSupportedInfo() {
73+
if NSAlert.osNotSupported().runModal() != .cancel {
74+
let url = Preferences.UnsupportedDeviceInfoBox.softwareUpdateURL
75+
NSWorkspace.shared.open(url)
76+
}
77+
}
78+
6879
}
6980

7081
extension UpdateController: SPUStandardUserDriverDelegate {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "0.140",
8+
"blue" : "0x33",
9+
"green" : "0xCC",
10+
"red" : "0xFF"
11+
}
12+
},
13+
"idiom" : "universal"
14+
}
15+
],
16+
"info" : {
17+
"author" : "xcode",
18+
"version" : 1
19+
}
20+
}

DuckDuckGo/Common/Extensions/NSAlertExtension.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,20 @@ extension NSAlert {
177177
return alert
178178
}
179179

180+
static func osNotSupported() -> NSAlert {
181+
let alert = NSAlert()
182+
alert.messageText = UserText.aboutUnsupportedDeviceInfo1
183+
alert.informativeText = UserText.aboutUnsupportedDeviceInfo2Part1 + " " +
184+
UserText.aboutUnsupportedDeviceInfo2Part2(version: "\(SupportedOSChecker.SupportedVersion.major).\(SupportedOSChecker.SupportedVersion.minor)") + " " +
185+
UserText.aboutUnsupportedDeviceInfo2Part3 + " " +
186+
UserText.aboutUnsupportedDeviceInfo2Part4
187+
alert.alertStyle = .warning
188+
189+
alert.addButton(withTitle: UserText.checkForUpdate)
190+
alert.addButton(withTitle: UserText.ok)
191+
return alert
192+
}
193+
180194
@discardableResult
181195
func runModal() async -> NSApplication.ModalResponse {
182196
await withCheckedContinuation { continuation in

DuckDuckGo/Common/Extensions/WKWebViewConfigurationExtensions.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ extension WKWebViewConfiguration {
3939
preferences.javaScriptCanOpenWindowsAutomatically = true
4040
preferences.isFraudulentWebsiteWarningEnabled = false
4141

42-
if urlSchemeHandler(forURLScheme: DuckPlayer.duckPlayerScheme) == nil {
43-
setURLSchemeHandler(DuckPlayerSchemeHandler(), forURLScheme: DuckPlayer.duckPlayerScheme)
42+
if SupportedOSChecker.isCurrentOSReceivingUpdates {
43+
if urlSchemeHandler(forURLScheme: DuckPlayer.duckPlayerScheme) == nil {
44+
setURLSchemeHandler(DuckPlayerSchemeHandler(), forURLScheme: DuckPlayer.duckPlayerScheme)
45+
}
4446
}
4547

4648
let userContentController = UserContentController(assetsPublisher: contentBlocking.contentBlockingAssetsPublisher,

DuckDuckGo/Common/Localizables/UserText.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct UserText {
6464
static let tabOnboardingTitle = NSLocalizedString("tab.onboarding.title", value: "Welcome", comment: "Tab onboarding title")
6565
static let tabErrorTitle = NSLocalizedString("tab.error.title", value: "Oops!", comment: "Tab error title")
6666
static let openSystemPreferences = NSLocalizedString("open.preferences", value: "Open System Preferences", comment: "Open System Preferences (to re-enable permission for the App) (up to and including macOS 12")
67+
static let checkForUpdate = NSLocalizedString("check.for.update", value: "Check for Update", comment: "Button users can use to check for a new update")
6768

6869
static let unknownErrorMessage = NSLocalizedString("error.unknown", value: "An unknown error has occurred", comment: "Error page subtitle")
6970
static let unknownErrorTryAgainMessage = NSLocalizedString("error.unknown.try.again", value: "An unknown error has occurred", comment: "Generic error message on a dialog for when the cause is not known.")
@@ -322,6 +323,15 @@ struct UserText {
322323

323324
static let aboutDuckDuckGo = NSLocalizedString("preferences.about.about-duckduckgo", value: "About DuckDuckGo", comment: "About screen")
324325
static let privacySimplified = NSLocalizedString("preferences.about.privacy-simplified", value: "Privacy, simplified.", comment: "About screen")
326+
static let aboutUnsupportedDeviceInfo1 = NSLocalizedString("preferences.about.unsupported-device-info1", value: "DuckDuckGo is no longer providing browser updates for your version of macOS.", comment: "")
327+
static let aboutUnsupportedDeviceInfo2Part1 = NSLocalizedString("preferences.about.unsupported-device-info2-part1", value: "Please", comment: "Second paragraph of unsupported device info - sentence part 1")
328+
static func aboutUnsupportedDeviceInfo2Part2(version: String) -> String {
329+
return String(format: NSLocalizedString("preferences.about.unsupported-device-info2-part2", value: "update to macOS %@", comment: "Second paragraph of unsupported device info - sentence part 2 (underlined)"), version)
330+
}
331+
static let aboutUnsupportedDeviceInfo2Part3 = NSLocalizedString("preferences.about.unsupported-device-info2-part3", value: "or later to use the most recent version", comment: "Second paragraph of unsupported device info - sentence part 3")
332+
static let aboutUnsupportedDeviceInfo2Part4 = NSLocalizedString("preferences.about.unsupported-device-info2-part3", value: "of DuckDuckGo. You can also keep using your current version of the browser, but it will not receive further updates.", comment: "Second paragraph of unsupported device info - sentence part 4")
333+
static let unsupportedDeviceInfoAlertHeader = NSLocalizedString("unsupported.device.info.alert.header", value: "Your version of macOS is no longer supported.", comment: "")
334+
325335

326336
static func moreAt(url: String) -> String {
327337
let localized = NSLocalizedString("preferences.about.more-at", value: "More at %@", comment: "Link to the about page")
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// SupportedOsChecker.swift
3+
//
4+
// Copyright © 2023 DuckDuckGo. All rights reserved.
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
19+
import Foundation
20+
21+
final class SupportedOSChecker {
22+
23+
struct SupportedVersion {
24+
static let major = 11
25+
static let minor = 4
26+
static let patch = 0
27+
}
28+
29+
private static let currentOSVersion = ProcessInfo.processInfo.operatingSystemVersion
30+
31+
// Check if the current macOS version is at least the supported version
32+
static var isCurrentOSReceivingUpdates: Bool {
33+
if currentOSVersion.majorVersion > SupportedVersion.major {
34+
return true
35+
}
36+
if currentOSVersion.majorVersion == SupportedVersion.major {
37+
if currentOSVersion.minorVersion > SupportedVersion.minor {
38+
return true
39+
}
40+
if currentOSVersion.minorVersion == SupportedVersion.minor && currentOSVersion.patchVersion >= SupportedVersion.patch {
41+
return true
42+
}
43+
}
44+
return false
45+
}
46+
}

0 commit comments

Comments
 (0)