/*
* Copyright (c) 2025 Proton AG
*
* This file is part of ProtonVPN.
*
* ProtonVPN is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonVPN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonVPN. If not, see .
*/
using Microsoft.UI.Xaml.Controls;
using ProtonVPN.Client.Common.Dispatching;
using ProtonVPN.Client.Common.Models;
using ProtonVPN.Client.Core.Services.Activation;
using ProtonVPN.Client.Core.Services.Activation.Bases;
using ProtonVPN.Client.Core.Services.Mapping;
using ProtonVPN.Client.Core.Services.Selection;
using ProtonVPN.Client.Localization.Contracts;
using ProtonVPN.Client.Settings.Contracts;
using ProtonVPN.Client.UI.Overlays.HumanVerification;
using ProtonVPN.Client.UI.Overlays.Information;
using ProtonVPN.Client.UI.Overlays.Information.Notification;
using ProtonVPN.Client.UI.Overlays.Upsell;
using ProtonVPN.Client.UI.Overlays.Welcome;
using ProtonVPN.Client.UI.Overlays.WhatsNew;
using ProtonVPN.Logging.Contracts;
namespace ProtonVPN.Client.Services.Activation;
public class MainWindowOverlayActivator : OverlayActivatorBase, IMainWindowOverlayActivator
{
private readonly ILocalizationProvider _localizer;
public MainWindowOverlayActivator(
ILocalizationProvider localizer,
ILogger logger,
IUIThreadDispatcher uiThreadDispatcher,
IApplicationThemeSelector themeSelector,
ISettings settings,
ILocalizationService localizationService,
IOverlayViewMapper overlayViewMapper)
: base(logger,
uiThreadDispatcher,
themeSelector,
settings,
localizationService,
overlayViewMapper)
{
_localizer = localizer;
}
public Task ShowHumanVerificationOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowSecureCoreInfoOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowDiscardConfirmationOverlayAsync()
{
return ShowMessageAsync(
new MessageDialogParameters
{
Title = _localizer.Get("Settings_DiscardChanges_Confirmation_Title"),
PrimaryButtonText = _localizer.Get("Settings_DiscardChanges_Confirmation_Action"),
CloseButtonText = _localizer.Get("Settings_DiscardChanges_Confirmation_Cancel"),
});
}
public Task ShowSettingsOverriddenByProfileOverlayAsync(string localizedSettingsName)
{
return ShowMessageAsync(
new MessageDialogParameters
{
Title = _localizer.GetFormat("Settings_OverriddenByProfile_Title", localizedSettingsName),
Message = $"{_localizer.Get("Settings_OverriddenByProfile_Description1")}{Environment.NewLine}{Environment.NewLine}{_localizer.Get("Settings_OverriddenByProfile_Description2")}",
PrimaryButtonText = _localizer.Get("Connection_Error_EditProfile"),
CloseButtonText = _localizer.Get("Common_Actions_Close"),
});
}
public Task ShowP2PInfoOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowTorInfoOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowSmartRoutingInfoOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowProfileInfoOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowServerLoadInfoOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowOutdatedClientOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowWelcomeOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowWelcomeToVpnB2BOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowWelcomeToVpnPlusOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowWelcomeToVpnUnlimitedOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowFreeConnectionsOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowWhatsNewOverlayAsync()
{
return ShowOverlayAsync();
}
public Task ShowExcludedLocationsSmartDiscoveryPromptAsync()
{
return ShowMessageAsync(
new MessageDialogParameters
{
Title = _localizer.Get("ExcludedLocations_SmartDiscovery_Prompt_Title"),
Message = _localizer.Get("ExcludedLocations_SmartDiscovery_Prompt_Message"),
PrimaryButtonText = _localizer.Get("ExcludedLocations_SmartDiscovery_Prompt_ExcludeLocations"),
CloseButtonText = _localizer.Get("ExcludedLocations_SmartDiscovery_Prompt_Skip"),
});
}
}