Skip to content

Commit

Permalink
Check purchased state when service is launched
Browse files Browse the repository at this point in the history
Connection state is queried when purchased state is loaded and
it's purchased user.

fix brave/brave-browser#22677
fix brave/brave-browser#22726
fix brave/brave-browser#23080
  • Loading branch information
simonhong committed May 27, 2022
1 parent 6387cfd commit 6febc9d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/brave_vpn/brave_vpn_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ BraveVpnService::BraveVpnService(
observed_.Observe(GetBraveVPNConnectionAPI());

GetBraveVPNConnectionAPI()->set_target_vpn_entry_name(kBraveVPNEntryName);

LoadPurchasedState();
}
#endif

Expand Down Expand Up @@ -227,6 +229,12 @@ void BraveVpnService::UpdateAndNotifyConnectionStateChange(
<< state;

connection_state_ = state;

// Don't need to notify connection state change for non purchased state.
// This can be happened when user controls vpn settings via os.
if (!is_purchased_user())
return;

for (const auto& obs : observers_)
obs->OnConnectionStateChanged(connection_state_);
}
Expand Down

0 comments on commit 6febc9d

Please sign in to comment.