Skip to content

Commit

Permalink
Wire up VPN error UI (#2826)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414235014887631/1207198886354136/f
Tech Design URL:
CC:

Description:

This PR re-enables the VPN error UI. This is done for internal users only.
  • Loading branch information
samsymons authored May 9, 2024
1 parent 768b9de commit d0eb8aa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DuckDuckGo/NetworkProtectionStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private struct NetworkProtectionErrorView: View {
.daxBodyRegular()
.foregroundColor(.primary)
}
.listRowBackground(Color(designSystemColor: .accent))
.listRowBackground(Color(designSystemColor: .surface))
}
}

Expand Down
19 changes: 19 additions & 0 deletions DuckDuckGo/NetworkProtectionStatusViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ final class NetworkProtectionStatusViewModel: ObservableObject {
setUpServerInfoPublishers()
setUpLocationPublishers()
setUpThroughputRefreshTimer()
setUpErrorPublishers()

// Prefetching this now for snappy load times on the locations screens
Task {
Expand Down Expand Up @@ -288,6 +289,24 @@ final class NetworkProtectionStatusViewModel: ObservableObject {
.store(in: &cancellables)
}

private func setUpErrorPublishers() {
guard AppDependencyProvider.shared.internalUserDecider.isInternalUser else {
return
}

errorObserver.publisher
.map { errorMessage in
guard let errorMessage else {
return nil
}

return ErrorItem(title: "Failed to Connect", message: errorMessage)
}
.receive(on: DispatchQueue.main)
.assign(to: \.error, onWeaklyHeld: self)
.store(in: &cancellables)
}

private func setUpLocationPublishers() {
settings.selectedLocationPublisher
.receive(on: DispatchQueue.main)
Expand Down

0 comments on commit d0eb8aa

Please sign in to comment.