mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-21 04:26:29 +02:00
Version 3.0.364
This commit is contained in:
parent
91d42552c7
commit
0b9196a78d
91 changed files with 3452 additions and 555 deletions
|
@ -101,7 +101,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
}
|
||||
}
|
||||
|
||||
// Notify corpi about unlock action in order to start booking.
|
||||
// Notify copri about unlock action in order to start booking.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextRentingBike;
|
||||
IsConnected = IsConnectedDelegate();
|
||||
try
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace TINK.ViewModel.Contact
|
|||
? $"{stationId}" // there is a station marker with index letter for given station id
|
||||
: "Open"; // there is no station marker. Use open marker.
|
||||
|
||||
var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]);
|
||||
var colorPartPrefix = GetResourceNameColorPart(stationsColorList[pinIndex]);
|
||||
|
||||
var l_iName = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
try
|
||||
|
@ -234,7 +234,7 @@ namespace TINK.ViewModel.Contact
|
|||
/// <summary> Gets the color related part of the ressrouce name.</summary>
|
||||
/// <param name="color">Color to get name for.</param>
|
||||
/// <returns>Resource name.</returns>
|
||||
private static string GetRessourceNameColorPart(Color color)
|
||||
private static string GetResourceNameColorPart(Color color)
|
||||
{
|
||||
if (color == Color.Blue)
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ namespace TINK.ViewModel.Contact
|
|||
|
||||
var colors = GetStationColors(
|
||||
Pins.Select(x => x.Tag.ToString()).ToList(),
|
||||
resultStationsAndBikes.Response.Bikes);
|
||||
resultStationsAndBikes.Response.BikesOccupied);
|
||||
|
||||
// Update pins color form count of bikes located at station.
|
||||
UpdatePinsColor(colors);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace TINK.ViewModel.Contact
|
|||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
/// <summary> Holds value wether site caching is on or off.</summary>
|
||||
/// <summary> Holds value whether site caching is on or off.</summary>
|
||||
bool IsSiteCachingOn { get; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -64,7 +64,7 @@ namespace TINK.ViewModel.Contact
|
|||
|
||||
/// <summary> Constructs view model.</summary>
|
||||
/// <param name="isSiteCachingOn">Set of user permissions</param>
|
||||
/// <param name="resourceProvider">Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty.</param>
|
||||
/// <param name="resourceProvider">Delegate to get embedded html resource. Used as fallback if download from web page does not work and cache is empty.</param>
|
||||
/// <param name="query">Object to query resources path values if required.</param>
|
||||
public FeesAndBikesPageViewModel(
|
||||
string hostName,
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace TINK.ViewModel.Info
|
|||
/// <summary> Holds the name of the host.</summary>
|
||||
private string HostName { get; }
|
||||
|
||||
/// <summary> Holds value wether site caching is on or off.</summary>
|
||||
/// <summary> Holds value whether site caching is on or off.</summary>
|
||||
bool IsSiteCachingOn { get; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -74,11 +74,11 @@ namespace TINK.ViewModel.Info
|
|||
|
||||
/// <summary> Constructs Info view model</summary>
|
||||
/// <param name="hostName">Name of the host to get html resources from.</param>
|
||||
/// <param name="isSiteCachingOn">Holds value wether site caching is on or off.</param>
|
||||
/// <param name="agbResourcePath"> Agb resouce path received from backend.</param>
|
||||
/// <param name="privacyResourcePath"> Privacy resouce path received from backend.</param>
|
||||
/// <param name="impressResourcePath"> Impress resouce path received from backend.</param>
|
||||
/// <param name="resourceProvider">Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty.</param>
|
||||
/// <param name="isSiteCachingOn">Holds value whether site caching is on or off.</param>
|
||||
/// <param name="agbResourcePath"> Agb resource path received from backend.</param>
|
||||
/// <param name="privacyResourcePath"> Privacy resource path received from backend.</param>
|
||||
/// <param name="impressResourcePath"> Impress resource path received from backend.</param>
|
||||
/// <param name="resourceProvider">Delegate to get embedded html resource. Used as fallback if download from web page does not work and cache is empty.</param>
|
||||
/// <param name="queryProvider">Object to query resources urls object from backend if required.</param>
|
||||
/// <param name="updateUrlsAction">Action to update shared resources urls object</param>
|
||||
public InfoPageViewModel(
|
||||
|
@ -102,7 +102,7 @@ namespace TINK.ViewModel.Info
|
|||
InfoAgb = new HtmlWebViewSource { Html = "<html>Loading...</html>" };
|
||||
|
||||
ResourceProvider = resourceProvider
|
||||
?? throw new ArgumentException($"Can not instantiate {typeof(InfoPageViewModel)}-object. No ressource provider centered.");
|
||||
?? throw new ArgumentException($"Can not instantiate {typeof(InfoPageViewModel)}-object. No resource provider centered.");
|
||||
}
|
||||
|
||||
/// <summary> Called when page is shown. </summary>
|
||||
|
@ -147,7 +147,7 @@ namespace TINK.ViewModel.Info
|
|||
|
||||
if (string.IsNullOrEmpty(PrivacyResourcePath))
|
||||
{
|
||||
// Information to access ressource is missing
|
||||
// Information to access resource is missing
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = await Task.FromResult(ViewModelHelper.FromBody("No privacy resource available. Resource path is null or empty."))
|
||||
|
@ -172,7 +172,7 @@ namespace TINK.ViewModel.Info
|
|||
|
||||
if (string.IsNullOrEmpty(ImpressResourcePath))
|
||||
{
|
||||
// Information to access ressource is missing
|
||||
// Information to access resource is missing
|
||||
return new HtmlWebViewSource
|
||||
{
|
||||
Html = await Task.FromResult(ViewModelHelper.FromBody("No impress resource available. Resource path is null or empty."))
|
||||
|
|
|
@ -329,7 +329,7 @@ namespace TINK.ViewModel
|
|||
return;
|
||||
}
|
||||
|
||||
// Swich to map page
|
||||
// Switch to map page
|
||||
#if USEFLYOUT
|
||||
m_oViewService.ShowPage(ViewTypes.BikeInfoCarouselPage, AppResources.MarkingLoginInstructions);
|
||||
#else
|
||||
|
|
|
@ -22,11 +22,11 @@ using TINK.Services.Permissions;
|
|||
using Xamarin.Essentials;
|
||||
using System.Threading;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Services.BluetoothLock;
|
||||
using TINK.Repository;
|
||||
using TINK.Services.Geolocation;
|
||||
using TINK.Model.State;
|
||||
using TINK.ViewModel.Bikes;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BC;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
|
||||
#if !TRYNOTBACKSTYLE
|
||||
#endif
|
||||
|
@ -263,7 +263,7 @@ namespace TINK.ViewModel.Map
|
|||
? $"{stationId}" // there is a station marker with index letter for given station id
|
||||
: "Open"; // there is no station marker. Use open marker.
|
||||
|
||||
var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]);
|
||||
var colorPartPrefix = GetResourceNameColorPart(stationsColorList[pinIndex]);
|
||||
var name = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}";
|
||||
try
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ namespace TINK.ViewModel.Map
|
|||
/// <summary> Gets the color related part of the ressrouce name.</summary>
|
||||
/// <param name="color">Color to get name for.</param>
|
||||
/// <returns>Resource name.</returns>
|
||||
private static string GetRessourceNameColorPart(Color color)
|
||||
private static string GetResourceNameColorPart(Color color)
|
||||
{
|
||||
if (color == Color.Blue)
|
||||
{
|
||||
|
@ -394,7 +394,8 @@ namespace TINK.ViewModel.Map
|
|||
|
||||
var colors = GetStationColors(
|
||||
Pins.Select(x => x.Tag.ToString()).ToList(),
|
||||
resultStationsAndBikes.Response.Bikes);
|
||||
resultStationsAndBikes.Response.StationsAll,
|
||||
resultStationsAndBikes.Response.BikesOccupied);
|
||||
|
||||
// Update pins color form count of bikes located at station.
|
||||
UpdatePinsColor(colors);
|
||||
|
@ -402,7 +403,7 @@ namespace TINK.ViewModel.Map
|
|||
Log.ForContext<MapPageViewModel>().Verbose("Update pins color done.");
|
||||
|
||||
// Load MyBikes Count -> MyBikes Icon/Button
|
||||
GetMyBikesCount(resultStationsAndBikes.Response.Bikes);
|
||||
GetMyBikesCount(resultStationsAndBikes.Response.BikesOccupied);
|
||||
|
||||
// Move and scale before getting stations and bikes which takes some time.
|
||||
ActionText = AppResources.ActivityTextCenterMap;
|
||||
|
@ -655,7 +656,7 @@ namespace TINK.ViewModel.Map
|
|||
}
|
||||
|
||||
// Load MyBikes Count -> MyBikes Icon/Button
|
||||
GetMyBikesCount(resultStationsAndBikes.Response.Bikes);
|
||||
GetMyBikesCount(resultStationsAndBikes.Response.BikesOccupied);
|
||||
|
||||
// Check if there are already any pins to the map.
|
||||
// If no initialize pins.
|
||||
|
@ -670,7 +671,8 @@ namespace TINK.ViewModel.Map
|
|||
// Set/ update pins colors.
|
||||
var l_oColors = GetStationColors(
|
||||
Pins.Select(x => x.Tag.ToString()).ToList(),
|
||||
resultStationsAndBikes.Response.Bikes);
|
||||
resultStationsAndBikes.Response.StationsAll,
|
||||
resultStationsAndBikes.Response.BikesOccupied);
|
||||
|
||||
// Update pins color form count of bikes located at station.
|
||||
TinkApp.PostAction(
|
||||
|
@ -758,10 +760,13 @@ namespace TINK.ViewModel.Map
|
|||
/// Gets the list of station color for all stations.
|
||||
/// </summary>
|
||||
/// <param name="stationsId">Station id list to get color for.</param>
|
||||
/// <param name="stations">Station object dictionary to get count of available bike from for each station.</param>
|
||||
/// <param name="bikesReserved">Bike collection to get count of reserved/ rented bikes from for each station.</param>
|
||||
/// <returns></returns>
|
||||
private static IList<Color> GetStationColors(
|
||||
internal static IList<Color> GetStationColors(
|
||||
IEnumerable<string> stationsId,
|
||||
BikeCollection bikesAll)
|
||||
IEnumerable<IStation> stations,
|
||||
IEnumerable<BikeInfo> bikesReserved)
|
||||
{
|
||||
if (stationsId == null)
|
||||
{
|
||||
|
@ -769,11 +774,14 @@ namespace TINK.ViewModel.Map
|
|||
return new List<Color>();
|
||||
}
|
||||
|
||||
if (bikesAll == null)
|
||||
if (stations == null)
|
||||
{
|
||||
// If object is null an error occurred querying bikes centered or bikes occupied which results in an unknown state.
|
||||
Log.ForContext<MapPageViewModel>().Error("No bikes available to determine pins color.");
|
||||
return new List<Color>(stationsId.Select(x => Color.Blue));
|
||||
Log.ForContext<MapPageViewModel>().Error("No stations info available to get count of bikes available to determine whether a pin is green or not.");
|
||||
}
|
||||
|
||||
if (bikesReserved == null)
|
||||
{
|
||||
Log.ForContext<MapPageViewModel>().Error("No bikes info available to determine whether a pins is light blue or not.");
|
||||
}
|
||||
|
||||
// Get state for each station.
|
||||
|
@ -781,15 +789,14 @@ namespace TINK.ViewModel.Map
|
|||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value.IsOccupied()) != null)
|
||||
if (bikesReserved?.Where(x => x.StationId == stationId).Count() > 0)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
colors.Add(Color.LightBlue);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bikesAtStation.ToList().Count > 0)
|
||||
if (stations?.FirstOrDefault(x => x.Id == stationId)?.AvailableBikesCount > 0)
|
||||
{
|
||||
// There is at least one bike available
|
||||
colors.Add(Color.Green);
|
||||
|
@ -1030,7 +1037,8 @@ namespace TINK.ViewModel.Map
|
|||
Log.ForContext<MapPageViewModel>().Verbose("Starting update pins color on toggle...");
|
||||
var l_oColors = GetStationColors(
|
||||
Pins.Select(x => x.Tag.ToString()).ToList(),
|
||||
resultStationsAndBikes.Response.Bikes);
|
||||
resultStationsAndBikes.Response.StationsAll,
|
||||
resultStationsAndBikes.Response.BikesOccupied);
|
||||
|
||||
// Update pins color form count of bikes located at station.
|
||||
UpdatePinsColor(l_oColors);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
@ -66,12 +66,12 @@ namespace TINK.Model.Connector
|
|||
{
|
||||
NextActiveUri = new Uri(serverTextToUri.ContainsKey(value) ? serverTextToUri[value] : value);
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CorpiServerUriDescription)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CopriServerUriDescription)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Holds the description of the picker, i.e. binds to label Text.</summary>
|
||||
public string CorpiServerUriDescription
|
||||
public string CopriServerUriDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -65,21 +65,21 @@ namespace TINK.ViewModel
|
|||
/// <summary> Reference on the tink app instance. </summary>
|
||||
private ITinkApp TinkApp { get; }
|
||||
|
||||
IServicesContainer<IGeolocationService> GeoloctionServicesContainer { get; }
|
||||
IServicesContainer<IGeolocationService> GeolocationServicesContainer { get; }
|
||||
|
||||
/// <summary> Constructs a settings page view model object.</summary>
|
||||
/// <param name="tinkApp"> Reference to tink app model.</param>
|
||||
/// <param name="geoloctionServicesContainer"></param>
|
||||
/// <param name="geolocationServicesContainer"></param>
|
||||
/// <param name="viewService">Interface to view</param>
|
||||
public SettingsPageViewModel(
|
||||
ITinkApp tinkApp,
|
||||
IServicesContainer<IGeolocationService> geoloctionServicesContainer,
|
||||
IServicesContainer<IGeolocationService> geolocationServicesContainer,
|
||||
IViewService viewService)
|
||||
{
|
||||
TinkApp = tinkApp
|
||||
?? throw new ArgumentException("Can not instantiate settings page view model- object. No tink app object available.");
|
||||
|
||||
GeoloctionServicesContainer = geoloctionServicesContainer
|
||||
GeolocationServicesContainer = geolocationServicesContainer
|
||||
?? throw new ArgumentException($"Can not instantiate {nameof(SettingsPageViewModel)}- object. Geolocation services container object must not be null.");
|
||||
|
||||
m_oViewService = viewService
|
||||
|
@ -175,14 +175,14 @@ namespace TINK.ViewModel
|
|||
TinkApp.LocksServices.Active.GetType().FullName));
|
||||
|
||||
GeolocationServices = new ServicesViewModel(
|
||||
GeoloctionServicesContainer.Select(x => x.GetType().FullName),
|
||||
GeolocationServicesContainer.Select(x => x.GetType().FullName),
|
||||
new Dictionary<string, string> {
|
||||
{ typeof(LastKnownGeolocationService).FullName, "LastKnowGeolocation" },
|
||||
{ typeof(GeolocationAccuracyMediumService).FullName, "Medium Accuracy" },
|
||||
{ typeof(GeolocationAccuracyHighService).FullName, "High Accuracy" },
|
||||
{ typeof(GeolocationAccuracyBestService).FullName, "Best Accuracy" },
|
||||
{ typeof(SimulatedGeolocationService).FullName, "Simulation-AlwaysSamePosition" } },
|
||||
GeoloctionServicesContainer.Active.GetType().FullName);
|
||||
GeolocationServicesContainer.Active.GetType().FullName);
|
||||
|
||||
StartupSettings = new PickerViewModel(
|
||||
new Dictionary<string, string> {
|
||||
|
@ -310,7 +310,7 @@ namespace TINK.ViewModel
|
|||
|
||||
TinkApp.LocksServices.SetActive(LocksServices.Services.Active);
|
||||
|
||||
GeoloctionServicesContainer.SetActive(GeolocationServices.Active);
|
||||
GeolocationServicesContainer.SetActive(GeolocationServices.Active);
|
||||
|
||||
TinkApp.LocksServices.SetTimeOut(TimeSpan.FromSeconds(LocksServices.ConnectTimeoutSec));
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace TINK.ViewModel
|
|||
|
||||
}
|
||||
|
||||
/// <summary> Gets error message and handles aggegate exceptions. </summary>
|
||||
/// <summary> Gets error message and handles aggregate exceptions. </summary>
|
||||
public static string GetErrorMessage(this Exception exception)
|
||||
{
|
||||
if (exception == null)
|
||||
|
@ -239,8 +239,8 @@ namespace TINK.ViewModel
|
|||
|
||||
/// <summary> Called when page is shown. </summary>
|
||||
/// <param name="resourceUrl">Url to load data from.</param>
|
||||
/// <param name="isSiteCachingOn">Holds value wether site caching is on or off.</param>
|
||||
/// <param name="resourceProvider"> Provides resource from embedded ressources.</param>
|
||||
/// <param name="isSiteCachingOn">Holds value whether site caching is on or off.</param>
|
||||
/// <param name="resourceProvider"> Provides resource from embedded resources.</param>
|
||||
public static async Task<string> GetSource(
|
||||
string resourceUrl,
|
||||
bool isSiteCachingOn,
|
||||
|
@ -271,7 +271,7 @@ namespace TINK.ViewModel
|
|||
// An error occurred getting resource from web
|
||||
htmlContent = Barrel.Current.Exists(resourceUrl)
|
||||
? Barrel.Current.Get<string>(key: resourceUrl) // Get from MonkeyCache
|
||||
: resourceProvider != null ? resourceProvider() : $"<DOCTYPE html>Error loading {resourceUrl}."; // Get build in ressource.
|
||||
: resourceProvider != null ? resourceProvider() : $"<DOCTYPE html>Error loading {resourceUrl}."; // Get build in resource.
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -280,7 +280,7 @@ namespace TINK.ViewModel
|
|||
break;
|
||||
}
|
||||
|
||||
return htmlContent ?? FromBody("An error occurred loading html- ressource.");
|
||||
return htmlContent ?? FromBody("An error occurred loading html- resource.");
|
||||
}
|
||||
|
||||
public static string FromBody(string message) => $"<!DOCTYPE html><html lang=\"de\"><head><title>Error Information</title></head><body>{message}</body></html>";
|
||||
|
|
|
@ -16,13 +16,13 @@ namespace TINK.ViewModel.WhatsNew.Agb
|
|||
/// <summary> Holds the name of the host.</summary>
|
||||
private string HostName { get; }
|
||||
|
||||
/// <summary> Holds value wether site caching is on or off.</summary>
|
||||
/// <summary> Holds value whether site caching is on or off.</summary>
|
||||
bool IsSiteCachingOn { get; }
|
||||
|
||||
/// <summary> Constructs AGB view model</summary>
|
||||
/// <param name="isSiteCachingOn">Holds value wether site caching is on or off.</param>
|
||||
/// <param name="isSiteCachingOn">Holds value whether site caching is on or off.</param>
|
||||
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
|
||||
/// <param name="resourceProvider">Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty.</param>
|
||||
/// <param name="resourceProvider">Delegate to get embedded html resource. Used as fallback if download from web page does not work and cache is empty.</param>
|
||||
/// <param name="viewService">View service to close page.</param>
|
||||
public AgbViewModel(
|
||||
string hostName,
|
||||
|
@ -37,7 +37,7 @@ namespace TINK.ViewModel.WhatsNew.Agb
|
|||
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No view available.");
|
||||
|
||||
ResourceProvider = resourceProvider
|
||||
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No ressource provider centered.");
|
||||
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No resource provider centered.");
|
||||
}
|
||||
|
||||
/// <summary> Gets the platfrom specific prefix. </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue