Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into anya/autofill-pixe…
Browse files Browse the repository at this point in the history
…l-param-updates
  • Loading branch information
amddg44 committed Oct 2, 2023
2 parents 4e2a178 + 11167cf commit d84c38d
Show file tree
Hide file tree
Showing 20 changed files with 332 additions and 111 deletions.
28 changes: 28 additions & 0 deletions Core/NetworkProtectionNotificationIdentifier.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// NetworkProtectionNotificationIdentifier.swift
// DuckDuckGo
//
// 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

public enum NetworkProtectionNotificationIdentifier: String {
case reconnecting = "network-protection.notification.reconnecting"
case reconnected = "network-protection.notification.reconnected"
case connectionFailure = "network-protection.notification.connection-failure"
case superseded = "network-protection.notification.superseded"
case test = "network-protection.notification.test"
}
32 changes: 30 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@
EE0153ED2A6FF9E6002A8B26 /* NetworkProtectionRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0153EC2A6FF9E6002A8B26 /* NetworkProtectionRootView.swift */; };
EE0153EF2A70021E002A8B26 /* NetworkProtectionInviteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0153EE2A70021E002A8B26 /* NetworkProtectionInviteView.swift */; };
EE276BEA2A77F823009167B6 /* NetworkProtectionRootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE276BE92A77F823009167B6 /* NetworkProtectionRootViewController.swift */; };
EE3766DE2AC5945500AAB575 /* NetworkProtectionUNNotificationPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE3766DD2AC5945500AAB575 /* NetworkProtectionUNNotificationPresenter.swift */; };
EE3B226B29DE0F110082298A /* MockInternalUserStoring.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE3B226A29DE0F110082298A /* MockInternalUserStoring.swift */; };
EE3B226C29DE0FD30082298A /* MockInternalUserStoring.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE3B226A29DE0F110082298A /* MockInternalUserStoring.swift */; };
EE41BD192A729E9C00546C57 /* NetworkProtectionInviteViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE41BD182A729E9C00546C57 /* NetworkProtectionInviteViewModelTests.swift */; };
Expand All @@ -758,11 +759,13 @@
EE50053029C3BA0800AE0773 /* InternalUserStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE50052F29C3BA0800AE0773 /* InternalUserStore.swift */; };
EE72CA852A862D000043B5B3 /* NetworkProtectionDebugViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE72CA842A862D000043B5B3 /* NetworkProtectionDebugViewController.swift */; };
EE7917912A83DE93008DFF28 /* CombineTestUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7917902A83DE93008DFF28 /* CombineTestUtilities.swift */; };
EE7A92872AC6DE4700832A36 /* NetworkProtectionNotificationIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7A92862AC6DE4700832A36 /* NetworkProtectionNotificationIdentifier.swift */; };
EE8594992A44791C008A6D06 /* NetworkProtectionTunnelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8594982A44791C008A6D06 /* NetworkProtectionTunnelController.swift */; };
EE8E568A2A56BCE400F11DCA /* NetworkProtection in Frameworks */ = {isa = PBXBuildFile; productRef = EE8E56892A56BCE400F11DCA /* NetworkProtection */; };
EEEB80A32A421CE600386378 /* NetworkProtectionPacketTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEEB80A22A421CE600386378 /* NetworkProtectionPacketTunnelProvider.swift */; };
EEF0F8CC2ABC832300630031 /* NetworkProtectionDebugFeatures.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF0F8CB2ABC832200630031 /* NetworkProtectionDebugFeatures.swift */; };
EEFAB4672A73C230008A38E4 /* NetworkProtectionTestUtils in Frameworks */ = {isa = PBXBuildFile; productRef = EEFAB4662A73C230008A38E4 /* NetworkProtectionTestUtils */; };
EEFC6A602AC0F2F80065027D /* UserText.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFC6A5F2AC0F2F80065027D /* UserText.swift */; };
EEFD562F2A65B6CA00DAEC48 /* NetworkProtectionInviteViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFD562E2A65B6CA00DAEC48 /* NetworkProtectionInviteViewModel.swift */; };
EEFE9C732A603CE9005B0A26 /* NetworkProtectionStatusViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFE9C722A603CE9005B0A26 /* NetworkProtectionStatusViewModelTests.swift */; };
F103073B1E7C91330059FEC7 /* BookmarksDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = F103073A1E7C91330059FEC7 /* BookmarksDataSource.swift */; };
Expand Down Expand Up @@ -2332,6 +2335,7 @@
EE0153EC2A6FF9E6002A8B26 /* NetworkProtectionRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionRootView.swift; sourceTree = "<group>"; };
EE0153EE2A70021E002A8B26 /* NetworkProtectionInviteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionInviteView.swift; sourceTree = "<group>"; };
EE276BE92A77F823009167B6 /* NetworkProtectionRootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionRootViewController.swift; sourceTree = "<group>"; };
EE3766DD2AC5945500AAB575 /* NetworkProtectionUNNotificationPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionUNNotificationPresenter.swift; sourceTree = "<group>"; };
EE3B226A29DE0F110082298A /* MockInternalUserStoring.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockInternalUserStoring.swift; sourceTree = "<group>"; };
EE3B98EA2A9634CC002F63A0 /* DuckDuckGoAlpha.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DuckDuckGoAlpha.entitlements; sourceTree = "<group>"; };
EE3B98EB2A963515002F63A0 /* WidgetsExtensionAlpha.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WidgetsExtensionAlpha.entitlements; sourceTree = "<group>"; };
Expand All @@ -2346,10 +2350,12 @@
EE50052F29C3BA0800AE0773 /* InternalUserStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalUserStore.swift; sourceTree = "<group>"; };
EE72CA842A862D000043B5B3 /* NetworkProtectionDebugViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionDebugViewController.swift; sourceTree = "<group>"; };
EE7917902A83DE93008DFF28 /* CombineTestUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombineTestUtilities.swift; sourceTree = "<group>"; };
EE7A92862AC6DE4700832A36 /* NetworkProtectionNotificationIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionNotificationIdentifier.swift; sourceTree = "<group>"; };
EE8594982A44791C008A6D06 /* NetworkProtectionTunnelController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionTunnelController.swift; sourceTree = "<group>"; };
EEB8FDB92A990AEE00EBEDCF /* Configuration-Alpha.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Configuration-Alpha.xcconfig"; path = "Configuration/Configuration-Alpha.xcconfig"; sourceTree = "<group>"; };
EEEB80A22A421CE600386378 /* NetworkProtectionPacketTunnelProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionPacketTunnelProvider.swift; sourceTree = "<group>"; };
EEF0F8CB2ABC832200630031 /* NetworkProtectionDebugFeatures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkProtectionDebugFeatures.swift; sourceTree = "<group>"; };
EEFC6A5F2AC0F2F80065027D /* UserText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserText.swift; sourceTree = "<group>"; };
EEFD562E2A65B6CA00DAEC48 /* NetworkProtectionInviteViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionInviteViewModel.swift; sourceTree = "<group>"; };
EEFE9C722A603CE9005B0A26 /* NetworkProtectionStatusViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionStatusViewModelTests.swift; sourceTree = "<group>"; };
F103073A1E7C91330059FEC7 /* BookmarksDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BookmarksDataSource.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2604,13 +2610,14 @@
02025665298818B200E694E7 /* PacketTunnelProvider */ = {
isa = PBXGroup;
children = (
EE3766DC2AC5940A00AAB575 /* NetworkProtection */,
EE3B98EC2A963538002F63A0 /* PacketTunnelProviderAlpha.entitlements */,
02025670298818CB00E694E7 /* ProxyServer */,
02025666298818B200E694E7 /* AppTrackingProtectionPacketTunnelProvider.swift */,
02025B1429884EA500E694E7 /* DDGObserverFactory.swift */,
02025668298818B200E694E7 /* Info.plist */,
02025669298818B200E694E7 /* PacketTunnelProvider.entitlements */,
EEEB80A22A421CE600386378 /* NetworkProtectionPacketTunnelProvider.swift */,
EEFC6A5F2AC0F2F80065027D /* UserText.swift */,
);
path = PacketTunnelProvider;
sourceTree = "<group>";
Expand Down Expand Up @@ -4344,6 +4351,15 @@
name = Root;
sourceTree = "<group>";
};
EE3766DC2AC5940A00AAB575 /* NetworkProtection */ = {
isa = PBXGroup;
children = (
EEEB80A22A421CE600386378 /* NetworkProtectionPacketTunnelProvider.swift */,
EE3766DD2AC5945500AAB575 /* NetworkProtectionUNNotificationPresenter.swift */,
);
path = NetworkProtection;
sourceTree = "<group>";
};
EE3B226929DE0EE10082298A /* FeatureFlags */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4380,6 +4396,14 @@
name = NetworkProtection;
sourceTree = "<group>";
};
EE7A92852AC6DE2500832A36 /* NetworkProtection */ = {
isa = PBXGroup;
children = (
EE7A92862AC6DE4700832A36 /* NetworkProtectionNotificationIdentifier.swift */,
);
name = NetworkProtection;
sourceTree = "<group>";
};
EECD94B22A28B8580085C66E /* NetworkProtection */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4655,6 +4679,7 @@
F143C2E51E4A4CD400CFDE3A /* Core */ = {
isa = PBXGroup;
children = (
EE7A92852AC6DE2500832A36 /* NetworkProtection */,
4B470ED4299C484B0086EBDC /* AppTrackingProtection */,
F1CE42A71ECA0A520074A8DF /* Bookmarks */,
837774491F8E1ECE00E17A29 /* ContentBlocker */,
Expand Down Expand Up @@ -5962,6 +5987,7 @@
4BEF656D2989C2FC00B650CB /* EventType.swift in Sources */,
02025AAC2988229800E694E7 /* GCDHTTPProxyServer.swift in Sources */,
02025AAD2988229800E694E7 /* NWUDPSocket.swift in Sources */,
EE3766DE2AC5945500AAB575 /* NetworkProtectionUNNotificationPresenter.swift in Sources */,
02025AAE2988229800E694E7 /* RawTCPSocketProtocol.swift in Sources */,
02025AAF2988229800E694E7 /* NWTCPSocket.swift in Sources */,
02025AB12988229800E694E7 /* RawSocketFactory.swift in Sources */,
Expand Down Expand Up @@ -6005,6 +6031,7 @@
02025AEB2988229800E694E7 /* Utils.swift in Sources */,
02025AEC2988229800E694E7 /* AppTrackingProtectionPacketTunnelProvider.swift in Sources */,
02025B1029884DC500E694E7 /* AppTrackerDataParser.swift in Sources */,
EEFC6A602AC0F2F80065027D /* UserText.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -6677,6 +6704,7 @@
85F21DC621145DD5002631A6 /* global.swift in Sources */,
F41C2DA326C1925700F9A760 /* BookmarksAndFolders.xcdatamodeld in Sources */,
F4F6DFBA26EFF28A00ED7E12 /* BookmarkObjects.swift in Sources */,
EE7A92872AC6DE4700832A36 /* NetworkProtectionNotificationIdentifier.swift in Sources */,
836A941D247F23C600BF8EF5 /* UserAgentManager.swift in Sources */,
4B83397329AFB8D2003F7EA9 /* AppTrackingProtectionFeedbackModel.swift in Sources */,
85CA53A824BB343700A6288C /* Favicons.swift in Sources */,
Expand Down Expand Up @@ -8928,7 +8956,7 @@
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 80.2.1;
version = 80.4.1;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/DuckDuckGo/BrowserServicesKit",
"state": {
"branch": null,
"revision": "e955f958201a91ef353c55236361e095357e9505",
"version": "80.2.1"
"revision": "9dea0583dc6269971fb4728bd3efa1ed53f88306",
"version": "80.4.1"
}
},
{
Expand Down
21 changes: 17 additions & 4 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Configuration.setURLProvider(AppConfigurationURLProvider())

CrashCollection.start {
Pixel.fire(pixel: .dbCrashDetected, withAdditionalParameters: $0, includedParameters: [.appVersion])
Pixel.fire(pixel: .dbCrashDetected, withAdditionalParameters: $0, includedParameters: [])
}

clearTmp()
Expand Down Expand Up @@ -677,9 +677,16 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
if response.actionIdentifier == UNNotificationDefaultActionIdentifier {
if response.notification.request.identifier == WindowsBrowserWaitlist.notificationIdentitier {
let identifier = response.notification.request.identifier
if identifier == WindowsBrowserWaitlist.notificationIdentitier {
presentWindowsBrowserWaitlistSettingsModal()
}

#if NETWORK_PROTECTION
if NetworkProtectionNotificationIdentifier(rawValue: identifier) != nil {
presentNetworkProtectionStatusSettingsModal()
}
#endif
}

completionHandler()
Expand All @@ -689,7 +696,14 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let waitlistViewController = WindowsWaitlistViewController(nibName: nil, bundle: nil)
presentSettings(with: waitlistViewController)
}


#if NETWORK_PROTECTION
private func presentNetworkProtectionStatusSettingsModal() {
let networkProtectionRoot = NetworkProtectionRootViewController()
presentSettings(with: networkProtectionRoot)
}
#endif

private func presentSettings(with viewController: UIViewController) {
guard let window = window, let rootViewController = window.rootViewController as? MainViewController else { return }

Expand All @@ -703,5 +717,4 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
navigationController?.pushViewController(viewController, animated: true)
}
}

}
4 changes: 0 additions & 4 deletions DuckDuckGo/AutofillListItemTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ class AutofillListItemTableViewCell: UITableViewCell {
contentStackView.bottomAnchor.constraint(equalTo: margins.bottomAnchor)
])
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}

private func setupContentView(with item: AutofillLoginListItemViewModel) {
titleLabel.text = item.title
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/DaxDialogs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ final class DaxDialogs {
case .siteIsMajorTracker, .siteOwnedByMajorTracker:
settings.browsingMajorTrackingSiteShown = flag
settings.browsingWithoutTrackersShown = flag
}
}
}

struct BrowsingSpec: Equatable {
Expand Down
4 changes: 0 additions & 4 deletions DuckDuckGo/KeychainItemsDebugViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ private enum SecClass: CaseIterable {

class KeychainItemsDebugViewController: UITableViewController {

override func viewDidLoad() {
super.viewDidLoad()
}

override func numberOfSections(in tableView: UITableView) -> Int {
return SecClass.allCases.count
}
Expand Down
40 changes: 40 additions & 0 deletions DuckDuckGo/NetworkProtectionDebugUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,46 @@ final class NetworkProtectionDebugUtilities {

try? activeSession.sendProviderMessage(.expireRegistrationKey)
}

// MARK: - Notifications

func sendTestNotificationRequest() async throws {
guard let activeSession = try? await ConnectionSessionUtilities.activeSession() else {
return
}

try? activeSession.sendProviderMessage(.triggerTestNotification)
}

// MARK: - Failure Simulation

func triggerSimulation(_ option: NetworkProtectionSimulationOption) async {
guard let activeSession = try? await ConnectionSessionUtilities.activeSession() else {
return
}

guard let message = option.extensionMessage else {
return
}
try? activeSession.sendProviderMessage(message)
}
}

private extension NetworkProtectionSimulationOption {
var extensionMessage: ExtensionMessage? {
switch self {
case .crashFatalError:
return .simulateTunnelFatalError
case .crashMemory:
return .simulateTunnelMemoryOveruse
case .tunnelFailure:
return .simulateTunnelFailure
case .controllerFailure:
return nil
case .connectionInterruption:
return .simulateConnectionInterruption
}
}
}

#endif
Loading

0 comments on commit d84c38d

Please sign in to comment.