Browse Source

Add userIsLogged contiditon in view for fake location

pull/809/head
Christian Arenas 7 years ago
parent
commit
19647d8b7d
3 changed files with 14 additions and 7 deletions
  1. +3
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs
  2. +4
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs
  3. +7
    -5
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml

+ 3
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs View File

@ -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)


+ 4
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs View File

@ -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()


+ 7
- 5
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml View File

@ -163,7 +163,8 @@
Grid.ColumnSpan="2"/>
<StackLayout
Grid.Column="0"
Grid.Row="4">
Grid.Row="4"
IsVisible="{Binding UserIsLogged}">
<Label
Text="{Binding TitleUseFakeLocation}"
TextColor="{StaticResource GreenColor}"
@ -179,7 +180,8 @@
Animate="True"
Checked="{Binding UseFakeLocation, Mode=TwoWay}"
Command="{Binding ToggleFakeLocationCommand}"
Style="{StaticResource SettingsToggleButtonStyle}">
Style="{StaticResource SettingsToggleButtonStyle}"
IsVisible="{Binding UserIsLogged}">
<controls:ToggleButton.CheckedImage>
<OnPlatform x:TypeArguments="ImageSource"
Android="switch_on.png"
@ -193,7 +195,7 @@
WinPhone="Assets/switchOff.png"/>
</controls:ToggleButton.UnCheckedImage>
</controls:ToggleButton>
<!-- ENDPOINT -->
<!-- FAKE LOCATIONS -->
<StackLayout
Grid.Row="5"
Grid.Column="0"
@ -205,7 +207,7 @@
Style="{StaticResource HeaderLabelStyle}"/>
<Entry
Text="{Binding Latitude, Mode=TwoWay}"
Keyboard="Numeric">
Keyboard="Text">
<Entry.Style>
<OnPlatform
x:TypeArguments="Style"
@ -219,7 +221,7 @@
Style="{StaticResource HeaderLabelStyle}"/>
<Entry
Text="{Binding Longitude, Mode=TwoWay}"
Keyboard="Numeric">
Keyboard="Text">
<Entry.Style>
<OnPlatform
x:TypeArguments="Style"


Loading…
Cancel
Save