Downgrade API Level requirements
Added Settings feedback
This commit is contained in:
parent
18299d40e0
commit
a3455599c4
@ -1,19 +1,53 @@
|
|||||||
namespace eShopOnContainers.Core
|
namespace eShopOnContainers.Core
|
||||||
{
|
{
|
||||||
public static class GlobalSetting
|
public class GlobalSetting
|
||||||
{
|
{
|
||||||
public const string RegisterWebsite = "http://104.40.62.65/Account/Register";
|
private string _baseEndpoint;
|
||||||
|
private static readonly GlobalSetting _instance = new GlobalSetting();
|
||||||
|
|
||||||
public const string CatalogEndpoint = "http://104.40.62.65:5101/";
|
public GlobalSetting()
|
||||||
|
{
|
||||||
|
BaseEndpoint = "http://104.40.62.65";
|
||||||
|
}
|
||||||
|
|
||||||
public const string OrdersEndpoint = "http://104.40.62.65:5102/";
|
public static GlobalSetting Instance
|
||||||
|
{
|
||||||
|
get { return _instance; }
|
||||||
|
}
|
||||||
|
|
||||||
public const string BasketEndpoint = "http://104.40.62.65:5103/";
|
public string BaseEndpoint
|
||||||
|
{
|
||||||
public const string IdentityEndpoint = "http://104.40.62.65:5105/connect/authorize";
|
get { return _baseEndpoint; }
|
||||||
|
set
|
||||||
public const string LogoutEndpoint = "http://104.40.62.65:5105/connect/endsession";
|
{
|
||||||
|
_baseEndpoint = value;
|
||||||
public const string IdentityCallback = "http://localhost:5003/callback.html";
|
UpdateEndpoint(_baseEndpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string RegisterWebsite { get; set; }
|
||||||
|
|
||||||
|
public string CatalogEndpoint { get; set; }
|
||||||
|
|
||||||
|
public string OrdersEndpoint { get; set; }
|
||||||
|
|
||||||
|
public string BasketEndpoint { get; set; }
|
||||||
|
|
||||||
|
public string IdentityEndpoint { get; set; }
|
||||||
|
|
||||||
|
public string LogoutEndpoint { get; set; }
|
||||||
|
|
||||||
|
public string IdentityCallback { get; set; }
|
||||||
|
|
||||||
|
private void UpdateEndpoint(string baseEndpoint)
|
||||||
|
{
|
||||||
|
RegisterWebsite = string.Format("{0}/Account/Register", baseEndpoint);
|
||||||
|
CatalogEndpoint = string.Format("{0}:5101", baseEndpoint);
|
||||||
|
OrdersEndpoint = string.Format("{0}:5102", baseEndpoint);
|
||||||
|
BasketEndpoint = string.Format("{0}:5103", baseEndpoint);
|
||||||
|
IdentityEndpoint = string.Format("{0}:5105/connect/authorize", baseEndpoint);
|
||||||
|
LogoutEndpoint = string.Format("{0}:5105/connect/endsession", baseEndpoint);
|
||||||
|
IdentityCallback = "http://localhost:5003/callback.html";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.BasketEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
|
||||||
|
|
||||||
builder.Path = guidUser;
|
builder.Path = guidUser;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket)
|
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket customerBasket)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.BasketEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
|
||||||
|
|
||||||
string uri = builder.ToString();
|
string uri = builder.ToString();
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ namespace eShopOnContainers.Core.Services.Basket
|
|||||||
|
|
||||||
public async Task ClearBasketAsync(string guidUser)
|
public async Task ClearBasketAsync(string guidUser)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.BasketEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.BasketEndpoint);
|
||||||
|
|
||||||
builder.Path = guidUser;
|
builder.Path = guidUser;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
||||||
|
|
||||||
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
|
builder.Path = string.Format("api/v1/catalog/items/type/{0}/brand/{1}", catalogTypeId, catalogBrandId);
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/catalog/items";
|
builder.Path = "api/v1/catalog/items";
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/catalog/catalogbrands";
|
builder.Path = "api/v1/catalog/catalogbrands";
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ namespace eShopOnContainers.Core.Services.Catalog
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.CatalogEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.CatalogEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/catalog/catalogtypes";
|
builder.Path = "api/v1/catalog/catalogtypes";
|
||||||
|
|
||||||
|
@ -13,15 +13,15 @@ namespace eShopOnContainers.Core.Services.Identity
|
|||||||
{
|
{
|
||||||
// Create URI to authorize endpoint
|
// Create URI to authorize endpoint
|
||||||
var authorizeRequest =
|
var authorizeRequest =
|
||||||
new AuthorizeRequest(GlobalSetting.IdentityEndpoint);
|
new AuthorizeRequest(GlobalSetting.Instance.IdentityEndpoint);
|
||||||
|
|
||||||
// Dictionary with values for the authorize request
|
// Dictionary with values for the authorize request
|
||||||
var dic = new Dictionary<string, string>();
|
var dic = new Dictionary<string, string>();
|
||||||
dic.Add("client_id", "js");
|
dic.Add("client_id", "xamarin");
|
||||||
dic.Add("response_type", "id_token token");
|
dic.Add("response_type", "id_token token");
|
||||||
dic.Add("scope", "openid profile basket");
|
dic.Add("scope", "openid profile basket");
|
||||||
|
|
||||||
dic.Add("redirect_uri", GlobalSetting.IdentityCallback);
|
dic.Add("redirect_uri", GlobalSetting.Instance.IdentityCallback);
|
||||||
dic.Add("nonce", Guid.NewGuid().ToString("N"));
|
dic.Add("nonce", Guid.NewGuid().ToString("N"));
|
||||||
|
|
||||||
// Add CSRF token to protect against cross-site request forgery attacks.
|
// Add CSRF token to protect against cross-site request forgery attacks.
|
||||||
@ -36,9 +36,9 @@ namespace eShopOnContainers.Core.Services.Identity
|
|||||||
public string CreateLogoutRequest(string token)
|
public string CreateLogoutRequest(string token)
|
||||||
{
|
{
|
||||||
return string.Format("{0}?id_token_hint={1}&post_logout_redirect_uri={2}",
|
return string.Format("{0}?id_token_hint={1}&post_logout_redirect_uri={2}",
|
||||||
GlobalSetting.LogoutEndpoint,
|
GlobalSetting.Instance.LogoutEndpoint,
|
||||||
token,
|
token,
|
||||||
GlobalSetting.IdentityCallback);
|
GlobalSetting.Instance.IdentityCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DecodeToken(string token)
|
public string DecodeToken(string token)
|
||||||
|
@ -16,7 +16,7 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
|
|
||||||
public async Task CreateOrderAsync(Models.Orders.Order newOrder)
|
public async Task CreateOrderAsync(Models.Orders.Order newOrder)
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/orders/new";
|
builder.Path = "api/v1/orders/new";
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/orders";
|
builder.Path = "api/v1/orders";
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
||||||
|
|
||||||
builder.Path = string.Format("api/v1/orders/{0}", orderId);
|
builder.Path = string.Format("api/v1/orders/{0}", orderId);
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ namespace eShopOnContainers.Core.Services.Order
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder(GlobalSetting.OrdersEndpoint);
|
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.OrdersEndpoint);
|
||||||
|
|
||||||
builder.Path = "api/v1/orders/cardtypes";
|
builder.Path = "api/v1/orders/cardtypes";
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
|
|
||||||
private void Register()
|
private void Register()
|
||||||
{
|
{
|
||||||
_openUrlService.OpenUrl(GlobalSetting.RegisterWebsite);
|
_openUrlService.OpenUrl(GlobalSetting.Instance.RegisterWebsite);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Logout()
|
private void Logout()
|
||||||
@ -188,7 +188,7 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
|
|
||||||
private async void NavigateAsync(string url)
|
private async void NavigateAsync(string url)
|
||||||
{
|
{
|
||||||
if (url.Contains(GlobalSetting.IdentityCallback))
|
if (url.Contains(GlobalSetting.Instance.IdentityCallback))
|
||||||
{
|
{
|
||||||
// Parse response
|
// Parse response
|
||||||
var authResponse = new AuthorizeResponse(url);
|
var authResponse = new AuthorizeResponse(url);
|
||||||
|
@ -10,6 +10,7 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
private string _title;
|
private string _title;
|
||||||
private string _description;
|
private string _description;
|
||||||
private bool _useAzureServices;
|
private bool _useAzureServices;
|
||||||
|
private string _endpoint;
|
||||||
|
|
||||||
public SettingsViewModel()
|
public SettingsViewModel()
|
||||||
{
|
{
|
||||||
@ -46,6 +47,22 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Endpoint
|
||||||
|
{
|
||||||
|
get { return _endpoint; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_endpoint = value;
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(_endpoint))
|
||||||
|
{
|
||||||
|
UpdateEndpoint(_endpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
RaisePropertyChanged(() => Endpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand MockServicesCommand => new Command(MockServices);
|
public ICommand MockServicesCommand => new Command(MockServices);
|
||||||
|
|
||||||
private void MockServices()
|
private void MockServices()
|
||||||
@ -58,6 +75,8 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
{
|
{
|
||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
|
|
||||||
|
Endpoint = GlobalSetting.Instance.BaseEndpoint;
|
||||||
|
|
||||||
return base.InitializeAsync(navigationData);
|
return base.InitializeAsync(navigationData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,5 +93,10 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
Description = "Azure Services are real objects that required a valid internet connection";
|
Description = "Azure Services are real objects that required a valid internet connection";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateEndpoint(string endpoint)
|
||||||
|
{
|
||||||
|
GlobalSetting.Instance.BaseEndpoint = endpoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31,6 +31,11 @@ namespace eShopOnContainers.Core.Views
|
|||||||
|
|
||||||
public async Task AnimateIn()
|
public async Task AnimateIn()
|
||||||
{
|
{
|
||||||
|
if (Device.OS == TargetPlatform.Windows)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await AnimateItem(Banner, 10500);
|
await AnimateItem(Banner, 10500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,18 @@
|
|||||||
Value="12, 12, 12, 0" />
|
Value="12, 12, 12, 0" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="HeaderLabelStyle"
|
||||||
|
TargetType="{x:Type Label}">
|
||||||
|
<Setter Property="FontFamily"
|
||||||
|
Value="{StaticResource MontserratRegular}" />
|
||||||
|
<Setter Property="FontSize"
|
||||||
|
Value="{StaticResource LittleSize}" />
|
||||||
|
<Setter Property="TextColor"
|
||||||
|
Value="{StaticResource GreenColor}" />
|
||||||
|
<Setter Property="HorizontalOptions"
|
||||||
|
Value="Start" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<animations:StoryBoard
|
<animations:StoryBoard
|
||||||
x:Key="MockServicesAnimation"
|
x:Key="MockServicesAnimation"
|
||||||
Target="{x:Reference MockServices}">
|
Target="{x:Reference MockServices}">
|
||||||
@ -82,6 +94,7 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="1" />
|
<RowDefinition Height="1" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="1" />
|
<RowDefinition Height="1" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid
|
<Grid
|
||||||
@ -121,10 +134,31 @@
|
|||||||
WinPhone="Assets/switchOff.png"/>
|
WinPhone="Assets/switchOff.png"/>
|
||||||
</controls:ToggleButton.UnCheckedImage>
|
</controls:ToggleButton.UnCheckedImage>
|
||||||
</controls:ToggleButton>
|
</controls:ToggleButton>
|
||||||
<Grid
|
<!-- ENDPOINT -->
|
||||||
|
<StackLayout
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
|
Margin="12, 0, 12, 12"
|
||||||
|
IsVisible="{Binding UseAzureServices}">
|
||||||
|
<Label
|
||||||
|
Text="Endpoint"
|
||||||
|
Style="{StaticResource HeaderLabelStyle}"/>
|
||||||
|
<Entry
|
||||||
|
Text="{Binding Endpoint, Mode=TwoWay}">
|
||||||
|
<Entry.Style>
|
||||||
|
<OnPlatform
|
||||||
|
x:TypeArguments="Style"
|
||||||
|
iOS="{StaticResource EntryStyle}"
|
||||||
|
Android="{StaticResource EntryStyle}"
|
||||||
|
WinPhone="{StaticResource UwpEntryStyle}"/>
|
||||||
|
</Entry.Style>
|
||||||
|
</Entry>
|
||||||
|
</StackLayout>
|
||||||
|
<Grid
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
BackgroundColor="Gray"/>
|
BackgroundColor="Gray"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
||||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||||
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
|
||||||
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
|
||||||
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
|
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
|
||||||
<AndroidStoreUncompressedFileExtensions />
|
<AndroidStoreUncompressedFileExtensions />
|
||||||
<MandroidI18n />
|
<MandroidI18n />
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<AssemblyName>eShopOnContainers.Windows</AssemblyName>
|
<AssemblyName>eShopOnContainers.Windows</AssemblyName>
|
||||||
<DefaultLanguage>en-US</DefaultLanguage>
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||||
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
|
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
|
||||||
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
|
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
|
||||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||||
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
|
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
@ -174,11 +174,10 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<SDKReference Include="WindowsMobile, Version=10.0.14393.0">
|
<SDKReference Include="WindowsMobile, Version=10.0.10586.0">
|
||||||
<Name>Windows Mobile Extensions for the UWP</Name>
|
<Name>Windows Mobile Extensions for the UWP</Name>
|
||||||
</SDKReference>
|
</SDKReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user