mirror of
https://github.com/bitwarden/mobile
synced 2025-12-11 05:43:30 +00:00
PM-3298 Updated region selector to be logging in on and also its options (#2657)
This commit is contained in:
committed by
GitHub
parent
c4e64e082b
commit
c34d1da6e6
@@ -7,17 +7,17 @@ using Bit.App.Utilities;
|
|||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Models.Data;
|
using Bit.Core.Models.Data;
|
||||||
using Bit.Core.Models.Response;
|
|
||||||
using Bit.Core.Services;
|
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
using Xamarin.Essentials;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
public class HomeViewModel : BaseViewModel
|
public class HomeViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
|
private const string LOGGING_IN_ON_US = "bitwarden.com";
|
||||||
|
private const string LOGGING_IN_ON_EU = "bitwarden.eu";
|
||||||
|
|
||||||
private readonly IStateService _stateService;
|
private readonly IStateService _stateService;
|
||||||
private readonly IMessagingService _messagingService;
|
private readonly IMessagingService _messagingService;
|
||||||
private readonly IPlatformUtilsService _platformUtilsService;
|
private readonly IPlatformUtilsService _platformUtilsService;
|
||||||
@@ -30,8 +30,6 @@ namespace Bit.App.Pages
|
|||||||
private bool _rememberEmail;
|
private bool _rememberEmail;
|
||||||
private string _email;
|
private string _email;
|
||||||
private string _selectedEnvironmentName;
|
private string _selectedEnvironmentName;
|
||||||
private bool _isEmailEnabled;
|
|
||||||
private bool _canLogin;
|
|
||||||
private bool _displayEuEnvironment;
|
private bool _displayEuEnvironment;
|
||||||
|
|
||||||
public HomeViewModel()
|
public HomeViewModel()
|
||||||
@@ -86,7 +84,7 @@ namespace Bit.App.Pages
|
|||||||
set => SetProperty(ref _selectedEnvironmentName, value);
|
set => SetProperty(ref _selectedEnvironmentName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RegionText => $"{AppResources.Region}:";
|
public string RegionText => $"{AppResources.LoggingInOn}:";
|
||||||
public bool CanContinue => !string.IsNullOrEmpty(Email);
|
public bool CanContinue => !string.IsNullOrEmpty(Email);
|
||||||
|
|
||||||
public FormattedString CreateAccountText
|
public FormattedString CreateAccountText
|
||||||
@@ -167,12 +165,12 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
_displayEuEnvironment = await _configService.GetFeatureFlagBoolAsync(Constants.DisplayEuEnvironmentFlag);
|
_displayEuEnvironment = await _configService.GetFeatureFlagBoolAsync(Constants.DisplayEuEnvironmentFlag);
|
||||||
var options = _displayEuEnvironment
|
var options = _displayEuEnvironment
|
||||||
? new string[] { AppResources.US, AppResources.EU, AppResources.SelfHosted }
|
? new string[] { LOGGING_IN_ON_US, LOGGING_IN_ON_EU, AppResources.SelfHosted }
|
||||||
: new string[] { AppResources.US, AppResources.SelfHosted };
|
: new string[] { LOGGING_IN_ON_US, AppResources.SelfHosted };
|
||||||
|
|
||||||
await Device.InvokeOnMainThreadAsync(async () =>
|
await Device.InvokeOnMainThreadAsync(async () =>
|
||||||
{
|
{
|
||||||
var result = await Page.DisplayActionSheet(AppResources.DataRegion, AppResources.Cancel, null, options);
|
var result = await Page.DisplayActionSheet(AppResources.LoggingInOn, AppResources.Cancel, null, options);
|
||||||
|
|
||||||
if (result is null || result == AppResources.Cancel)
|
if (result is null || result == AppResources.Cancel)
|
||||||
{
|
{
|
||||||
@@ -185,7 +183,7 @@ namespace Bit.App.Pages
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _environmentService.SetUrlsAsync(result == AppResources.EU ? EnvironmentUrlData.DefaultEU : EnvironmentUrlData.DefaultUS);
|
await _environmentService.SetUrlsAsync(result == LOGGING_IN_ON_EU ? EnvironmentUrlData.DefaultEU : EnvironmentUrlData.DefaultUS);
|
||||||
await _configService.GetAsync(true);
|
await _configService.GetAsync(true);
|
||||||
SelectedEnvironmentName = result;
|
SelectedEnvironmentName = result;
|
||||||
});
|
});
|
||||||
@@ -198,17 +196,17 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
await _environmentService.SetUrlsAsync(EnvironmentUrlData.DefaultUS);
|
await _environmentService.SetUrlsAsync(EnvironmentUrlData.DefaultUS);
|
||||||
environmentsSaved = EnvironmentUrlData.DefaultUS;
|
environmentsSaved = EnvironmentUrlData.DefaultUS;
|
||||||
SelectedEnvironmentName = AppResources.US;
|
SelectedEnvironmentName = LOGGING_IN_ON_US;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environmentsSaved.Base == EnvironmentUrlData.DefaultUS.Base)
|
if (environmentsSaved.Base == EnvironmentUrlData.DefaultUS.Base)
|
||||||
{
|
{
|
||||||
SelectedEnvironmentName = AppResources.US;
|
SelectedEnvironmentName = LOGGING_IN_ON_US;
|
||||||
}
|
}
|
||||||
else if (environmentsSaved.Base == EnvironmentUrlData.DefaultEU.Base)
|
else if (environmentsSaved.Base == EnvironmentUrlData.DefaultEU.Base)
|
||||||
{
|
{
|
||||||
SelectedEnvironmentName = AppResources.EU;
|
SelectedEnvironmentName = LOGGING_IN_ON_EU;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
11
src/App/Resources/AppResources.Designer.cs
generated
11
src/App/Resources/AppResources.Designer.cs
generated
@@ -3721,6 +3721,15 @@ namespace Bit.App.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Logging in on.
|
||||||
|
/// </summary>
|
||||||
|
public static string LoggingInOn {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LoggingInOn", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Log In.
|
/// Looks up a localized string similar to Log In.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -6269,10 +6278,10 @@ namespace Bit.App.Resources {
|
|||||||
public static string ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem {
|
public static string ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem", resourceCulture);
|
return ResourceManager.GetString("ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem", resourceCulture);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// Looks up a localized string similar to There are no blocked URIs.
|
/// Looks up a localized string similar to There are no blocked URIs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ThereAreNoBlockedURIs {
|
public static string ThereAreNoBlockedURIs {
|
||||||
|
|||||||
@@ -2714,4 +2714,7 @@ Do you want to switch to this account?</value>
|
|||||||
<data name="CannotEditMultipleURIsAtOnce" xml:space="preserve">
|
<data name="CannotEditMultipleURIsAtOnce" xml:space="preserve">
|
||||||
<value>Cannot edit multiple URIs at once</value>
|
<value>Cannot edit multiple URIs at once</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LoggingInOn" xml:space="preserve">
|
||||||
|
<value>Logging in on</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
Reference in New Issue
Block a user