Skip to content

Commit

Permalink
Updates BSK
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoreymendez committed Feb 22, 2024
1 parent d0e23b4 commit 59d48b9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
6 changes: 2 additions & 4 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3805,7 +3805,6 @@
7BB108572A43375D000AB95F /* PFMoveApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFMoveApplication.h; sourceTree = "<group>"; };
7BB108582A43375D000AB95F /* PFMoveApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFMoveApplication.m; sourceTree = "<group>"; };
7BBD45B02A691AB500C83CA9 /* NetworkProtectionDebugUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionDebugUtilities.swift; sourceTree = "<group>"; };
7BC0F96E2B86514500742C0C /* BrowserServicesKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = BrowserServicesKit; path = ../../BrowserServicesKit; sourceTree = "<group>"; };
7BD01C182AD8319C0088B32E /* IPCServiceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPCServiceManager.swift; sourceTree = "<group>"; };
7BD1688D2AD4A4C400D24876 /* NetworkExtensionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkExtensionController.swift; sourceTree = "<group>"; };
7BD3AF5C2A8E7AF1006F9F56 /* KeychainType+ClientDefault.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KeychainType+ClientDefault.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5075,7 +5074,6 @@
378E279C2970217400FCADA2 /* LocalPackages */ = {
isa = PBXGroup;
children = (
7BC0F96E2B86514500742C0C /* BrowserServicesKit */,
378E279D2970217400FCADA2 /* BuildToolPlugins */,
3192A2702A4C4E330084EA89 /* DataBrokerProtection */,
9DB6E7222AA0DA7A00A17F3C /* LoginItems */,
Expand Down Expand Up @@ -13380,8 +13378,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 109.0.0;
kind = revision;
revision = f730645572928152da571bbfb31f738a51c71d42;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"version" : "3.0.0"
}
},
{
"identity" : "browserserviceskit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "f730645572928152da571bbfb31f738a51c71d42"
}
},
{
"identity" : "content-scope-scripts",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
providerEvents: Self.packetTunnelProviderEvents,
settings: settings)

observeConnectionStatusChanges()
observeServerChanges()
observeStatusUpdateRequests()
}
Expand All @@ -247,12 +246,11 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {

/// Observe connection status changes to broadcast those changes through distributed notifications.
///
private func observeConnectionStatusChanges() {
connectionStatusPublisher.sink { [weak self] status in
self?.lastStatusChangeDate = Date()
self?.broadcast(status)
}
.store(in: &cancellables)
public override func handleConnectionStatusChange(old: ConnectionStatus, new: ConnectionStatus) {
super.handleConnectionStatusChange(old: old, new: new)

lastStatusChangeDate = Date()
broadcast(new)
}

/// Observe server changes to broadcast those changes through distributed notifications.
Expand All @@ -271,8 +269,12 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
///
private func observeStatusUpdateRequests() {
notificationCenter.publisher(for: .requestStatusUpdate).sink { [weak self] _ in
self?.broadcastConnectionStatus()
self?.broadcastLastSelectedServerInfo()
guard let self else { return }

Task { @MainActor in
self.broadcastConnectionStatus()
self.broadcastLastSelectedServerInfo()
}
}
.store(in: &cancellables)
}
Expand All @@ -281,6 +283,7 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {

/// Broadcasts the current connection status.
///
@MainActor
private func broadcastConnectionStatus() {
broadcast(connectionStatus)
}
Expand Down

0 comments on commit 59d48b9

Please sign in to comment.