Urls for Identity, Gateway Shopping and Marketing added to setting view
This commit is contained in:
parent
262341c140
commit
cc034183aa
@ -6,33 +6,54 @@
|
||||
public const string MockTag = "Mock";
|
||||
public const string DefaultEndpoint = "http://YOUR_IP_OR_DNS_NAME"; // i.e.: "http://YOUR_IP" or "http://YOUR_DNS_NAME"
|
||||
|
||||
private string _baseEndpoint;
|
||||
private static readonly GlobalSetting _instance = new GlobalSetting();
|
||||
private string _baseIdentityEndpoint;
|
||||
private string _baseGatewayShoppingEndpoint;
|
||||
private string _baseGatewayMarketingEndpoint;
|
||||
|
||||
public GlobalSetting()
|
||||
{
|
||||
AuthToken = "INSERT AUTHENTICATION TOKEN";
|
||||
BaseEndpoint = DefaultEndpoint;
|
||||
|
||||
BaseIdentityEndpoint = DefaultEndpoint;
|
||||
BaseGatewayShoppingEndpoint = DefaultEndpoint;
|
||||
BaseGatewayMarketingEndpoint = DefaultEndpoint;
|
||||
}
|
||||
|
||||
public static GlobalSetting Instance
|
||||
{
|
||||
get { return _instance; }
|
||||
}
|
||||
public static GlobalSetting Instance { get; } = new GlobalSetting();
|
||||
|
||||
public string BaseEndpoint
|
||||
public string BaseIdentityEndpoint
|
||||
{
|
||||
get { return _baseEndpoint; }
|
||||
get { return _baseIdentityEndpoint; }
|
||||
set
|
||||
{
|
||||
_baseEndpoint = value;
|
||||
UpdateEndpoint(_baseEndpoint);
|
||||
_baseIdentityEndpoint = value;
|
||||
UpdateEndpoint(_baseIdentityEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public string ClientId { get { return "xamarin"; }}
|
||||
public string BaseGatewayShoppingEndpoint
|
||||
{
|
||||
get { return _baseGatewayShoppingEndpoint; }
|
||||
set
|
||||
{
|
||||
_baseGatewayShoppingEndpoint = value;
|
||||
UpdateGatewayShoppingEndpoint(_baseGatewayShoppingEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public string ClientSecret { get { return "secret"; }}
|
||||
public string BaseGatewayMarketingEndpoint
|
||||
{
|
||||
get { return _baseGatewayMarketingEndpoint; }
|
||||
set
|
||||
{
|
||||
_baseGatewayMarketingEndpoint = value;
|
||||
UpdateGatewayMarketingEndpoint(_baseGatewayMarketingEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public string ClientId { get { return "xamarin"; } }
|
||||
|
||||
public string ClientSecret { get { return "secret"; } }
|
||||
|
||||
public string AuthToken { get; set; }
|
||||
|
||||
@ -50,9 +71,13 @@
|
||||
|
||||
public string LogoutCallback { get; set; }
|
||||
|
||||
private void UpdateEndpoint(string baseEndpoint)
|
||||
public string GatewayShoppingEndpoint { get; set; }
|
||||
|
||||
public string GatewayMarketingEndpoint { get; set; }
|
||||
|
||||
private void UpdateEndpoint(string endpoint)
|
||||
{
|
||||
var identityBaseEndpoint = $"{baseEndpoint}/identity";
|
||||
var identityBaseEndpoint = $"{endpoint}/identity";
|
||||
RegisterWebsite = $"{identityBaseEndpoint}/Account/Register";
|
||||
LogoutCallback = $"{identityBaseEndpoint}/Account/Redirecting";
|
||||
|
||||
@ -61,8 +86,18 @@
|
||||
UserInfoEndpoint = $"{connectBaseEndpoint}/userinfo";
|
||||
TokenEndpoint = $"{connectBaseEndpoint}/token";
|
||||
LogoutEndpoint = $"{connectBaseEndpoint}/endsession";
|
||||
|
||||
IdentityCallback = $"{baseEndpoint}/xamarincallback";
|
||||
|
||||
IdentityCallback = $"{endpoint}/xamarincallback";
|
||||
}
|
||||
|
||||
private void UpdateGatewayShoppingEndpoint(string endpoint)
|
||||
{
|
||||
GatewayShoppingEndpoint = $"{endpoint}/mobileshoppingapigw";
|
||||
}
|
||||
|
||||
private void UpdateGatewayMarketingEndpoint(string endpoint)
|
||||
{
|
||||
GatewayMarketingEndpoint = $"{endpoint}/mobilemarketingapigw";
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
||||
private readonly IRequestProvider _requestProvider;
|
||||
private readonly IFixUriService _fixUriService;
|
||||
|
||||
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/b/basket";
|
||||
private const string ApiUrlBase = "api/v1/b/basket";
|
||||
|
||||
public BasketService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
||||
{
|
||||
@ -21,7 +21,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
||||
|
||||
public async Task<CustomerBasket> GetBasketAsync(string guidUser, string token)
|
||||
{
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint)
|
||||
{
|
||||
Path = $"{ApiUrlBase}/{guidUser}"
|
||||
};
|
||||
@ -45,7 +45,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
||||
|
||||
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket, string token)
|
||||
{
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint)
|
||||
{
|
||||
Path = ApiUrlBase
|
||||
};
|
||||
@ -57,7 +57,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
||||
|
||||
public async Task CheckoutAsync(BasketCheckout basketCheckout, string token)
|
||||
{
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint)
|
||||
{
|
||||
Path = $"{ApiUrlBase}/checkout"
|
||||
};
|
||||
@ -68,7 +68,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
||||
|
||||
public async Task ClearBasketAsync(string guidUser, string token)
|
||||
{
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint)
|
||||
var builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint)
|
||||
{
|
||||
Path = $"{ApiUrlBase}/{guidUser}"
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
||||
private readonly IRequestProvider _requestProvider;
|
||||
private readonly IFixUriService _fixUriService;
|
||||
|
||||
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/c/catalog";
|
||||
private const string ApiUrlBase = "api/v1/c/catalog";
|
||||
|
||||
public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
||||
{
|
||||
@ -24,7 +24,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
||||
|
||||
public async Task<ObservableCollection<CatalogItem>> FilterAsync(int catalogBrandId, int catalogTypeId)
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint);
|
||||
builder.Path = $"{ApiUrlBase}/items/type/{catalogTypeId}/brand/{catalogBrandId}";
|
||||
string uri = builder.ToString();
|
||||
|
||||
@ -38,7 +38,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
||||
|
||||
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint);
|
||||
builder.Path = $"{ApiUrlBase}/items";
|
||||
string uri = builder.ToString();
|
||||
|
||||
@ -55,7 +55,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
||||
|
||||
public async Task<ObservableCollection<CatalogBrand>> GetCatalogBrandAsync()
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint);
|
||||
builder.Path = $"{ApiUrlBase}/catalogbrands";
|
||||
string uri = builder.ToString();
|
||||
|
||||
@ -69,7 +69,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
||||
|
||||
public async Task<ObservableCollection<CatalogType>> GetCatalogTypeAsync()
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint);
|
||||
builder.Path = $"{ApiUrlBase}/catalogtypes";
|
||||
string uri = builder.ToString();
|
||||
|
||||
|
@ -31,12 +31,12 @@ namespace eShopOnContainers.Core.Services.FixUri
|
||||
try
|
||||
{
|
||||
if (!ViewModelLocator.UseMockService
|
||||
&& _settingsService.UrlBase != GlobalSetting.DefaultEndpoint)
|
||||
&& _settingsService.IdentityEndpointBase != GlobalSetting.DefaultEndpoint)
|
||||
{
|
||||
foreach (var catalogItem in catalogItems)
|
||||
{
|
||||
MatchCollection serverResult = IpRegex.Matches(catalogItem.PictureUri);
|
||||
MatchCollection localResult = IpRegex.Matches(_settingsService.UrlBase);
|
||||
MatchCollection localResult = IpRegex.Matches(_settingsService.IdentityEndpointBase);
|
||||
|
||||
if (serverResult.Count != -1 && localResult.Count != -1)
|
||||
{
|
||||
@ -64,12 +64,12 @@ namespace eShopOnContainers.Core.Services.FixUri
|
||||
try
|
||||
{
|
||||
if (!ViewModelLocator.UseMockService
|
||||
&& _settingsService.UrlBase != GlobalSetting.DefaultEndpoint)
|
||||
&& _settingsService.IdentityEndpointBase != GlobalSetting.DefaultEndpoint)
|
||||
{
|
||||
foreach (var basketItem in basketItems)
|
||||
{
|
||||
MatchCollection serverResult = IpRegex.Matches(basketItem.PictureUrl);
|
||||
MatchCollection localResult = IpRegex.Matches(_settingsService.UrlBase);
|
||||
MatchCollection localResult = IpRegex.Matches(_settingsService.IdentityEndpointBase);
|
||||
|
||||
if (serverResult.Count != -1 && localResult.Count != -1)
|
||||
{
|
||||
@ -96,12 +96,12 @@ namespace eShopOnContainers.Core.Services.FixUri
|
||||
try
|
||||
{
|
||||
if (!ViewModelLocator.UseMockService
|
||||
&& _settingsService.UrlBase != GlobalSetting.DefaultEndpoint)
|
||||
&& _settingsService.IdentityEndpointBase != GlobalSetting.DefaultEndpoint)
|
||||
{
|
||||
foreach (var campaignItem in campaignItems)
|
||||
{
|
||||
MatchCollection serverResult = IpRegex.Matches(campaignItem.PictureUri);
|
||||
MatchCollection localResult = IpRegex.Matches(_settingsService.UrlBase);
|
||||
MatchCollection localResult = IpRegex.Matches(_settingsService.IdentityEndpointBase);
|
||||
|
||||
if (serverResult.Count != -1 && localResult.Count != -1)
|
||||
{
|
||||
|
@ -8,6 +8,8 @@ namespace eShopOnContainers.Core.Services.Location
|
||||
{
|
||||
private readonly IRequestProvider _requestProvider;
|
||||
|
||||
private const string ApiUrlBase = "api/v1/l/locations";
|
||||
|
||||
public LocationService(IRequestProvider requestProvider)
|
||||
{
|
||||
_requestProvider = requestProvider;
|
||||
@ -15,8 +17,8 @@ namespace eShopOnContainers.Core.Services.Location
|
||||
|
||||
public async Task UpdateUserLocation(eShopOnContainers.Core.Models.Location.Location newLocReq, string token)
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
builder.Path = "/mobilemarketingapigw/api/v1/l/locations";
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayMarketingEndpoint);
|
||||
builder.Path = ApiUrlBase;
|
||||
string uri = builder.ToString();
|
||||
await _requestProvider.PostAsync(uri, newLocReq, token);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace eShopOnContainers.Core.Services.Marketing
|
||||
private readonly IRequestProvider _requestProvider;
|
||||
private readonly IFixUriService _fixUriService;
|
||||
|
||||
private const string ApiUrlBase = "mobilemarketingapigw/api/v1/m/campaigns";
|
||||
private const string ApiUrlBase = "api/v1/m/campaigns";
|
||||
|
||||
public CampaignService(IRequestProvider requestProvider, IFixUriService fixUriService)
|
||||
{
|
||||
@ -23,7 +23,7 @@ namespace eShopOnContainers.Core.Services.Marketing
|
||||
|
||||
public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token)
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayMarketingEndpoint);
|
||||
builder.Path = $"{ApiUrlBase}/user";
|
||||
string uri = builder.ToString();
|
||||
|
||||
@ -40,7 +40,7 @@ namespace eShopOnContainers.Core.Services.Marketing
|
||||
|
||||
public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token)
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayMarketingEndpoint);
|
||||
builder.Path = $"{ApiUrlBase}/{campaignId}";
|
||||
string uri = builder.ToString();
|
||||
return await _requestProvider.GetAsync<CampaignItem>(uri, token);
|
||||
|
@ -11,7 +11,7 @@ namespace eShopOnContainers.Core.Services.Order
|
||||
{
|
||||
private readonly IRequestProvider _requestProvider;
|
||||
|
||||
private const string ApiUrlBase = "mobileshoppingapigw/api/v1/o/orders";
|
||||
private const string ApiUrlBase = "api/v1/o/orders";
|
||||
|
||||
public OrderService(IRequestProvider requestProvider)
|
||||
{
|
||||
@ -25,7 +25,7 @@ namespace eShopOnContainers.Core.Services.Order
|
||||
|
||||
public async Task<ObservableCollection<Models.Orders.Order>> GetOrdersAsync(string token)
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint);
|
||||
|
||||
builder.Path = ApiUrlBase;
|
||||
|
||||
@ -42,7 +42,7 @@ namespace eShopOnContainers.Core.Services.Order
|
||||
{
|
||||
try
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint);
|
||||
|
||||
builder.Path = $"{ApiUrlBase}/{orderId}";
|
||||
|
||||
@ -78,7 +78,7 @@ namespace eShopOnContainers.Core.Services.Order
|
||||
|
||||
public async Task<bool> CancelOrderAsync(int orderId, string token)
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BaseEndpoint);
|
||||
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.GatewayShoppingEndpoint);
|
||||
|
||||
builder.Path = $"{ApiUrlBase}/cancel";
|
||||
|
||||
|
@ -7,7 +7,9 @@ namespace eShopOnContainers.Core.Services.Settings
|
||||
string AuthAccessToken { get; set; }
|
||||
string AuthIdToken { get; set; }
|
||||
bool UseMocks { get; set; }
|
||||
string UrlBase { get; set; }
|
||||
string IdentityEndpointBase { get; set; }
|
||||
string GatewayShoppingEndpointBase { get; set; }
|
||||
string GatewayMarketingEndpointBase { get; set; }
|
||||
bool UseFakeLocation { get; set; }
|
||||
string Latitude { get; set; }
|
||||
string Longitude { get; set; }
|
||||
|
@ -11,7 +11,9 @@ namespace eShopOnContainers.Core.Services.Settings
|
||||
private const string AccessToken = "access_token";
|
||||
private const string IdToken = "id_token";
|
||||
private const string IdUseMocks = "use_mocks";
|
||||
private const string IdUrlBase = "url_base";
|
||||
private const string IdIdentityBase = "url_base";
|
||||
private const string IdGatewayMarketingBase = "url_marketing";
|
||||
private const string IdGatewayShoppingBase = "url_shopping";
|
||||
private const string IdUseFakeLocation = "use_fake_location";
|
||||
private const string IdLatitude = "latitude";
|
||||
private const string IdLongitude = "longitude";
|
||||
@ -23,8 +25,9 @@ namespace eShopOnContainers.Core.Services.Settings
|
||||
private readonly bool AllowGpsLocationDefault = false;
|
||||
private readonly double FakeLatitudeDefault = 47.604610d;
|
||||
private readonly double FakeLongitudeDefault = -122.315752d;
|
||||
private readonly string UrlBaseDefault = GlobalSetting.Instance.BaseEndpoint;
|
||||
|
||||
private readonly string UrlIdentityDefault = GlobalSetting.Instance.BaseIdentityEndpoint;
|
||||
private readonly string UrlGatewayMarketingDefault = GlobalSetting.Instance.BaseGatewayMarketingEndpoint;
|
||||
private readonly string UrlGatewayShoppingDefault = GlobalSetting.Instance.BaseGatewayShoppingEndpoint;
|
||||
#endregion
|
||||
|
||||
#region Settings Properties
|
||||
@ -47,10 +50,22 @@ namespace eShopOnContainers.Core.Services.Settings
|
||||
set => AddOrUpdateValue(IdUseMocks, value);
|
||||
}
|
||||
|
||||
public string UrlBase
|
||||
public string IdentityEndpointBase
|
||||
{
|
||||
get => GetValueOrDefault(IdUrlBase, UrlBaseDefault);
|
||||
set => AddOrUpdateValue(IdUrlBase, value);
|
||||
get => GetValueOrDefault(IdIdentityBase, UrlIdentityDefault);
|
||||
set => AddOrUpdateValue(IdIdentityBase, value);
|
||||
}
|
||||
|
||||
public string GatewayShoppingEndpointBase
|
||||
{
|
||||
get => GetValueOrDefault(IdGatewayShoppingBase, UrlGatewayShoppingDefault);
|
||||
set => AddOrUpdateValue(IdGatewayShoppingBase, value);
|
||||
}
|
||||
|
||||
public string GatewayMarketingEndpointBase
|
||||
{
|
||||
get => GetValueOrDefault(IdGatewayMarketingBase, UrlGatewayMarketingDefault);
|
||||
set => AddOrUpdateValue(IdGatewayMarketingBase, value);
|
||||
}
|
||||
|
||||
public bool UseFakeLocation
|
||||
|
@ -29,7 +29,12 @@ namespace eShopOnContainers.Core.ViewModels.Base
|
||||
{
|
||||
DialogService = ViewModelLocator.Resolve<IDialogService>();
|
||||
NavigationService = ViewModelLocator.Resolve<INavigationService>();
|
||||
GlobalSetting.Instance.BaseEndpoint = ViewModelLocator.Resolve<ISettingsService>().UrlBase;
|
||||
|
||||
var settingsService = ViewModelLocator.Resolve<ISettingsService>();
|
||||
|
||||
GlobalSetting.Instance.BaseIdentityEndpoint = settingsService.IdentityEndpointBase;
|
||||
GlobalSetting.Instance.BaseGatewayShoppingEndpoint = settingsService.GatewayShoppingEndpointBase;
|
||||
GlobalSetting.Instance.BaseGatewayMarketingEndpoint = settingsService.GatewayMarketingEndpointBase;
|
||||
}
|
||||
|
||||
public virtual Task InitializeAsync(object navigationData)
|
||||
|
@ -16,7 +16,9 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
private bool _useAzureServices;
|
||||
private bool _allowGpsLocation;
|
||||
private bool _useFakeLocation;
|
||||
private string _endpoint;
|
||||
private string _identityEndpoint;
|
||||
private string _gatewayShoppingEndpoint;
|
||||
private string _gatewayMarketingEndpoint;
|
||||
private double _latitude;
|
||||
private double _longitude;
|
||||
private string _gpsWarningMessage;
|
||||
@ -32,7 +34,9 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
_dependencyService = dependencyService;
|
||||
|
||||
_useAzureServices = !_settingsService.UseMocks;
|
||||
_endpoint = _settingsService.UrlBase;
|
||||
_identityEndpoint = _settingsService.IdentityEndpointBase;
|
||||
_gatewayShoppingEndpoint = _settingsService.GatewayShoppingEndpointBase;
|
||||
_gatewayMarketingEndpoint = _settingsService.GatewayMarketingEndpointBase;
|
||||
_latitude = double.Parse(_settingsService.Latitude, CultureInfo.CurrentCulture);
|
||||
_longitude = double.Parse(_settingsService.Longitude, CultureInfo.CurrentCulture);
|
||||
_useFakeLocation = _settingsService.UseFakeLocation;
|
||||
@ -51,7 +55,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
{
|
||||
return !UseAzureServices
|
||||
? "Mock Services are simulated objects that mimic the behavior of real services using a controlled approach."
|
||||
: "When enabling the use of microservices/containers, the app will attempt to use real services deployed as Docker containers at the specified base endpoint, which will must be reachable through the network.";
|
||||
: "When enabling the use of microservices/containers, the app will attempt to use real services deployed as Docker/Kubernetes containers at the specified base endpoint, which will must be reachable through the network.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,17 +121,45 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string Endpoint
|
||||
public string IdentityEndpoint
|
||||
{
|
||||
get => _endpoint;
|
||||
get => _identityEndpoint;
|
||||
set
|
||||
{
|
||||
_endpoint = value;
|
||||
if (!string.IsNullOrEmpty(_endpoint))
|
||||
_identityEndpoint = value;
|
||||
if (!string.IsNullOrEmpty(_identityEndpoint))
|
||||
{
|
||||
UpdateEndpoint();
|
||||
UpdateIdentityEndpoint();
|
||||
}
|
||||
RaisePropertyChanged(() => Endpoint);
|
||||
RaisePropertyChanged(() => IdentityEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public string GatewayShoppingEndpoint
|
||||
{
|
||||
get => _gatewayShoppingEndpoint;
|
||||
set
|
||||
{
|
||||
_gatewayShoppingEndpoint = value;
|
||||
if (!string.IsNullOrEmpty(_gatewayShoppingEndpoint))
|
||||
{
|
||||
UpdateGatewayShoppingEndpoint();
|
||||
}
|
||||
RaisePropertyChanged(() => GatewayShoppingEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public string GatewayMarketingEndpoint
|
||||
{
|
||||
get => _gatewayMarketingEndpoint;
|
||||
set
|
||||
{
|
||||
_gatewayMarketingEndpoint = value;
|
||||
if (!string.IsNullOrEmpty(_gatewayMarketingEndpoint))
|
||||
{
|
||||
UpdateGatewayMarketingEndpoint();
|
||||
}
|
||||
RaisePropertyChanged(() => GatewayMarketingEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,10 +265,20 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
_settingsService.UseMocks = !_useAzureServices;
|
||||
}
|
||||
|
||||
private void UpdateEndpoint()
|
||||
private void UpdateIdentityEndpoint()
|
||||
{
|
||||
// Update remote endpoint (save to local storage)
|
||||
GlobalSetting.Instance.BaseEndpoint = _settingsService.UrlBase = _endpoint;
|
||||
GlobalSetting.Instance.BaseIdentityEndpoint = _settingsService.IdentityEndpointBase = _identityEndpoint;
|
||||
}
|
||||
|
||||
private void UpdateGatewayShoppingEndpoint()
|
||||
{
|
||||
GlobalSetting.Instance.BaseGatewayShoppingEndpoint = _settingsService.GatewayShoppingEndpointBase = _gatewayShoppingEndpoint;
|
||||
}
|
||||
|
||||
private void UpdateGatewayMarketingEndpoint()
|
||||
{
|
||||
GlobalSetting.Instance.BaseGatewayMarketingEndpoint = _settingsService.GatewayMarketingEndpointBase = _gatewayMarketingEndpoint;
|
||||
}
|
||||
|
||||
private void UpdateFakeLocation()
|
||||
|
@ -168,10 +168,36 @@
|
||||
Style="{StaticResource SettingsStackLayoutStyle}"
|
||||
IsVisible="{Binding UseAzureServices}">
|
||||
<Label
|
||||
Text="Endpoint"
|
||||
Text="Identity Url"
|
||||
Style="{StaticResource HeaderLabelStyle}"/>
|
||||
<Entry
|
||||
Text="{Binding Endpoint, Mode=TwoWay}">
|
||||
Text="{Binding IdentityEndpoint, Mode=TwoWay}">
|
||||
<Entry.Style>
|
||||
<OnPlatform x:TypeArguments="Style">
|
||||
<On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" />
|
||||
<On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" />
|
||||
</OnPlatform>
|
||||
</Entry.Style>
|
||||
</Entry>
|
||||
|
||||
<Label
|
||||
Text="Gateway Shopping Url"
|
||||
Style="{StaticResource HeaderLabelStyle}"/>
|
||||
<Entry
|
||||
Text="{Binding GatewayShoppingEndpoint, Mode=TwoWay}">
|
||||
<Entry.Style>
|
||||
<OnPlatform x:TypeArguments="Style">
|
||||
<On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" />
|
||||
<On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" />
|
||||
</OnPlatform>
|
||||
</Entry.Style>
|
||||
</Entry>
|
||||
|
||||
<Label
|
||||
Text="Gateway Marketing Url"
|
||||
Style="{StaticResource HeaderLabelStyle}"/>
|
||||
<Entry
|
||||
Text="{Binding GatewayMarketingEndpoint, Mode=TwoWay}">
|
||||
<Entry.Style>
|
||||
<OnPlatform x:TypeArguments="Style">
|
||||
<On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" />
|
||||
|
@ -11,7 +11,9 @@ namespace eShopOnContainers.UnitTests.Mocks
|
||||
const string AccessToken = "access_token";
|
||||
const string IdToken = "id_token";
|
||||
const string IdUseMocks = "use_mocks";
|
||||
const string IdUrlBase = "url_base";
|
||||
const string IdIdentityBase = "url_base";
|
||||
const string IdGatewayMarketingBase = "url_marketing";
|
||||
const string IdGatewayShoppingBase = "url_shopping";
|
||||
const string IdUseFakeLocation = "use_fake_location";
|
||||
const string IdLatitude = "latitude";
|
||||
const string IdLongitude = "longitude";
|
||||
@ -23,7 +25,9 @@ namespace eShopOnContainers.UnitTests.Mocks
|
||||
readonly bool AllowGpsLocationDefault = false;
|
||||
readonly double FakeLatitudeDefault = 47.604610d;
|
||||
readonly double FakeLongitudeDefault = -122.315752d;
|
||||
readonly string UrlBaseDefault = "https://13.88.8.119";
|
||||
readonly string UrlIdentityDefault = "https://13.88.8.119";
|
||||
readonly string UrlGatewayMarketingDefault = "https://13.88.8.119";
|
||||
readonly string UrlGatewayShoppingDefault = "https://13.88.8.119";
|
||||
|
||||
public string AuthAccessToken
|
||||
{
|
||||
@ -43,10 +47,22 @@ namespace eShopOnContainers.UnitTests.Mocks
|
||||
set => AddOrUpdateValue(IdUseMocks, value);
|
||||
}
|
||||
|
||||
public string UrlBase
|
||||
public string IdentityEndpointBase
|
||||
{
|
||||
get => GetValueOrDefault(IdUrlBase, UrlBaseDefault);
|
||||
set => AddOrUpdateValue(IdUrlBase, value);
|
||||
get => GetValueOrDefault(IdIdentityBase, UrlIdentityDefault);
|
||||
set => AddOrUpdateValue(IdIdentityBase, value);
|
||||
}
|
||||
|
||||
public string GatewayShoppingEndpointBase
|
||||
{
|
||||
get => GetValueOrDefault(IdGatewayShoppingBase, UrlGatewayShoppingDefault);
|
||||
set => AddOrUpdateValue(IdGatewayShoppingBase, value);
|
||||
}
|
||||
|
||||
public string GatewayMarketingEndpointBase
|
||||
{
|
||||
get => GetValueOrDefault(IdGatewayMarketingBase, UrlGatewayMarketingDefault);
|
||||
set => AddOrUpdateValue(IdGatewayMarketingBase, value);
|
||||
}
|
||||
|
||||
public bool UseFakeLocation
|
||||
|
Loading…
x
Reference in New Issue
Block a user