/*
* Copyright (c) 2024 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 ProtonVPN.Client.Common.Dispatching;
using ProtonVPN.Client.Core.Enums;
using ProtonVPN.Client.Core.Services.Mapping;
using ProtonVPN.Client.Core.Services.Navigation;
using ProtonVPN.Client.Core.Services.Navigation.Bases;
using ProtonVPN.Client.UI.Dialogs.Upsell.Features;
using ProtonVPN.Logging.Contracts;
namespace ProtonVPN.Client.Services.Navigation;
public class UpsellCarouselViewNavigator : ViewNavigatorBase, IUpsellCarouselViewNavigator
{
public override FrameLoadedBehavior LoadBehavior { get; protected set; } = FrameLoadedBehavior.NavigateToDefaultViewIfEmpty;
public UpsellCarouselViewNavigator(
ILogger logger,
IPageViewMapper pageViewMapper,
IUIThreadDispatcher uiThreadDispatcher)
: base(logger, pageViewMapper, uiThreadDispatcher)
{ }
public Task NavigateToFeatureViewAsync(UpsellFeatureType? upsellFeatureType)
{
return upsellFeatureType switch
{
UpsellFeatureType.WorldwideCoverage => NavigateToWorldwideCoverageViewAsync(),
UpsellFeatureType.Speed => NavigateToSpeedViewAsync(),
UpsellFeatureType.Streaming => NavigateToStreamingViewAsync(),
UpsellFeatureType.NetShield => NavigateToNetShieldViewAsync(),
UpsellFeatureType.SecureCore => NavigateToSecureCoreViewAsync(),
UpsellFeatureType.P2P => NavigateToP2PViewAsync(),
UpsellFeatureType.MultipleDevices => NavigateToMultipleDevicesViewAsync(),
UpsellFeatureType.Tor => NavigateToTorViewAsync(),
UpsellFeatureType.SplitTunneling => NavigateToSplitTunnelingViewAsync(),
UpsellFeatureType.Profiles => NavigateToProfilesViewAsync(),
UpsellFeatureType.AdvancedSettings
or UpsellFeatureType.CustomDns
or UpsellFeatureType.ModerateNat
or UpsellFeatureType.AllowLanConnections => NavigateToAdvancedSettingsViewAsync(),
_ => NavigateToDefaultAsync(),
};
}
public override Task NavigateToDefaultAsync()
{
return NavigateToFeatureViewAsync(UpsellFeatureType.WorldwideCoverage);
}
private Task NavigateToWorldwideCoverageViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToSpeedViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToStreamingViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToNetShieldViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToSecureCoreViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToP2PViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToMultipleDevicesViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToTorViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToSplitTunnelingViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToProfilesViewAsync()
{
return NavigateToAsync();
}
private Task NavigateToAdvancedSettingsViewAsync()
{
return NavigateToAsync();
}
}