Merge branch 'dev' of https://github.com/dotnet-architecture/eShopOnContainers into dev
This commit is contained in:
commit
0fe33b7f3d
@ -1,7 +1,11 @@
|
|||||||
using eShopOnContainers.Core.Helpers;
|
using System;
|
||||||
|
using eShopOnContainers.Core.Helpers;
|
||||||
using eShopOnContainers.Services;
|
using eShopOnContainers.Services;
|
||||||
using eShopOnContainers.Core.ViewModels.Base;
|
using eShopOnContainers.Core.ViewModels.Base;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using eShopOnContainers.Core.Models.Location;
|
||||||
|
using eShopOnContainers.Core.Services.Location;
|
||||||
|
using Plugin.Geolocator;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
@ -36,6 +40,7 @@ namespace eShopOnContainers
|
|||||||
return navigationService.InitializeAsync();
|
return navigationService.InitializeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override async void OnStart()
|
protected override async void OnStart()
|
||||||
{
|
{
|
||||||
base.OnStart();
|
base.OnStart();
|
||||||
@ -44,6 +49,18 @@ namespace eShopOnContainers
|
|||||||
{
|
{
|
||||||
await InitNavigation();
|
await InitNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Settings.UseFakeLocation)
|
||||||
|
{
|
||||||
|
await GetRealLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Settings.UseMocks && !string.IsNullOrEmpty(Settings.UserId))
|
||||||
|
{
|
||||||
|
await SendCurrentLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSleep()
|
protected override void OnSleep()
|
||||||
@ -51,9 +68,29 @@ namespace eShopOnContainers
|
|||||||
// Handle when your app sleeps
|
// Handle when your app sleeps
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResume()
|
private async Task GetRealLocation()
|
||||||
{
|
{
|
||||||
// Handle when your app resumes
|
var locator = CrossGeolocator.Current;
|
||||||
|
locator.AllowsBackgroundUpdates = true;
|
||||||
|
locator.DesiredAccuracy = 50;
|
||||||
|
|
||||||
|
var position = await locator.GetPositionAsync(20000);
|
||||||
|
|
||||||
|
Settings.Latitude = position.Latitude;
|
||||||
|
Settings.Longitude = position.Longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SendCurrentLocation()
|
||||||
|
{
|
||||||
|
var location = new Location
|
||||||
|
{
|
||||||
|
Latitude = Settings.Latitude,
|
||||||
|
Longitude = Settings.Longitude
|
||||||
|
};
|
||||||
|
|
||||||
|
var locationService = ViewModelLocator.Resolve<ILocationService>();
|
||||||
|
await locationService.UpdateUserLocation(location,
|
||||||
|
Settings.AuthAccessToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,8 +26,8 @@ namespace eShopOnContainers.Core.Helpers
|
|||||||
private const string IdUseMocks = "use_mocks";
|
private const string IdUseMocks = "use_mocks";
|
||||||
private const string IdUrlBase = "url_base";
|
private const string IdUrlBase = "url_base";
|
||||||
private const string IdUseFakeLocation = "use_fake_location";
|
private const string IdUseFakeLocation = "use_fake_location";
|
||||||
private const string IdFakeLatitude = "fake_latitude";
|
private const string IdLatitude = "latitude";
|
||||||
private const string IdFakeLongitude = "fake_longitude";
|
private const string IdLongitude = "flongitude";
|
||||||
private static readonly string AccessTokenDefault = string.Empty;
|
private static readonly string AccessTokenDefault = string.Empty;
|
||||||
private static readonly string IdTokenDefault = string.Empty;
|
private static readonly string IdTokenDefault = string.Empty;
|
||||||
private static readonly bool UseMocksDefault = true;
|
private static readonly bool UseMocksDefault = true;
|
||||||
@ -40,91 +40,49 @@ namespace eShopOnContainers.Core.Helpers
|
|||||||
|
|
||||||
public static string UserId
|
public static string UserId
|
||||||
{
|
{
|
||||||
get { return AppSettings.GetValueOrDefault<string>(IdUserId); }
|
get => AppSettings.GetValueOrDefault<string>(IdUserId);
|
||||||
set { AppSettings.AddOrUpdateValue<string>(IdUserId, value); }
|
set => AppSettings.AddOrUpdateValue<string>(IdUserId, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string AuthAccessToken
|
public static string AuthAccessToken
|
||||||
{
|
{
|
||||||
get
|
get => AppSettings.GetValueOrDefault<string>(AccessToken, AccessTokenDefault);
|
||||||
{
|
set => AppSettings.AddOrUpdateValue<string>(AccessToken, value);
|
||||||
return AppSettings.GetValueOrDefault<string>(AccessToken, AccessTokenDefault);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppSettings.AddOrUpdateValue<string>(AccessToken, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string AuthIdToken
|
public static string AuthIdToken
|
||||||
{
|
{
|
||||||
get
|
get => AppSettings.GetValueOrDefault<string>(IdToken, IdTokenDefault);
|
||||||
{
|
set => AppSettings.AddOrUpdateValue<string>(IdToken, value);
|
||||||
return AppSettings.GetValueOrDefault<string>(IdToken, IdTokenDefault);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppSettings.AddOrUpdateValue<string>(IdToken, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UseMocks
|
public static bool UseMocks
|
||||||
{
|
{
|
||||||
get
|
get => AppSettings.GetValueOrDefault<bool>(IdUseMocks, UseMocksDefault);
|
||||||
{
|
set => AppSettings.AddOrUpdateValue<bool>(IdUseMocks, value);
|
||||||
return AppSettings.GetValueOrDefault<bool>(IdUseMocks, UseMocksDefault);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppSettings.AddOrUpdateValue<bool>(IdUseMocks, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string UrlBase
|
public static string UrlBase
|
||||||
{
|
{
|
||||||
get
|
get => AppSettings.GetValueOrDefault<string>(IdUrlBase, UrlBaseDefault);
|
||||||
{
|
set => AppSettings.AddOrUpdateValue<string>(IdUrlBase, value);
|
||||||
return AppSettings.GetValueOrDefault<string>(IdUrlBase, UrlBaseDefault);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppSettings.AddOrUpdateValue<string>(IdUrlBase, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UseFakeLocation
|
public static bool UseFakeLocation
|
||||||
{
|
{
|
||||||
get
|
get => AppSettings.GetValueOrDefault<bool>(IdUseFakeLocation, UseFakeLocationDefault);
|
||||||
{
|
set => AppSettings.AddOrUpdateValue<bool>(IdUseFakeLocation, value);
|
||||||
return AppSettings.GetValueOrDefault<bool>(IdUseFakeLocation, UseFakeLocationDefault);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppSettings.AddOrUpdateValue<bool>(IdUseFakeLocation, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double FakeLatitude
|
public static double Latitude
|
||||||
{
|
{
|
||||||
get
|
get => AppSettings.GetValueOrDefault<double>(IdLatitude, FakeLatitudeValue);
|
||||||
{
|
set => AppSettings.AddOrUpdateValue<double>(IdLatitude, value);
|
||||||
return AppSettings.GetValueOrDefault<double>(IdFakeLatitude, FakeLatitudeValue);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppSettings.AddOrUpdateValue<double>(IdFakeLatitude, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static double FakeLongitude
|
public static double Longitude
|
||||||
{
|
{
|
||||||
get
|
get => AppSettings.GetValueOrDefault<double>(IdLongitude, FakeLongitudeValue);
|
||||||
{
|
set => AppSettings.AddOrUpdateValue<double>(IdLongitude, value);
|
||||||
return AppSettings.GetValueOrDefault<double>(IdFakeLongitude, FakeLongitudeValue);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AppSettings.AddOrUpdateValue<double>(IdFakeLongitude, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,8 +27,8 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
{
|
{
|
||||||
UseAzureServices = !Settings.UseMocks;
|
UseAzureServices = !Settings.UseMocks;
|
||||||
_useFakeLocation = Settings.UseFakeLocation;
|
_useFakeLocation = Settings.UseFakeLocation;
|
||||||
_latitude = Settings.FakeLatitude;
|
_latitude = Settings.Latitude;
|
||||||
_longitude = Settings.FakeLongitude;
|
_longitude = Settings.Longitude;
|
||||||
_locationService = locationService;
|
_locationService = locationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,8 +154,8 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
UpdateInfoFakeLocation();
|
UpdateInfoFakeLocation();
|
||||||
|
|
||||||
Endpoint = Settings.UrlBase;
|
Endpoint = Settings.UrlBase;
|
||||||
_latitude = Settings.FakeLatitude;
|
_latitude = Settings.Latitude;
|
||||||
_longitude = Settings.FakeLongitude;
|
_longitude = Settings.Longitude;
|
||||||
_useFakeLocation = Settings.UseFakeLocation;
|
_useFakeLocation = Settings.UseFakeLocation;
|
||||||
return base.InitializeAsync(navigationData);
|
return base.InitializeAsync(navigationData);
|
||||||
}
|
}
|
||||||
@ -191,14 +191,17 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
|
|
||||||
private async Task ToggleSendLocationAsync()
|
private async Task ToggleSendLocationAsync()
|
||||||
{
|
{
|
||||||
Location locationRequest = new Location
|
if (!Settings.UseMocks)
|
||||||
{
|
{
|
||||||
Latitude = _latitude,
|
var locationRequest = new Location
|
||||||
Longitude = _longitude
|
{
|
||||||
};
|
Latitude = _latitude,
|
||||||
var authToken = Settings.AuthAccessToken;
|
Longitude = _longitude
|
||||||
|
};
|
||||||
|
var authToken = Settings.AuthAccessToken;
|
||||||
|
|
||||||
await _locationService.UpdateUserLocation(locationRequest, authToken);
|
await _locationService.UpdateUserLocation(locationRequest, authToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateInfo()
|
private void UpdateInfo()
|
||||||
@ -238,13 +241,13 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
private void UpdateLatitude(double latitude)
|
private void UpdateLatitude(double latitude)
|
||||||
{
|
{
|
||||||
// Update fake latitude (save to local storage)
|
// Update fake latitude (save to local storage)
|
||||||
Settings.FakeLatitude = latitude;
|
Settings.Latitude = latitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLongitude(double longitude)
|
private void UpdateLongitude(double longitude)
|
||||||
{
|
{
|
||||||
// Update fake longitude (save to local storage)
|
// Update fake longitude (save to local storage)
|
||||||
Settings.FakeLongitude = longitude;
|
Settings.Longitude = longitude;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,6 +10,7 @@
|
|||||||
"Newtonsoft.Json": "9.0.1",
|
"Newtonsoft.Json": "9.0.1",
|
||||||
"SlideOverKit": "2.1.4",
|
"SlideOverKit": "2.1.4",
|
||||||
"Splat": "1.6.2",
|
"Splat": "1.6.2",
|
||||||
|
"Xam.Plugin.Geolocator": "3.0.4",
|
||||||
"Xam.Plugins.Settings": "2.6.0.12-beta",
|
"Xam.Plugins.Settings": "2.6.0.12-beta",
|
||||||
"Xamarin.FFImageLoading": "2.2.9",
|
"Xamarin.FFImageLoading": "2.2.9",
|
||||||
"Xamarin.FFImageLoading.Forms": "2.2.9",
|
"Xamarin.FFImageLoading.Forms": "2.2.9",
|
||||||
|
@ -9,6 +9,7 @@ using Android.Content;
|
|||||||
using Android.Runtime;
|
using Android.Runtime;
|
||||||
using FFImageLoading;
|
using FFImageLoading;
|
||||||
using System;
|
using System;
|
||||||
|
using Plugin.Permissions;
|
||||||
|
|
||||||
namespace eShopOnContainers.Droid.Activities
|
namespace eShopOnContainers.Droid.Activities
|
||||||
{
|
{
|
||||||
@ -56,6 +57,11 @@ namespace eShopOnContainers.Droid.Activities
|
|||||||
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
|
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
|
||||||
base.OnTrimMemory(level);
|
base.OnTrimMemory(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
|
||||||
|
{
|
||||||
|
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
using Android.App;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Plugin.CurrentActivity;
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Droid
|
||||||
|
{
|
||||||
|
//You can specify additional application information in this attribute
|
||||||
|
[Application]
|
||||||
|
public class MainApplication : Application, Application.IActivityLifecycleCallbacks
|
||||||
|
{
|
||||||
|
public MainApplication(IntPtr handle, JniHandleOwnership transer)
|
||||||
|
:base(handle, transer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnCreate()
|
||||||
|
{
|
||||||
|
base.OnCreate();
|
||||||
|
RegisterActivityLifecycleCallbacks(this);
|
||||||
|
//A great place to initialize Xamarin.Insights and Dependency Services!
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnTerminate()
|
||||||
|
{
|
||||||
|
base.OnTerminate();
|
||||||
|
UnregisterActivityLifecycleCallbacks(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
CrossCurrentActivity.Current.Activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActivityDestroyed(Activity activity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActivityPaused(Activity activity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActivityResumed(Activity activity)
|
||||||
|
{
|
||||||
|
CrossCurrentActivity.Current.Activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActivityStarted(Activity activity)
|
||||||
|
{
|
||||||
|
CrossCurrentActivity.Current.Activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActivityStopped(Activity activity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,5 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||||
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
|
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<application android:label="eShopOnContainers" android:icon="@drawable/icon" android:largeHeap="true"></application>
|
<application android:label="eShopOnContainers" android:icon="@drawable/icon" android:largeHeap="true"></application>
|
||||||
</manifest>
|
</manifest>
|
@ -2,6 +2,14 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Net.Primitives" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
|
<assemblyIdentity name="System.Net.Http" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
@ -100,6 +100,21 @@
|
|||||||
<HintPath>..\..\..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll</HintPath>
|
<HintPath>..\..\..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Plugin.CurrentActivity, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\..\..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Plugin.Geolocator, Version=3.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Plugin.Geolocator.Abstractions, Version=3.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Plugin.Permissions, Version=1.1.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Plugin.Permissions.Abstractions, Version=1.1.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.Abstractions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Plugin.Settings, Version=2.6.0.12, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Plugin.Settings, Version=2.6.0.12, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\MonoAndroid10\Plugin.Settings.dll</HintPath>
|
<HintPath>..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\MonoAndroid10\Plugin.Settings.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@ -207,6 +222,7 @@
|
|||||||
<Compile Include="Effects\EntryLineColorEffect.cs" />
|
<Compile Include="Effects\EntryLineColorEffect.cs" />
|
||||||
<Compile Include="Extensions\ViewExtensions.cs" />
|
<Compile Include="Extensions\ViewExtensions.cs" />
|
||||||
<Compile Include="Helpers\Settings.cs" />
|
<Compile Include="Helpers\Settings.cs" />
|
||||||
|
<Compile Include="MainApplication.cs" />
|
||||||
<Compile Include="Renderers\BadgeView.cs" />
|
<Compile Include="Renderers\BadgeView.cs" />
|
||||||
<Compile Include="Renderers\CustomNavigationPageRenderer.cs" />
|
<Compile Include="Renderers\CustomNavigationPageRenderer.cs" />
|
||||||
<Compile Include="Renderers\CustomTabbedPageRenderer.cs" />
|
<Compile Include="Renderers\CustomTabbedPageRenderer.cs" />
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
<package id="modernhttpclient" version="2.4.2" targetFramework="monoandroid70" />
|
<package id="modernhttpclient" version="2.4.2" targetFramework="monoandroid70" />
|
||||||
<package id="NETStandard.Library" version="1.6.0" targetFramework="monoandroid60" />
|
<package id="NETStandard.Library" version="1.6.0" targetFramework="monoandroid60" />
|
||||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="monoandroid60" />
|
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="monoandroid60" />
|
||||||
|
<package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid60" />
|
||||||
|
<package id="Plugin.Permissions" version="1.1.7" targetFramework="monoandroid60" />
|
||||||
<package id="SlideOverKit" version="2.1.4" targetFramework="monoandroid70" />
|
<package id="SlideOverKit" version="2.1.4" targetFramework="monoandroid70" />
|
||||||
<package id="Splat" version="1.6.2" targetFramework="monoandroid70" />
|
<package id="Splat" version="1.6.2" targetFramework="monoandroid70" />
|
||||||
<package id="System.AppContext" version="4.1.0" targetFramework="monoandroid60" />
|
<package id="System.AppContext" version="4.1.0" targetFramework="monoandroid60" />
|
||||||
@ -61,6 +63,7 @@
|
|||||||
<package id="System.Threading.Timer" version="4.0.1" targetFramework="monoandroid60" />
|
<package id="System.Threading.Timer" version="4.0.1" targetFramework="monoandroid60" />
|
||||||
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="monoandroid70" />
|
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="monoandroid70" />
|
||||||
<package id="System.Xml.XDocument" version="4.0.11" targetFramework="monoandroid70" />
|
<package id="System.Xml.XDocument" version="4.0.11" targetFramework="monoandroid70" />
|
||||||
|
<package id="Xam.Plugin.Geolocator" version="3.0.4" targetFramework="monoandroid60" />
|
||||||
<package id="Xam.Plugins.Settings" version="2.6.0.12-beta" targetFramework="monoandroid70" />
|
<package id="Xam.Plugins.Settings" version="2.6.0.12-beta" targetFramework="monoandroid70" />
|
||||||
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid70" />
|
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid70" />
|
||||||
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid70" />
|
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid70" />
|
||||||
|
@ -25,5 +25,6 @@
|
|||||||
<Capabilities>
|
<Capabilities>
|
||||||
<Capability Name="internetClient" />
|
<Capability Name="internetClient" />
|
||||||
<Capability Name="privateNetworkClientServer" />
|
<Capability Name="privateNetworkClientServer" />
|
||||||
|
<DeviceCapability Name="location" />
|
||||||
</Capabilities>
|
</Capabilities>
|
||||||
</Package>
|
</Package>
|
@ -24,6 +24,7 @@
|
|||||||
{
|
{
|
||||||
await SetIndexes();
|
await SetIndexes();
|
||||||
await SetUSLocations();
|
await SetUSLocations();
|
||||||
|
await SetBarcelonaLocations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +86,20 @@
|
|||||||
await ctx.Locations.InsertOneAsync(rdm);
|
await ctx.Locations.InsertOneAsync(rdm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async Task SetBarcelonaLocations()
|
||||||
|
{
|
||||||
|
var bcn = new Locations()
|
||||||
|
{
|
||||||
|
Code = "BCN",
|
||||||
|
Description = "Barcelona",
|
||||||
|
LocationId = 5
|
||||||
|
};
|
||||||
|
bcn.SetLocation(2.156453, 41.395226);
|
||||||
|
bcn.SetArea(GetBarcelonaPoligon());
|
||||||
|
await ctx.Locations.InsertOneAsync(bcn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static async Task SetIndexes()
|
static async Task SetIndexes()
|
||||||
{
|
{
|
||||||
// Set location indexes
|
// Set location indexes
|
||||||
@ -145,5 +160,18 @@
|
|||||||
new GeoJson2DGeographicCoordinates(-124.68633, 48.8943)
|
new GeoJson2DGeographicCoordinates(-124.68633, 48.8943)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static List<GeoJson2DGeographicCoordinates> GetBarcelonaPoligon()
|
||||||
|
{
|
||||||
|
return new List<GeoJson2DGeographicCoordinates>()
|
||||||
|
{
|
||||||
|
new GeoJson2DGeographicCoordinates(2.033879, 41.383858),
|
||||||
|
new GeoJson2DGeographicCoordinates(2.113741, 41.419068),
|
||||||
|
new GeoJson2DGeographicCoordinates(2.188778, 41.451153),
|
||||||
|
new GeoJson2DGeographicCoordinates(2.235266, 41.418033),
|
||||||
|
new GeoJson2DGeographicCoordinates(2.137101, 41.299536),
|
||||||
|
new GeoJson2DGeographicCoordinates(2.033879, 41.383858)
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user