Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@
1D69C553291302F200B75945 /* BWVault.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D69C552291302F200B75945 /* BWVault.swift */; };
1D6A492029CF7A490011DF74 /* NSPopoverExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6A491F29CF7A490011DF74 /* NSPopoverExtension.swift */; };
1D6A492129CF7A490011DF74 /* NSPopoverExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6A491F29CF7A490011DF74 /* NSPopoverExtension.swift */; };
1D76760E2A9CE4F000DA0BD7 /* SupportedOsChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */; };
1D77921828FDC54C00BE0210 /* FaviconReferenceCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D77921728FDC54C00BE0210 /* FaviconReferenceCacheTests.swift */; };
1D77921A28FDC79800BE0210 /* FaviconStoringMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D77921928FDC79800BE0210 /* FaviconStoringMock.swift */; };
1D8057C82A83CAEE00F4FED6 /* SupportedOsChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */; };
1D8057C92A83CB3C00F4FED6 /* SupportedOsChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */; };
1D8B7D6A2A38BF050045C6F6 /* FireproofDomainsStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BBF1712744CE36004F850E /* FireproofDomainsStoreMock.swift */; };
1D8B7D6B2A38BF060045C6F6 /* FireproofDomainsStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BBF1712744CE36004F850E /* FireproofDomainsStoreMock.swift */; };
1DA6D0FD2A1FF9A100540406 /* HTTPCookie.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DA6D0FC2A1FF9A100540406 /* HTTPCookie.swift */; };
Expand Down Expand Up @@ -2944,6 +2947,7 @@
1D77921728FDC54C00BE0210 /* FaviconReferenceCacheTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconReferenceCacheTests.swift; sourceTree = "<group>"; };
1D77921928FDC79800BE0210 /* FaviconStoringMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconStoringMock.swift; sourceTree = "<group>"; };
1D77921C28FFF27C00BE0210 /* RunningApplicationCheck.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunningApplicationCheck.swift; sourceTree = "<group>"; };
1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportedOsChecker.swift; sourceTree = "<group>"; };
1DA6D0FC2A1FF9A100540406 /* HTTPCookie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPCookie.swift; sourceTree = "<group>"; };
1DA6D0FF2A1FF9DC00540406 /* HTTPCookieTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPCookieTests.swift; sourceTree = "<group>"; };
1DB9617929F1D06D00CF5568 /* InternalUserDeciderMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalUserDeciderMock.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4296,6 +4300,14 @@
path = RunningApplication;
sourceTree = "<group>";
};
1D8057C62A83CAD500F4FED6 /* OsVersion */ = {
isa = PBXGroup;
children = (
1D8057C72A83CAEE00F4FED6 /* SupportedOsChecker.swift */,
);
path = OsVersion;
sourceTree = "<group>";
};
313AED9F287CAC5A00E1E8F4 /* UI */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6268,6 +6280,7 @@
AA80EC52256BE33A007083E7 /* Localizables */,
1D43EAFF291D7D280065E5D6 /* Logging */,
85AC3B3325DA828900C7D2AA /* Network */,
1D8057C62A83CAD500F4FED6 /* OsVersion */,
4BB88B4E25B7BA20006F6B06 /* Utilities */,
1D77921B28FFF26100BE0210 /* RunningApplication */,
AA86491424D831C4001BABEE /* View */,
Expand Down Expand Up @@ -8695,6 +8708,7 @@
3192A00D2A4C4CFF0084EA89 /* ChromiumDataImporter.swift in Sources */,
3192A00E2A4C4CFF0084EA89 /* LegacyWebKitDownloadDelegate.swift in Sources */,
3192A00F2A4C4CFF0084EA89 /* WKBackForwardListItemViewModel.swift in Sources */,
1D76760E2A9CE4F000DA0BD7 /* SupportedOsChecker.swift in Sources */,
3192A0102A4C4CFF0084EA89 /* BWNotRespondingAlert.swift in Sources */,
3192A0112A4C4CFF0084EA89 /* DebugUserScript.swift in Sources */,
3192A0122A4C4CFF0084EA89 /* RecentlyClosedTab.swift in Sources */,
Expand Down Expand Up @@ -9274,6 +9288,7 @@
3706FAB4293F65D500E42796 /* NSPopUpButtonExtension.swift in Sources */,
3706FAB5293F65D500E42796 /* ConfigurationManager.swift in Sources */,
3706FAB6293F65D500E42796 /* YoutubePlayerUserScript.swift in Sources */,
1D8057C92A83CB3C00F4FED6 /* SupportedOsChecker.swift in Sources */,
373D9B4929EEAC1B00381FDD /* SyncMetadataDatabase.swift in Sources */,
3706FAB7293F65D500E42796 /* PixelParameters.swift in Sources */,
3706FAB8293F65D500E42796 /* FaviconImageCache.swift in Sources */,
Expand Down Expand Up @@ -10417,6 +10432,7 @@
4BE65485271FCD7B008D1D63 /* LoginFaviconView.swift in Sources */,
4B0511CA262CAA5A00F6079C /* FireproofDomainsViewController.swift in Sources */,
AA4D700725545EF800C3411E /* URLEventHandler.swift in Sources */,
1D8057C82A83CAEE00F4FED6 /* SupportedOsChecker.swift in Sources */,
AA92127725ADA07900600CD4 /* WKWebViewExtension.swift in Sources */,
AAAB9114288EB1D600A057A9 /* CleanThisHistoryMenuItem.swift in Sources */,
B6A9E499261474120067D1B9 /* TimedPixel.swift in Sources */,
Expand Down
11 changes: 11 additions & 0 deletions DuckDuckGo/AppDelegate/UpdateController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ final class UpdateController: NSObject {
}

func checkForUpdates(_ sender: Any!) {
if !SupportedOSChecker.isCurrentOSReceivingUpdates {
showNotSupportedInfo()
}

NSApp.windows.forEach {
if let controller = $0.windowController, "\(type(of: controller))" == "SUUpdateAlert" {
$0.orderFrontRegardless()
Expand Down Expand Up @@ -65,6 +69,13 @@ final class UpdateController: NSObject {
#endif
}

private func showNotSupportedInfo() {
if NSAlert.osNotSupported().runModal() != .cancel {
let url = Preferences.UnsupportedDeviceInfoBox.softwareUpdateURL
NSWorkspace.shared.open(url)
}
}

}

extension UpdateController: SPUStandardUserDriverDelegate {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.140",
"blue" : "0x33",
"green" : "0xCC",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
14 changes: 14 additions & 0 deletions DuckDuckGo/Common/Extensions/NSAlertExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ extension NSAlert {
return alert
}

static func osNotSupported() -> NSAlert {
let alert = NSAlert()
alert.messageText = UserText.aboutUnsupportedDeviceInfo1
alert.informativeText = UserText.aboutUnsupportedDeviceInfo2Part1 + " " +
UserText.aboutUnsupportedDeviceInfo2Part2(version: "\(SupportedOSChecker.SupportedVersion.major).\(SupportedOSChecker.SupportedVersion.minor)") + " " +
UserText.aboutUnsupportedDeviceInfo2Part3 + " " +
UserText.aboutUnsupportedDeviceInfo2Part4
alert.alertStyle = .warning

alert.addButton(withTitle: UserText.checkForUpdate)
alert.addButton(withTitle: UserText.ok)
return alert
}

@discardableResult
func runModal() async -> NSApplication.ModalResponse {
await withCheckedContinuation { continuation in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ extension WKWebViewConfiguration {
preferences.javaScriptCanOpenWindowsAutomatically = true
preferences.isFraudulentWebsiteWarningEnabled = false

if urlSchemeHandler(forURLScheme: DuckPlayer.duckPlayerScheme) == nil {
setURLSchemeHandler(DuckPlayerSchemeHandler(), forURLScheme: DuckPlayer.duckPlayerScheme)
if SupportedOSChecker.isCurrentOSReceivingUpdates {
if urlSchemeHandler(forURLScheme: DuckPlayer.duckPlayerScheme) == nil {
setURLSchemeHandler(DuckPlayerSchemeHandler(), forURLScheme: DuckPlayer.duckPlayerScheme)
}
}

let userContentController = UserContentController(assetsPublisher: contentBlocking.contentBlockingAssetsPublisher,
Expand Down
10 changes: 10 additions & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct UserText {
static let tabOnboardingTitle = NSLocalizedString("tab.onboarding.title", value: "Welcome", comment: "Tab onboarding title")
static let tabErrorTitle = NSLocalizedString("tab.error.title", value: "Oops!", comment: "Tab error title")
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")
static let checkForUpdate = NSLocalizedString("check.for.update", value: "Check for Update", comment: "Button users can use to check for a new update")

static let unknownErrorMessage = NSLocalizedString("error.unknown", value: "An unknown error has occurred", comment: "Error page subtitle")
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.")
Expand Down Expand Up @@ -322,6 +323,15 @@ struct UserText {

static let aboutDuckDuckGo = NSLocalizedString("preferences.about.about-duckduckgo", value: "About DuckDuckGo", comment: "About screen")
static let privacySimplified = NSLocalizedString("preferences.about.privacy-simplified", value: "Privacy, simplified.", comment: "About screen")
static let aboutUnsupportedDeviceInfo1 = NSLocalizedString("preferences.about.unsupported-device-info1", value: "DuckDuckGo is no longer providing browser updates for your version of macOS.", comment: "")
static let aboutUnsupportedDeviceInfo2Part1 = NSLocalizedString("preferences.about.unsupported-device-info2-part1", value: "Please", comment: "Second paragraph of unsupported device info - sentence part 1")
static func aboutUnsupportedDeviceInfo2Part2(version: String) -> String {
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)
}
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")
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")
static let unsupportedDeviceInfoAlertHeader = NSLocalizedString("unsupported.device.info.alert.header", value: "Your version of macOS is no longer supported.", comment: "")


static func moreAt(url: String) -> String {
let localized = NSLocalizedString("preferences.about.more-at", value: "More at %@", comment: "Link to the about page")
Expand Down
46 changes: 46 additions & 0 deletions DuckDuckGo/Common/OsVersion/SupportedOsChecker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// SupportedOsChecker.swift
//
// Copyright © 2023 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation

final class SupportedOSChecker {

struct SupportedVersion {
static let major = 11
static let minor = 4
static let patch = 0
}

private static let currentOSVersion = ProcessInfo.processInfo.operatingSystemVersion

// Check if the current macOS version is at least the supported version
static var isCurrentOSReceivingUpdates: Bool {
if currentOSVersion.majorVersion > SupportedVersion.major {
return true
}
if currentOSVersion.majorVersion == SupportedVersion.major {
if currentOSVersion.minorVersion > SupportedVersion.minor {
return true
}
if currentOSVersion.minorVersion == SupportedVersion.minor && currentOSVersion.patchVersion >= SupportedVersion.patch {
return true
}
}
return false
}
}
Loading