This commit is contained in:
Oliver Hauff 2022-01-22 18:32:22 +01:00
parent 6ed1579494
commit 3c97e2f4aa
34 changed files with 278 additions and 135 deletions

View file

@ -652,6 +652,24 @@
<Generator>MSBuild:UpdateGeneratedFiles</Generator> <Generator>MSBuild:UpdateGeneratedFiles</Generator>
</AndroidResource> </AndroidResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-mdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\sharee_no_background.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\sharee_no_background.png" />
</ItemGroup>
<Import Project="..\TINK\LastenradBayern.projitems" Label="Shared" Condition="Exists('..\TINK\LastenradBayern.projitems')" /> <Import Project="..\TINK\LastenradBayern.projitems" Label="Shared" Condition="Exists('..\TINK\LastenradBayern.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<ProjectExtensions> <ProjectExtensions>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.276" android:versionCode="276"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.277" android:versionCode="277">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" /> <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions --> <!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services --> <!-- Permission to receive remote notifications from Google Play Services -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

@ -53,8 +53,8 @@
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>LastenradBayern</string> <string>LastenradBayern</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>276</string> <string>277</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.276</string> <string>3.0.277</string>
</dict> </dict>
</plist> </plist>

View file

@ -135,13 +135,13 @@ namespace TINK
store = new Store(); store = new Store();
Barrel.ApplicationId = "TINKApp"; Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var context = SynchronizationContext.Current; var context = SynchronizationContext.Current;
var appInfoService = DependencyService.Get<IAppInfo>(); var appInfoService = DependencyService.Get<IAppInfo>();
const string MERCHANTID = "baei987w"; const string MERCHANTID = "23456789";
// Create new app instnace. // Create new app instnace.
Log.Debug("Constructing main model..."); Log.Debug("Constructing main model...");

View file

@ -30,7 +30,7 @@ namespace TINK
#if USEFLYOUT #if USEFLYOUT
return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault(); return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault();
#else #else
return (Application.Current.MainPage as AppShellViewModel)?.Detail.Navigation.NavigationStack.LastOrDefault(); return Shell.Current.CurrentPage;
#endif #endif
} }

View file

@ -1,7 +1,9 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using TINK.Model.Device; using TINK.Model.Device;
#if USEFLYOUT
using TINK.View.MasterDetail; using TINK.View.MasterDetail;
#endif
using TINK.ViewModel.Info; using TINK.ViewModel.Info;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
@ -9,8 +11,11 @@ using Xamarin.Forms.Xaml;
namespace TINK.View.Contact namespace TINK.View.Contact
{ {
[XamlCompilation(XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ContactPage : ContentPage, IViewService, IDetailPage #if USEFLYOUT
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#else
public partial class ContactPage : ContentPage, IViewService
#endif
{ {
public ContactPage () public ContactPage ()
{ {
@ -71,8 +76,8 @@ namespace TINK.View.Contact
/// <summary> Pushes a page onto the stack. </summary> /// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param> /// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage) public async Task PushAsync(ViewTypes typeOfPage)
{ {
#if USEFLYOUT
if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage)) if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage))
{ {
await Task.CompletedTask; await Task.CompletedTask;
@ -83,6 +88,7 @@ namespace TINK.View.Contact
detailPage.NavigationMasterDetail = NavigationMasterDetail; detailPage.NavigationMasterDetail = NavigationMasterDetail;
await Navigation.PushAsync((Page)detailPage); await Navigation.PushAsync((Page)detailPage);
#endif
} }
#if USCSHARP9 #if USCSHARP9

View file

@ -103,7 +103,7 @@ namespace TINK.View.Map
#if USEFLYOUT #if USEFLYOUT
var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage; var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage;
#else #else
var page = Activator.CreateInstance(p_oTypeOfPage.GetViewType()); var page = Activator.CreateInstance(typeOfPage.GetViewType());
#endif #endif
if (page == null) if (page == null)
{ {

View file

@ -7,6 +7,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="30" /> <RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image <Image
HeightRequest="140" HeightRequest="140"
@ -16,6 +17,12 @@
HorizontalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"
FontSize="Large" FontSize="Large"
Grid.Row="1" Grid.Row="1"
Text="{Binding MasterDetailMenuTitlte}"/> Text="{Binding MasterDetailMenuTitlte}"/>
<Label
HorizontalOptions="CenterAndExpand"
FontSize="Micro"
HorizontalTextAlignment="Center"
Grid.Row="2"
Text="gefördert vom Bayrischen Staatministerium für Wohnen, Bau und Verkehr"/>
</Grid> </Grid>
</ContentView> </ContentView>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.276" android:versionCode="276"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.277" android:versionCode="277">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" /> <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions --> <!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services --> <!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -53,8 +53,8 @@
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>Mein konrad</string> <string>Mein konrad</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>276</string> <string>277</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.276</string> <string>3.0.277</string>
</dict> </dict>
</plist> </plist>

View file

@ -134,13 +134,13 @@ namespace TINK
store = new Store(); store = new Store();
Barrel.ApplicationId = "TINKApp"; Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var context = SynchronizationContext.Current; var context = SynchronizationContext.Current;
var appInfoService = DependencyService.Get<IAppInfo>(); var appInfoService = DependencyService.Get<IAppInfo>();
const string MERCHANTID = "mkef9BuN"; const string MERCHANTID = "23456789";
// Create new app instnace. // Create new app instnace.
Log.Debug("Constructing main model..."); Log.Debug("Constructing main model...");

View file

@ -30,7 +30,7 @@ namespace TINK
#if USEFLYOUT #if USEFLYOUT
return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault(); return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault();
#else #else
return (Application.Current.MainPage as AppShellViewModel)?.Detail.Navigation.NavigationStack.LastOrDefault(); return Shell.Current.CurrentPage;
#endif #endif
} }

View file

@ -1,7 +1,9 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using TINK.Model.Device; using TINK.Model.Device;
#if USEFLYOUT
using TINK.View.MasterDetail; using TINK.View.MasterDetail;
#endif
using TINK.ViewModel.Info; using TINK.ViewModel.Info;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
@ -9,10 +11,14 @@ using Xamarin.Forms.Xaml;
namespace TINK.View.Contact namespace TINK.View.Contact
{ {
[XamlCompilation(XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ContactPage : ContentPage, IViewService, IDetailPage #if USEFLYOUT
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#else
public partial class ContactPage : ContentPage, IViewService
#endif
{ {
public ContactPage () public ContactPage ()
{ {
InitializeComponent (); InitializeComponent ();
@ -71,8 +77,8 @@ namespace TINK.View.Contact
/// <summary> Pushes a page onto the stack. </summary> /// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param> /// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage) public async Task PushAsync(ViewTypes typeOfPage)
{ {
#if USEFLYOUT
if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage)) if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage))
{ {
await Task.CompletedTask; await Task.CompletedTask;
@ -83,6 +89,7 @@ namespace TINK.View.Contact
detailPage.NavigationMasterDetail = NavigationMasterDetail; detailPage.NavigationMasterDetail = NavigationMasterDetail;
await Navigation.PushAsync((Page)detailPage); await Navigation.PushAsync((Page)detailPage);
#endif
} }
#if USCSHARP9 #if USCSHARP9

View file

@ -103,7 +103,7 @@ namespace TINK.View.Map
#if USEFLYOUT #if USEFLYOUT
var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage; var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage;
#else #else
var page = Activator.CreateInstance(p_oTypeOfPage.GetViewType()); var page = Activator.CreateInstance(typeOfPage.GetViewType());
#endif #endif
if (page == null) if (page == null)
{ {

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.hauffware.sharee" android:versionName="3.0.276" android:versionCode="276"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.hauffware.sharee" android:versionName="3.0.277" android:versionCode="277">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" /> <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions --> <!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services --> <!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -53,8 +53,8 @@
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>sharee.bike</string> <string>sharee.bike</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>276</string> <string>277</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.276</string> <string>3.0.277</string>
</dict> </dict>
</plist> </plist>

View file

@ -134,13 +134,13 @@ namespace TINK
store = new Store(); store = new Store();
Barrel.ApplicationId = "TINKApp"; Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var context = SynchronizationContext.Current; var context = SynchronizationContext.Current;
var appInfoService = DependencyService.Get<IAppInfo>(); var appInfoService = DependencyService.Get<IAppInfo>();
const string MERCHANTID = "oiF2kahH"; const string MERCHANTID = "23456789";
// Create new app instnace. // Create new app instnace.
Log.Debug("Constructing main model..."); Log.Debug("Constructing main model...");

View file

@ -30,7 +30,7 @@ namespace TINK
#if USEFLYOUT #if USEFLYOUT
return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault(); return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault();
#else #else
return (Application.Current.MainPage as AppShellViewModel)?.Detail.Navigation.NavigationStack.LastOrDefault(); return Shell.Current.CurrentPage;
#endif #endif
} }

View file

@ -1,7 +1,9 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using TINK.Model.Device; using TINK.Model.Device;
#if USEFLYOUT
using TINK.View.MasterDetail; using TINK.View.MasterDetail;
#endif
using TINK.ViewModel.Info; using TINK.ViewModel.Info;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
@ -9,10 +11,14 @@ using Xamarin.Forms.Xaml;
namespace TINK.View.Contact namespace TINK.View.Contact
{ {
[XamlCompilation(XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ContactPage : ContentPage, IViewService, IDetailPage #if USEFLYOUT
public partial class ContactPage : ContentPage, IViewService, IDetailPage
#else
public partial class ContactPage : ContentPage, IViewService
#endif
{ {
public ContactPage () public ContactPage ()
{ {
InitializeComponent (); InitializeComponent ();
@ -71,8 +77,8 @@ namespace TINK.View.Contact
/// <summary> Pushes a page onto the stack. </summary> /// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param> /// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage) public async Task PushAsync(ViewTypes typeOfPage)
{ {
#if USEFLYOUT
if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage)) if (!(Activator.CreateInstance(typeOfPage.GetViewType()) is IDetailPage detailPage))
{ {
await Task.CompletedTask; await Task.CompletedTask;
@ -83,6 +89,7 @@ namespace TINK.View.Contact
detailPage.NavigationMasterDetail = NavigationMasterDetail; detailPage.NavigationMasterDetail = NavigationMasterDetail;
await Navigation.PushAsync((Page)detailPage); await Navigation.PushAsync((Page)detailPage);
#endif
} }
#if USCSHARP9 #if USCSHARP9

View file

@ -103,7 +103,7 @@ namespace TINK.View.Map
#if USEFLYOUT #if USEFLYOUT
var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage; var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage;
#else #else
var page = Activator.CreateInstance(p_oTypeOfPage.GetViewType()); var page = Activator.CreateInstance(typeOfPage.GetViewType());
#endif #endif
if (page == null) if (page == null)
{ {

View file

@ -477,7 +477,11 @@ namespace TINK.Model
}, },
{ {
new Version(3, 0, 276), new Version(3, 0, 276),
AppResources.ChangeLog3_0_276 AppResources.ChangeLog3_0_276
},
{
new Version(3, 0, 277),
AppResources.ChangeLog3_0_277
} }
}; };

View file

@ -920,6 +920,15 @@ namespace TINK.MultilingualResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Bugfix: No more closing of app on Select Bike page..
/// </summary>
public static string ChangeLog3_0_277 {
get {
return ResourceManager.GetString("ChangeLog3_0_277", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Lock of rented bike can not be found.. /// Looks up a localized string similar to Lock of rented bike can not be found..
/// </summary> /// </summary>
@ -1736,6 +1745,24 @@ namespace TINK.MultilingualResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to No bike with id {0} found..
/// </summary>
public static string MessageErrorSelectBikeNoBikeFound {
get {
return ResourceManager.GetString("MessageErrorSelectBikeNoBikeFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error Selecting Bike!.
/// </summary>
public static string MessageErrorSelectBikeTitle {
get {
return ResourceManager.GetString("MessageErrorSelectBikeTitle", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Login cookie must not be empty. {0}. /// Looks up a localized string similar to Login cookie must not be empty. {0}.
/// </summary> /// </summary>

View file

@ -742,4 +742,13 @@ Fehlerbehebung: Supportmails können wieder verschickt werden.</value>
<value>Beim Umschalten zwischen Lasten-/ Stadträdern ist ein Fehler aufgetreten. <value>Beim Umschalten zwischen Lasten-/ Stadträdern ist ein Fehler aufgetreten.
{0}</value> {0}</value>
</data> </data>
<data name="MessageErrorSelectBikeNoBikeFound" xml:space="preserve">
<value>Kein Fahrrad mit Id {0} gefunden.</value>
</data>
<data name="MessageErrorSelectBikeTitle" xml:space="preserve">
<value>Fehler beim Rad Wählen!</value>
</data>
<data name="ChangeLog3_0_277" xml:space="preserve">
<value>Fehlerbehebung: App schließt sich nicht mehr auf Fahrrad Wählen-Seite.</value>
</data>
</root> </root>

View file

@ -837,4 +837,13 @@ Bugfix: Sending support mails works again. </value>
<value>An error occurred switching from cargo bikes/ city bikes. <value>An error occurred switching from cargo bikes/ city bikes.
{0}</value> {0}</value>
</data> </data>
<data name="MessageErrorSelectBikeNoBikeFound" xml:space="preserve">
<value>No bike with id {0} found.</value>
</data>
<data name="MessageErrorSelectBikeTitle" xml:space="preserve">
<value>Error Selecting Bike!</value>
</data>
<data name="ChangeLog3_0_277" xml:space="preserve">
<value>Bugfix: No more closing of app on Select Bike page.</value>
</data>
</root> </root>

View file

@ -998,6 +998,18 @@ Fehlerbehebung: Supportmails können wieder verschickt werden.</target>
<target state="translated">Beim Umschalten zwischen Lasten-/ Stadträdern ist ein Fehler aufgetreten. <target state="translated">Beim Umschalten zwischen Lasten-/ Stadträdern ist ein Fehler aufgetreten.
{0}</target> {0}</target>
</trans-unit> </trans-unit>
<trans-unit id="MessageErrorSelectBikeNoBikeFound" translate="yes" xml:space="preserve">
<source>No bike with id {0} found.</source>
<target state="translated">Kein Fahrrad mit Id {0} gefunden.</target>
</trans-unit>
<trans-unit id="MessageErrorSelectBikeTitle" translate="yes" xml:space="preserve">
<source>Error Selecting Bike!</source>
<target state="translated">Fehler beim Rad Wählen!</target>
</trans-unit>
<trans-unit id="ChangeLog3_0_277" translate="yes" xml:space="preserve">
<source>Bugfix: No more closing of app on Select Bike page.</source>
<target state="translated">Fehlerbehebung: App schließt sich nicht mehr auf Fahrrad Wählen-Seite.</target>
</trans-unit>
</group> </group>
</body> </body>
</file> </file>

View file

@ -2,6 +2,9 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#if !USEFLYOUT
using System.Threading.Tasks;
#endif
using TINK.Model.Connector; using TINK.Model.Connector;
using TINK.Model.Device; using TINK.Model.Device;
using TINK.Model.State; using TINK.Model.State;
@ -323,7 +326,7 @@ namespace TINK.ViewModel.Bikes.Bike
#if USEFLYOUT #if USEFLYOUT
=> new Xamarin.Forms.Command(() => ShowAgbPageAsync()); => new Xamarin.Forms.Command(() => ShowAgbPageAsync());
#else #else
=> new Xamarin.Forms.Command(async () => await OpenLoginPageAsync()); => new Xamarin.Forms.Command(async () => await ShowAgbPageAsync());
#endif #endif
/// <summary> Opens login page. </summary> /// <summary> Opens login page. </summary>

View file

@ -462,9 +462,12 @@ namespace TINK.ViewModel.Contact
typeof(BikesAtStationPage), typeof(BikesAtStationPage),
p_strStationName); p_strStationName);
#else #else
#if USEFLYOUT
// Show page. // Show page.
ViewService.ShowPage(ViewTypes.ContactPage, AppResources.MarkingContactPageTitle); ViewService.ShowPage(ViewTypes.ContactPage, AppResources.MarkingContactPageTitle);
#else
await ViewService.ShowPage("//ContactPage");
#endif
IsMapPageEnabled = true; IsMapPageEnabled = true;
ActionText = ""; ActionText = "";
} }
@ -480,14 +483,14 @@ namespace TINK.ViewModel.Contact
"OK"); "OK");
} }
#endif #endif
} }
/// <summary> /// <summary>
/// Gets the list of station color for all stations. /// Gets the list of station color for all stations.
/// </summary> /// </summary>
/// <param name="stationsId">Station id list to get color for.</param> /// <param name="stationsId">Station id list to get color for.</param>
/// <returns></returns> /// <returns></returns>
private static IList<Color> GetStationColors( private static IList<Color> GetStationColors(
IEnumerable<string> stationsId, IEnumerable<string> stationsId,
BikeCollection bikesAll) BikeCollection bikesAll)
{ {

View file

@ -47,11 +47,28 @@ namespace TINK.ViewModel.FindBike
} }
} }
/// <summary>
/// True if any action can be performed (request and cancel request)
/// </summary>
public override bool IsIdle
{
get => base.IsIdle;
set
{
if (value == IsIdle)
return;
Log.ForContext<FindBikePageViewModel>().Debug($"Switch value of {nameof(IsIdle)} to {value}.");
base.IsIdle = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelectBikeEnabled))); // Enable select bike button.
}
}
/// <summary> Holds all bikes available.</summary> /// <summary> Holds all bikes available.</summary>
public BikeCollection Bikes { get; set; } public BikeCollection Bikes { get; set; }
/// <summary> Do not allow to select bike if id is not set.</summary> /// <summary> Do not allow to select bike if id is not set.</summary>
public bool IsSelectBikeEnabled => BikeIdUserInput != null && BikeIdUserInput.Length > 0; public bool IsSelectBikeEnabled => IsIdle && BikeIdUserInput != null && BikeIdUserInput.Length > 0;
/// <summary> Hide id input fields as soon as bike is found.</summary> /// <summary> Hide id input fields as soon as bike is found.</summary>
public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0; public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0;
@ -125,123 +142,137 @@ namespace TINK.ViewModel.FindBike
/// <summary> Select a bike by ID</summary> /// <summary> Select a bike by ID</summary>
public async Task SelectBike() public async Task SelectBike()
{ {
var selectedBike = Bikes.FirstOrDefault(x => x.Id.Equals(BikeIdUserInput.Trim(), StringComparison.OrdinalIgnoreCase)); try
if (selectedBike == null)
{ {
await ViewService.DisplayAlert("Fehler bei Radauswahl!", $"Kein Rad mit Id {BikeIdUserInput} gefunden.", "OK"); var selectedBike = Bikes.FirstOrDefault(x => x.Id.Equals(BikeIdUserInput.Trim(), StringComparison.OrdinalIgnoreCase));
return;
}
var bikeCollection = new BikeCollection(new Dictionary<string, Model.Bike.BC.BikeInfo> { { selectedBike.Id, selectedBike } }); if (selectedBike == null)
var lockIdList = bikeCollection
.GetLockIt()
.Cast<BikeInfo>()
.Select(x => x.LockInfo)
.ToList();
if (LockService is ILocksServiceFake serviceFake)
{
serviceFake.UpdateSimulation(bikeCollection);
}
// Check bluetooth and location permission and states
ActionText = AppResources.ActivityTextCheckBluetoothState;
if (bikeCollection.FirstOrDefault(x => x is BikeInfo btBike) != null
&& RuntimePlatform == Device.Android)
{
// Check location permission
var status = await PermissionsService.CheckStatusAsync();
if (status != Status.Granted)
{ {
var permissionResult = await PermissionsService.RequestAsync(); await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
string.Format(AppResources.MessageErrorSelectBikeNoBikeFound, BikeIdUserInput),
AppResources.MessageAnswerOk);
return;
}
if (permissionResult != Status.Granted) var bikeCollection = new BikeCollection(new Dictionary<string, Model.Bike.BC.BikeInfo> { { selectedBike.Id, selectedBike } });
var lockIdList = bikeCollection
.GetLockIt()
.Cast<BikeInfo>()
.Select(x => x.LockInfo)
.ToList();
if (LockService is ILocksServiceFake serviceFake)
{
serviceFake.UpdateSimulation(bikeCollection);
}
// Check bluetooth and location permission and states
ActionText = AppResources.ActivityTextCheckBluetoothState;
if (bikeCollection.FirstOrDefault(x => x is BikeInfo btBike) != null
&& RuntimePlatform == Device.Android)
{
// Check location permission
var status = await PermissionsService.CheckStatusAsync();
if (status != Status.Granted)
{ {
var dialogResult = await ViewService.DisplayAlert( var permissionResult = await PermissionsService.RequestAsync();
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationPermissionOpenDialog,
AppResources.MessageAnswerYes,
AppResources.MessageAnswerNo);
if (!dialogResult) if (permissionResult != Status.Granted)
{ {
// User decided not to give access to locations permissions. var dialogResult = await ViewService.DisplayAlert(
BikeCollection.Update(bikeCollection, Stations); AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationPermissionOpenDialog,
AppResources.MessageAnswerYes,
AppResources.MessageAnswerNo);
//await OnAppearing(() => UpdateTask()); if (!dialogResult)
{
// User decided not to give access to locations permissions.
BikeCollection.Update(bikeCollection, Stations);
ActionText = ""; //await OnAppearing(() => UpdateTask());
IsIdle = true;
return; ActionText = "";
IsIdle = true;
return;
}
// Open permissions dialog.
PermissionsService.OpenAppSettings();
} }
}
// Open permissions dialog. // Location state
PermissionsService.OpenAppSettings(); if (Geolocation.IsGeolcationEnabled == false)
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementLocationActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection, Stations);
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
return;
}
// Bluetooth state
if (await BluetoothService.GetBluetoothState() != BluetoothState.On)
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementBluetoothActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection, Stations);
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
return;
} }
} }
// Location state // Connect to bluetooth devices.
if (Geolocation.IsGeolcationEnabled == false) ActionText = AppResources.ActivityTextSearchBikes;
IEnumerable<LockInfoTdo> locksInfoTdo;
try
{ {
await ViewService.DisplayAlert( locksInfoTdo = await LockService.GetLocksStateAsync(
AppResources.MessageTitleHint, lockIdList.Select(x => x.ToLockInfoTdo()).ToList(),
AppResources.MessageBikesManagementLocationActivation, LockService.TimeOut.MultiConnect);
AppResources.MessageAnswerOk); }
catch (Exception exception)
BikeCollection.Update(bikeCollection, Stations); {
Log.ForContext<FindBikePageViewModel>().Error("Getting bluetooth state failed. {Exception}", exception);
await OnAppearing(() => UpdateTask()); locksInfoTdo = new List<LockInfoTdo>();
ActionText = "";
IsIdle = true;
return;
} }
// Bluetooth state var locksInfo = lockIdList.UpdateById(locksInfoTdo);
if (await BluetoothService.GetBluetoothState() != BluetoothState.On)
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageBikesManagementBluetoothActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection, Stations); BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo), Stations);
await OnAppearing(() => UpdateTask()); await OnAppearing(() => UpdateTask());
ActionText = ""; ActionText = "";
IsIdle = true; IsIdle = true;
return; } catch (Exception exception)
}
}
// Connect to bluetooth devices.
ActionText = AppResources.ActivityTextSearchBikes;
IEnumerable<LockInfoTdo> locksInfoTdo;
try
{ {
locksInfoTdo = await LockService.GetLocksStateAsync( await ViewService.DisplayAlert(
lockIdList.Select(x => x.ToLockInfoTdo()).ToList(), AppResources.MessageErrorSelectBikeTitle,
LockService.TimeOut.MultiConnect); exception.Message,
AppResources.MessageAnswerOk);
Log.ForContext<FindBikePageViewModel>().Error("Running command to select bike failed. {Exception}", exception);
return;
} }
catch (Exception exception)
{
Log.ForContext<FindBikePageViewModel>().Error("Getting bluetooth state failed. {Exception}", exception);
locksInfoTdo = new List<LockInfoTdo>();
}
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo), Stations);
await OnAppearing(() => UpdateTask());
ActionText = "";
IsIdle = true;
} }
/// <summary> Create task which updates my bike view model.</summary> /// <summary> Create task which updates my bike view model.</summary>