generated from nventive/Template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Refactor Some Native Platform Classes
- Loading branch information
Showing
37 changed files
with
328 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/app/ApplicationTemplate.Access/Configuration/NativePlatformConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace ApplicationTemplate.DataAccess; | ||
|
||
/// <summary> | ||
/// This class is used for native platform configuration. | ||
/// - Configures native platform repositories. | ||
/// </summary> | ||
public static class NativePlatformConfiguration | ||
{ | ||
/// <summary> | ||
/// Adds the native platform repositories to the <see cref="IServiceCollection"/>. | ||
/// </summary> | ||
/// <param name="services">Service collection.</param> | ||
/// <returns><see cref="IServiceCollection"/>.</returns> | ||
public static IServiceCollection AddNativePlaformRepositories(this IServiceCollection services) | ||
{ | ||
return services | ||
.AddSingleton<IConnectivityRepository, MockedConnectivityRepository>() | ||
.AddSingleton<IEmailRepository, MockedEmailRepository>(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...nectivity/ConnectivityChangedEventArgs.cs → ...nectivity/ConnectivityChangedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/app/ApplicationTemplate.Access/NativePlatform/Connectivity/IConnectivityRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
|
||
namespace ApplicationTemplate.DataAccess; | ||
|
||
/// <summary> | ||
/// Provides access to the current network state and detects changes. | ||
/// </summary> | ||
public interface IConnectivityRepository | ||
{ | ||
/// <summary> | ||
/// Occurs when network state changes. | ||
/// </summary> | ||
event EventHandler<ConnectivityChangedEventArgs> ConnectivityChanged; | ||
|
||
/// <summary> | ||
/// Gets the current network state. | ||
/// </summary> | ||
NetworkAccess State { get; } | ||
} |
30 changes: 30 additions & 0 deletions
30
...pp/ApplicationTemplate.Access/NativePlatform/Connectivity/MockedConnectivityRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
namespace ApplicationTemplate.DataAccess; | ||
|
||
public sealed class MockedConnectivityRepository : IConnectivityRepository | ||
{ | ||
private NetworkAccess _networkAccess; | ||
|
||
public MockedConnectivityRepository() | ||
{ | ||
State = NetworkAccess.Internet; | ||
} | ||
|
||
public MockedConnectivityRepository(NetworkAccess networkAccess) | ||
{ | ||
State = networkAccess; | ||
} | ||
|
||
public NetworkAccess State | ||
{ | ||
get => _networkAccess; | ||
set | ||
{ | ||
_networkAccess = value; | ||
ConnectivityChanged?.Invoke(this, new ConnectivityChangedEventArgs(value)); | ||
} | ||
} | ||
|
||
public event EventHandler<ConnectivityChangedEventArgs> ConnectivityChanged; | ||
} |
2 changes: 1 addition & 1 deletion
2
...n/Framework/Connectivity/NetworkAccess.cs → ...ivePlatform/Connectivity/NetworkAccess.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ate.Presentation/Framework/Email/Email.cs → ...late.Access/NativePlatform/Email/Email.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tation/Framework/Email/EmailAttachment.cs → ...s/NativePlatform/Email/EmailAttachment.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tation/Framework/Email/EmailBodyFormat.cs → ...s/NativePlatform/Email/EmailBodyFormat.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace ApplicationTemplate; | ||
namespace ApplicationTemplate.DataAccess; | ||
|
||
public enum EmailBodyFormat | ||
{ | ||
|
6 changes: 3 additions & 3 deletions
6
...entation/Framework/Email/IEmailService.cs → .../NativePlatform/Email/IEmailRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/app/ApplicationTemplate.Access/NativePlatform/Email/MockedEmailRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace ApplicationTemplate.DataAccess; | ||
|
||
public sealed class MockedEmailRepository : IEmailRepository | ||
{ | ||
private readonly ILogger<MockedEmailRepository> _logger; | ||
|
||
public MockedEmailRepository(ILogger<MockedEmailRepository> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public Task Compose(Email email) | ||
{ | ||
_logger.LogInformation("Email composed: {Email}", email); | ||
return Task.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
src/app/ApplicationTemplate.Presentation/Framework/Connectivity/IConnectivityProvider.cs
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
...app/ApplicationTemplate.Presentation/Framework/Connectivity/MockedConnectivityProvider.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
src/app/ApplicationTemplate.Presentation/ViewModels/Diagnostics/DiagnosticsPageViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.