mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
Reverted AnonAddy to AddyIo refactor, keeping text and url changes
This commit is contained in:
@@ -269,15 +269,15 @@
|
||||
Grid.Column="1"
|
||||
AutomationId="ShowForwardedEmailApiSecretButton" />
|
||||
</Grid>
|
||||
<Label IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.AddyIo}}"
|
||||
<Label IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.AnonAddy}}"
|
||||
Text="{u:I18n DomainNameRequiredParenthesis}"
|
||||
StyleClass="box-label"
|
||||
Margin="0,10,0,0"/>
|
||||
<Entry IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.AddyIo}}"
|
||||
x:Name="_addyIoDomainNameEntry"
|
||||
<Entry IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.AnonAddy}}"
|
||||
x:Name="_anonAddyDomainNameEntry"
|
||||
Text="{Binding AddyIoDomainName}"
|
||||
StyleClass="box-value"
|
||||
AutomationId="AddyIoDomainNameEntry" />
|
||||
AutomationId="AnonAddyDomainNameEntry" />
|
||||
</StackLayout>
|
||||
<!--RANDOM WORD OPTIONS-->
|
||||
<Grid IsVisible="{Binding UsernameTypeSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:UsernameType.RandomWord}}">
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Bit.App.Pages
|
||||
};
|
||||
|
||||
ForwardedEmailServiceTypeOptions = new List<ForwardedEmailServiceType> {
|
||||
ForwardedEmailServiceType.AddyIo,
|
||||
ForwardedEmailServiceType.AnonAddy,
|
||||
ForwardedEmailServiceType.DuckDuckGo,
|
||||
ForwardedEmailServiceType.Fastmail,
|
||||
ForwardedEmailServiceType.FirefoxRelay,
|
||||
@@ -451,8 +451,8 @@ namespace Bit.App.Pages
|
||||
{
|
||||
switch (ForwardedEmailServiceSelected)
|
||||
{
|
||||
case ForwardedEmailServiceType.AddyIo:
|
||||
return _usernameOptions.AddyIoApiAccessToken;
|
||||
case ForwardedEmailServiceType.AnonAddy:
|
||||
return _usernameOptions.AnonAddyApiAccessToken;
|
||||
case ForwardedEmailServiceType.DuckDuckGo:
|
||||
return _usernameOptions.DuckDuckGoApiKey;
|
||||
case ForwardedEmailServiceType.Fastmail:
|
||||
@@ -470,10 +470,10 @@ namespace Bit.App.Pages
|
||||
bool changed = false;
|
||||
switch (ForwardedEmailServiceSelected)
|
||||
{
|
||||
case ForwardedEmailServiceType.AddyIo:
|
||||
if (_usernameOptions.AddyIoApiAccessToken != value)
|
||||
case ForwardedEmailServiceType.AnonAddy:
|
||||
if (_usernameOptions.AnonAddyApiAccessToken != value)
|
||||
{
|
||||
_usernameOptions.AddyIoApiAccessToken = value;
|
||||
_usernameOptions.AnonAddyApiAccessToken = value;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
@@ -523,7 +523,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
switch (ForwardedEmailServiceSelected)
|
||||
{
|
||||
case ForwardedEmailServiceType.AddyIo:
|
||||
case ForwardedEmailServiceType.AnonAddy:
|
||||
case ForwardedEmailServiceType.FirefoxRelay:
|
||||
return AppResources.APIAccessToken;
|
||||
case ForwardedEmailServiceType.DuckDuckGo:
|
||||
@@ -547,12 +547,12 @@ namespace Bit.App.Pages
|
||||
|
||||
public string AddyIoDomainName
|
||||
{
|
||||
get => _usernameOptions.AddyIoDomainName;
|
||||
get => _usernameOptions.AnonAddyDomainName;
|
||||
set
|
||||
{
|
||||
if (_usernameOptions.AddyIoDomainName != value)
|
||||
if (_usernameOptions.AnonAddyDomainName != value)
|
||||
{
|
||||
_usernameOptions.AddyIoDomainName = value;
|
||||
_usernameOptions.AnonAddyDomainName = value;
|
||||
TriggerPropertyChanged(nameof(AddyIoDomainName));
|
||||
SaveUsernameOptionsAsync(false).FireAndForget();
|
||||
}
|
||||
@@ -832,7 +832,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
if (ex is ForwardedEmailInvalidSecretException)
|
||||
{
|
||||
message = ForwardedEmailServiceSelected == ForwardedEmailServiceType.AddyIo || ForwardedEmailServiceSelected == ForwardedEmailServiceType.FirefoxRelay
|
||||
message = ForwardedEmailServiceSelected == ForwardedEmailServiceType.AnonAddy || ForwardedEmailServiceSelected == ForwardedEmailServiceType.FirefoxRelay
|
||||
? AppResources.InvalidAPIToken
|
||||
: AppResources.InvalidAPIKey;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Bit.Core.Enums
|
||||
{
|
||||
None = -1,
|
||||
[LocalizableEnum("AddyIo")]
|
||||
AddyIo = 0,
|
||||
AnonAddy = 0,
|
||||
[LocalizableEnum("FirefoxRelay")]
|
||||
FirefoxRelay = 1,
|
||||
[LocalizableEnum("SimpleLogin")]
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Bit.Core.Models.Domain
|
||||
public string SimpleLoginApiKey { get; set; }
|
||||
public string DuckDuckGoApiKey { get; set; }
|
||||
public string FastMailApiKey { get; set; }
|
||||
public string AddyIoApiAccessToken { get; set; }
|
||||
public string AddyIoDomainName { get; set; }
|
||||
public string AnonAddyApiAccessToken { get; set; }
|
||||
public string AnonAddyDomainName { get; set; }
|
||||
public string EmailWebsite { get; set; }
|
||||
|
||||
public ForwarderOptions GetForwarderOptions()
|
||||
@@ -35,11 +35,11 @@ namespace Bit.Core.Models.Domain
|
||||
|
||||
switch (ServiceType)
|
||||
{
|
||||
case ForwardedEmailServiceType.AddyIo:
|
||||
return new AddyIoForwarderOptions
|
||||
case ForwardedEmailServiceType.AnonAddy:
|
||||
return new AnonAddyForwarderOptions
|
||||
{
|
||||
ApiKey = AddyIoApiAccessToken,
|
||||
DomainName = AddyIoDomainName
|
||||
ApiKey = AnonAddyApiAccessToken,
|
||||
DomainName = AnonAddyDomainName
|
||||
};
|
||||
case ForwardedEmailServiceType.DuckDuckGo:
|
||||
return new ForwarderOptions { ApiKey = DuckDuckGoApiKey };
|
||||
|
||||
@@ -7,26 +7,26 @@ using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Bit.Core.Services.EmailForwarders
|
||||
{
|
||||
public class AddyIoForwarderOptions : ForwarderOptions
|
||||
public class AnonAddyForwarderOptions : ForwarderOptions
|
||||
{
|
||||
public string DomainName { get; set; }
|
||||
}
|
||||
|
||||
public class AddyIoForwarder : BaseForwarder<AddyIoForwarderOptions>
|
||||
public class AnonAddyForwarder : BaseForwarder<AnonAddyForwarderOptions>
|
||||
{
|
||||
protected override string RequestUri => "https://app.addy.io/api/v1/aliases";
|
||||
|
||||
protected override bool CanGenerate(AddyIoForwarderOptions options)
|
||||
protected override bool CanGenerate(AnonAddyForwarderOptions options)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(options.ApiKey) && !string.IsNullOrWhiteSpace(options.DomainName);
|
||||
}
|
||||
|
||||
protected override void ConfigureHeaders(HttpRequestHeaders headers, AddyIoForwarderOptions options)
|
||||
protected override void ConfigureHeaders(HttpRequestHeaders headers, AnonAddyForwarderOptions options)
|
||||
{
|
||||
headers.Add("Authorization", $"Bearer {options.ApiKey}");
|
||||
}
|
||||
|
||||
protected override Task<HttpContent> GetContentAsync(IApiService apiService, AddyIoForwarderOptions options)
|
||||
protected override Task<HttpContent> GetContentAsync(IApiService apiService, AnonAddyForwarderOptions options)
|
||||
{
|
||||
return Task.FromResult<HttpContent>(new FormUrlEncodedContent(new Dictionary<string, string>
|
||||
{
|
||||
@@ -135,10 +135,10 @@ namespace Bit.Core.Services
|
||||
|
||||
private async Task<string> GenerateForwardedEmailAliasAsync(UsernameGenerationOptions options)
|
||||
{
|
||||
if (options.ServiceType == ForwardedEmailServiceType.AddyIo)
|
||||
if (options.ServiceType == ForwardedEmailServiceType.AnonAddy)
|
||||
{
|
||||
return await new AddyIoForwarder()
|
||||
.GenerateAsync(_apiService, (AddyIoForwarderOptions)options.GetForwarderOptions());
|
||||
return await new AnonAddyForwarder()
|
||||
.GenerateAsync(_apiService, (AnonAddyForwarderOptions)options.GetForwarderOptions());
|
||||
}
|
||||
|
||||
BaseForwarder<ForwarderOptions> simpleForwarder = null;
|
||||
|
||||
Reference in New Issue
Block a user