Skip to content

Commit 484a7d0

Browse files
committed
Changes in CatalogService
1 parent 5a81d42 commit 484a7d0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using eShopOnContainers.Core.Helpers;
1010
using Xamarin.Forms;
1111
using eShopOnContainers.Core.Services.IPAddress;
12+
using System.Text.RegularExpressions;
1213

1314
namespace eShopOnContainers.Core.Services.Catalog
1415
{
@@ -65,8 +66,15 @@ public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
6566
{
6667
foreach (var catalogItem in catalog?.Data)
6768
{
68-
string ipaddress = DependencyService.Get<IIPAddressService>().GetIPAddress();
69-
catalogItem.PictureUri.Replace(Settings.UrlBase, ipaddress);
69+
//string ipaddress = DependencyService.Get<IIPAddressService>().GetIPAddress();
70+
Regex ip = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b");
71+
MatchCollection result = ip.Matches(catalogItem.PictureUri);
72+
73+
if (result.Count != -1)
74+
{
75+
var serviceIp = result[0].Value;
76+
catalogItem.PictureUri = catalogItem.PictureUri.Replace(serviceIp, Settings.UrlBase);
77+
}
7078
}
7179
}
7280

0 commit comments

Comments
 (0)