3.0.257 merged

This commit is contained in:
Oliver Hauff 2022-01-04 18:48:58 +01:00
parent de8d5f8414
commit b6fb6394db
155 changed files with 805 additions and 5751 deletions

View file

@ -122,13 +122,13 @@ namespace TINK.Model.Connector
Log.ForContext<Command>().Error("Unexpected booking request detected. No user logged in.");
await Task.CompletedTask;
}
public async Task<BookingFinishedModel> DoReturn(
public async Task<MiniSurveyModel> DoReturn(
Bikes.Bike.BluetoothLock.IBikeInfoMutable bike,
LocationDto location,
ISmartDevice smartDevice)
{
Log.ForContext<Command>().Error("Unexpected returning request detected. No user logged in.");
return await Task.FromResult(new BookingFinishedModel());
return await Task.FromResult(new MiniSurveyModel());
}
/// <summary>

View file

@ -248,7 +248,7 @@ namespace TINK.Model.Connector
/// <param name="bike">Bike to return.</param>
/// <param name="locaton">Position of the bike.</param>
/// <param name="smartDevice">Provides info about hard and software.</param>
public async Task<BookingFinishedModel> DoReturn(
public async Task<MiniSurveyModel> DoReturn(
Bikes.Bike.BluetoothLock.IBikeInfoMutable bike,
LocationDto location,
ISmartDevice smartDevice)
@ -258,7 +258,7 @@ namespace TINK.Model.Connector
throw new ArgumentNullException("Can not return bike. No bike object available.");
}
DoReturnResponse response;
ReservationCancelReturnResponse response;
try
{
response = (await CopriServer.DoReturn(bike.Id, location, smartDevice, bike.OperatorUri)).GetIsReturnBikeResponseOk(bike.Id);
@ -270,7 +270,7 @@ namespace TINK.Model.Connector
}
bike.Load(Bikes.Bike.BC.NotifyPropertyChangedLevel.None);
return response?.Create() ?? new BookingFinishedModel();
return response?.Create() ?? new MiniSurveyModel();
}
/// <summary>

View file

@ -50,7 +50,7 @@ namespace TINK.Model.Connector
/// <param name="bike">Bike to return.</param>
/// <param name="location">Geolocation of lock when returning bike.</param>
/// <param name="smartDevice">Provides info about hard and software.</param>
Task<BookingFinishedModel> DoReturn(Bikes.Bike.BluetoothLock.IBikeInfoMutable bike, LocationDto geolocation = null, ISmartDevice smartDevice = null);
Task<MiniSurveyModel> DoReturn(Bikes.Bike.BluetoothLock.IBikeInfoMutable bike, LocationDto geolocation = null, ISmartDevice smartDevice = null);
/// <summary> True if connector has access to copri server, false if cached values are used. </summary>
bool IsConnected { get; }

View file

@ -512,28 +512,22 @@ namespace TINK.Model.Connector
};
}
/// <summary> Creates a booking finished object from response.</summary>
/// <summary> Creates a survey object from response.</summary>
/// <param name="response">Response to create survey object from.</param>
public static BookingFinishedModel Create(this DoReturnResponse response)
public static MiniSurveyModel Create(this ReservationCancelReturnResponse response)
{
var bookingFinished = new BookingFinishedModel
{
Co2Saving = response?.co2saving
};
if (response?.user_miniquery == null)
{
return bookingFinished;
return new MiniSurveyModel();
}
var miniquery = response.user_miniquery;
bookingFinished.MiniSurvey = new MiniSurveyModel
{
Title = miniquery.title,
Subtitle = miniquery.subtitle,
Footer = miniquery.footer
};
var survey = new MiniSurveyModel
{
Title = miniquery.title,
Subtitle = miniquery.subtitle,
Footer = miniquery.footer
};
foreach (var question in miniquery?.questions?.OrderBy(x => x.Key) ?? new Dictionary<string, MiniSurveyResponse.Question>().OrderBy(x => x.Key))
{
@ -544,12 +538,12 @@ namespace TINK.Model.Connector
continue;
}
bookingFinished.MiniSurvey.Questions.Add(
survey.Questions.Add(
question.Key,
new MiniSurveyModel.QuestionModel());
}
return bookingFinished;
return survey;
}
}
}

View file

@ -3,9 +3,6 @@
namespace TINK.Model.MiniSurvey
{
/// <summary>
/// Holds mini survey.
/// </summary>
public class MiniSurveyModel
{
public enum Type
@ -15,17 +12,21 @@ namespace TINK.Model.MiniSurvey
}
public class QuestionModel
{
/// <summary>
/// Holds the query description.
/// </summary>
public QuestionModel()
{
PossibleAnswers = new Dictionary<string, string>();
}
public string Text { get; set; }
public Type Type { get; set; }
/// <summary>
/// Holds the collection of possible answers.
/// </summary>
public Dictionary<string, string> PossibleAnswers { get; private set; } = new Dictionary<string, string>();
public Dictionary<string, string> PossibleAnswers { get; private set; }
}
public MiniSurveyModel()
{
Questions = new Dictionary<string, QuestionModel>();
}
public string Title { get; set; }
@ -34,6 +35,6 @@ namespace TINK.Model.MiniSurvey
public string Footer { get; set; }
public Dictionary<string, QuestionModel> Questions { get; } = new Dictionary<string, QuestionModel>();
public Dictionary<string, QuestionModel> Questions { get; }
}
}

View file

@ -215,8 +215,16 @@ namespace TINK.Model
GeolocationServices = geolocationServicesContainer
?? throw new ArgumentException($"Can not instantiate {nameof(TinkApp)}- object. No geolocation services container object available.");
FilterGroupSetting = settings.GroupFilterSettings;
GroupFilterMapPage = settings.GroupFilterMapPage;
if (settings.ActiveUri == new Uri(CopriServerUriList.TINK_LIVE) ||
settings.ActiveUri == new Uri(CopriServerUriList.TINK_DEVEL))
{
FilterGroupSetting = settings.GroupFilterSettings;
GroupFilterMapPage = settings.GroupFilterMapPage;
} else
{
FilterGroupSetting = new GroupFilterSettings();
GroupFilterMapPage = new GroupFilterMapPage();
}
CenterMapToCurrentLocation = settings.CenterMapToCurrentLocation;

View file

@ -455,21 +455,9 @@ namespace TINK.Model
AppResources.ChangeLog3_0_250 // Third-party components updated.
},
{
new Version(3, 0, 260),
new Version(3, 0, 257),
// Same info as for version 3.0.251 and 3.0.252
AppResources.ChangeLog3_0_231 // Minor improvements.
},
{
new Version(3, 0, 263),
AppResources.ChangeLog3_0_263
},
{
new Version(3, 0, 264),
AppResources.ChangeLog3_0_264
},
{
new Version(3, 0, 265),
AppResources.ChangeLog3_0_265
}
};

View file

@ -871,35 +871,6 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to CO2 saving is displayed for bikes with GPS-lock after returning bike..
/// </summary>
public static string ChangeLog3_0_263 {
get {
return ResourceManager.GetString("ChangeLog3_0_263", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Bug &quot;object reference not set ....&quot; &lt;a href=&quot;https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186&quot;&gt;185&lt;/a&gt; fixed..
/// </summary>
public static string ChangeLog3_0_264 {
get {
return ResourceManager.GetString("ChangeLog3_0_264", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Filter functionality city bike/ cargo bike improved.
///Layouting improved.
///App supports deep linking..
/// </summary>
public static string ChangeLog3_0_265 {
get {
return ResourceManager.GetString("ChangeLog3_0_265", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Lock of rented bike can not be found..
/// </summary>
@ -1250,24 +1221,6 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cargo bike.
/// </summary>
public static string MarkingCargoBike {
get {
return ResourceManager.GetString("MarkingCargoBike", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to City bike.
/// </summary>
public static string MarkingCityBike {
get {
return ResourceManager.GetString("MarkingCityBike", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please open a bike station page to to contact the bike sharing operator..
/// </summary>

View file

@ -710,24 +710,4 @@ Kleinere Verbesserungen.</value>
Kartenzentrierfehler behoben.
Kleine Verbesserungen.</value>
</data>
<data name="ChangeLog3_0_263" xml:space="preserve">
<value>Bei Fahrrädern mit GPS-Schloss wird die CO2-Einsparung nach der Rückgabe des Fahrrads angezeigt.</value>
</data>
<data name="ChangeLog3_0_264" xml:space="preserve">
<value>Fehler "object reference not set ...." &lt;a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186"&gt;185&lt;/a&gt; behoben.</value>
</data>
<data name="ChangeLog3_0_265" xml:space="preserve">
<value>Filterfunktion Stadtrad/ Lastenrad verbessert.
Layouting verbessert.
Deep linking wird unterstützt.</value>
</data>
<data name="MarkingCargoBike" xml:space="preserve">
<value>Lastenrad</value>
</data>
<data name="MarkingCityBike" xml:space="preserve">
<value>Stadtrad</value>
</data>
<data name="MessageBikesManagementTariffDescriptionTariffHeaderNameId" xml:space="preserve">
<value>Tarif {0}, Nr. {1}</value>
</data>
</root>

View file

@ -805,24 +805,4 @@ Minor fixes.</value>
Center map to current position issue fixed.
Minor improvements.</value>
</data>
<data name="ChangeLog3_0_263" xml:space="preserve">
<value>CO2 saving is displayed for bikes with GPS-lock after returning bike.</value>
</data>
<data name="ChangeLog3_0_264" xml:space="preserve">
<value>Bug "object reference not set ...." &lt;a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186"&gt;185&lt;/a&gt; fixed.</value>
</data>
<data name="ChangeLog3_0_265" xml:space="preserve">
<value>Filter functionality city bike/ cargo bike improved.
Layouting improved.
App supports deep linking.</value>
</data>
<data name="MarkingCargoBike" xml:space="preserve">
<value>Cargo bike</value>
</data>
<data name="MarkingCityBike" xml:space="preserve">
<value>City bike</value>
</data>
<data name="MessageBikesManagementTariffDescriptionTariffHeaderNameId" xml:space="preserve">
<value>Tariff {0}, nr. {1}</value>
</data>
</root>

View file

@ -952,34 +952,6 @@ Minor improvements.</source>
Kartenzentrierfehler behoben.
Kleine Verbesserungen.</target>
</trans-unit>
<trans-unit id="ChangeLog3_0_263" translate="yes" xml:space="preserve">
<source>CO2 saving is displayed for bikes with GPS-lock after returning bike.</source>
<target state="translated">Bei Fahrrädern mit GPS-Schloss wird die CO2-Einsparung nach der Rückgabe des Fahrrads angezeigt.</target>
</trans-unit>
<trans-unit id="ChangeLog3_0_264" translate="yes" xml:space="preserve">
<source>Bug "object reference not set ...." <bpt id="1">&lt;a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186"&gt;</bpt>185<ept id="1">&lt;/a&gt;</ept> fixed.</source>
<target state="translated">Fehler "object reference not set ...." <bpt id="1">&lt;a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186"&gt;</bpt>185<ept id="1">&lt;/a&gt;</ept> behoben.</target>
</trans-unit>
<trans-unit id="ChangeLog3_0_265" translate="yes" xml:space="preserve">
<source>Filter functionality city bike/ cargo bike improved.
Layouting improved.
App supports deep linking.</source>
<target state="translated">Filterfunktion Stadtrad/ Lastenrad verbessert.
Layouting verbessert.
Deep linking wird unterstützt.</target>
</trans-unit>
<trans-unit id="MarkingCargoBike" translate="yes" xml:space="preserve">
<source>Cargo bike</source>
<target state="translated">Lastenrad</target>
</trans-unit>
<trans-unit id="MarkingCityBike" translate="yes" xml:space="preserve">
<source>City bike</source>
<target state="translated">Stadtrad</target>
</trans-unit>
<trans-unit id="MessageBikesManagementTariffDescriptionTariffHeaderNameId" translate="yes" xml:space="preserve">
<source>Tariff {0}, nr. {1}</source>
<target state="translated">Tarif {0}, Nr. {1}</target>
</trans-unit>
</group>
</body>
</file>

View file

@ -621,10 +621,10 @@ namespace TINK.Repository
string userAgent = null)
{
#if !WINDOWS_UWP
string doReturnResponse;
string cancelOrReturnResponse;
try
{
doReturnResponse = await PostAsync(copriHost, command, userAgent);
cancelOrReturnResponse = await PostAsync(copriHost, command, userAgent);
}
catch (System.Exception l_oException)
{
@ -642,7 +642,7 @@ namespace TINK.Repository
}
// Extract bikes from response.
return JsonConvertRethrow.DeserializeObject<ResponseContainer<DoReturnResponse>>(doReturnResponse)?.shareejson;
return JsonConvertRethrow.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(cancelOrReturnResponse)?.shareejson;
#else
return null;
#endif

View file

@ -1,4 +1,5 @@

using System.Runtime.Serialization;
namespace TINK.Repository.Response
{
@ -7,5 +8,8 @@ namespace TINK.Repository.Response
/// </summary>
public class ReservationCancelReturnResponse : BikesReservedOccupiedResponse
{
/// <summary> Mini survey.</summary>
[DataMember]
public MiniSurveyResponse user_miniquery { get; private set; }
}
}

View file

@ -68,6 +68,14 @@ namespace TINK.Model.Services.CopriApi
public Task<ResponseBase> DoSubmitMiniSurvey(IDictionary<string, string> answers)
=> throw new NotSupportedException();
public Task<SubmitFeedbackResponse> DoSubmitFeedback(string bikeId, string messge, bool bIsBikeBroke, Uri operatorUri)
=> throw new NotImplementedException();
/// <summary> Submits mini survey to copri server. </summary>
/// <param name="answers">Collection of answers.</param>
public Task<ResponseBase> DoSubmitMiniSurvey(IDictionary<string, string> answers)
=> throw new NotSupportedException();
public async Task<AuthorizationResponse> DoAuthorizationAsync(string p_strMailAddress, string p_strPassword, string p_strDeviceId)
{

View file

@ -43,7 +43,7 @@
<PackageReference Include="Xam.Plugin.Connectivity" Version="3.2.0" />
<PackageReference Include="Xam.Plugins.Messaging" Version="5.2.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2125" />
<PackageReference Include="Xamarin.Forms.GoogleMaps" Version="3.3.0" />
</ItemGroup>
<ItemGroup>

View file

@ -15,9 +15,9 @@ using TINK.Model.User;
using Xamarin.Essentials;
using TINK.Repository.Request;
using TINK.Model.Device;
using TINK.Model.MiniSurvey;
using System.Collections.Generic;
using System.Threading;
using TINK.Model;
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
@ -162,10 +162,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
var feedBackUri = SelectedBike?.OperatorUri;
BookingFinishedModel bookingFinished;
MiniSurveyModel miniSurvey;
try
{
bookingFinished = await ConnectorFactory(IsConnected).Command.DoReturn(
miniSurvey = await ConnectorFactory(IsConnected).Command.DoReturn(
SelectedBike,
currentLocationDto);
@ -289,7 +289,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, Geolocation, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
#endif
if (bookingFinished != null && bookingFinished.MiniSurvey.Questions.Count > 0)
if (miniSurvey != null && miniSurvey.Questions.Count > 0)
{
await ViewService.PushModalAsync(ViewTypes.MiniSurvey);
}

View file

@ -15,9 +15,9 @@ using TINK.Model.Bikes.Bike.BluetoothLock;
using TINK.Model.User;
using TINK.Repository.Request;
using TINK.Model.Device;
using TINK.Model.MiniSurvey;
using System.Collections.Generic;
using System.Threading;
using TINK.Model;
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
@ -273,10 +273,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
var feedBackUri = SelectedBike?.OperatorUri;
BookingFinishedModel bookingFinished;
MiniSurveyModel miniSurvey;
try
{
bookingFinished = await ConnectorFactory(IsConnected).Command.DoReturn(
miniSurvey = await ConnectorFactory(IsConnected).Command.DoReturn(
SelectedBike,
currentLocation != null
? new LocationDto.Builder
@ -404,7 +404,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
}
#endif
if (bookingFinished != null && bookingFinished.MiniSurvey.Questions.Count > 0)
if (miniSurvey != null && miniSurvey.Questions.Count > 0)
{
await ViewService.PushModalAsync(ViewTypes.MiniSurvey);
}

View file

@ -408,7 +408,7 @@ namespace TINK.ViewModel.Contact
}
catch (Exception l_oException)
{
Log.ForContext<SelectStationPageViewModel>().Error($"An error occurred opening select station page.\r\n{l_oException.Message}");
Log.ForContext<SelectStationPageViewModel>().Error($"An error occurred switching view TINK/ Konrad.\r\n{l_oException.Message}");
IsRunning = false;

View file

@ -419,29 +419,19 @@ namespace TINK.ViewModel.Map
// Move and scale before getting stations and bikes which takes some time.
ActionText = AppResources.ActivityTextCenterMap;
if (TinkApp.CenterMapToCurrentLocation)
Location currentLocation = null;
try
{
Location currentLocation = null;
try
{
currentLocation = await GeolocationService.GetAsync();
}
catch (Exception ex)
{
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
if (currentLocation != null)
{
TinkApp.UserMapSpan = MapSpan.FromCenterAndRadius(
new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
TinkApp.ActiveMapSpan.Radius);
TinkApp.Save();
}
currentLocation = TinkApp.CenterMapToCurrentLocation
? await GeolocationService.GetAsync()
: null;
}
catch (Exception ex)
{
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.ActiveMapSpan);
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.Uris.ActiveUri, ActiveFilterMap, currentLocation);
m_oViewUpdateManager = CreateUpdateTask();