Skip to content

Commit 19647d8

Browse files
committed
Add userIsLogged contiditon in view for fake location
1 parent dde8e68 commit 19647d8

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,10 @@ private void Logout()
215215
if(Settings.UseMocks)
216216
{
217217
Settings.AuthAccessToken = string.Empty;
218-
Settings.AuthIdToken = string.Empty;
218+
Settings.AuthIdToken = string.Empty;
219219
}
220+
221+
Settings.UseFakeLocation = false;
220222
}
221223

222224
private async Task NavigateAsync(string url)

src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ public double Longitude
140140
}
141141
}
142142

143+
public bool UserIsLogged => !string.IsNullOrEmpty(Settings.AuthAccessToken);
144+
143145
public ICommand ToggleMockServicesCommand => new Command(async () => await ToggleMockServicesAsync());
144146

145147
public ICommand ToggleFakeLocationCommand => new Command(() => ToggleFakeLocationAsync());
@@ -194,8 +196,9 @@ private async Task ToggleSendLocationAsync()
194196
Latitude = _latitude,
195197
Longitude = _longitude
196198
};
199+
var authToken = Settings.AuthAccessToken;
197200

198-
await _locationService.UpdateUserLocation(locationRequest);
201+
await _locationService.UpdateUserLocation(locationRequest, authToken);
199202
}
200203

201204
private void UpdateInfo()

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@
163163
Grid.ColumnSpan="2"/>
164164
<StackLayout
165165
Grid.Column="0"
166-
Grid.Row="4">
166+
Grid.Row="4"
167+
IsVisible="{Binding UserIsLogged}">
167168
<Label
168169
Text="{Binding TitleUseFakeLocation}"
169170
TextColor="{StaticResource GreenColor}"
@@ -179,7 +180,8 @@
179180
Animate="True"
180181
Checked="{Binding UseFakeLocation, Mode=TwoWay}"
181182
Command="{Binding ToggleFakeLocationCommand}"
182-
Style="{StaticResource SettingsToggleButtonStyle}">
183+
Style="{StaticResource SettingsToggleButtonStyle}"
184+
IsVisible="{Binding UserIsLogged}">
183185
<controls:ToggleButton.CheckedImage>
184186
<OnPlatform x:TypeArguments="ImageSource"
185187
Android="switch_on.png"
@@ -193,7 +195,7 @@
193195
WinPhone="Assets/switchOff.png"/>
194196
</controls:ToggleButton.UnCheckedImage>
195197
</controls:ToggleButton>
196-
<!-- ENDPOINT -->
198+
<!-- FAKE LOCATIONS -->
197199
<StackLayout
198200
Grid.Row="5"
199201
Grid.Column="0"
@@ -205,7 +207,7 @@
205207
Style="{StaticResource HeaderLabelStyle}"/>
206208
<Entry
207209
Text="{Binding Latitude, Mode=TwoWay}"
208-
Keyboard="Numeric">
210+
Keyboard="Text">
209211
<Entry.Style>
210212
<OnPlatform
211213
x:TypeArguments="Style"
@@ -219,7 +221,7 @@
219221
Style="{StaticResource HeaderLabelStyle}"/>
220222
<Entry
221223
Text="{Binding Longitude, Mode=TwoWay}"
222-
Keyboard="Numeric">
224+
Keyboard="Text">
223225
<Entry.Style>
224226
<OnPlatform
225227
x:TypeArguments="Style"

0 commit comments

Comments
 (0)