mirror of
https://github.com/bitwarden/mobile
synced 2025-12-20 18:23:51 +00:00
[PM-192] Refactor forwarded email providers (#2579)
* PM-192 Refactor Forwarded email providers to use better patterns and code reuse. * PM-192 fix format
This commit is contained in:
committed by
GitHub
parent
3506269811
commit
1014563c75
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Services.EmailForwarders;
|
||||
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
@@ -24,5 +25,33 @@ namespace Bit.Core.Models.Domain
|
||||
public string AnonAddyApiAccessToken { get; set; }
|
||||
public string AnonAddyDomainName { get; set; }
|
||||
public string EmailWebsite { get; set; }
|
||||
|
||||
public ForwarderOptions GetForwarderOptions()
|
||||
{
|
||||
if (Type != UsernameType.ForwardedEmailAlias)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (ServiceType)
|
||||
{
|
||||
case ForwardedEmailServiceType.AnonAddy:
|
||||
return new AnonAddyForwarderOptions
|
||||
{
|
||||
ApiKey = AnonAddyApiAccessToken,
|
||||
DomainName = AnonAddyDomainName
|
||||
};
|
||||
case ForwardedEmailServiceType.DuckDuckGo:
|
||||
return new ForwarderOptions { ApiKey = DuckDuckGoApiKey };
|
||||
case ForwardedEmailServiceType.Fastmail:
|
||||
return new ForwarderOptions { ApiKey = FastMailApiKey };
|
||||
case ForwardedEmailServiceType.FirefoxRelay:
|
||||
return new ForwarderOptions { ApiKey = FirefoxRelayApiAccessToken };
|
||||
case ForwardedEmailServiceType.SimpleLogin:
|
||||
return new ForwarderOptions { ApiKey = SimpleLoginApiKey };
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user