diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Identity/IdentityService.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Identity/IdentityService.cs index e144eb6ff..daeab7fec 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Identity/IdentityService.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Identity/IdentityService.cs @@ -16,7 +16,7 @@ namespace eShopOnContainers.Core.Services.Identity dic.Add("client_id", "xamarin"); dic.Add("client_secret", "secret"); dic.Add("response_type", "code id_token token"); - dic.Add("scope", "openid profile basket orders offline_access"); + dic.Add("scope", "openid profile basket orders locations offline_access"); dic.Add("redirect_uri", GlobalSetting.Instance.IdentityCallback); dic.Add("nonce", Guid.NewGuid().ToString("N")); diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/ILocationService.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/ILocationService.cs index bc2c59915..94bff221d 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/ILocationService.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/ILocationService.cs @@ -5,6 +5,6 @@ public interface ILocationService { - Task UpdateUserLocation(LocationRequest newLocReq); + Task UpdateUserLocation(LocationRequest newLocReq, string token); } } \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs index 2149a5118..6c6a104c2 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs @@ -14,7 +14,7 @@ _requestProvider = requestProvider; } - public async Task UpdateUserLocation(LocationRequest newLocReq) + public async Task UpdateUserLocation(LocationRequest newLocReq, string token) { UriBuilder builder = new UriBuilder(GlobalSetting.Instance.LocationEndpoint); @@ -22,7 +22,7 @@ string uri = builder.ToString(); - var result = await _requestProvider.PostAsync(uri, newLocReq); + await _requestProvider.PostAsync(uri, newLocReq, token); } } } diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs index c174e36c8..95d2c8556 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs @@ -215,8 +215,10 @@ namespace eShopOnContainers.Core.ViewModels if(Settings.UseMocks) { Settings.AuthAccessToken = string.Empty; - Settings.AuthIdToken = string.Empty; + Settings.AuthIdToken = string.Empty; } + + Settings.UseFakeLocation = false; } private async Task NavigateAsync(string url) diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs index 8bfe9ed25..33188a96c 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs @@ -140,6 +140,8 @@ namespace eShopOnContainers.Core.ViewModels } } + public bool UserIsLogged => !string.IsNullOrEmpty(Settings.AuthAccessToken); + public ICommand ToggleMockServicesCommand => new Command(async () => await ToggleMockServicesAsync()); public ICommand ToggleFakeLocationCommand => new Command(() => ToggleFakeLocationAsync()); @@ -194,8 +196,9 @@ namespace eShopOnContainers.Core.ViewModels Latitude = _latitude, Longitude = _longitude }; + var authToken = Settings.AuthAccessToken; - await _locationService.UpdateUserLocation(locationRequest); + await _locationService.UpdateUserLocation(locationRequest, authToken); } private void UpdateInfo() diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml index a8da35daa..e374af1a7 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml @@ -163,7 +163,8 @@ Grid.ColumnSpan="2"/> + Grid.Row="4" + IsVisible="{Binding UserIsLogged}">