Select station page added to ease getting operator specific contact information.

This commit is contained in:
Oliver Hauff 2021-07-22 22:41:35 +02:00
parent a58c33f005
commit ddfea49ea6
24 changed files with 1105 additions and 89 deletions

View file

@ -20,7 +20,6 @@ using TINK.Model.Connector;
using TINK.Model.Services.CopriApi;
using Plugin.Permissions;
using Xamarin.Essentials;
using Plugin.BLE;
using System.Threading;
using TINK.MultilingualResources;
using TINK.Services.BluetoothLock;
@ -37,11 +36,11 @@ namespace TINK.ViewModel.Map
{
public class MapPageViewModel : INotifyPropertyChanged
{
/// <summary> Holds the count of custom idcons availalbe.</summary>
/// <summary> Holds the count of custom icons availalbe.</summary>
private const int CUSTOM_ICONS_COUNT = 30;
/// <summary> Reference on view servcie to show modal notifications and to perform navigation. </summary>
private IViewService m_oViewService;
private IViewService ViewService { get; }
/// <summary>
/// Holds the exception which occurred getting bikes occupied information.
@ -144,7 +143,7 @@ namespace TINK.ViewModel.Map
m_oMoveToRegionDelegate = moveToRegionDelegate
?? throw new ArgumentException("Can not instantiate map page view model- object. No move delegate available.");
m_oViewService = viewService
ViewService = viewService
?? throw new ArgumentException("Can not instantiate map page view model- object. No view available.");
m_oNavigation = navigation
@ -330,7 +329,7 @@ namespace TINK.ViewModel.Map
if (permissionResult != Plugin.Permissions.Abstractions.PermissionStatus.Granted)
{
var dialogResult = await m_oViewService.DisplayAlert(
var dialogResult = await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageCenterMapLocationPermissionOpenDialog,
AppResources.MessageAnswerYes,
@ -390,7 +389,7 @@ namespace TINK.ViewModel.Map
Log.ForContext<MapPageViewModel>().Verbose("No pins detected on page.");
if (resultStationsAndBikes.Response.StationsAll.CopriVersion < CopriCallsStatic.UnsupportedVersionLower)
{
await m_oViewService.DisplayAlert(
await ViewService.DisplayAlert(
AppResources.MessageWaring,
string.Format(AppResources.MessageCopriVersionIsOutdated, ContactPageViewModel.GetAppName(TinkApp.Uris.ActiveUri)),
AppResources.MessageAnswerOk);
@ -400,7 +399,7 @@ namespace TINK.ViewModel.Map
if (resultStationsAndBikes.Response.StationsAll.CopriVersion >= CopriCallsStatic.UnsupportedVersionUpper)
{
await m_oViewService.DisplayAlert(
await ViewService.DisplayAlert(
AppResources.MessageWaring,
string.Format(AppResources.MessageAppVersionIsOutdated, ContactPageViewModel.GetAppName(TinkApp.Uris.ActiveUri)),
AppResources.MessageAnswerOk);
@ -420,7 +419,7 @@ namespace TINK.ViewModel.Map
Log.ForContext<MapPageViewModel>().Error("Map page is shown (probable for the first time after startup of app) and COPRI auth cookie is not defined. {@l_oException}", resultStationsAndBikes.Exception);
// COPRI reports an auth cookie error.
await m_oViewService.DisplayAlert(
await ViewService.DisplayAlert(
AppResources.MessageWaring,
AppResources.MessageMapPageErrorAuthcookieUndefined,
AppResources.MessageAnswerOk);
@ -464,7 +463,7 @@ namespace TINK.ViewModel.Map
IsRunning = false;
await m_oViewService.DisplayAlert(
await ViewService.DisplayAlert(
"Fehler",
$"Beim Anzeigen der Fahrradstandorte- Seite ist ein Fehler aufgetreten.\r\n{l_oException.Message}",
"OK");
@ -621,7 +620,7 @@ namespace TINK.ViewModel.Map
p_strStationName);
#else
// Show page.
await m_oViewService.PushAsync(ViewTypes.BikesAtStation);
await ViewService.PushAsync(ViewTypes.BikesAtStation);
IsMapPageEnabled = true;
ActionText = "";
@ -632,7 +631,7 @@ namespace TINK.ViewModel.Map
ActionText = "";
Log.ForContext<MapPageViewModel>().Error("Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {Exception}", exception);
await m_oViewService.DisplayAlert(
await ViewService.DisplayAlert(
"Fehler",
$"Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {exception.Message}",
"OK");
@ -867,7 +866,7 @@ namespace TINK.ViewModel.Map
if (permissionResult != Plugin.Permissions.Abstractions.PermissionStatus.Granted)
{
var dialogResult = await m_oViewService.DisplayAlert(
var dialogResult = await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationPermission,
"Ja",
@ -888,7 +887,7 @@ namespace TINK.ViewModel.Map
// see https://github.com/xabre/xamarin-bluetooth-le/issues/112#issuecomment-380994887
if (await BluetoothService.GetBluetoothState() != Plugin.BLE.Abstractions.Contracts.BluetoothState.On)
{
await m_oViewService.DisplayAlert(
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementBluetoothActivation,
AppResources.MessageAnswerOk);
@ -949,7 +948,7 @@ namespace TINK.ViewModel.Map
{
Log.ForContext<MapPageViewModel>().Error("An error occurred switching view TINK/ Konrad.{}");
await m_oViewService.DisplayAlert(
await ViewService.DisplayAlert(
"Fehler",
$"Beim Umschalten TINK/ Konrad ist ein Fehler aufgetreten.\r\n{l_oException.Message}",
"OK");