1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-05 09:01:11 +01:00

Changed link on Settings "Change Master Password" and "Two Step Login" to go to the web vault settings. Also refactored a bit to reuse the urls (#1809)

This commit is contained in:
Federico Maccaroni 2022-02-24 10:27:08 -03:00 committed by GitHub
parent 9201da8515
commit c74ed668b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 29 deletions

View File

@ -156,7 +156,7 @@ namespace Bit.App.Pages
#endif
return;
}
var webVault = _environmentService.GetWebVaultUrl();
var webVault = _environmentService.GetWebVaultUrl(true);
if (string.IsNullOrWhiteSpace(webVault))
{
webVault = "https://bitwarden.com";

View File

@ -27,13 +27,11 @@ namespace Bit.App.Pages
captchaRequiredText = AppResources.CaptchaRequired,
});
var url = environmentService.GetWebVaultUrl();
if (url == null)
{
url = "https://vault.bitwarden.com";
}
url += "/captcha-mobile-connector.html?" + "data=" + data +
"&parent=" + Uri.EscapeDataString(callbackUri) + "&v=1";
var url = environmentService.GetWebVaultUrl() +
"/captcha-mobile-connector.html?" +
"data=" + data +
"&parent=" + Uri.EscapeDataString(callbackUri) +
"&v=1";
WebAuthenticatorResult authResult = null;
bool cancelled = false;

View File

@ -190,12 +190,7 @@ namespace Bit.App.Pages
public void WebVault()
{
var url = _environmentService.GetWebVaultUrl();
if (url == null)
{
url = "https://vault.bitwarden.com";
}
_platformUtilsService.LaunchUri(url);
_platformUtilsService.LaunchUri(_environmentService.GetWebVaultUrl());
}
public async Task ShareAsync()
@ -214,7 +209,7 @@ namespace Bit.App.Pages
AppResources.TwoStepLogin, AppResources.Yes, AppResources.Cancel);
if (confirmed)
{
_platformUtilsService.LaunchUri("https://bitwarden.com/help/setup-two-step-login/");
_platformUtilsService.LaunchUri($"{_environmentService.GetWebVaultUrl()}/#/settings");
}
}
@ -224,7 +219,7 @@ namespace Bit.App.Pages
AppResources.ChangeMasterPassword, AppResources.Yes, AppResources.Cancel);
if (confirmed)
{
_platformUtilsService.LaunchUri("https://bitwarden.com/help/master-password/#change-your-master-password");
_platformUtilsService.LaunchUri($"{_environmentService.GetWebVaultUrl()}/#/settings");
}
}

View File

@ -225,12 +225,7 @@ namespace Bit.App.Utilities
private static string GetSendUrl(SendView send)
{
var environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
var webVaultUrl = environmentService.GetWebVaultUrl();
if (webVaultUrl != null)
{
return webVaultUrl + "/#/send/" + send.AccessId + "/" + send.UrlB64Key;
}
return "https://send.bitwarden.com/#" + send.AccessId + "/" + send.UrlB64Key;
return environmentService.GetWebSendUrl() + send.AccessId + "/" + send.UrlB64Key;
}
public static async Task<bool> RemoveSendPasswordAsync(string sendId)

View File

@ -13,7 +13,8 @@ namespace Bit.Core.Abstractions
string WebVaultUrl { get; set; }
string EventsUrl { get; set; }
string GetWebVaultUrl();
string GetWebVaultUrl(bool returnNullIfDefault = false);
string GetWebSendUrl();
Task<EnvironmentUrlData> SetUrlsAsync(EnvironmentUrlData urls);
Task SetUrlsFromStorageAsync();
}

View File

@ -1,13 +1,16 @@
using Bit.Core.Abstractions;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Bit.Core.Abstractions;
using Bit.Core.Models.Data;
using Bit.Core.Models.Domain;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Bit.Core.Services
{
public class EnvironmentService : IEnvironmentService
{
private const string DEFAULT_WEB_VAULT_URL = "https://vault.bitwarden.com";
private const string DEFAULT_WEB_SEND_URL = "https://send.bitwarden.com/#";
private readonly IApiService _apiService;
private readonly IStateService _stateService;
@ -27,17 +30,24 @@ namespace Bit.Core.Services
public string NotificationsUrl { get; set; }
public string EventsUrl { get; set; }
public string GetWebVaultUrl()
public string GetWebVaultUrl(bool returnNullIfDefault = false)
{
if (!string.IsNullOrWhiteSpace(WebVaultUrl))
{
return WebVaultUrl;
}
else if (!string.IsNullOrWhiteSpace(BaseUrl))
if (!string.IsNullOrWhiteSpace(BaseUrl))
{
return BaseUrl;
}
return null;
return returnNullIfDefault ? (string)null : DEFAULT_WEB_VAULT_URL;
}
public string GetWebSendUrl()
{
return GetWebVaultUrl(true) is string webVaultUrl ? $"{webVaultUrl}/#/send/" : DEFAULT_WEB_SEND_URL;
}
public async Task SetUrlsFromStorageAsync()