Skip to content

Commit

Permalink
Reenable toggle on disallowing vpn (#2404) (#2416)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/0/1206463994034099/f

Description:

When “Don’t Allow” is tapped, the dialog is dismissed and the toggle is greyed out. We have to back out of the screen and reopen the VPN screen to give it another attempt.

Reenable the button again when the VPN permission is denied.

This can be solved by simply reenabling the toggle after it’s been disabled for 2 seconds, something we were already sort of doing to stop spamming. This just slightly reworks the logic to cover more scenarios.
  • Loading branch information
samsymons authored Jan 30, 2024
1 parent 056bb91 commit 942386c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion DuckDuckGo/NetworkProtectionStatusViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ final class NetworkProtectionStatusViewModel: ObservableObject {

// Set up a delayed publisher to fire just once that reenables the toggle
// Each event cancels the previous delayed publisher
isLoadingPublisher
$shouldDisableToggle
.filter { $0 }
.map {
Just(!$0)
Expand Down

0 comments on commit 942386c

Please sign in to comment.