Skip to content

Commit f6801f0

Browse files
Mindaugas VeblauskasLukas Makaravicius
Mindaugas Veblauskas
authored and
Lukas Makaravicius
committed
Fetch logicals on free plan rescope
1 parent 96a70d8 commit f6801f0

File tree

7 files changed

+18
-27
lines changed

7 files changed

+18
-27
lines changed

src/ProtonVPN.App/Windows/Popups/FreeRescope/FreeRescopePopupView.xaml src/ProtonVPN.App/Modals/FreeRescopeModalView.xaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@ You should have received a copy of the GNU General Public License
1717
along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
1818
-->
1919

20-
<resource:BasePopupWindow x:Class="ProtonVPN.Windows.Popups.FreeRescope.FreeRescopePopupView"
20+
<resource:BaseModalWindow x:Class="ProtonVPN.Modals.FreeRescopeModalView"
2121
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2222
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2323
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2424
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
2525
xmlns:resource="clr-namespace:ProtonVPN.Resource;assembly=ProtonVPN.Resource"
26-
xmlns:rebranding="clr-namespace:ProtonVPN.Windows.Popups.Rebranding"
2726
xmlns:translations="clr-namespace:ProtonVPN.Translations;assembly=ProtonVPN.Translations"
2827
mc:Ignorable="d"
2928
Title=" "
3029
Width="657"
3130
Height="Auto"
3231
SizeToContent="Height"
33-
d:DataContext="{d:DesignInstance rebranding:RebrandingPopupViewModel}"
34-
Style="{StaticResource BasePopupWindowStyle}">
35-
<resource:BasePopupWindow.Resources>
32+
Style="{StaticResource BaseWindowStyle}">
33+
<resource:BaseModalWindow.Resources>
3634
<Style x:Key="ItemTitle" TargetType="TextBlock">
3735
<Setter Property="FontSize" Value="16" />
3836
<Setter Property="Margin" Value="0,24,0,8" />
@@ -46,7 +44,7 @@ along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
4644
<Setter Property="Foreground" Value="{StaticResource TextWeakBrushColor}" />
4745
<Setter Property="TextWrapping" Value="Wrap" />
4846
</Style>
49-
</resource:BasePopupWindow.Resources>
47+
</resource:BaseModalWindow.Resources>
5048
<StackPanel HorizontalAlignment="Center"
5149
Margin="64">
5250
<Image Source="pack://application:,,,/ProtonVPN.Resource;component/Graphics/Images/brand-logo-box.png"
@@ -74,4 +72,4 @@ along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
7472
Command="{Binding CloseCommand}"
7573
Content="{translations:Loc Modals_Rescope_btn_GotIt}" />
7674
</StackPanel>
77-
</resource:BasePopupWindow>
75+
</resource:BaseModalWindow>

src/ProtonVPN.App/Windows/Popups/FreeRescope/FreeRescopePopupView.xaml.cs src/ProtonVPN.App/Modals/FreeRescopeModalView.xaml.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
* along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
1818
*/
1919

20-
namespace ProtonVPN.Windows.Popups.FreeRescope
20+
namespace ProtonVPN.Modals
2121
{
22-
public partial class FreeRescopePopupView
22+
public partial class FreeRescopeModalView
2323
{
24-
public FreeRescopePopupView()
24+
public FreeRescopeModalView()
2525
{
2626
InitializeComponent();
2727
}

src/ProtonVPN.App/Windows/Popups/FreeRescope/FreeRescopePopupViewModel.cs src/ProtonVPN.App/Modals/FreeRescopeModalViewModel.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
* along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
1818
*/
1919

20-
namespace ProtonVPN.Windows.Popups.FreeRescope
20+
namespace ProtonVPN.Modals
2121
{
22-
public class FreeRescopePopupViewModel : BasePopupViewModel
22+
public class FreeRescopeModalViewModel : BaseModalViewModel
2323
{
24-
public FreeRescopePopupViewModel(AppWindow appWindow) : base(appWindow)
25-
{
26-
}
2724
}
2825
}

src/ProtonVPN.App/Modals/Welcome/WelcomeModalManager.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
using ProtonVPN.Core.Settings;
2828
using ProtonVPN.Core.Windows.Popups;
2929
using ProtonVPN.Modals.Upsell;
30-
using ProtonVPN.Windows.Popups.FreeRescope;
3130
using ProtonVPN.Windows.Popups.Offers;
3231
using ProtonVPN.Windows.Popups.Rebranding;
3332

@@ -75,19 +74,19 @@ public void Load()
7574
}
7675
else if (IsToShowFreeRescopePopup)
7776
{
78-
ShowFreeRescopePopup();
77+
ShowFreeRescopeModal();
7978
}
8079
else if (!user.Paid() && !_userStorage.GetUser().IsDelinquent())
8180
{
8281
ShowUpsellModal();
8382
}
8483
}
8584

86-
private void ShowFreeRescopePopup()
85+
private async void ShowFreeRescopeModal()
8786
{
8887
if (_appSettings.WelcomeModalShown)
8988
{
90-
_popupWindows.Show<FreeRescopePopupViewModel>();
89+
await _modals.ShowAsync<FreeRescopeModalViewModel>();
9190
_appSettings.IsFreeRescopeModalDisplayed = true;
9291
}
9392
}
@@ -157,7 +156,7 @@ public void OnAppSettingsChanged(PropertyChangedEventArgs e)
157156
{
158157
if (e.PropertyName == nameof(IAppSettings.FeatureFreeRescopeEnabled) && IsToShowFreeRescopePopup)
159158
{
160-
ShowFreeRescopePopup();
159+
ShowFreeRescopeModal();
161160
}
162161
}
163162
}

src/ProtonVPN.App/Sidebar/Countries.xaml

+2
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
466466
Height="20" />
467467
<TextBlock x:Name="CountryLabel"
468468
Text="{Binding Name}"
469+
FontSize="16"
469470
Style="{StaticResource CountrySeparator}"
471+
Foreground="{StaticResource TextNormBrushColor}"
470472
TextTrimming="CharacterEllipsis" />
471473
</DockPanel>
472474
<Button Style="{StaticResource SidebarCountryConnectButton}"

src/ProtonVPN.App/Views/Controls/UpsellBanner.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
4242
</Grid.ColumnDefinitions>
4343
<Image Grid.Column="0"
4444
Width="48"
45+
VerticalAlignment="Top"
4546
Source="{Binding ImagePath, ElementName=UserControl, TargetNullValue={x:Null}}" />
4647
<TextBlock Grid.Column="1"
4748
Text="{Binding Title, ElementName=UserControl}"

src/ProtonVPN.Core/Servers/ServerUpdater.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
using ProtonVPN.Api.Contracts.Servers;
2626
using ProtonVPN.Common.Configuration;
2727
using ProtonVPN.Common.Extensions;
28-
using ProtonVPN.Common.Networking;
2928
using ProtonVPN.Common.Threading;
3029
using ProtonVPN.Core.Auth;
3130
using ProtonVPN.Core.Servers.FileStoraging;
@@ -42,7 +41,6 @@ public class ServerUpdater : IServerUpdater, ILoggedInAware, ILogoutAware, ISett
4241
private readonly SingleAction _updateAction;
4342
private readonly IAppSettings _appSettings;
4443

45-
private VpnProtocol _lastVpnProtocol;
4644
private bool _firstTime = true;
4745

4846
public ServerUpdater(
@@ -72,7 +70,6 @@ public ServerUpdater(
7270
public void OnUserLoggedIn()
7371
{
7472
_timer.Start();
75-
_lastVpnProtocol = _appSettings.GetProtocol();
7673
}
7774

7875
public void OnUserLoggedOut()
@@ -141,12 +138,9 @@ private void InvokeServersUpdated()
141138

142139
public void OnAppSettingsChanged(PropertyChangedEventArgs e)
143140
{
144-
if (e.PropertyName == nameof(IAppSettings.OvpnProtocol) &&
145-
_lastVpnProtocol == VpnProtocol.WireGuard && _appSettings.GetProtocol() != VpnProtocol.WireGuard ||
146-
_lastVpnProtocol != VpnProtocol.WireGuard && _appSettings.GetProtocol() == VpnProtocol.WireGuard)
141+
if (e.PropertyName == nameof(IAppSettings.FeatureFreeRescopeEnabled))
147142
{
148143
_updateAction.Run();
149-
_lastVpnProtocol = _appSettings.GetProtocol();
150144
}
151145
}
152146
}

0 commit comments

Comments
 (0)