Add userIsLogged contiditon in view for fake location

This commit is contained in:
Christian Arenas 2017-06-12 20:22:38 +02:00
parent 3b5d081086
commit 2283a9d12b
3 changed files with 14 additions and 7 deletions

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)

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

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"