Version 3.0.342

This commit is contained in:
Oliver Hauff 2022-10-03 17:55:10 +02:00
parent d852ccef4c
commit 2cde196f16
54 changed files with 998 additions and 498 deletions

View file

@ -1,5 +1,5 @@
<?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.341" android:versionCode="341">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.342" android:versionCode="342">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -55,8 +55,8 @@
<key>CFBundleDisplayName</key>
<string>LastenradBayern</string>
<key>CFBundleVersion</key>
<string>341</string>
<string>342</string>
<key>CFBundleShortVersionString</key>
<string>3.0.341</string>
<string>3.0.342</string>
</dict>
</plist>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:conv="clr-namespace:TINK.View"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
@ -27,15 +27,11 @@
IsVisible="{Binding DisplayId, Converter={StaticResource Label_Converter}}"
Text="{Binding DisplayId}"/>
<!-- Battery level -->
<!--<sharedGui:BarLevelView
<sharedGui:BarLevelView
Current="{Binding CurrentChargeBars}"
Maximum="{Binding MaxChargeBars}"
IsVisible="{Binding IsBatteryChargeVisible}"/>-->
<sharedGui:BarLevelView
Current="{Binding CurrentChargeBars}"
Maximum="{Binding MaxChargeBars}"
IsVisible="False"/>
<!-- Rental state -->
IsVisible="{Binding IsBatteryChargeVisible}"/>
<!-- Rental state -->
<Label
Text="{Binding StateText}"
TextColor="{Binding StateColor}"/>
@ -89,8 +85,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<!-- Operator AGB -->
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -216,18 +210,7 @@
IsVisible="{Binding TariffDescription.InfoEntry5, Converter={StaticResource Label_Converter}}"
Grid.Row="14"
Grid.ColumnSpan="2"/>
<!-- AGB entry -->
<Label
TextType="Html"
Text="{Binding TariffDescription.OperatorAgb}"
IsVisible="{Binding TariffDescription.OperatorAgb, Converter={StaticResource Label_Converter}}"
Grid.ColumnSpan="2"
Grid.Row="15">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ShowAgbTappedCommand}"/>
</Label.GestureRecognizers>
</Label>
</Grid>
</StackLayout>
</ContentView>
</ViewCell>
</ViewCell>

View file

@ -25,7 +25,6 @@
Source="{Binding Uri}" />
<ActivityIndicator Grid.Row="0"
x:Name="ActivityIndicatorLoading"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"

View file

@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using Serilog;
using TINK.Model.Device;
using TINK.ViewModel.Login;
@ -14,40 +14,12 @@ namespace TINK.View.CopriWebView
{
InitializeComponent();
ManageAccount.Navigating += (sender, ev) =>
{
if (!ev.Url.ToUpper().EndsWith(".PDF"))
{
// Stay inside web view except for downloading pdf- files.
this.IsEnabled = false;
ActivityIndicatorLoading.IsVisible = true;
ActivityIndicatorLoading.IsRunning = true;
return;
}
ManageAccount.Navigating += WebViewHelper.SetBusyAndDisplayOrDownload;
DependencyService.Get<IExternalBrowserService>().OpenUrl(ev.Url);
};
ManageAccount.Navigated += (sender, ev) =>
{
if (ev.Result == WebNavigationResult.Success)
{
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
return;
}
Log.ForContext<ManageAccountPage>().Error("Navigation did not succeed.{@Event}{@Sender}", ev, sender);
ManageAccount.Source = new HtmlWebViewSource
{
Html = "<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>"
};
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
};
ManageAccount.Navigated += (sender, eventArgs) => WebViewHelper.SetIdleAndHandleError(
sender,
eventArgs,
"<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>");
ManageAccount.BindingContext = new ManageAccountViewModel(
App.ModelRoot.ActiveUser.SessionCookie,
@ -56,4 +28,4 @@ namespace TINK.View.CopriWebView
App.ModelRoot.NextActiveUri.Host);
}
}
}
}

View file

@ -10,26 +10,51 @@
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or inline-->
<ContentPage Title="{x:Static resources:AppResources.MarkingTabFees}">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabFees}">
<ContentPage.Content>
<StackLayout>
<WebView
x:Name="InfoRentBikeWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding RentBikeText}"/>
</StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoRentBikeWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding RentBikeText}"/>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="{x:Static resources:AppResources.MarkingTabBikes}">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabBikes}">
<ContentPage.Content>
<StackLayout>
<WebView
x:Name="InfoTypesOfBikesWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding TypesOfBikesText}"/>
</StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoTypesOfBikesWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding TypesOfBikesText}"/>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>
</TabbedPage>

View file

@ -1,4 +1,5 @@
using TINK.ViewModel;
using Serilog;
using TINK.ViewModel;
using TINK.ViewModel.Contact;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -14,19 +15,31 @@ namespace TINK.View.Contact
{
InitializeComponent();
/// Info about renting.
InfoRentBikeWebView.Navigating += WebViewHelper.SelectDisplayTarget;
InfoRentBikeWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Mietinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
/// Info about types of bikes.
InfoTypesOfBikesWebView.Navigating += WebViewHelper.SelectDisplayTarget;
InfoTypesOfBikesWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Radinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
ViewModel = new FeesAndBikesPageViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.ResourceUrls.FeesResourcePath,
App.ModelRoot.ResourceUrls.BikesResourcePath,
App.ModelRoot.IsSiteCachingOn);
App.ModelRoot.IsSiteCachingOn,
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
BindingContext = ViewModel;
/// Info about renting.
InfoRentBikeWebView.Navigating += ViewModelHelper.OnNavigating;
/// Info about types of bikes.
InfoTypesOfBikesWebView.Navigating += ViewModelHelper.OnNavigating;
}
/// <summary> Called when page is shown. </summary>
@ -35,4 +48,4 @@ namespace TINK.View.Contact
ViewModel.OnAppearing();
}
}
}
}

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
@ -11,49 +11,96 @@
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or inline-->
<ContentPage Title="App">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabApp}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoLicenses"
Source="{Binding InfoLicenses}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="Datenschutz">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabPrivacy}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoDatenschutz"
Source="{Binding InfoPrivacy}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="AGB">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabGtc}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoABG"
Source ="{Binding InfoAgb}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="Impressum">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabImpress}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoImpressum"
Source="{Binding InfoImpressum}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>

View file

@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using TINK.ViewModel;
using TINK.ViewModel.Info;
using Xamarin.Forms;
@ -21,15 +21,34 @@ namespace TINK.View.Info
App.ModelRoot.ResourceUrls.PrivacyResourcePath,
App.ModelRoot.ResourceUrls.ImpressResourcePath,
App.ModelRoot.IsSiteCachingOn,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
resourceName => ViewModelResourceHelper.GetSource(resourceName));
resourceName => ViewModelResourceHelper.GetSource(resourceName),
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
TabbedInfoPage.BindingContext = ViewModel;
InfoLicenses.Navigating += ViewModelHelper.OnNavigating;
InfoDatenschutz.Navigating += ViewModelHelper.OnNavigating;
InfoABG.Navigating += ViewModelHelper.OnNavigating;
InfoLicenses.Navigating += WebViewHelper.SelectDisplayTarget;
InfoLicenses.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Lizenzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoImpressum.Navigating += ViewModelHelper.OnNavigating;
InfoDatenschutz.Navigating += WebViewHelper.SelectDisplayTarget;
InfoDatenschutz.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Datenschutzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoABG.Navigating += WebViewHelper.SelectDisplayTarget;
InfoABG.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann allgemeine Geschäftsbedingungen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoImpressum.Navigating += WebViewHelper.SelectDisplayTarget;
InfoImpressum.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Impressum nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
}
/// <summary> Called when page is shown. </summary>
@ -38,4 +57,4 @@ namespace TINK.View.Info
ViewModel.OnAppearing();
}
}
}
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Globalization;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
@ -19,7 +19,6 @@ namespace TINK.View.WhatsNew.Agb
agbViewModel = new AgbViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.IsSiteCachingOn,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
(resourceName) => ViewModelResourceHelper.GetSource(resourceName),
this);
@ -81,4 +80,4 @@ namespace TINK.View.WhatsNew.Agb
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException();
#endif
}
}
}

View file

@ -1,5 +1,5 @@
<?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.341" android:versionCode="341">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.342" android:versionCode="342">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -55,8 +55,8 @@
<key>CFBundleDisplayName</key>
<string>Mein konrad</string>
<key>CFBundleVersion</key>
<string>341</string>
<string>342</string>
<key>CFBundleShortVersionString</key>
<string>3.0.341</string>
<string>3.0.342</string>
</dict>
</plist>

View file

@ -97,8 +97,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<!-- Operator AGB -->
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -224,17 +222,6 @@
IsVisible="{Binding TariffDescription.InfoEntry5, Converter={StaticResource Label_Converter}}"
Grid.Row="14"
Grid.ColumnSpan="2"/>
<!-- AGB entry -->
<Label
TextType="Html"
Text="{Binding TariffDescription.OperatorAgb}"
IsVisible="{Binding TariffDescription.OperatorAgb, Converter={StaticResource Label_Converter}}"
Grid.ColumnSpan="2"
Grid.Row="15">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ShowAgbTappedCommand}"/>
</Label.GestureRecognizers>
</Label>
</Grid>
</StackLayout>
</ContentView>

View file

@ -25,7 +25,6 @@
Source="{Binding Uri}" />
<ActivityIndicator Grid.Row="0"
x:Name="ActivityIndicatorLoading"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"

View file

@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using Serilog;
using TINK.Model.Device;
using TINK.ViewModel.Login;
@ -14,40 +14,12 @@ namespace TINK.View.CopriWebView
{
InitializeComponent();
ManageAccount.Navigating += (sender, ev) =>
{
if (!ev.Url.ToUpper().EndsWith(".PDF"))
{
// Stay inside web view except for downloading pdf- files.
this.IsEnabled = false;
ActivityIndicatorLoading.IsVisible = true;
ActivityIndicatorLoading.IsRunning = true;
return;
}
ManageAccount.Navigating += WebViewHelper.SetBusyAndDisplayOrDownload;
DependencyService.Get<IExternalBrowserService>().OpenUrl(ev.Url);
};
ManageAccount.Navigated += (sender, ev) =>
{
if (ev.Result == WebNavigationResult.Success)
{
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
return;
}
Log.ForContext<ManageAccountPage>().Error("Navigation did not succeed.{@Event}{@Sender}", ev, sender);
ManageAccount.Source = new HtmlWebViewSource
{
Html = "<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>"
};
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
};
ManageAccount.Navigated += (sender, eventArgs) => WebViewHelper.SetIdleAndHandleError(
sender,
eventArgs,
"<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>");
ManageAccount.BindingContext = new ManageAccountViewModel(
App.ModelRoot.ActiveUser.SessionCookie,
@ -56,4 +28,4 @@ namespace TINK.View.CopriWebView
App.ModelRoot.NextActiveUri.Host);
}
}
}
}

View file

@ -11,26 +11,44 @@
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or inline-->
<ContentPage Title="{x:Static resources:AppResources.MarkingTabFees}">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabFees}">
<ContentPage.Content>
<StackLayout>
<Grid>
<WebView
x:Name="InfoRentBikeWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding RentBikeText}"/>
</StackLayout>
x:Name="InfoRentBikeWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding RentBikeText}"/>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="{x:Static resources:AppResources.MarkingTabBikes}">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabBikes}">
<ContentPage.Content>
<StackLayout>
<Grid>
<WebView
x:Name="InfoTypesOfBikesWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding TypesOfBikesText}"/>
</StackLayout>
x:Name="InfoTypesOfBikesWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding TypesOfBikesText}"/>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>
</TabbedPage>

View file

@ -1,4 +1,5 @@
using TINK.ViewModel;
using Serilog;
using TINK.ViewModel;
using TINK.ViewModel.Contact;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -14,19 +15,31 @@ namespace TINK.View.Contact
{
InitializeComponent();
/// Info about renting.
InfoRentBikeWebView.Navigating += WebViewHelper.SelectDisplayTarget;
InfoRentBikeWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Mietinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
/// Info about types of bikes.
InfoTypesOfBikesWebView.Navigating += WebViewHelper.SelectDisplayTarget;
InfoTypesOfBikesWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Radinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
ViewModel = new FeesAndBikesPageViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.ResourceUrls.FeesResourcePath,
App.ModelRoot.ResourceUrls.BikesResourcePath,
App.ModelRoot.IsSiteCachingOn);
App.ModelRoot.IsSiteCachingOn,
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
BindingContext = ViewModel;
/// Info about renting.
InfoRentBikeWebView.Navigating += ViewModelHelper.OnNavigating;
/// Info about types of bikes.
InfoTypesOfBikesWebView.Navigating += ViewModelHelper.OnNavigating;
}
/// <summary> Called when page is shown. </summary>
@ -35,4 +48,4 @@ namespace TINK.View.Contact
ViewModel.OnAppearing();
}
}
}
}

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
@ -12,49 +12,96 @@
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or inline-->
<ContentPage Title="App">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabApp}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoLicenses"
Source="{Binding InfoLicenses}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="Datenschutz">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabPrivacy}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoDatenschutz"
Source="{Binding InfoPrivacy}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="AGB">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabGtc}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoABG"
Source ="{Binding InfoAgb}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="Impressum">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabImpress}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoImpressum"
Source="{Binding InfoImpressum}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>

View file

@ -1,4 +1,5 @@
using System.Globalization;
using System.Globalization;
using AndroidX.Navigation;
using TINK.ViewModel;
using TINK.ViewModel.Info;
using Xamarin.Forms;
@ -21,15 +22,34 @@ namespace TINK.View.Info
App.ModelRoot.ResourceUrls.PrivacyResourcePath,
App.ModelRoot.ResourceUrls.ImpressResourcePath,
App.ModelRoot.IsSiteCachingOn,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
resourceName => ViewModelResourceHelper.GetSource(resourceName));
resourceName => ViewModelResourceHelper.GetEmbeddedResource(resourceName),
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
TabbedInfoPage.BindingContext = ViewModel;
InfoLicenses.Navigating += ViewModelHelper.OnNavigating;
InfoDatenschutz.Navigating += ViewModelHelper.OnNavigating;
InfoABG.Navigating += ViewModelHelper.OnNavigating;
InfoLicenses.Navigating += WebViewHelper.SelectDisplayTarget;
InfoLicenses.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Lizenzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoImpressum.Navigating += ViewModelHelper.OnNavigating;
InfoDatenschutz.Navigating += WebViewHelper.SelectDisplayTarget;
InfoDatenschutz.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Datenschutzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoABG.Navigating += WebViewHelper.SelectDisplayTarget;
InfoABG.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann allgemeine Geschäftsbedingungen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoImpressum.Navigating += WebViewHelper.SelectDisplayTarget;
InfoImpressum.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Impressum nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
}
/// <summary> Called when page is shown. </summary>
@ -38,4 +58,4 @@ namespace TINK.View.Info
ViewModel.OnAppearing();
}
}
}
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Globalization;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
@ -19,8 +19,7 @@ namespace TINK.View.WhatsNew.Agb
agbViewModel = new AgbViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.IsSiteCachingOn,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
(resourceName) => ViewModelResourceHelper.GetSource(resourceName),
(resourceName) => ViewModelResourceHelper.GetEmbeddedResource(resourceName),
this);
BindingContext = agbViewModel;
@ -81,4 +80,4 @@ namespace TINK.View.WhatsNew.Agb
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException();
#endif
}
}
}

View file

@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using System.Reflection;
using System.Text;
using Serilog;
@ -27,16 +27,16 @@ namespace TINK.ViewModel
/// <summary> Gets an an embedded html ressource.</summary>
/// <param name="resrouceName">Name of resource to get.</param>
/// <returns></returns>
public static string GetSource(string resrouceName)
public static string GetEmbeddedResource(string resrouceName)
{
var l_oRessourceName = RessourcePrefix + resrouceName;
var ressourceName = RessourcePrefix + resrouceName;
Log.Verbose($"Using this resource prefix {RessourcePrefix}.");
// note that the prefix includes the trailing period '.' that is required
var assembly = typeof(ViewModelResourceHelper).GetTypeInfo().Assembly;
var stream = assembly.GetManifestResourceStream(l_oRessourceName);
var stream = assembly.GetManifestResourceStream(ressourceName);
return stream != null
? (new StreamReader(stream, Encoding.UTF8)).ReadToEnd()
: string.Format("<!DOCTYPE html><html lang=\"de\"><body>An error occurred loading html- ressource {0}.</body>", l_oRessourceName);
: string.Format("<!DOCTYPE html><html lang=\"de\"><body>An error occurred loading html- ressource {0}.</body>", ressourceName);
}
}
}

View file

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

View file

@ -55,8 +55,8 @@
<key>CFBundleDisplayName</key>
<string>sharee.bike</string>
<key>CFBundleVersion</key>
<string>341</string>
<string>342</string>
<key>CFBundleShortVersionString</key>
<string>3.0.341</string>
<string>3.0.342</string>
</dict>
</plist>

View file

@ -1,13 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:themes="clr-namespace:TINK.Themes;assembly=TINKLib"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="TINK.App"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Application.EnableAccessibilityScalingForNamedFontSizes="false">
<Application.Resources>
<ResourceDictionary>
<x:String x:Key="IconMap">&#xf5a0;</x:String>
<xct:InvertedBoolConverter x:Key="InvertedBoolConverter" />
<x:String x:Key="IconMap">&#xf5a0;</x:String>
<x:String x:Key="IconFindBike">&#xf002;</x:String>
<x:String x:Key="IconMyBikes">&#xf206;</x:String>
<x:String x:Key="IconAccount">&#xf007;</x:String>
@ -29,4 +31,4 @@
<!-- Add more resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
</Application>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:conv="clr-namespace:TINK.View"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
@ -91,8 +91,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<!-- Operator AGB -->
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -218,18 +216,7 @@
IsVisible="{Binding TariffDescription.InfoEntry5, Converter={StaticResource Label_Converter}}"
Grid.Row="14"
Grid.ColumnSpan="2"/>
<!-- AGB entry -->
<Label
TextType="Html"
Text="{Binding TariffDescription.OperatorAgb}"
IsVisible="{Binding TariffDescription.OperatorAgb, Converter={StaticResource Label_Converter}}"
Grid.ColumnSpan="2"
Grid.Row="15">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ShowAgbTappedCommand}"/>
</Label.GestureRecognizers>
</Label>
</Grid>
</StackLayout>
</ContentView>
</ViewCell>
</ViewCell>

View file

@ -31,7 +31,6 @@
Source="{Binding Uri}" />
<ActivityIndicator Grid.Row="0"
x:Name="ActivityIndicatorLoading"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"

View file

@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using Serilog;
using TINK.Model.Device;
using TINK.ViewModel.Login;
@ -14,40 +14,12 @@ namespace TINK.View.CopriWebView
{
InitializeComponent();
ManageAccount.Navigating += (sender, ev) =>
{
if (!ev.Url.ToUpper().EndsWith(".PDF"))
{
// Stay inside web view except for downloading pdf- files.
this.IsEnabled = false;
ActivityIndicatorLoading.IsVisible = true;
ActivityIndicatorLoading.IsRunning = true;
return;
}
ManageAccount.Navigating += WebViewHelper.SetBusyAndDisplayOrDownload;
DependencyService.Get<IExternalBrowserService>().OpenUrl(ev.Url);
};
ManageAccount.Navigated += (sender, ev) =>
{
if (ev.Result == WebNavigationResult.Success)
{
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
return;
}
Log.ForContext<ManageAccountPage>().Error("Navigation did not succeed.{@Event}{@Sender}", ev, sender);
ManageAccount.Source = new HtmlWebViewSource
{
Html = "<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>"
};
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
};
ManageAccount.Navigated += (sender, eventArgs) => WebViewHelper.SetIdleAndHandleError(
sender,
eventArgs,
"<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>");
ManageAccount.BindingContext = new ManageAccountViewModel(
App.ModelRoot.ActiveUser.SessionCookie,
@ -56,4 +28,4 @@ namespace TINK.View.CopriWebView
App.ModelRoot.NextActiveUri.Host);
}
}
}
}

View file

@ -10,26 +10,50 @@
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or inline-->
<ContentPage Title="{x:Static resources:AppResources.MarkingTabFees}">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabFees}">
<ContentPage.Content>
<StackLayout>
<WebView
x:Name="InfoRentBikeWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding RentBikeText}"/>
</StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoRentBikeWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding RentBikeText}"/>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="{x:Static resources:AppResources.MarkingTabBikes}">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabBikes}">
<ContentPage.Content>
<StackLayout>
<WebView
x:Name="InfoTypesOfBikesWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding TypesOfBikesText}"/>
</StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoTypesOfBikesWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding TypesOfBikesText}"/>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>
</TabbedPage>

View file

@ -1,4 +1,5 @@
using TINK.ViewModel;
using Serilog;
using TINK.ViewModel;
using TINK.ViewModel.Contact;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -14,19 +15,31 @@ namespace TINK.View.Contact
{
InitializeComponent();
/// Info about renting.
InfoRentBikeWebView.Navigating += WebViewHelper.SelectDisplayTarget;
InfoRentBikeWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Mietinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
/// Info about types of bikes.
InfoTypesOfBikesWebView.Navigating += WebViewHelper.SelectDisplayTarget;
InfoTypesOfBikesWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Radinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
ViewModel = new FeesAndBikesPageViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.ResourceUrls.FeesResourcePath,
App.ModelRoot.ResourceUrls.BikesResourcePath,
App.ModelRoot.IsSiteCachingOn);
App.ModelRoot.IsSiteCachingOn,
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
BindingContext = ViewModel;
/// Info about renting.
InfoRentBikeWebView.Navigating += ViewModelHelper.OnNavigating;
/// Info about types of bikes.
InfoTypesOfBikesWebView.Navigating += ViewModelHelper.OnNavigating;
}
/// <summary> Called when page is shown. </summary>
@ -35,4 +48,4 @@ namespace TINK.View.Contact
ViewModel.OnAppearing();
}
}
}
}

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TINK.View.Info.InfoPage"
@ -11,49 +11,96 @@
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or inline-->
<ContentPage Title="App">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabApp}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoLicenses"
Source="{Binding InfoLicenses}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="Datenschutz">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabPrivacy}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoDatenschutz"
Source="{Binding InfoPrivacy}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="AGB">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabGtc}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoABG"
Source ="{Binding InfoAgb}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage Title="Impressum">
<ContentPage
IsEnabled="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Title="{x:Static resources:AppResources.MarkingTabImpress}">
<ContentPage.Content>
<StackLayout>
<WebView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
x:Name="InfoImpressum"
Source="{Binding InfoImpressum}"
HeightRequest="1000"
WidthRequest="1000" />
</StackLayout>
<ActivityIndicator Grid.Row="0"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>

View file

@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using TINK.ViewModel;
using TINK.ViewModel.Info;
using Xamarin.Forms;
@ -21,15 +21,34 @@ namespace TINK.View.Info
App.ModelRoot.ResourceUrls.PrivacyResourcePath,
App.ModelRoot.ResourceUrls.ImpressResourcePath,
App.ModelRoot.IsSiteCachingOn,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
resourceName => ViewModelResourceHelper.GetSource(resourceName));
resourceName => ViewModelResourceHelper.GetSource(resourceName),
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
TabbedInfoPage.BindingContext = ViewModel;
InfoLicenses.Navigating += ViewModelHelper.OnNavigating;
InfoDatenschutz.Navigating += ViewModelHelper.OnNavigating;
InfoABG.Navigating += ViewModelHelper.OnNavigating;
InfoLicenses.Navigating += WebViewHelper.SelectDisplayTarget;
InfoLicenses.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Lizenzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoImpressum.Navigating += ViewModelHelper.OnNavigating;
InfoDatenschutz.Navigating += WebViewHelper.SelectDisplayTarget;
InfoDatenschutz.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Datenschutzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoABG.Navigating += WebViewHelper.SelectDisplayTarget;
InfoABG.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann allgemeine Geschäftsbedingungen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
InfoImpressum.Navigating += WebViewHelper.SelectDisplayTarget;
InfoImpressum.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Impressum nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
}
/// <summary> Called when page is shown. </summary>
@ -38,4 +57,4 @@ namespace TINK.View.Info
ViewModel.OnAppearing();
}
}
}
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Globalization;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
@ -19,7 +19,6 @@ namespace TINK.View.WhatsNew.Agb
agbViewModel = new AgbViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.IsSiteCachingOn,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
(resourceName) => ViewModelResourceHelper.GetSource(resourceName),
this);
@ -81,4 +80,4 @@ namespace TINK.View.WhatsNew.Agb
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException();
#endif
}
}
}

View file

@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using TINK.MultilingualResources;
using TINK.Repository.Response;
@ -67,12 +67,6 @@ namespace TINK.Model.Connector.Updater
});
}
if (!string.IsNullOrEmpty(tariffDesciption?.operator_agb ?? string.Empty))
{
bike.InfoEntries.Add("1", new Bikes.BikeInfoNS.RentalDescription.InfoElement { Key = "AGB", Value = tariffDesciption.operator_agb });
}
return bike;
}

View file

@ -1,4 +1,4 @@
namespace TINK.Model
namespace TINK.Model
{
public class ResourceUrls : IResourceUrls
{
@ -9,11 +9,11 @@
string privacyResourcePath = null,
string impressResourcePath = null)
{
FeesResourcePath = !string.IsNullOrEmpty(feesResourcePath) ? feesResourcePath : "site/tariff_info_1.html";
BikesResourcePath = !string.IsNullOrEmpty(bikesResourcePath) ? bikesResourcePath : "site/bike_info.html";
AgbResourcePath = !string.IsNullOrEmpty(agbResourcePath) ? agbResourcePath : "site/agb.html";
PrivacyResourcePath = !string.IsNullOrEmpty(privacyResourcePath) ? privacyResourcePath : "site/privacy.html";
ImpressResourcePath = !string.IsNullOrEmpty(impressResourcePath) ? impressResourcePath : "site/impress.html";
FeesResourcePath = !string.IsNullOrEmpty(feesResourcePath) ? feesResourcePath : "";
BikesResourcePath = !string.IsNullOrEmpty(bikesResourcePath) ? bikesResourcePath : "";
AgbResourcePath = !string.IsNullOrEmpty(agbResourcePath) ? agbResourcePath : "";
PrivacyResourcePath = !string.IsNullOrEmpty(privacyResourcePath) ? privacyResourcePath : "";
ImpressResourcePath = !string.IsNullOrEmpty(impressResourcePath) ? impressResourcePath : "";
}
public string FeesResourcePath { get; }

View file

@ -596,12 +596,12 @@ namespace TINK.Model
new List<AppFlavor> { AppFlavor.MeinKonrad }
},
{
new Version(3, 0, 341),
new Version(3, 0, 342),
AppResources.ChangeLog_MinorDesignImprovements,
new List<AppFlavor> { AppFlavor.LastenradBayern, AppFlavor.MeinKonrad }
},
{
new Version(3, 0, 341),
new Version(3, 0, 342),
AppResources.ChangeLog_MinorBugFixes,
new List<AppFlavor> { AppFlavor.ShareeBike }
}

View file

@ -2081,6 +2081,15 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to App.
/// </summary>
public static string MarkingTabApp {
get {
return ResourceManager.GetString("MarkingTabApp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Instructions.
/// </summary>
@ -2099,6 +2108,33 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to GTC.
/// </summary>
public static string MarkingTabGtc {
get {
return ResourceManager.GetString("MarkingTabGtc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Impress.
/// </summary>
public static string MarkingTabImpress {
get {
return ResourceManager.GetString("MarkingTabImpress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Privacy.
/// </summary>
public static string MarkingTabPrivacy {
get {
return ResourceManager.GetString("MarkingTabPrivacy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Verbose error messages.
/// </summary>

View file

@ -1037,4 +1037,16 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben:
<data name="MarkingContactSupportBusy" xml:space="preserve">
<value>{0} &lt;font color="gray"&gt;&lt;u&gt;kontaktieren&lt;/u&gt;&lt;/font&gt;.</value>
</data>
<data name="MarkingTabApp" xml:space="preserve">
<value>App</value>
</data>
<data name="MarkingTabGtc" xml:space="preserve">
<value>AGB</value>
</data>
<data name="MarkingTabImpress" xml:space="preserve">
<value>Impressum</value>
</data>
<data name="MarkingTabPrivacy" xml:space="preserve">
<value>Datenschutz</value>
</data>
</root>

View file

@ -1129,4 +1129,16 @@ You can now see at a glance which app version you have installed: in the menu at
<data name="MarkingContactSupportBusy" xml:space="preserve">
<value>&lt;font color="gray"&gt;&lt;u&gt;Contact&lt;/u&gt;&lt;/font&gt; {0}.</value>
</data>
</root>
<data name="MarkingTabApp" xml:space="preserve">
<value>App</value>
</data>
<data name="MarkingTabGtc" xml:space="preserve">
<value>GTC</value>
</data>
<data name="MarkingTabImpress" xml:space="preserve">
<value>Impress</value>
</data>
<data name="MarkingTabPrivacy" xml:space="preserve">
<value>Privacy</value>
</data>
</root>

View file

@ -1408,6 +1408,22 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben:
<source><bpt id="1">&lt;font color="gray"&gt;</bpt><bpt id="2">&lt;u&gt;</bpt>Contact<ept id="2">&lt;/u&gt;</ept><ept id="1">&lt;/font&gt;</ept> {0}.</source>
<target state="translated">{0} <bpt id="1">&lt;font color="gray"&gt;</bpt><bpt id="2">&lt;u&gt;</bpt>kontaktieren<ept id="2">&lt;/u&gt;</ept><ept id="1">&lt;/font&gt;</ept>.</target>
</trans-unit>
<trans-unit id="MarkingTabApp" translate="yes" xml:space="preserve">
<source>App</source>
<target state="translated">App</target>
</trans-unit>
<trans-unit id="MarkingTabGtc" translate="yes" xml:space="preserve">
<source>GTC</source>
<target state="translated">AGB</target>
</trans-unit>
<trans-unit id="MarkingTabImpress" translate="yes" xml:space="preserve">
<source>Impress</source>
<target state="translated">Impressum</target>
</trans-unit>
<trans-unit id="MarkingTabPrivacy" translate="yes" xml:space="preserve">
<source>Privacy</source>
<target state="translated">Datenschutz</target>
</trans-unit>
</group>
</body>
</file>

View file

@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace TINK.Repository.Response
{
@ -48,10 +48,6 @@ namespace TINK.Repository.Response
[DataMember]
public string max_eur_per_day { get; private set; }
/// <summary> Info about operator agb as HTML (i.g. text and hyperlink). </summary>
[DataMember]
public string operator_agb { get; private set; }
/// <summary> Text which informs users about GPS tracking if tracking is on. </summary>
[DataMember]
public string track_info { get; private set; }

View file

@ -0,0 +1,175 @@
using System.Linq;
using Serilog;
using TINK.Model.Device;
using Xamarin.Forms;
namespace TINK.View
{
public static class WebViewHelper
{
/// <summary> Rountes request to browser if internal URI was detected or displays link in app otherwise. </summary>
/// <param name="sender">Sender of the event.</param>
/// <param name="eventArgs">Event arguments</param>
public static void SelectDisplayTarget(object sender, WebNavigatingEventArgs eventArgs)
{
if (!eventArgs.Url.ToUpper().StartsWith("HTTP"))
{
// An internal link was detected.
// Stay inside WebView
eventArgs.Cancel = false;
return;
}
// Do not navigate outside the document on web view.
eventArgs.Cancel = true;
// Open external link in browser.
DependencyService.Get<IExternalBrowserService>().OpenUrl(eventArgs.Url);
}
/// <summary> Routes request to broswer to download pdf- documents or displays link in app otherwise. </summary>
/// <param name="sender">Sender of the event.</param>
/// <param name="eventArgs">Event arguments</param>
public static void SetBusyAndDisplayOrDownload(object sender, WebNavigatingEventArgs eventArgs)
{
if (!eventArgs.Url.ToUpper().EndsWith(".PDF"))
{
// Stay inside web view except for downloading pdf- files.
SetBusy(sender);
eventArgs.Cancel = false;
return;
}
// Do not navigate outside the document on web view.
eventArgs.Cancel = true;
// Open external link in browser.
DependencyService.Get<IExternalBrowserService>().OpenUrl(eventArgs.Url);
}
/// <summary>
/// Disables WebView and shows ActivityIndicator.
/// </summary>
/// <remarks>
/// Prerequisites: Both WebView and ActivityInicator must be located on the same Grid object.
/// </remarks>
/// <param name="sender"></param>
private static void SetBusy(object sender)
{
if (!(sender is WebView webView))
{
// Nothing to do if sender is not a web view.
Log.Error($"Unexpected call of {nameof(SetBusy)} detected. Argument must not be of type {sender.GetType()}.");
return;
}
if (!(webView.Parent is Grid grid))
{
// Nothing to do if web view is not located on grid.
Log.Error($"Unexpected call of {nameof(SetBusy)} detected. Parent of argument must not be of type {webView.Parent.GetType()}.");
return;
}
grid.IsEnabled = false;
var indicator = grid.Children.OfType<ActivityIndicator>().FirstOrDefault();
if (indicator == null)
{
// Nothing to do if there is not activity indicator.
Log.Error($"Unexpected call of {nameof(SetBusy)} detected. No activity indicator found.");
return;
}
indicator.IsVisible = true;
indicator.IsRunning = true;
}
/// <summary>
/// Enables WebView and hides ActivityIndicator and sets error text to WebView in case an error occurred.
/// </summary>
/// <remarks>
/// Prerequisites: Both WebView and ActivityInicator must be located on the same Grid object.
/// </remarks>
/// <param name="htmlErrorMessage">HTML showing an error message.</param>
public static void SetIdleAndHandleError(
object sender,
WebNavigatedEventArgs eventArgs,
string htmlErrorMessage)
{
if (!(sender is WebView webView))
{
// Nothing to do if sender is not a web view.
Log.Error($"Unexpected call of {nameof(SetIdleAndHandleError)} detected. Argument must not be of type {sender.GetType()}.");
return;
}
if (!(webView.Parent is Grid grid))
{
// Nothing to do if web view is not located on grid.
Log.Error($"Unexpected call of {nameof(SetIdleAndHandleError)} detected. Parent of argument must not be of type {webView.Parent.GetType()}.");
return;
}
var indicator = grid.Children.OfType<ActivityIndicator>().FirstOrDefault();
if (indicator == null)
{
// Nothing to do if there is not activity indicator.
Log.Error($"Unexpected call of {nameof(SetIdleAndHandleError)} detected. No activity indicator found.");
}
if (eventArgs.Result == WebNavigationResult.Success)
{
// Uri could be loaded successfully.
grid.IsEnabled = true;
if (indicator != null)
{
indicator.IsVisible = false;
indicator.IsRunning = false;
}
return;
}
// Navigation failed.
Log.Error("Navigation did not succeed.{@Event}{@Sender}", eventArgs, sender);
webView.Source = new HtmlWebViewSource
{
Html = !string.IsNullOrEmpty(htmlErrorMessage) ? htmlErrorMessage : $"Navigation to {eventArgs.Url} failed."
};
grid.IsEnabled = true;
if (indicator != null)
{
indicator.IsVisible = false;
indicator.IsRunning = false;
}
}
/// <summary>
/// Sets error text to WebView in case an error occurred.
/// </summary>
/// <param name="htmlErrorMessage">HTML showing an error message.</param>
public static void HandleError(
object sender,
WebNavigatedEventArgs eventArgs,
string htmlErrorMessage)
{
if (eventArgs.Result == WebNavigationResult.Success)
{
// Uri could be loaded successfully.
return;
}
if (!(sender is WebView webView))
{
// Nothing to do if sender is not a web view.
Log.Error($"Unexpected call of {nameof(HandleError)} detected. Argument must not be of type {sender.GetType()}.");
return;
}
// Navigation failed.
Log.Error("Navigation did not succeed.{@Event}{@Sender}", eventArgs, sender);
webView.Source = new HtmlWebViewSource
{
Html = !string.IsNullOrEmpty(htmlErrorMessage) ? htmlErrorMessage : $"Navigation to {eventArgs.Url} failed."
};
}
}
}

View file

@ -1,4 +1,4 @@
using Serilog;
using Serilog;
using System;
using System.ComponentModel;
using System.Text.RegularExpressions;
@ -355,32 +355,6 @@ namespace TINK.ViewModel.Bikes.Bike
/// <summary> Gets the value of property <see cref="StateColor"/> when PropertyChanged was fired. </summary>
public Color LastStateColor { get; set; }
/// <summary> Command object to bind login page redirect link to view model.</summary>
public System.Windows.Input.ICommand ShowAgbTappedCommand
=> new Xamarin.Forms.Command(() => ShowAgbPageAsync());
/// <summary> Opens login page. </summary>
public void ShowAgbPageAsync()
{
try
{
var url = GetUrlFirstOrDefault(TariffDescription.OperatorAgb);
if (string.IsNullOrEmpty(url))
{
// No url contained in string.
return;
}
OpenUrlInBrowser(url);
}
catch (Exception p_oException)
{
Log.Error("An unexpected error occurred opening broser. {@Exception}", p_oException);
return;
}
}
/// <summary> Gets first url from text.</summary>
/// <param name="htmlSource">url to extract text from.</param>
/// <returns>Gets first url or an empty string if on url is contained in text.</returns>

View file

@ -36,7 +36,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IUser activeUser) : base(
selectedBike,
AppResources.ActionReturn, // Copri button text "Miete beenden"
false, // Do no more allow to return bike.
true, // Show button to enabled returning of bike.
isConnectedDelegate,
connectorFactory,
geolocation,

View file

@ -1,4 +1,4 @@
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.Linq;
using TINK.Model.Bikes.BikeInfoNS;
@ -9,8 +9,6 @@ namespace TINK.ViewModel.Bikes.Bike
/// </summary>
public class TariffDescriptionViewModel
{
private const string AGBKEY = "AGB";
public TariffDescriptionViewModel(RentalDescription tariff)
{
Name = tariff?.Name ?? string.Empty;
@ -20,13 +18,8 @@ namespace TINK.ViewModel.Bikes.Bike
: new ObservableCollection<RentalDescription.TariffElement>();
InfoEntries = tariff != null && tariff?.InfoEntries != null
? new ObservableCollection<string>(tariff.InfoEntries.OrderBy(x => x.Key).Where(x => x.Value.Key != AGBKEY).Select(x => x.Value.Value))
? new ObservableCollection<string>(tariff.InfoEntries.OrderBy(x => x.Key).Select(x => x.Value.Value))
: new ObservableCollection<string>();
OperatorAgb = tariff?.InfoEntries != null
&& tariff.InfoEntries.Select(x => x.Value.Key).Contains(AGBKEY)
? tariff?.InfoEntries.FirstOrDefault(x => x.Value.Key == AGBKEY).Value.Value
: string.Empty;
}
/// <summary>
@ -44,9 +37,6 @@ namespace TINK.ViewModel.Bikes.Bike
/// </summary>
public ObservableCollection<string> InfoEntries { get; private set; }
/// <summary> Info about operator agb as HTML (i.g. text and hyperlink). </summary>
public string OperatorAgb { get; set; }
public RentalDescription.TariffElement TarifEntry1 => TariffEntries.Count > 0 ? TariffEntries[0] : new RentalDescription.TariffElement();
public RentalDescription.TariffElement TarifEntry2 => TariffEntries.Count > 1 ? TariffEntries[1] : new RentalDescription.TariffElement();
public RentalDescription.TariffElement TarifEntry3 => TariffEntries.Count > 2 ? TariffEntries[2] : new RentalDescription.TariffElement();

View file

@ -1,5 +1,12 @@
using System.ComponentModel;
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using Serilog;
using TINK.Model;
using TINK.Model.Bikes;
using TINK.Model.Connector;
using TINK.Model.Services.CopriApi;
using TINK.ViewModel.Info;
using Xamarin.Forms;
namespace TINK.ViewModel.Contact
@ -12,24 +19,67 @@ namespace TINK.ViewModel.Contact
/// <summary> Holds value wether site caching is on or off.</summary>
bool IsSiteCachingOn { get; }
private string FeesResourcePath { get; }
/// <summary>
/// Relative path to fees resources of empty if value was not yet querried from backend.
/// </summary>
private string FeesResourcePath { get; set; }
private string BikesResourcePath { get; }
/// <summary>
/// Relative path to bike info resources of empty if value was not yet querried from backend.
/// </summary>
private string BikesResourcePath { get; set; }
private bool _IsIdle = false;
/// <summary>
/// Is true if no action is pending, false otherwise.
/// </summary>
public bool IsIdle
{
get => _IsIdle;
private set
{
if (_IsIdle == value)
{
// Nothing to do.
return;
}
_IsIdle = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsIdle)));
return;
}
}
/// <summary>
/// Object to querry resources urls object from backend if required.
/// This object is used to update resources path values <see cref="FeesResourcePath"/>, and <see cref="BikesResourcePath"/> from.
/// </summary>
private Func<IQuery> QueryProvider { get; }
/// <summary>
/// Action to update shared resources urls object exposed by main model.
/// </summary>
private Action<IResourceUrls> UpdateUrlsAction { get; }
/// <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="query">Object to querry resources path values if required.</param>
public FeesAndBikesPageViewModel(
string hostName,
string feesResourcePath,
string bikesResourcePath,
bool isSiteCachingOn)
bool isSiteCachingOn,
Func<IQuery> queryProvider,
Action<IResourceUrls> updateUrlsAction)
{
HostName = hostName;
FeesResourcePath = feesResourcePath;
BikesResourcePath = bikesResourcePath;
IsSiteCachingOn = isSiteCachingOn;
QueryProvider = queryProvider;
UpdateUrlsAction = updateUrlsAction;
}
/// <summary> Holds the name of the host.</summary>
@ -38,10 +88,38 @@ namespace TINK.ViewModel.Contact
/// <summary> Called when page is shown. </summary>
public async void OnAppearing()
{
// Get resource urls object from backend.
async Task<IResourceUrls> GetUrls()
{
Result<BikeCollection> bikes;
try
{
bikes = await QueryProvider().GetBikesAsync();
}
catch (Exception ex)
{
Log.ForContext<FeesAndBikesPageViewModel>().Error($"Getting resource urls from COPRI failed. {ex.Message}");
return new ResourceUrls();
}
return bikes?.GeneralData?.ResourceUrls ?? new ResourceUrls();
}
// Set state to busy.
IsIdle = false;
if (string.IsNullOrEmpty(FeesResourcePath))
{
var urls = await GetUrls();
FeesResourcePath = urls.FeesResourcePath;
BikesResourcePath = urls.BikesResourcePath;
UpdateUrlsAction(urls); // Update main model to prevent duplicate queries.
}
RentBikeText = new HtmlWebViewSource
{
Html = !string.IsNullOrEmpty(FeesResourcePath)
? await ViewModelHelper.GetSource($"https://{HostName}/{FeesResourcePath}" /* "site/tariff_info_1.html" */, IsSiteCachingOn)
? await ViewModelHelper.GetSource($"https://{HostName}/{FeesResourcePath}", IsSiteCachingOn)
: await Task.FromResult(ViewModelHelper.FromBody("No fees resource available. Resource path is null or empty."))
};
@ -51,6 +129,9 @@ namespace TINK.ViewModel.Contact
? await ViewModelHelper.GetSource($"https://{HostName}/{BikesResourcePath}" /*"site/bike_info.html"*/, IsSiteCachingOn)
: await Task.FromResult(ViewModelHelper.FromBody("No bikes instruction resource available. Resource path is null or empty."))
};
// Set state to idle.
IsIdle = true;
}
private HtmlWebViewSource rentBikeText;

View file

@ -1,10 +1,14 @@
using System;
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes;
using TINK.Model;
using TINK.Model.Device;
using TINK.Model.Services.CopriApi;
using Xamarin.Essentials;
using Xamarin.Forms;
using TINK.Model.Connector;
namespace TINK.ViewModel.Info
{
@ -20,39 +24,80 @@ namespace TINK.ViewModel.Info
/// <summary> Holds value wether site caching is on or off.</summary>
bool IsSiteCachingOn { get; }
private string AgbResourcePath { get; }
private string PrivacyResourcePath { get; }
private string ImpressResourcePath { get; }
/// <summary>
/// Relative path to agb resources of empty if value was not yet querried from backend.
/// </summary>
private string AgbResourcePath { get; set; }
/// <summary>
/// Holds the current ui two letter ISO language name.
/// Relative path to privacy resources of empty if value was not yet querried from backend.
/// </summary>
private string UiIsoLanguageName { get; }
private string PrivacyResourcePath { get; set; }
/// <summary>
/// Relative path to impress resources of empty if value was not yet querried from backend.
/// </summary>
private string ImpressResourcePath { get; set; }
private bool _IsIdle = false;
/// <summary>
/// Is true if no action is pending, false otherwise.
/// </summary>
public bool IsIdle
{
get => _IsIdle;
private set
{
if (_IsIdle == value)
{
// Nothing to do.
return;
}
_IsIdle = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsIdle)));
return;
}
}
/// <summary>
/// Object to querry resources urls object from backend if required.
/// This object is used to update resources path values <see cref="AgbResourcePath"/>, <see cref="PrivacyResourcePath"/> and <see cref="ImpressResourcePath"/> from.
/// </summary>
private Func<IQuery> QueryProvider { get; }
/// <summary>
/// Action to update shared resources urls object exposed by main model.
/// </summary>
private Action<IResourceUrls> UpdateUrlsAction { get; }
/// <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="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="queryProvider">Object to querry resources urls object from backend if required.</param>
/// <param name="updateUrlsAction">Action to update shared resources urls object</param>
public InfoPageViewModel(
string hostName,
string agbResourcePath,
string privacyResourcePath,
string impressResourcePath,
bool isSiteCachingOn,
string uiIsoLangugageName,
Func<string, string> resourceProvider)
Func<string, string> resourceProvider,
Func<IQuery> queryProvider,
Action<IResourceUrls> updateUrlsAction)
{
HostName = hostName;
AgbResourcePath = agbResourcePath;
PrivacyResourcePath = privacyResourcePath;
ImpressResourcePath = impressResourcePath;
IsSiteCachingOn = isSiteCachingOn;
UiIsoLanguageName = uiIsoLangugageName;
QueryProvider = queryProvider;
UpdateUrlsAction = updateUrlsAction;
InfoAgb = new HtmlWebViewSource { Html = "<html>Loading...</html>" };
@ -63,6 +108,37 @@ namespace TINK.ViewModel.Info
/// <summary> Called when page is shown. </summary>
public async void OnAppearing()
{
// Get resource urls object from backend.
async Task<IResourceUrls> GetUrls()
{
Result<BikeCollection> bikes;
try
{
bikes = await QueryProvider().GetBikesAsync();
}
catch (Exception ex)
{
Log.ForContext<InfoPageViewModel>().Error($"Getting resource urls from COPRI failed. {ex.Message}");
return new ResourceUrls();
}
IResourceUrls resourceUrls = bikes?.GeneralData?.ResourceUrls ?? new ResourceUrls();
return resourceUrls;
}
// Set state to busy.
IsIdle = false;
// Check if urls to show info from are already known.
if (string.IsNullOrEmpty(PrivacyResourcePath))
{
var urls = await GetUrls();
PrivacyResourcePath = urls.PrivacyResourcePath;
ImpressResourcePath = urls.ImpressResourcePath;
AgbResourcePath = urls.AgbResourcePath;
UpdateUrlsAction(urls); // Update main model to prevent duplicate queries.
}
// Gets privacy info from server.
async Task<HtmlWebViewSource> GetInfoPrivacy()
{
@ -113,11 +189,14 @@ namespace TINK.ViewModel.Info
};
}
InfoAgb = await GetAgb(HostName, AgbResourcePath, IsSiteCachingOn, UiIsoLanguageName);
InfoAgb = await GetAgb(HostName, AgbResourcePath, IsSiteCachingOn);
InfoPrivacy = await GetInfoPrivacy();
InfoImpressum = await GetImpressum();
// Set state to idle.
IsIdle = true;
}
/// <summary> Gets the AGBs</summary>
@ -126,8 +205,7 @@ namespace TINK.ViewModel.Info
public static async Task<HtmlWebViewSource> GetAgb(
string hostName,
string agbResourcePath,
bool isSiteCachingOn,
string uiIsoLangugageName)
bool isSiteCachingOn)
{
string GetUriText()
=> $"https://{hostName}/{agbResourcePath}";

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
@ -228,27 +228,6 @@ namespace TINK.ViewModel
return l_oError;
}
/// <summary> User tabbed a URI. </summary>
/// <param name="sender">Sender of the event.</param>
/// <param name="eventArgs">Event arguments</param>
public static void OnNavigating(object sender, WebNavigatingEventArgs eventArgs)
{
if (!eventArgs.Url.ToUpper().StartsWith("HTTP"))
{
// An internal link was detected.
// Stay inside WebView
eventArgs.Cancel = false;
return;
}
// Do not navigate outside the document.
eventArgs.Cancel = true;
DependencyService.Get<IExternalBrowserService>().OpenUrl(eventArgs.Url);
}
/// <summary> Gets the user group if a user friendly name.</summary>
/// <param name="user"></param>
/// <returns></returns>

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Input;
@ -19,11 +19,6 @@ namespace TINK.ViewModel.WhatsNew.Agb
/// <summary> Holds value wether site caching is on or off.</summary>
bool IsSiteCachingOn { get; }
/// <summary>
/// Holds the current ui two letter ISO language name.
/// </summary>
private string UiIsoLanguageName { get; }
/// <summary> Constructs AGB view model</summary>
/// <param name="isSiteCachingOn">Holds value wether site caching is on or off.</param>
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
@ -32,13 +27,11 @@ namespace TINK.ViewModel.WhatsNew.Agb
public AgbViewModel(
string hostName,
bool isSiteCachingOn,
string uiIsoLangugageName,
Func<string, string> resourceProvider,
IViewService viewService)
{
HostName = hostName;
IsSiteCachingOn = isSiteCachingOn;
UiIsoLanguageName = uiIsoLangugageName;
ViewService = viewService
?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No view available.");
@ -67,7 +60,7 @@ namespace TINK.ViewModel.WhatsNew.Agb
/// <summary> Called when page is shown. </summary>
public async Task OnAppearing()
{
InfoAgb = await InfoPageViewModel.GetAgb(HostName, "agbResourcePath", IsSiteCachingOn, UiIsoLanguageName);
InfoAgb = await InfoPageViewModel.GetAgb(HostName, "agbResourcePath", IsSiteCachingOn);
}
/// <summary> User clicks OK button.</summary>

View file

@ -887,9 +887,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}

View file

@ -1095,9 +1095,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -1278,9 +1277,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -1341,9 +1339,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -1405,9 +1402,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}

View file

@ -286,9 +286,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -973,9 +972,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -1036,9 +1034,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -1100,9 +1097,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}

View file

@ -663,9 +663,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -843,9 +842,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -906,9 +904,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}
@ -970,9 +967,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
});
// Verify state "Booked Closed" after action
// Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/.
//Assert.AreEqual("Return bike", subsequent.ButtonText);
//Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Return bike", subsequent.ButtonText);
Assert.IsTrue(subsequent.IsButtonVisible);
Assert.AreEqual("Open lock", subsequent.LockitButtonText);
Assert.IsTrue(subsequent.IsLockitButtonVisible);
}

View file

@ -1,4 +1,4 @@
using NUnit.Framework;
using NUnit.Framework;
using TINK.Model.Bikes.BikeInfoNS;
using TINK.ViewModel.Bikes.Bike;
@ -22,7 +22,6 @@ namespace TestShareeLib.ViewModel.Bikes.Bike
InfoEntries = new System.Collections.Generic.Dictionary<string, RentalDescription.InfoElement>
{
{ "15", new RentalDescription.InfoElement { Key = "Tracking", Value = "Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!" } },
{ "22", new RentalDescription.InfoElement { Key = "AGB", Value ="Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt"} }
}
};
@ -40,10 +39,6 @@ namespace TestShareeLib.ViewModel.Bikes.Bike
viewModel.InfoEntries.Count,
Is.EqualTo(1));
Assert.That(
viewModel.OperatorAgb,
Is.EqualTo("Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt"));
Assert.That(
viewModel.TarifEntry1.Value,
Is.EqualTo("Max Gebühr"));

View file

@ -1,4 +1,4 @@
using NUnit.Framework;
using NUnit.Framework;
using TINK.ViewModel.Info;
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Info
@ -9,7 +9,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Info
[Test]
public void TestOnAppearing()
{
var viewModel = new InfoPageViewModel("Hosti", "agbResourcePath", "privacyResourcePath", "impressResourcePath", false, "de", (url) => string.Empty);
var viewModel = new InfoPageViewModel(
"Hosti",
"agbResourcePath",
"privacyResourcePath",
"impressResourcePath",
false,
(url) => string.Empty,
() => null,
(resourceUrls) => { });
}
}
}