Skip to content

Commit

Permalink
Merge pull request #28 from Clifftech123/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
frankodoom authored May 28, 2024
2 parents 384b839 + 93109f6 commit 2925616
Show file tree
Hide file tree
Showing 10 changed files with 311 additions and 295 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/development-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
file: ./TestResults/coverage.cobertura.xml
flags: unittests
name: codecov-umbrella
#fail_ci_if_error: true
#fail_ci_if_error: true
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For feature requests and enhancements, open an issue first to discuss the change

Pull requests are the best way to propose changes to the project. They allow us to review your modifications before merging them into the main branch. Please follow these steps to create a pull request:

1. Fork the Project Repository.
1. Fork the Project Repository, *Note* Fork from `develop` branch.
2. Create a new branch for your changes.
3. Commit your changes to the new branch.
4. Push your branch to GitHub.
Expand Down
510 changes: 261 additions & 249 deletions README.md

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions sample/CountryData.Sample.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void Main()
GetRegionsByCountryCode("US");
GetCountryFlag("US");
GetPhoneCodeByCountryShortCode("AF");
GetCountryByPhoneCode("93");
GetCountryByPhoneCode("+233");


}
Expand Down Expand Up @@ -107,10 +107,14 @@ static void GetPhoneCodeByCountryShortCode(string shortCode)
/// <param name="phoneCode">The phone code.</param>
static void GetCountryByPhoneCode(string phoneCode)
{
var country = _helper.GetCountriesByPhoneCode(phoneCode);
Console.WriteLine($"Country for phone code {phoneCode}:");
Console.WriteLine(country.FirstOrDefault());
var countries = _helper.GetCountriesByPhoneCode(phoneCode);
Console.WriteLine($"Countries for phone code {phoneCode}:");
foreach (var country in countries)
{
Console.WriteLine(country.CountryName);
}
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type country:Country}">
<ContentView>
<Grid ColumnDefinitions="Auto,30,*"
<Grid ColumnDefinitions="Auto,45,*"
Margin="5"

ColumnSpacing="5">
<Label Text="{Binding CountryFlag}"
Margin="20,0,0,0"
FontSize="Large"/>

<Label Grid.Column="1"
Text="{Binding CountryShortCode}"/>

Text="{Binding PhoneCode}"
Margin="5,0,0,0"
/>

<Label Grid.Column="2"
HorizontalTextAlignment="Start"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
using CountryData.Sample.MAUI.ViewModels;

namespace CountryData.Sample.MAUI;

public partial class MainPage : ContentPage
namespace CountryData.Sample.MAUI
{
int count = 0;

public MainPage(MainViewModel mainViewModel)
{
InitializeComponent();
BindingContext = mainViewModel;
}

//private void OnCounterClicked(object sender, EventArgs e)
//{
// count++;
// CounterLabel.Text = $"Current count: {count}";
public partial class MainPage : ContentPage
{
int count = 0;

Check warning on line 7 in sample/CountryData.Sample.MAUI/CountryData.Sample.MAUI/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MainPage.count' is assigned but its value is never used

Check warning on line 7 in sample/CountryData.Sample.MAUI/CountryData.Sample.MAUI/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MainPage.count' is assigned but its value is never used

Check warning on line 7 in sample/CountryData.Sample.MAUI/CountryData.Sample.MAUI/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MainPage.count' is assigned but its value is never used

Check warning on line 7 in sample/CountryData.Sample.MAUI/CountryData.Sample.MAUI/MainPage.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MainPage.count' is assigned but its value is never used

// SemanticScreenReader.Announce(CounterLabel.Text);
//}
}
public MainPage(MainViewModel mainViewModel)
{
InitializeComponent();
BindingContext = mainViewModel;
}

// Uncomment this method if you need it
//private void OnCounterClicked(object sender, EventArgs e)
//{
// count++;
// CounterLabel.Text = $"Current count: {count}";
//}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using CountryData.Standard;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CountryData.Sample.MAUI.ViewModels
{
Expand Down
28 changes: 14 additions & 14 deletions sample/CountryData.Sample.Web.API/Controllers/CountryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public IActionResult GetCountries()
/// </summary>
/// <param name="countryCode">The ISO country code.</param>
/// <returns>The data for the specified country. If no data is found, a NotFound result is returned.</returns>
[HttpGet("{countryCode}/countries")]
public IActionResult GetCountryByCode(string countryCode)
[HttpGet("country")]
public IActionResult GetCountryByCode([FromQuery] string countryCode)
{
var country = _helper.GetCountryByCode(countryCode);
if (country == null)
Expand Down Expand Up @@ -79,8 +79,8 @@ public IActionResult GetCountryData()
/// </summary>
/// <param name="countryCode">The ISO country code.</param>
/// <returns>A list of regions for the specified country. If no regions are found, a NotFound result is returned.</returns>
[HttpGet("{countryCode}/regions")]
public IActionResult GetRegionsByCountryCode(string countryCode)
[HttpGet("regions")]
public IActionResult GetRegionsByCountryCode([FromQuery] string countryCode)
{
var regions = _helper.GetRegionByCountryCode(countryCode);
if (regions == null)
Expand All @@ -97,8 +97,8 @@ public IActionResult GetRegionsByCountryCode(string countryCode)
/// </summary>
/// <param name="shortCode">The short code of the country.</param>
/// <returns>The emoji flag for the specified country. If no flag is found, a NotFound result is returned.</returns>
[HttpGet("{shortCode}/flag")]
public IActionResult GetCountryFlag(string shortCode)
[HttpGet("flag")]
public IActionResult GetCountryFlag([FromQuery] string shortCode)
{
var flag = _helper.GetCountryEmojiFlag(shortCode);
if (flag == null)
Expand All @@ -115,8 +115,8 @@ public IActionResult GetCountryFlag(string shortCode)
/// </summary>
/// <param name="shortCode">The short code of the country.</param>
/// <returns>The phone code for the specified country. If no phone code is found, a NotFound result is returned.</returns>
[HttpGet("{shortCode}/phoneCode")]
public IActionResult GetPhoneCodeByCountryShortCode(string shortCode)
[HttpGet("phoneCodeByShortCode")]
public IActionResult GetPhoneCodeByCountryShortCode([FromQuery] string shortCode)
{
var phoneCode = _helper.GetPhoneCodeByCountryShortCode(shortCode);
if (phoneCode == null)
Expand All @@ -132,20 +132,20 @@ public IActionResult GetPhoneCodeByCountryShortCode(string shortCode)
/// </summary>
/// <param name="phoneCode">The phone code of the country.</param>
/// <returns>The data for the specified country. If no data is found, a NotFound result is returned.</returns>
[HttpGet("phoneCode/{phoneCode}")]
public IActionResult GetCountryByPhoneCode(string phoneCode)
[HttpGet("countryByPhoneCode")]
public IActionResult GetCountryByPhoneCode([FromQuery] string phoneCode)
{
var country = _helper.GetCountriesByPhoneCode(phoneCode);
if (country == null)
var countryDataByPhoneCode = _helper.GetCountriesByPhoneCode(phoneCode);
if (countryDataByPhoneCode == null)
{
return NotFound();
}

return Ok(country);
return Ok(countryDataByPhoneCode);
}




}
}
}
2 changes: 1 addition & 1 deletion sample/CountryData.Sample.Web.API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@

app.MapControllers();

app.Run();
app.Run();
1 change: 1 addition & 0 deletions test/CountryData.UnitTests/CountryData.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PackageReference Include="CountryData.Standard" Version="1.3.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen.ConventionalRouting" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit 2925616

Please sign in to comment.