mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-22 06:56:25 +01:00
Version 3.0.340
This commit is contained in:
parent
52c9f6f1d9
commit
bad07e1ec9
62 changed files with 1401 additions and 1000 deletions
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
|
@ -18,15 +18,15 @@ namespace TINK.Droid
|
|||
[IntentFilter(new[] { Intent.ActionView },
|
||||
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||
DataScheme = "https",
|
||||
DataHost = "sharee.bike",
|
||||
DataPathPrefix = "/lastenrad",
|
||||
DataHost = "app.sharee.bike",
|
||||
DataPathPrefix = "/App-LastenradBayern",
|
||||
AutoVerify = true)]
|
||||
|
||||
[IntentFilter(new[] { Intent.ActionView },
|
||||
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||
DataScheme = "http",
|
||||
DataHost = "sharee.bike",
|
||||
DataPathPrefix = "/lastenrad",
|
||||
DataHost = "app.sharee.bike",
|
||||
DataPathPrefix = "/App-LastenradBayern",
|
||||
AutoVerify = true)]
|
||||
|
||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
|
|
|
@ -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.339" android:versionCode="339">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.340" android:versionCode="340">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
|
||||
<!-- Google Maps related permissions -->
|
||||
<!-- Permission to receive remote notifications from Google Play Services -->
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
<key>CFBundleDisplayName</key>
|
||||
<string>LastenradBayern</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>339</string>
|
||||
<string>340</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.339</string>
|
||||
<string>3.0.340</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -1,137 +1,106 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.BikesAtStation.BikesAtStationPage"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib">
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{Binding Title}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<Frame>
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<!-- Title bar stack layout-->
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<Label
|
||||
HorizontalOptions="Center"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{DynamicResource primary-back-title-color}"
|
||||
Text="{Binding StationDetailText}"/>
|
||||
<BoxView
|
||||
HeightRequest="1"
|
||||
Color="{DynamicResource primary-back-title-color}"/>
|
||||
</StackLayout>
|
||||
<!-- Center stack layout -->
|
||||
<StackLayout
|
||||
Orientation="Vertical"
|
||||
VerticalOptions="CenterAndExpand">
|
||||
<ListView
|
||||
x:Name="BikesAtStationListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
<Label
|
||||
IsVisible="{Binding IsNoBikesAtStationVisible}"
|
||||
Text="{Binding NoBikesAtStationText}"/>
|
||||
</StackLayout>
|
||||
<!-- Status bar stack layout-->
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<Label
|
||||
TextType="Html"
|
||||
Text="{Binding ContactSupportHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding ContactSupportClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
<Label
|
||||
IsVisible="{Binding IsLoginRequiredHintVisible}"
|
||||
TextType="Html"
|
||||
Text="{Binding LoginRequiredHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding LoginRequiredHintClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
<StackLayout
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
Text="{Binding StatusInfoText}"
|
||||
FontSize="Small"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#009BDB" iOS="#009BDB" WinPhone="#009BDB" />
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
<!-- Possible New Design -->
|
||||
<!--<StackLayout
|
||||
Orientation="Vertical">
|
||||
<StackLayout
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
FontSize="Small"
|
||||
Text="{Binding StatusInfoText}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#009BDB" iOS="#009BDB" WinPhone="#009BDB" />
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
<BoxView HeightRequest="1" Color="{DynamicResource primary-back-title-color}"/>
|
||||
<Label
|
||||
TextType="Html"
|
||||
Text="{Binding ContactSupportHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding ContactSupportClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
<Label
|
||||
IsVisible="{Binding IsLoginRequiredHintVisible}"
|
||||
TextType="Html"
|
||||
Text="{Binding LoginRequiredHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding LoginRequiredHintClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
</StackLayout>
|
||||
</StackLayout>-->
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.BikesAtStation.BikesAtStationPage"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{Binding Title}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<ContentPage.Content>
|
||||
|
||||
<Frame>
|
||||
|
||||
<!--Grid for Bike(s) view and Running process in same row-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Bike(s) view-->
|
||||
<StackLayout Grid.Row="0"
|
||||
Orientation="Vertical">
|
||||
|
||||
<!--Title-->
|
||||
<Label
|
||||
HorizontalOptions="Center"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{DynamicResource primary-back-title-color}"
|
||||
Text="{Binding StationDetailText}"/>
|
||||
|
||||
<!--Line-->
|
||||
<BoxView
|
||||
HeightRequest="1"
|
||||
Color="{DynamicResource primary-back-title-color}"/>
|
||||
</StackLayout>
|
||||
|
||||
<!--Bike(s)-->
|
||||
<ListView
|
||||
Grid.Row="1"
|
||||
x:Name="BikesAtStationListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
|
||||
<!--No Bikes-->
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
IsVisible="{Binding IsNoBikesAtStationVisible}"
|
||||
Text="{Binding NoBikesAtStationText}"/>
|
||||
|
||||
<!-- Contact and Login at end of page-->
|
||||
<StackLayout
|
||||
Orientation="Vertical"
|
||||
Grid.Row="2">
|
||||
|
||||
<!--Line-->
|
||||
<BoxView HeightRequest="1" Color="{DynamicResource primary-back-title-color}"/>
|
||||
|
||||
<!--Contact to operator-->
|
||||
<Label
|
||||
TextType="Html"
|
||||
Text="{Binding ContactSupportHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding ContactSupportClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
|
||||
<!--Login required-->
|
||||
<Label
|
||||
IsVisible="{Binding IsLoginRequiredHintVisible}"
|
||||
TextType="Html"
|
||||
Text="{Binding LoginRequiredHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding LoginRequiredHintClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
</StackLayout>
|
||||
|
||||
<!--While process is running-->
|
||||
<sharedGui:RunningProcessView
|
||||
IsVisible="{Binding IsRunning}"
|
||||
Grid.Row="1"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Frame>
|
||||
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
|
@ -23,11 +23,13 @@
|
|||
HeightRequest="1400"
|
||||
WidthRequest="1000"
|
||||
Source="{Binding Uri}" />
|
||||
<ActivityIndicator
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
HeightRequest="100"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"/>
|
||||
</Grid>
|
||||
|
||||
<ActivityIndicator Grid.Row="0"
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
|
@ -22,11 +22,13 @@
|
|||
HeightRequest="1400"
|
||||
WidthRequest="1000"
|
||||
Source="{Binding Uri}" />
|
||||
<ActivityIndicator
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
HeightRequest="100"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"/>
|
||||
</Grid>
|
||||
|
||||
<ActivityIndicator Grid.Row="0"
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
|
@ -22,11 +22,13 @@
|
|||
HeightRequest="1400"
|
||||
WidthRequest="1000"
|
||||
Source="{Binding Uri}" />
|
||||
<ActivityIndicator
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
HeightRequest="100"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"/>
|
||||
</Grid>
|
||||
|
||||
<ActivityIndicator Grid.Row="0"
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,68 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
x:Class="TINK.View.FindBike.FindBikePage"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike">
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingFindBike}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<Frame>
|
||||
<StackLayout>
|
||||
<Entry
|
||||
Placeholder="Fahrrad-Nummer bitte hier eingeben"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
MaxLength="10"
|
||||
CursorPosition="0"
|
||||
Text="{Binding BikeIdUserInput}">
|
||||
</Entry>
|
||||
<Button
|
||||
Text="Rad Wählen"
|
||||
IsEnabled="{Binding IsSelectBikeEnabled}"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
Command="{Binding OnSelectBikeRequest}">
|
||||
</Button>
|
||||
<ListView
|
||||
x:Name="FindBikeListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
<StackLayout
|
||||
VerticalOptions="EndAndExpand"
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
Text="{Binding StatusInfoText}"
|
||||
FontSize="Small"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#009BDB" iOS="#009BDB" WinPhone="#009BDB" />
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.FindBike.FindBikePage"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike"
|
||||
xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingFindBike}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<ContentPage.Content>
|
||||
|
||||
<Frame>
|
||||
|
||||
<!--Grid for Bike(s) view and Running process in same row-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Search bike-->
|
||||
<StackLayout Grid.Row="0">
|
||||
<Entry
|
||||
Placeholder="{x:Static resources:AppResources.PlaceholderFindBike}"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
MaxLength="10"
|
||||
CursorPosition="0"
|
||||
Text="{Binding BikeIdUserInput}"/>
|
||||
|
||||
<Button
|
||||
Text="{x:Static resources:AppResources.MarkingFindBike}"
|
||||
IsEnabled="{Binding IsSelectBikeEnabled}"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
Command="{Binding OnSelectBikeRequest}"/>
|
||||
|
||||
<ListView
|
||||
x:Name="FindBikeListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
<!--While process is running-->
|
||||
<sharedGui:RunningProcessView
|
||||
Grid.Row="0"
|
||||
IsVisible="{Binding IsRunning}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,140 +1,116 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
|
||||
xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
x:Class="TINK.View.Map.MapPage">
|
||||
<!--BackgroundColor="{DynamicResource Key=primary-back-title-color}"-->
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMapPage}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<Grid
|
||||
RowDefinitions="3,46,1*,33"
|
||||
ColumnDefinitions="1*,Auto,1*"
|
||||
IsEnabled="{Binding IsMapPageEnabled}"
|
||||
VerticalOptions="FillAndExpand"
|
||||
>
|
||||
<maps:Map
|
||||
Grid.RowSpan="3"
|
||||
Grid.ColumnSpan="3"
|
||||
WidthRequest="320"
|
||||
HeightRequest="800"
|
||||
x:Name="MyMap"
|
||||
IsShowingUser="False"
|
||||
MapType="Street">
|
||||
<maps:Map.Behaviors>
|
||||
<bindings:BindingPinsBehavior Value="{Binding Pins}"/>
|
||||
<bindings:PinClickedToCommandBehavior Command="{Binding PinClickedCommand}"/>
|
||||
</maps:Map.Behaviors>
|
||||
</maps:Map>
|
||||
<Frame
|
||||
CornerRadius="13"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
BackgroundColor="{DynamicResource secondary-back-title-color}">
|
||||
<StackLayout Orientation="Horizontal"
|
||||
Margin="0"
|
||||
Padding="0">
|
||||
<Button
|
||||
x:Name="KonradButton"
|
||||
AutomationId ="FilterKonrad_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCityBike}"
|
||||
Command="{Binding OnToggleTinkToKonrad}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding KonradColor}"
|
||||
BorderColor="{Binding KonradColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="3,0,0,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoKonradColor}">
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="TINKButton"
|
||||
AutomationId ="FilterTINK_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCargoBike}"
|
||||
Command="{Binding OnToggleKonradToTink}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding TinkColor}"
|
||||
BorderColor="{Binding TinkColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="0,0,3,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoTinkColor}">
|
||||
</Button>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
<StackLayout
|
||||
Grid.Row="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="6,3,6,6"
|
||||
VerticalOptions="EndAndExpand"
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
FontSize="Small"
|
||||
Text="{Binding StatusInfoText}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#009BDB" iOS="#009BDB" WinPhone="#009BDB"/>
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
<!-- New StatusInfoText Layout -->
|
||||
<!--<StackLayout
|
||||
Grid.Row="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="6,3,6,6"
|
||||
VerticalOptions="EndAndExpand"
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
FontSize="Small"
|
||||
Text="{Binding StatusInfoText}"
|
||||
TextColor="White"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="White" iOS="White" WinPhone="White"/>
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>-->
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
|
||||
xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
BackgroundColor="{DynamicResource Key=primary-back-title-color}"
|
||||
x:Class="TINK.View.Map.MapPage">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMapPage}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<!--Grid for Map with Buttons and Running process-->
|
||||
<Grid
|
||||
RowDefinitions="3,46,1*,Auto"
|
||||
ColumnDefinitions="1*,Auto,1*"
|
||||
IsEnabled="{Binding IsMapPageEnabled}"
|
||||
VerticalOptions="FillAndExpand">
|
||||
|
||||
<!--Map-->
|
||||
<maps:Map
|
||||
Grid.RowSpan="3"
|
||||
Grid.ColumnSpan="3"
|
||||
WidthRequest="320"
|
||||
HeightRequest="800"
|
||||
x:Name="MyMap"
|
||||
IsShowingUser="False"
|
||||
MapType="Street">
|
||||
<maps:Map.Behaviors>
|
||||
<bindings:BindingPinsBehavior Value="{Binding Pins}"/>
|
||||
<bindings:PinClickedToCommandBehavior Command="{Binding PinClickedCommand}"/>
|
||||
</maps:Map.Behaviors>
|
||||
</maps:Map>
|
||||
|
||||
<!--Buttons for choosing bike type-->
|
||||
<Frame
|
||||
CornerRadius="13"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
BackgroundColor="{DynamicResource secondary-back-title-color}">
|
||||
<StackLayout
|
||||
Orientation="Horizontal"
|
||||
Margin="0"
|
||||
Padding="0">
|
||||
<Button
|
||||
x:Name="KonradButton"
|
||||
AutomationId ="FilterKonrad_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCityBike}"
|
||||
Command="{Binding OnToggleTinkToKonrad}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding KonradColor}"
|
||||
BorderColor="{Binding KonradColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="3,0,0,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoKonradColor}">
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="TINKButton"
|
||||
AutomationId ="FilterTINK_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCargoBike}"
|
||||
Command="{Binding OnToggleKonradToTink}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding TinkColor}"
|
||||
BorderColor="{Binding TinkColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="0,0,3,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoTinkColor}">
|
||||
</Button>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
|
||||
<!--While process is running-->
|
||||
<!--Spinner-->
|
||||
<ActivityIndicator
|
||||
Grid.RowSpan="4"
|
||||
Grid.ColumnSpan="3"
|
||||
IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
|
||||
<!--Info text-->
|
||||
<Label
|
||||
Grid.Row="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Text="{Binding StatusInfoText}"
|
||||
TextColor="White"
|
||||
FontSize="Small"
|
||||
HorizontalOptions="Center"
|
||||
Padding="0,0,0,10"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,64 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.MyBikes.MyBikesPage"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike">
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMyBikes}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<Frame>
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<!-- Center stack layout -->
|
||||
<StackLayout
|
||||
VerticalOptions="CenterAndExpand"
|
||||
Orientation="Vertical">
|
||||
<ListView
|
||||
x:Name="MyBikesListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
<Label
|
||||
IsVisible="{Binding IsNoBikesOccupiedVisible}"
|
||||
Text="{Binding NoBikesOccupiedText}"/>
|
||||
</StackLayout>
|
||||
<!-- Status bar stack layout-->
|
||||
<StackLayout
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
Text="{Binding StatusInfoText}"
|
||||
FontSize="Small"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#009BDB" iOS="#009BDB" WinPhone="#009BDB" />
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.MyBikes.MyBikesPage"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMyBikes}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<ContentPage.Content>
|
||||
|
||||
<Frame>
|
||||
|
||||
<!--Grid for Bike(s) view and Running process in same row-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Bike(s) view-->
|
||||
<StackLayout Grid.Row="0"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
Orientation="Vertical">
|
||||
|
||||
<!--Bike(s)-->
|
||||
<ListView
|
||||
x:Name="MyBikesListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
|
||||
<!--No Bikes-->
|
||||
<Label
|
||||
IsVisible="{Binding IsNoBikesOccupiedVisible}"
|
||||
Text="{Binding NoBikesOccupiedText}"/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
<!--While process is running-->
|
||||
<sharedGui:RunningProcessView
|
||||
Grid.Row="0"
|
||||
IsVisible="{Binding IsRunning}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Frame>
|
||||
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
|
|
@ -83,6 +83,8 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
|
||||
private ICharacteristic BatteryCharacteristic { get; set; }
|
||||
|
||||
private ICharacteristic FirmwareVersionCharacteristic { get; set; }
|
||||
|
||||
private readonly AsyncRetryPolicy<byte[]> _retryPollicy;
|
||||
|
||||
/// <summary> Gets the lock control service.</summary>
|
||||
|
@ -301,6 +303,27 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
return BatteryCharacteristic;
|
||||
}
|
||||
|
||||
/// <summary> Gets the versions info characteristic.</summary>
|
||||
protected async Task<ICharacteristic> GetVersionsCharacteristicAsync()
|
||||
{
|
||||
if (FirmwareVersionCharacteristic != null) return FirmwareVersionCharacteristic ;
|
||||
|
||||
FirmwareVersionCharacteristic = null;
|
||||
|
||||
Log.ForContext<LockItBase>().Debug("Request to get versions info characteristic.");
|
||||
try
|
||||
{
|
||||
FirmwareVersionCharacteristic = await (await GetLockControlService())?.GetCharacteristicAsync(new Guid("0000baad-1212-efde-1523-785fef13d123"));
|
||||
}
|
||||
catch (System.Exception exception)
|
||||
{
|
||||
Log.ForContext<LockItBase>().Error("Getting versions info charcteristic failed. {Exception}", exception);
|
||||
throw new System.Exception(string.Format("Can not get versions info characteristic. {0}", exception.Message), exception);
|
||||
}
|
||||
|
||||
Log.ForContext<LockItBase>().Debug("Get versions info characteristic retrieved successfully.");
|
||||
return FirmwareVersionCharacteristic ;
|
||||
}
|
||||
/// <summary> Query name of lock.</summary>
|
||||
private void GetName()
|
||||
{
|
||||
|
@ -822,12 +845,12 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
throw new CoundntGetCharacteristicException("Can not get battery percentage. State characteristic must not be null.");
|
||||
}
|
||||
|
||||
byte[] state;
|
||||
byte[] percentage;
|
||||
var cts = new CancellationTokenSource();
|
||||
cts.CancelAfter(READ_TIMEOUT_MS);
|
||||
try
|
||||
{
|
||||
state = await batteryCharacteristic.ReadAsync(cts.Token);
|
||||
percentage = await batteryCharacteristic.ReadAsync(cts.Token);
|
||||
}
|
||||
catch (System.Exception exception)
|
||||
{
|
||||
|
@ -839,17 +862,109 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
cts.Dispose();
|
||||
}
|
||||
|
||||
if (state == null || state.Length <= 0)
|
||||
if (percentage == null || percentage.Length <= 0)
|
||||
{
|
||||
Log.ForContext<LockItBase>().Debug("Retrieving charging level (ReadAsync-call) failed. Data read is null or empty.{BatteryCharacteristic}", ToSerilogString(batteryCharacteristic));
|
||||
throw new System.Exception("Can not get battery percentage. No data read.");
|
||||
}
|
||||
|
||||
Log.ForContext<LockItBase>().Debug("Retrieving charging level (ReadAsync-call) succeeded.{Level}{BatteryCharacteristic}{Reading}", state[0], ToSerilogString(batteryCharacteristic), state);
|
||||
Log.ForContext<LockItBase>().Debug("Retrieving charging level (ReadAsync-call) succeeded.{Level}{BatteryCharacteristic}{Reading}", percentage[0], ToSerilogString(batteryCharacteristic), percentage);
|
||||
|
||||
return state[0];
|
||||
return percentage[0];
|
||||
}
|
||||
|
||||
/// <summary> Gets version info about the lock. </summary>
|
||||
/// <remarks>
|
||||
/// Lock state is first byte of of value read from state characteristic ("0000baaa-1212-efde-1523-785fef13d123").
|
||||
/// Values are as follows
|
||||
/// Byte number 0: firmware version,
|
||||
/// Byte number 1: lock version (2 – classic, 3 – plus, 4 – GPS)
|
||||
/// Byte number 2: hardware version,
|
||||
/// </remarks>
|
||||
/// <returns> .</returns>
|
||||
public async Task<VersionInfoTdo> GetVersionInfoAsync()
|
||||
{
|
||||
if (DeviceInfo.Platform != DevicePlatform.Unknown && MainThread.IsMainThread == false)
|
||||
{
|
||||
throw new System.Exception("Can not get versions info. Platform must not be unknown and bluetooth code must be run on main thread.");
|
||||
}
|
||||
|
||||
DeviceState? deviceState;
|
||||
Log.ForContext<LockItBase>().Debug("Request to get connection state in context of getting versions info.");
|
||||
try
|
||||
{
|
||||
deviceState = Device?.State.GetDeviceState()
|
||||
?? throw new System.Exception("Can not get bluetooth device state. State must not be null.");
|
||||
}
|
||||
catch (System.Exception exception)
|
||||
{
|
||||
Log.ForContext<LockItBase>().Error("Can not get versions info. Retrieving bluetooth state failed. {Exception}", exception);
|
||||
throw new System.Exception(string.Format("Can not get versions info. Getting bluetooth state failed. {0}", exception.Message), exception);
|
||||
}
|
||||
|
||||
switch (deviceState)
|
||||
{
|
||||
case DeviceState.Disconnected:
|
||||
throw new BluetoothDisconnectedException();
|
||||
|
||||
case DeviceState.Connected:
|
||||
break;
|
||||
|
||||
default:
|
||||
// Can not get state if device is not connected.
|
||||
Log.ForContext<LockItBase>().Error($"Getting versions info failed. Unexpected versions info {deviceState} detected.");
|
||||
throw new System.Exception(string.Format("Can not get versions info. Unexpected bluetooth state {0} detected.", deviceState));
|
||||
}
|
||||
|
||||
Log.ForContext<LockItBase>().Debug($"Connection state is {deviceState}.");
|
||||
|
||||
var firmwareVersionCharacteristic = await GetVersionsCharacteristicAsync();
|
||||
if (firmwareVersionCharacteristic == null)
|
||||
{
|
||||
Log.ForContext<LockItBase>().Error($"Can not get versions info. versions info characteristic is not available.");
|
||||
throw new CoundntGetCharacteristicException("Can not get versions info. versions info characteristic must not be null.");
|
||||
}
|
||||
|
||||
byte[] version;
|
||||
var cts = new CancellationTokenSource();
|
||||
cts.CancelAfter(READ_TIMEOUT_MS);
|
||||
try
|
||||
{
|
||||
version = await firmwareVersionCharacteristic.ReadAsync(cts.Token);
|
||||
}
|
||||
catch (System.Exception exception)
|
||||
{
|
||||
Log.ForContext<LockItBase>().Error("Retrieving versions info (ReadAsync-call) failed inside delegate.{StateCharacteristic}{Exception}", ToSerilogString(firmwareVersionCharacteristic), exception);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cts.Dispose();
|
||||
}
|
||||
|
||||
if (version == null || version.Length <= 0)
|
||||
{
|
||||
Log.ForContext<LockItBase>().Debug("Retrieving versions info (ReadAsync-call) failed. Data read is null or empty.{StateCharacteristic}", ToSerilogString(firmwareVersionCharacteristic));
|
||||
throw new System.Exception("Can not get versions info. No data read");
|
||||
}
|
||||
|
||||
VersionInfo = new VersionInfoTdo.Builder
|
||||
{
|
||||
FirmwareVersion = version[0],
|
||||
LockVersion = version[1],
|
||||
HardwareVersion = version[2]
|
||||
}.Build();
|
||||
|
||||
Log.ForContext<LockItBase>().Debug("Retrieving versions info (ReadAsync-call) succeeded. {@LockInfoTdo}{StateCharacteristic}{Reading}",
|
||||
VersionInfo,
|
||||
ToSerilogString(firmwareVersionCharacteristic),
|
||||
version);
|
||||
|
||||
return VersionInfo;
|
||||
}
|
||||
|
||||
public VersionInfoTdo VersionInfo { get; private set; }
|
||||
|
||||
/// <summary> Opens lock. </summary>
|
||||
/// <returns> Locking state.</returns>
|
||||
public abstract Task<LockitLockingState?> OpenAsync();
|
||||
|
|
|
@ -151,6 +151,8 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
|
||||
DeviceList.Add(lockIt);
|
||||
|
||||
await lockIt.GetVersionInfoAsync();
|
||||
|
||||
return await lockIt.GetLockStateAsync();
|
||||
}
|
||||
|
||||
|
@ -230,6 +232,8 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
|
||||
Log.ForContext<LockItByScanServiceBase>().Debug($"Auth succeeded for device {device}.");
|
||||
locksList.Add(lockIt);
|
||||
|
||||
await lockIt.GetVersionInfoAsync();
|
||||
}
|
||||
|
||||
return locksList;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
<ItemGroup>
|
||||
<Folder Include="Model\Device\" />
|
||||
<Folder Include="Services\BluetoothLock\Crypto\" />
|
||||
<Folder Include="Services\BluetoothLock\Tdo\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using TINK.Model.Connector;
|
||||
|
@ -53,39 +53,32 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
|
||||
public bool IsGuidValid => Guid != TextToLockItTypeHelper.INVALIDLOCKGUID;
|
||||
|
||||
public override bool Equals(object obj) => this.Equals(obj as LockInfo);
|
||||
public override bool Equals(object obj)
|
||||
=> Equals(obj as LockInfo);
|
||||
|
||||
public bool Equals(LockInfo other)
|
||||
{
|
||||
if (Object.ReferenceEquals(other, null)) return false;
|
||||
if (Object.ReferenceEquals(this, other)) return true;
|
||||
if (this.GetType() != other.GetType()) return false;
|
||||
if (ReferenceEquals(other, null)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (GetType() != other.GetType()) return false;
|
||||
|
||||
return ToString() == other.ToString();
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ToString().GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => ToString().GetHashCode();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
public override string ToString() => JsonConvert.SerializeObject(this);
|
||||
|
||||
public static bool operator ==(LockInfo lhs, LockInfo rhs)
|
||||
{
|
||||
if (Object.ReferenceEquals(lhs, null))
|
||||
return Object.ReferenceEquals(rhs, null) ? true /*null == null = true*/: false;
|
||||
if (ReferenceEquals(lhs, null))
|
||||
return ReferenceEquals(rhs, null) ? true /*null == null = true*/: false;
|
||||
|
||||
return lhs.Equals(rhs);
|
||||
}
|
||||
|
||||
public static bool operator !=(LockInfo lhs, LockInfo rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
=> !(lhs == rhs);
|
||||
|
||||
public class Builder
|
||||
{
|
||||
|
@ -127,6 +120,5 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
return LockInfo;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
|
@ -49,6 +49,17 @@ namespace TINK.Services.BluetoothLock
|
|||
|
||||
Task<bool> GetIsAlarmOffAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get info about lock firmware- hardware- and lock-version.
|
||||
/// </summary>
|
||||
/// <returns>Lock versions info.</returns>
|
||||
Task<VersionInfoTdo> GetVersionInfoAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Holds info about lock firmware- hardware- and lock-version, null if info has not yet been read.
|
||||
/// </summary>
|
||||
VersionInfoTdo VersionInfo { get; }
|
||||
|
||||
Task SetIsAlarmOffAsync(bool isActivated);
|
||||
|
||||
/// <summary>Gets the battery percentage.</summary>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
|
@ -37,6 +37,13 @@ namespace TINK.Services.BluetoothLock
|
|||
public Task<double> GetBatteryPercentageAsync() =>
|
||||
throw new System.Exception($"Can not get battery percentage. Lock {BikeId} not found.");
|
||||
|
||||
public Task<VersionInfoTdo> GetVersionInfoAsync() =>
|
||||
throw new System.Exception($"Can not get versions. Lock {BikeId} not found.");
|
||||
|
||||
public VersionInfoTdo VersionInfo
|
||||
{
|
||||
get => throw new System.Exception($"Can not get versions. Lock {BikeId} not found.");
|
||||
}
|
||||
public DeviceState? GetDeviceState() =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
|
|
41
LockItShared/Services/BluetoothLock/Tdo/VersionInfoTdo.cs
Normal file
41
LockItShared/Services/BluetoothLock/Tdo/VersionInfoTdo.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
namespace TINK.Services.BluetoothLock.Tdo
|
||||
{
|
||||
public class VersionInfoTdo
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about firmware- and hardware version of a lock and the type of lock (lock version).
|
||||
/// </summary>
|
||||
private VersionInfoTdo() { }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the firmware version of the lock.
|
||||
/// </summary>
|
||||
public int FirmwareVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the hardware version (revision) of the lock.
|
||||
/// </summary>
|
||||
public int HardwareVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds lock version (2 – classic, 3 – plus, 4 – GPS).
|
||||
/// </summary>
|
||||
public int LockVersion { get; private set; }
|
||||
|
||||
public class Builder
|
||||
{
|
||||
private VersionInfoTdo lockVersionTdo = new VersionInfoTdo();
|
||||
|
||||
public int FirmwareVersion { get => lockVersionTdo.FirmwareVersion; set => lockVersionTdo.FirmwareVersion = value; }
|
||||
|
||||
public int HardwareVersion { get => lockVersionTdo.HardwareVersion; set => lockVersionTdo.HardwareVersion = value; }
|
||||
|
||||
public int LockVersion { get => lockVersionTdo.LockVersion; set => lockVersionTdo.LockVersion = value; }
|
||||
|
||||
public VersionInfoTdo Build()
|
||||
{
|
||||
return lockVersionTdo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.339" android:versionCode="339">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.340" android:versionCode="340">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
|
||||
<!-- Google Maps related permissions -->
|
||||
<!-- Permission to receive remote notifications from Google Play Services -->
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
<key>CFBundleDisplayName</key>
|
||||
<string>Mein konrad</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>339</string>
|
||||
<string>340</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.339</string>
|
||||
<string>3.0.340</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -1,96 +1,107 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.BikesAtStation.BikesAtStationPage"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib">
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Image Style="{StaticResource Image-Navbar}"/>
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{Binding Title}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<Frame>
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<!-- Title bar stack layout-->
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<Label
|
||||
HorizontalOptions="Center"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{DynamicResource primary-back-title-color}"
|
||||
Text="{Binding StationDetailText}"/>
|
||||
<BoxView
|
||||
HeightRequest="1"
|
||||
Color="{DynamicResource primary-back-title-color}"/>
|
||||
</StackLayout>
|
||||
<!-- Center stack layout -->
|
||||
<StackLayout
|
||||
Orientation="Vertical"
|
||||
VerticalOptions="CenterAndExpand">
|
||||
<ListView
|
||||
x:Name="BikesAtStationListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
<Label
|
||||
IsVisible="{Binding IsNoBikesAtStationVisible}"
|
||||
Text="{Binding NoBikesAtStationText}"/>
|
||||
</StackLayout>
|
||||
<!-- Status bar stack layout-->
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<StackLayout
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
FontSize="Small"
|
||||
Text="{Binding StatusInfoText}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#D21113" iOS="#D21113" WinPhone="#D21113" />
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
<BoxView HeightRequest="1" Color="{DynamicResource primary-back-title-color}"/>
|
||||
<Label
|
||||
TextType="Html"
|
||||
Text="{Binding ContactSupportHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding ContactSupportClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
<Label
|
||||
IsVisible="{Binding IsLoginRequiredHintVisible}"
|
||||
TextType="Html"
|
||||
Text="{Binding LoginRequiredHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding LoginRequiredHintClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.BikesAtStation.BikesAtStationPage"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Image Style="{StaticResource Image-Navbar}"/>
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{Binding Title}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<ContentPage.Content>
|
||||
|
||||
<Frame>
|
||||
|
||||
<!--Grid for Bike(s) view and Running process in same row-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Bike(s) view-->
|
||||
<StackLayout Grid.Row="0"
|
||||
Orientation="Vertical">
|
||||
|
||||
<!--Title-->
|
||||
<Label
|
||||
HorizontalOptions="Center"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{DynamicResource primary-back-title-color}"
|
||||
Text="{Binding StationDetailText}"/>
|
||||
|
||||
<!--Line-->
|
||||
<BoxView
|
||||
HeightRequest="1"
|
||||
Color="{DynamicResource primary-back-title-color}"/>
|
||||
</StackLayout>
|
||||
|
||||
<!--Bike(s)-->
|
||||
<ListView
|
||||
Grid.Row="1"
|
||||
x:Name="BikesAtStationListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
|
||||
<!--No Bikes-->
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
IsVisible="{Binding IsNoBikesAtStationVisible}"
|
||||
Text="{Binding NoBikesAtStationText}"/>
|
||||
|
||||
<!-- Contact and Login at end of page-->
|
||||
<StackLayout
|
||||
Orientation="Vertical"
|
||||
Grid.Row="2">
|
||||
|
||||
<!--Line-->
|
||||
<BoxView HeightRequest="1" Color="{DynamicResource primary-back-title-color}"/>
|
||||
|
||||
<!--Contact to operator-->
|
||||
<Label
|
||||
TextType="Html"
|
||||
Text="{Binding ContactSupportHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding ContactSupportClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
|
||||
<!--Login required-->
|
||||
<Label
|
||||
IsVisible="{Binding IsLoginRequiredHintVisible}"
|
||||
TextType="Html"
|
||||
Text="{Binding LoginRequiredHintText}">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding LoginRequiredHintClickedCommand}"/>
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
</StackLayout>
|
||||
|
||||
<!--While process is running-->
|
||||
<sharedGui:RunningProcessView
|
||||
IsVisible="{Binding IsRunning}"
|
||||
Grid.Row="1"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Frame>
|
||||
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
|
@ -23,11 +23,13 @@
|
|||
HeightRequest="1400"
|
||||
WidthRequest="1000"
|
||||
Source="{Binding Uri}" />
|
||||
<ActivityIndicator
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
HeightRequest="100"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"/>
|
||||
</Grid>
|
||||
|
||||
<ActivityIndicator Grid.Row="0"
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
|
@ -22,11 +22,13 @@
|
|||
HeightRequest="1400"
|
||||
WidthRequest="1000"
|
||||
Source="{Binding Uri}" />
|
||||
<ActivityIndicator
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
HeightRequest="100"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"/>
|
||||
</Grid>
|
||||
|
||||
<ActivityIndicator Grid.Row="0"
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
|
@ -22,11 +22,13 @@
|
|||
HeightRequest="1400"
|
||||
WidthRequest="1000"
|
||||
Source="{Binding Uri}" />
|
||||
<ActivityIndicator
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
HeightRequest="100"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"/>
|
||||
</Grid>
|
||||
|
||||
<ActivityIndicator Grid.Row="0"
|
||||
x:Name="ActivityIndicatorLoading"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,69 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.FindBike.FindBikePage"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike">
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Image Style="{StaticResource Image-Navbar}"/>
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingFindBike}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<Frame>
|
||||
<StackLayout>
|
||||
<Entry
|
||||
Placeholder="Fahrrad-Nummer bitte hier eingeben"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
MaxLength="10"
|
||||
CursorPosition="0"
|
||||
Text="{Binding BikeIdUserInput}">
|
||||
</Entry>
|
||||
<Button
|
||||
Text="Rad Wählen"
|
||||
IsEnabled="{Binding IsSelectBikeEnabled}"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
Command="{Binding OnSelectBikeRequest}">
|
||||
</Button>
|
||||
<ListView
|
||||
x:Name="FindBikeListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
<StackLayout
|
||||
VerticalOptions="EndAndExpand"
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
Text="{Binding StatusInfoText}"
|
||||
FontSize="Small"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#D21113" iOS="#D21113" WinPhone="#D21113" />
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.FindBike.FindBikePage"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike"
|
||||
xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingFindBike}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<ContentPage.Content>
|
||||
|
||||
<Frame>
|
||||
|
||||
<!--Grid for Bike(s) view and Running process in same row-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Search bike-->
|
||||
<StackLayout Grid.Row="0">
|
||||
<Entry
|
||||
Placeholder="{x:Static resources:AppResources.PlaceholderFindBike}"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
MaxLength="10"
|
||||
CursorPosition="0"
|
||||
Text="{Binding BikeIdUserInput}"/>
|
||||
|
||||
<Button
|
||||
Text="{x:Static resources:AppResources.MarkingFindBike}"
|
||||
IsEnabled="{Binding IsSelectBikeEnabled}"
|
||||
IsVisible="{Binding IsSelectBikeVisible}"
|
||||
Command="{Binding OnSelectBikeRequest}"/>
|
||||
|
||||
<ListView
|
||||
x:Name="FindBikeListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
<!--While process is running-->
|
||||
<sharedGui:RunningProcessView
|
||||
Grid.Row="0"
|
||||
IsVisible="{Binding IsRunning}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,113 +1,116 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
|
||||
xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
x:Class="TINK.View.Map.MapPage"
|
||||
BackgroundColor="{DynamicResource Key=primary-back-title-color}">
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Image Style="{StaticResource Image-Navbar}"/>
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMapPage}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<Grid
|
||||
RowDefinitions="3,46,1*,33"
|
||||
ColumnDefinitions="1*,Auto,1*"
|
||||
IsEnabled="{Binding IsMapPageEnabled}"
|
||||
VerticalOptions="FillAndExpand"
|
||||
>
|
||||
<maps:Map
|
||||
Grid.RowSpan="3"
|
||||
Grid.ColumnSpan="3"
|
||||
WidthRequest="320"
|
||||
HeightRequest="800"
|
||||
x:Name="MyMap"
|
||||
IsShowingUser="False"
|
||||
MapType="Street">
|
||||
<maps:Map.Behaviors>
|
||||
<bindings:BindingPinsBehavior Value="{Binding Pins}"/>
|
||||
<bindings:PinClickedToCommandBehavior Command="{Binding PinClickedCommand}"/>
|
||||
</maps:Map.Behaviors>
|
||||
</maps:Map>
|
||||
<Frame
|
||||
CornerRadius="13"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
BackgroundColor="{DynamicResource secondary-back-title-color}">
|
||||
<StackLayout Orientation="Horizontal"
|
||||
Margin="0"
|
||||
Padding="0">
|
||||
<Button
|
||||
x:Name="KonradButton"
|
||||
AutomationId ="FilterKonrad_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCityBike}"
|
||||
Command="{Binding OnToggleTinkToKonrad}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding KonradColor}"
|
||||
BorderColor="{Binding KonradColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="3,0,0,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoKonradColor}">
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="TINKButton"
|
||||
AutomationId ="FilterTINK_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCargoBike}"
|
||||
Command="{Binding OnToggleKonradToTink}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding TinkColor}"
|
||||
BorderColor="{Binding TinkColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="0,0,3,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoTinkColor}">
|
||||
</Button>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
<StackLayout
|
||||
Grid.Row="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="6,3,6,6"
|
||||
VerticalOptions="EndAndExpand"
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
FontSize="Small"
|
||||
Text="{Binding StatusInfoText}"
|
||||
TextColor="White"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="White" iOS="White" WinPhone="White"/>
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
|
||||
xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
x:Class="TINK.View.Map.MapPage"
|
||||
BackgroundColor="{DynamicResource Key=primary-back-title-color}">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Image Style="{StaticResource Image-Navbar}"/>
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMapPage}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<!--Grid for Map with Buttons and Running process-->
|
||||
<Grid
|
||||
RowDefinitions="3,46,1*,Auto"
|
||||
ColumnDefinitions="1*,Auto,1*"
|
||||
IsEnabled="{Binding IsMapPageEnabled}"
|
||||
VerticalOptions="FillAndExpand">
|
||||
|
||||
<!--Map-->
|
||||
<maps:Map
|
||||
Grid.RowSpan="3"
|
||||
Grid.ColumnSpan="3"
|
||||
WidthRequest="320"
|
||||
HeightRequest="800"
|
||||
x:Name="MyMap"
|
||||
IsShowingUser="False"
|
||||
MapType="Street">
|
||||
<maps:Map.Behaviors>
|
||||
<bindings:BindingPinsBehavior Value="{Binding Pins}"/>
|
||||
<bindings:PinClickedToCommandBehavior Command="{Binding PinClickedCommand}"/>
|
||||
</maps:Map.Behaviors>
|
||||
</maps:Map>
|
||||
|
||||
<!--Buttons for choosing bike type-->
|
||||
<Frame
|
||||
CornerRadius="13"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
BackgroundColor="{DynamicResource secondary-back-title-color}">
|
||||
<StackLayout
|
||||
Orientation="Horizontal"
|
||||
Margin="0"
|
||||
Padding="0">
|
||||
<Button
|
||||
x:Name="KonradButton"
|
||||
AutomationId ="FilterKonrad_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCityBike}"
|
||||
Command="{Binding OnToggleTinkToKonrad}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding KonradColor}"
|
||||
BorderColor="{Binding KonradColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="3,0,0,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoKonradColor}">
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="TINKButton"
|
||||
AutomationId ="FilterTINK_button"
|
||||
Text="{x:Static resources:AppResources.MarkingCargoBike}"
|
||||
Command="{Binding OnToggleKonradToTink}"
|
||||
IsVisible="{Binding IsToggleVisible}"
|
||||
BackgroundColor="{Binding TinkColor}"
|
||||
BorderColor="{Binding TinkColor}"
|
||||
BorderWidth="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="94"
|
||||
HeightRequest="40"
|
||||
BorderRadius="10"
|
||||
Margin="0,0,3,0"
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{Binding NoTinkColor}">
|
||||
</Button>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
|
||||
<!--While process is running-->
|
||||
<!--Spinner-->
|
||||
<ActivityIndicator
|
||||
Grid.RowSpan="4"
|
||||
Grid.ColumnSpan="3"
|
||||
IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
Scale="2"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
Color="{x:DynamicResource primary-back-title-color}"/>
|
||||
|
||||
<!--Info text-->
|
||||
<Label
|
||||
Grid.Row="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Text="{Binding StatusInfoText}"
|
||||
TextColor="White"
|
||||
FontSize="Small"
|
||||
HorizontalOptions="Center"
|
||||
Padding="0,0,0,10"/>
|
||||
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,65 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.MyBikes.MyBikesPage"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike">
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Image Style="{StaticResource Image-Navbar}"/>
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMyBikes}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<Frame>
|
||||
<StackLayout
|
||||
Orientation="Vertical">
|
||||
<!-- Center stack layout -->
|
||||
<StackLayout
|
||||
VerticalOptions="CenterAndExpand"
|
||||
Orientation="Vertical">
|
||||
<ListView
|
||||
x:Name="MyBikesListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
<Label
|
||||
IsVisible="{Binding IsNoBikesOccupiedVisible}"
|
||||
Text="{Binding NoBikesOccupiedText}"/>
|
||||
</StackLayout>
|
||||
<!-- Status bar stack layout-->
|
||||
<StackLayout
|
||||
Orientation="Horizontal">
|
||||
<Label
|
||||
HeightRequest="24"
|
||||
FontSize="Small"
|
||||
Text="{Binding StatusInfoText}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsRunning}"
|
||||
IsVisible="{Binding IsRunning}"
|
||||
HeightRequest="20"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="End">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
<ActivityIndicator.Color>
|
||||
<OnPlatform x:TypeArguments="Color"
|
||||
Android="#D21113" iOS="#D21113" WinPhone="#D21113" />
|
||||
</ActivityIndicator.Color>
|
||||
</ActivityIndicator>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.View.MyBikes.MyBikesPage"
|
||||
xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib"
|
||||
xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View"
|
||||
xmlns:local_bike="clr-namespace:TINK.View.Bike">
|
||||
|
||||
<Shell.TitleView>
|
||||
<Grid ColumnDefinitions="Auto, 1*">
|
||||
<Label Style="{StaticResource Label-Navbar}"
|
||||
Text="{x:Static resources:AppResources.MarkingMyBikes}"/>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<ContentPage.Content>
|
||||
|
||||
<Frame>
|
||||
|
||||
<!--Grid for Bike(s) view and Running process in same row-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--Bike(s) view-->
|
||||
<StackLayout Grid.Row="0"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
Orientation="Vertical">
|
||||
|
||||
<!--Bike(s)-->
|
||||
<ListView
|
||||
x:Name="MyBikesListView"
|
||||
SelectionMode="None"
|
||||
SelectedItem="{Binding SelectedBike}"
|
||||
IsEnabled="{Binding IsIdle}"
|
||||
IsVisible="{Binding IsBikesListVisible}"
|
||||
HasUnevenRows="True"
|
||||
ItemTemplate="{StaticResource bikeTemplateSelector}"/>
|
||||
|
||||
<!--No Bikes-->
|
||||
<Label
|
||||
IsVisible="{Binding IsNoBikesOccupiedVisible}"
|
||||
Text="{Binding NoBikesOccupiedText}"/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
<!--While process is running-->
|
||||
<sharedGui:RunningProcessView
|
||||
Grid.Row="0"
|
||||
IsVisible="{Binding IsRunning}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Frame>
|
||||
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
|
@ -17,15 +17,15 @@ namespace TINK.Droid
|
|||
[IntentFilter(new[] { Intent.ActionView },
|
||||
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||
DataScheme = "https",
|
||||
DataHost = "sharee.bike",
|
||||
DataPathPrefix = "/sharee",
|
||||
DataHost = "app.sharee.bike",
|
||||
DataPathPrefix = "/App-shareebike",
|
||||
AutoVerify = true)]
|
||||
|
||||
[IntentFilter(new[] { Intent.ActionView },
|
||||
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||
DataScheme = "http",
|
||||
DataHost = "sharee.bike",
|
||||
DataPathPrefix = "/sharee",
|
||||
DataHost = "app.sharee.bike",
|
||||
DataPathPrefix = "/App-shareebike",
|
||||
AutoVerify = true)]
|
||||
|
||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
|
|
|
@ -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.339" android:versionCode="339">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.hauffware.sharee" android:versionName="3.0.340" android:versionCode="340">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
|
||||
<!-- Google Maps related permissions -->
|
||||
<!-- Permission to receive remote notifications from Google Play Services -->
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
<key>CFBundleDisplayName</key>
|
||||
<string>sharee.bike</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>339</string>
|
||||
<string>340</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.339</string>
|
||||
<string>3.0.340</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
||||
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
|
||||
using TINK.Model.State;
|
||||
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
||||
{
|
||||
public class BikeInfo : Model.Bikes.BikeInfoNS.BC.BikeInfo, IBikeInfo
|
||||
public class BikeInfo : BC.BikeInfo, IBikeInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructs a bike info object for a available bike.
|
||||
|
@ -18,7 +17,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
public BikeInfo(
|
||||
BikeNS.Bike bike,
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
int lockId,
|
||||
Guid lockGuid,
|
||||
|
@ -29,7 +28,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
IEnumerable<string> group = null) : base(
|
||||
new StateInfo(),
|
||||
bike != null
|
||||
? new BikeNS.Bike(
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
bike.WheelType,
|
||||
|
@ -43,7 +42,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder { Id = lockId, Guid = lockGuid }.Build();
|
||||
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid }.Build();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -59,7 +58,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="dateTimeProvider">Date time provider to calculate reaining time.</param>
|
||||
public BikeInfo(
|
||||
BikeNS.Bike bike,
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
int lockId,
|
||||
Guid lockGuid,
|
||||
|
@ -80,7 +79,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
mailAddress,
|
||||
""),
|
||||
bike != null
|
||||
? new BikeNS.Bike(
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
bike.WheelType,
|
||||
|
@ -94,7 +93,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
|
||||
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -110,7 +109,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="wheelType"></param>
|
||||
public BikeInfo(
|
||||
BikeNS.Bike bike,
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
int lockId,
|
||||
Guid lockGuid,
|
||||
|
@ -129,7 +128,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
mailAddress,
|
||||
""),
|
||||
bike != null
|
||||
? new BikeNS.Bike(
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
bike.WheelType,
|
||||
|
@ -143,16 +142,16 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
|
||||
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
|
||||
}
|
||||
|
||||
public BikeInfo(Model.Bikes.BikeInfoNS.BC.BikeInfo bikeInfo, Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo lockInfo) : base(
|
||||
public BikeInfo(Model.Bikes.BikeInfoNS.BC.BikeInfo bikeInfo, LockInfo lockInfo) : base(
|
||||
bikeInfo ?? throw new ArgumentException($"Can not copy-construct {typeof(BikeInfo).Name}-object. Source bike info must not be null."))
|
||||
{
|
||||
LockInfo = lockInfo
|
||||
?? throw new ArgumentException($"Can not copy-construct {typeof(BikeInfo).Name}-object. Source lock object must not be null.");
|
||||
}
|
||||
|
||||
public Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo LockInfo { get; private set; }
|
||||
public LockInfo LockInfo { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
||||
{
|
||||
|
@ -19,5 +19,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
Guid Guid { get; set; }
|
||||
|
||||
byte[] Seed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version info of the locks.
|
||||
/// </summary>
|
||||
IVersionInfo VersionInfo { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
20
TINKLib/Model/Bikes/BikeInfoNS/BluetoothLock/IVersionInfo.cs
Normal file
20
TINKLib/Model/Bikes/BikeInfoNS/BluetoothLock/IVersionInfo.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
||||
{
|
||||
public interface IVersionInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the firmware version of the lock.
|
||||
/// </summary>
|
||||
int FirmwareVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the hardware version (revision) of the lock.
|
||||
/// </summary>
|
||||
int HardwareVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds lock version (2 – classic, 3 – plus, 4 – GPS).
|
||||
/// </summary>
|
||||
int LockVersion { get; }
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System;
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
||||
{
|
||||
public class LockInfoMutable : TINK.Model.Bikes.BikeInfoNS.BluetoothLock.ILockInfoMutable
|
||||
public class LockInfoMutable : ILockInfoMutable
|
||||
{
|
||||
/// <summary> Lock info object. </summary>
|
||||
private Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo LockInfo { get; set; }
|
||||
private LockInfo LockInfo { get; set; }
|
||||
|
||||
/// <summary> Constructs a bluetooth lock info object. </summary>
|
||||
/// <param name="id">Id of lock must always been known when constructing an lock info object.</param>
|
||||
|
@ -15,9 +15,9 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
byte[] userKey,
|
||||
byte[] adminKey,
|
||||
byte[] seed,
|
||||
Model.Bikes.BikeInfoNS.BluetoothLock.LockingState state)
|
||||
LockingState state)
|
||||
{
|
||||
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder() { Id = id, Guid = guid, UserKey = userKey, AdminKey = adminKey, Seed = seed, State = state }.Build();
|
||||
LockInfo = new LockInfo.Builder() { Id = id, Guid = guid, UserKey = userKey, AdminKey = adminKey, Seed = seed, State = state }.Build();
|
||||
}
|
||||
|
||||
public int Id => LockInfo.Id;
|
||||
|
@ -26,7 +26,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
public Guid Guid
|
||||
{
|
||||
get => LockInfo.Guid;
|
||||
set => LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder(LockInfo) { Guid = value }.Build();
|
||||
set => LockInfo = new LockInfo.Builder(LockInfo) { Guid = value }.Build();
|
||||
}
|
||||
|
||||
public byte[] Seed => LockInfo.Seed;
|
||||
|
@ -35,19 +35,24 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
|
||||
public byte[] AdminKey => LockInfo.AdminKey;
|
||||
|
||||
public Model.Bikes.BikeInfoNS.BluetoothLock.LockingState State
|
||||
public LockingState State
|
||||
{
|
||||
get => LockInfo.State;
|
||||
set => LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder(LockInfo) { State = value }.Build();
|
||||
set => LockInfo = new LockInfo.Builder(LockInfo) { State = value }.Build();
|
||||
}
|
||||
|
||||
/// <summary> Holds the percentage of lock battery.</summary>
|
||||
public double BatteryPercentage { get; set; } = double.NaN;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version info of the lock.
|
||||
/// </summary>
|
||||
public IVersionInfo VersionInfo { get; set; } = new VersionInfo.Builder().Build();
|
||||
|
||||
/// <summary> Loads lock info object from values. </summary>
|
||||
public void Load(int id, Guid guid, byte[] seed, byte[] userKey, byte[] adminKey)
|
||||
{
|
||||
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder(LockInfo) { Id = id, Guid = guid, Seed = seed, UserKey = userKey, AdminKey = adminKey }.Build();
|
||||
LockInfo = new LockInfo.Builder(LockInfo) { Id = id, Guid = guid, Seed = seed, UserKey = userKey, AdminKey = adminKey }.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
69
TINKLib/Model/Bikes/BikeInfoNS/BluetoothLock/VersionInfo.cs
Normal file
69
TINKLib/Model/Bikes/BikeInfoNS/BluetoothLock/VersionInfo.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
||||
{
|
||||
public class VersionInfo : IVersionInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about firmware- and hardware version of a lock and the type of lock (lock version).
|
||||
/// </summary>
|
||||
private VersionInfo() { }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the firmware version of the lock.
|
||||
/// </summary>
|
||||
public int FirmwareVersion { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the hardware version (revision) of the lock.
|
||||
/// </summary>
|
||||
public int HardwareVersion { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Holds lock version (2 – classic, 3 – plus, 4 – GPS).
|
||||
/// </summary>
|
||||
public int LockVersion { get; private set; } = 0;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
=> Equals(obj as VersionInfo);
|
||||
|
||||
public bool Equals(VersionInfo other)
|
||||
{
|
||||
if (ReferenceEquals(other, null)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (GetType() != other.GetType()) return false;
|
||||
|
||||
return ToString() == other.ToString();
|
||||
}
|
||||
|
||||
public override int GetHashCode() => ToString().GetHashCode();
|
||||
|
||||
public override string ToString() => JsonConvert.SerializeObject(this);
|
||||
|
||||
public static bool operator ==(VersionInfo lhs, VersionInfo rhs)
|
||||
{
|
||||
if (ReferenceEquals(lhs, null))
|
||||
return ReferenceEquals(rhs, null) ? true /*null == null = true*/: false;
|
||||
|
||||
return lhs.Equals(rhs);
|
||||
}
|
||||
|
||||
public static bool operator !=(VersionInfo lhs, VersionInfo rhs)
|
||||
=> !(lhs == rhs);
|
||||
public class Builder
|
||||
{
|
||||
private VersionInfo versionInfo = new VersionInfo();
|
||||
|
||||
public int FirmwareVersion { get => versionInfo.FirmwareVersion; set => versionInfo.FirmwareVersion = value; }
|
||||
|
||||
public int HardwareVersion { get => versionInfo.HardwareVersion; set => versionInfo.HardwareVersion = value; }
|
||||
|
||||
public int LockVersion { get => versionInfo.LockVersion; set => versionInfo.LockVersion = value; }
|
||||
|
||||
public VersionInfo Build()
|
||||
{
|
||||
return versionInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
@ -226,7 +226,8 @@ namespace TINK.Model.Connector
|
|||
state.Value,
|
||||
bike.OperatorUri,
|
||||
location,
|
||||
bike.LockInfo.BatteryPercentage)).GetIsBookingResponseOk(bike.Id);
|
||||
bike.LockInfo.BatteryPercentage,
|
||||
bike.LockInfo.VersionInfo)).GetIsBookingResponseOk(bike.Id);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -320,4 +321,4 @@ namespace TINK.Model.Connector
|
|||
public async Task CloseLockAsync(Bikes.BikeInfoNS.CopriLock.IBikeInfoMutable bike)
|
||||
=> await CopriServer.CloseAync(bike);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -594,6 +594,16 @@ namespace TINK.Model
|
|||
new Version(3, 0, 339),
|
||||
AppResources.ChangeLog3_0_339_MK,
|
||||
new List<AppFlavor> { AppFlavor.MeinKonrad }
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 340),
|
||||
AppResources.ChangeLog_MinorDesignImprovements,
|
||||
new List<AppFlavor> { AppFlavor.LastenradBayern, AppFlavor.MeinKonrad }
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 340),
|
||||
AppResources.ChangeLog_MinorBugFixes,
|
||||
new List<AppFlavor> { AppFlavor.ShareeBike }
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -645,6 +645,15 @@ namespace TINK.MultilingualResources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A few small things have been changed in the design..
|
||||
/// </summary>
|
||||
public static string ChangeLog_MinorDesignImprovements {
|
||||
get {
|
||||
return ResourceManager.GetString("ChangeLog_MinorDesignImprovements", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Updated to latest lock firmware..
|
||||
/// </summary>
|
||||
|
|
|
@ -1031,4 +1031,7 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben:
|
|||
<data name="ChangeLog3_0_339_SB_LB" xml:space="preserve">
|
||||
<value>Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben: im Menü ganz unten. Bitte aktualisieren Sie die App regelmäßig, um in Funktionalität und Design auf dem neuesten Stand zu sein!</value>
|
||||
</data>
|
||||
<data name="ChangeLog_MinorDesignImprovements" xml:space="preserve">
|
||||
<value>Es wurden ein paar Kleinigkeiten im Design verändert.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1123,4 +1123,7 @@ You can now see at a glance which app version you have installed: in the menu at
|
|||
<data name="ChangeLog3_0_339_SB_LB" xml:space="preserve">
|
||||
<value>You can now see at a glance which app version you have installed: in the menu at the very bottom. Please update the app regularly to be up to date in functionality and design!</value>
|
||||
</data>
|
||||
<data name="ChangeLog_MinorDesignImprovements" xml:space="preserve">
|
||||
<value>A few small things have been changed in the design.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1400,6 +1400,10 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben:
|
|||
<source>You can now see at a glance which app version you have installed: in the menu at the very bottom. Please update the app regularly to be up to date in functionality and design!</source>
|
||||
<target state="translated">Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben: im Menü ganz unten. Bitte aktualisieren Sie die App regelmäßig, um in Funktionalität und Design auf dem neuesten Stand zu sein!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="ChangeLog_MinorDesignImprovements" translate="yes" xml:space="preserve">
|
||||
<source>A few small things have been changed in the design.</source>
|
||||
<target state="translated">Es wurden ein paar Kleinigkeiten im Design verändert.</target>
|
||||
</trans-unit>
|
||||
</group>
|
||||
</body>
|
||||
</file>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -6,6 +6,7 @@ using System.Net;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Logging;
|
||||
using TINK.Repository.Exception;
|
||||
|
@ -172,10 +173,11 @@ namespace TINK.Repository
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto location,
|
||||
double batteryLevel) =>
|
||||
double batteryLevel,
|
||||
IVersionInfo versionInfo) =>
|
||||
await DoUpdateLockingStateAsync(
|
||||
operatorUri?.AbsoluteUri ?? m_oCopriHost.AbsoluteUri,
|
||||
requestBuilder.UpateLockingState(bikeId, state, location, batteryLevel),
|
||||
requestBuilder.UpateLockingState(bikeId, state, location, batteryLevel, versionInfo),
|
||||
UserAgent);
|
||||
|
||||
/// <summary> Gets booking request request. </summary>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
|
@ -1636,7 +1637,8 @@ namespace TINK.Repository
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryLevel) => null;
|
||||
double batteryLevel,
|
||||
IVersionInfo versionInfo) => null;
|
||||
|
||||
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
=> null;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using MonkeyCache.FileStore;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository.Request;
|
||||
|
@ -171,7 +172,8 @@ namespace TINK.Repository
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryLevel)
|
||||
double batteryLevel,
|
||||
IVersionInfo versionInfo)
|
||||
=> throw new System.Exception("Aktualisierung des Schlossstatuses im Offlinemodus nicht möglich!");
|
||||
|
||||
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
|
@ -69,7 +70,8 @@ namespace TINK.Repository
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto location = null,
|
||||
double batteryPercentage = double.NaN);
|
||||
double batteryPercentage = double.NaN,
|
||||
IVersionInfo versionInfo = null);
|
||||
|
||||
/// <summary> Books a bluetooth bike. </summary>
|
||||
/// <param name="bikeId">Id of the bike to book.</param>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
|
||||
namespace TINK.Repository.Request
|
||||
|
@ -63,14 +64,16 @@ namespace TINK.Repository.Request
|
|||
|
||||
/// <summary> Gets the request for updating lock state for a booked bike. </summary>
|
||||
/// <param name="bikeId">Id of the bike to update locking state for.</param>
|
||||
/// <param name="location">Geolocation of lock when state change occurred.</param>
|
||||
/// <param name="state">New locking state.</param>
|
||||
/// <param name="location">Geolocation of lock when state change occurred.</param>
|
||||
/// <param name="versionInfo">Information about lock (firmware version, hardware version, ...).</param>
|
||||
/// <returns>Request to update locking state.</returns>
|
||||
string UpateLockingState(
|
||||
string bikeId,
|
||||
lock_state state,
|
||||
LocationDto location = null,
|
||||
double batteryPercentage = double.NaN);
|
||||
double batteryPercentage = double.NaN,
|
||||
IVersionInfo versionInfo = null);
|
||||
|
||||
/// <summary> Gets the booking request (synonym: booking == renting == mieten). </summary>
|
||||
/// <param name="bikeId">Id of the bike to book.</param>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository.Exception;
|
||||
|
||||
|
@ -101,7 +102,11 @@ namespace TINK.Repository.Request
|
|||
public string StartReturningBike(string bikeId)
|
||||
=> throw new NotSupportedException();
|
||||
|
||||
public string UpateLockingState(string bikeId, lock_state state, LocationDto geolocation, double batteryPercentage)
|
||||
/// <summary>
|
||||
/// Not supported if user is not logged in. Lock state is only updated after open/ close which is only possible if user is logged in.
|
||||
/// </summary>
|
||||
/// <exception cref="NotSupportedException"></exception>
|
||||
public string UpateLockingState(string bikeId, lock_state state, LocationDto geolocation, double batteryPercentage, IVersionInfo versionInfo)
|
||||
=> throw new NotSupportedException();
|
||||
|
||||
public string DoBook(string bikeId, Guid guid, double batteryPercentage)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Services.Logging;
|
||||
|
@ -129,17 +130,20 @@ namespace TINK.Repository.Request
|
|||
/// <remarks> Operator specific call.</remarks>
|
||||
/// <param name="bikeId">Id of the bike to update locking state for.</param>
|
||||
/// <param name="state">New locking state.</param>
|
||||
/// <param name="versionInfo">Information about lock (firmware version, hardware version, ...).</param>
|
||||
/// <returns>Request to update locking state.</returns>
|
||||
public string UpateLockingState(
|
||||
string bikeId,
|
||||
lock_state state,
|
||||
LocationDto geolocation,
|
||||
double batteryPercentage)
|
||||
double batteryPercentage,
|
||||
IVersionInfo versionInfo)
|
||||
=> "request=booking_update" +
|
||||
GetBikeIdParameter(bikeId) +
|
||||
GetLocationParameters(geolocation) +
|
||||
GetLockStateParameter(state) +
|
||||
GetBatteryPercentageParameters(batteryPercentage) +
|
||||
GetVersionInfoParameter(versionInfo) +
|
||||
AuthCookieParameter +
|
||||
UiIsoLanguageNameParameter;
|
||||
|
||||
|
@ -272,6 +276,10 @@ namespace TINK.Repository.Request
|
|||
? $"&voltage={batteryPercentage.ToString(CultureInfo.InvariantCulture)}"
|
||||
: string.Empty;
|
||||
|
||||
private static string GetVersionInfoParameter(IVersionInfo versionInfo) => versionInfo?.FirmwareVersion > 0 || versionInfo?.HardwareVersion > 0 || versionInfo?.LockVersion > 0
|
||||
? $"&firmware=HW%20{versionInfo.HardwareVersion};FW%20{versionInfo.FirmwareVersion};Lock%20{versionInfo.LockVersion}"
|
||||
: string.Empty;
|
||||
|
||||
/// <summary> Gets the geolocation parameter. </summary>
|
||||
/// <param name="geolocation">Geolocation or null.</param>
|
||||
private static string GetLocationParameters(LocationDto geolocation)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Connector.Updater;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository;
|
||||
|
@ -235,13 +236,15 @@ namespace TINK.Model.Services.CopriApi
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto location,
|
||||
double batteryLevel)
|
||||
double batteryLevel,
|
||||
IVersionInfo versionInfo)
|
||||
=> await HttpsServer.UpdateLockingStateAsync(
|
||||
bikeId,
|
||||
state,
|
||||
operatorUri,
|
||||
location,
|
||||
batteryLevel);
|
||||
batteryLevel,
|
||||
versionInfo);
|
||||
|
||||
/// <summary> Books a bike. </summary>
|
||||
/// <param name="bikeId">Id of the bike to book.</param>
|
||||
|
@ -303,4 +306,4 @@ namespace TINK.Model.Services.CopriApi
|
|||
=> await HttpsServer.DoSubmitMiniSurvey(answers);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
|
@ -53,13 +54,15 @@ namespace TINK.Model.Services.CopriApi
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryLevel)
|
||||
double batteryLevel,
|
||||
IVersionInfo versionInfo)
|
||||
=> await monkeyStore.UpdateLockingStateAsync(
|
||||
bikeId,
|
||||
state,
|
||||
operatorUri,
|
||||
geolocation,
|
||||
batteryLevel);
|
||||
batteryLevel,
|
||||
versionInfo);
|
||||
|
||||
public async Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.Themes.Konrad">
|
||||
|
||||
<!--Main color-->
|
||||
<Color x:Key="primary-back-title-color">#D21113</Color>
|
||||
|
||||
<!--Secondary color-->
|
||||
<Color x:Key="secondary-back-title-color">#FF0020</Color>
|
||||
|
||||
<!--Primary Button-->
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="WidthRequest" Value="400" />
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
|
@ -28,6 +32,8 @@
|
|||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--Secondary Button-->
|
||||
<Style x:Key="SecondaryButton" TargetType="Button">
|
||||
<Setter Property="WidthRequest" Value="400" />
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
|
@ -51,6 +57,7 @@
|
|||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--Switch-->
|
||||
<Style TargetType="Switch">
|
||||
<Style.Triggers>
|
||||
<Trigger TargetType="Switch"
|
||||
|
@ -65,17 +72,24 @@
|
|||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--Slider-->
|
||||
<Style TargetType="Slider">
|
||||
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Setter Property="Background" Value="LightGray"/>
|
||||
</Style>
|
||||
|
||||
<!--Label-->
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="FontSize" Value="Default"/>
|
||||
</Style>
|
||||
|
||||
<!--Flyout Item-->
|
||||
<Style TargetType="FlyoutItem">
|
||||
<Setter Property="Shell.BackgroundColor" Value="{DynamicResource Key=secondary-back-title-color}" />
|
||||
</Style>
|
||||
|
||||
<!--Navbar-->
|
||||
<Style x:Key="Label-Navbar" TargetType="Label">
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
<Setter Property="TextTransform" Value="Uppercase"/>
|
||||
|
@ -90,4 +104,4 @@
|
|||
<Setter Property="Grid.ColumnSpan" Value="2"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary>
|
||||
|
|
|
@ -1,83 +1,92 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.Themes.LastenradBayern">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="TINK.Themes.LastenradBayern">
|
||||
|
||||
<Color x:Key="primary-back-title-color">#009BDB</Color>
|
||||
<!--Main color-->
|
||||
<Color x:Key="primary-back-title-color">#009BDB</Color>
|
||||
|
||||
<!--<Style TargetType="Button">
|
||||
<Setter Property="WidthRequest" Value="400" />
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
<Setter Property="BorderWidth" Value="1"/>
|
||||
<Setter Property="BorderRadius" Value="10" />
|
||||
<Setter Property="FontSize" Value="Medium"/>
|
||||
<Setter Property="TextColor" Value="White"/>
|
||||
<Style.Triggers>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="True">
|
||||
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Setter Property="BackgroundColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
</Trigger>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="False">
|
||||
<Setter Property="BorderColor" Value="LightGray"/>
|
||||
<Setter Property="BackgroundColor" Value="LightGray"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="SecondaryButton" TargetType="Button">
|
||||
<Setter Property="WidthRequest" Value="400" />
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
<Setter Property="BorderWidth" Value="1"/>
|
||||
<Setter Property="BorderRadius" Value="10" />
|
||||
<Setter Property="FontSize" Value="Medium"/>
|
||||
<Setter Property="TextColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="True">
|
||||
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Setter Property="BackgroundColor" Value="White"/>
|
||||
</Trigger>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="False">
|
||||
<Setter Property="BorderColor" Value="LightGray"/>
|
||||
<Setter Property="BackgroundColor" Value="DimGray"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!--Primary Button-->
|
||||
<!--<<Style TargetType="Button">
|
||||
<Setter Property="WidthRequest" Value="400" />
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
<Setter Property="BorderWidth" Value="1"/>
|
||||
<Setter Property="BorderRadius" Value="10" />
|
||||
<Setter Property="FontSize" Value="Medium"/>
|
||||
<Setter Property="TextColor" Value="White"/>
|
||||
<Style.Triggers>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="True">
|
||||
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Setter Property="BackgroundColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
</Trigger>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="False">
|
||||
<Setter Property="BorderColor" Value="LightGray"/>
|
||||
<Setter Property="BackgroundColor" Value="LightGray"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
|
||||
|
||||
<Style TargetType="Switch">
|
||||
<Style.Triggers>
|
||||
<Trigger TargetType="Switch"
|
||||
Property="IsToggled"
|
||||
Value="True">
|
||||
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
</Trigger>
|
||||
<Trigger TargetType="Switch"
|
||||
Property="IsToggled"
|
||||
Value="False">
|
||||
<Setter Property="ThumbColor" Value="DimGray"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="Slider">
|
||||
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Setter Property="Background" Value="LightGray"/>
|
||||
</Style>
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="FontSize" Value="Default"/>
|
||||
</Style>
|
||||
</Style>-->
|
||||
<!--Sedondary Button-->
|
||||
<!--<Style x:Key="SecondaryButton" TargetType="Button">
|
||||
<Setter Property="WidthRequest" Value="400" />
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
<Setter Property="BorderWidth" Value="1"/>
|
||||
<Setter Property="BorderRadius" Value="10" />
|
||||
<Setter Property="FontSize" Value="Medium"/>
|
||||
<Setter Property="TextColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="True">
|
||||
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Setter Property="BackgroundColor" Value="White"/>
|
||||
</Trigger>
|
||||
<Trigger TargetType="Button"
|
||||
Property="IsEnabled"
|
||||
Value="False">
|
||||
<Setter Property="BorderColor" Value="LightGray"/>
|
||||
<Setter Property="BackgroundColor" Value="DimGray"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
|
||||
<!--Switch-->
|
||||
<!--<Style TargetType="Switch">
|
||||
<Style.Triggers>
|
||||
<Trigger TargetType="Switch"
|
||||
Property="IsToggled"
|
||||
Value="True">
|
||||
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
</Trigger>
|
||||
<Trigger TargetType="Switch"
|
||||
Property="IsToggled"
|
||||
Value="False">
|
||||
<Setter Property="ThumbColor" Value="DimGray"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
|
||||
<!--Slider-->
|
||||
<!--<Style TargetType="Slider">
|
||||
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
|
||||
<Setter Property="Background" Value="LightGray"/>
|
||||
</Style>-->
|
||||
|
||||
<!--Label-->
|
||||
<!--<Style TargetType="Label">
|
||||
<Setter Property="FontSize" Value="Default"/>
|
||||
</Style>-->
|
||||
|
||||
<!--Flyout Item-->
|
||||
<Style TargetType="FlyoutItem">
|
||||
<Setter Property="Shell.BackgroundColor" Value="{DynamicResource Key=primary-back-title-color}" />
|
||||
</Style>
|
||||
|
||||
|
||||
<!--Navbar-->
|
||||
<Style x:Key="Label-Navbar" TargetType="Label">
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
<!--<Setter Property="TextTransform" Value="Uppercase"/>-->
|
||||
|
@ -92,4 +101,4 @@
|
|||
<Setter Property="Grid.ColumnSpan" Value="2"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary>
|
||||
|
|
|
@ -318,13 +318,15 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
await ViewUpdateManager().StopUpdatePeridically();
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
|
||||
ILockService btLock;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
btLock = LockService[SelectedBike.LockInfo.Id];
|
||||
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
BikesViewModel.ActionText = string.Empty;
|
||||
BikesViewModel.ActionText = string.Empty;
|
||||
|
||||
if (exception is OutOfReachException)
|
||||
{
|
||||
|
@ -389,7 +391,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
|
||||
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -409,7 +411,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Lock list to avoid multiple taps while copri action is pending.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
|
||||
|
||||
var versionTdo = btLock.VersionInfo;
|
||||
if (versionTdo != null)
|
||||
{
|
||||
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
|
||||
{
|
||||
FirmwareVersion = versionTdo.FirmwareVersion,
|
||||
HardwareVersion = versionTdo.HardwareVersion,
|
||||
LockVersion = versionTdo.LockVersion,
|
||||
}.Build();
|
||||
}
|
||||
IsConnected = IsConnectedDelegate();
|
||||
|
||||
try
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -69,8 +69,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
await ViewUpdateManager().StopUpdatePeridically();
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
|
||||
ILockService btLock;
|
||||
try
|
||||
{
|
||||
btLock = LockService[SelectedBike.LockInfo.Id];
|
||||
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -140,7 +142,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
|
||||
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -160,7 +162,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Lock list to avoid multiple taps while copri action is pending.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
|
||||
|
||||
var versionTdo = btLock.VersionInfo;
|
||||
if (versionTdo != null)
|
||||
{
|
||||
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
|
||||
{
|
||||
FirmwareVersion = versionTdo.FirmwareVersion,
|
||||
HardwareVersion = versionTdo.HardwareVersion,
|
||||
LockVersion = versionTdo.LockVersion,
|
||||
}.Build();
|
||||
}
|
||||
IsConnected = IsConnectedDelegate();
|
||||
|
||||
try
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
@ -58,7 +58,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
{
|
||||
BikesViewModel.IsIdle = false;
|
||||
|
||||
// Ask whether to really book bike?
|
||||
// Ask whether to really reserve bike?
|
||||
var alertResult = await ViewService.DisplayAlert(
|
||||
string.Empty,
|
||||
string.Format(AppResources.QuestionReserveBike, SelectedBike.GetFullDisplayName(), StateRequestedInfo.MaximumReserveTime.Minutes),
|
||||
|
@ -257,9 +257,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Unlock bike.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
|
||||
ILockService btLock;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
btLock = LockService[SelectedBike.LockInfo.Id];
|
||||
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -336,7 +338,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
|
||||
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -356,7 +358,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Lock list to avoid multiple taps while copri action is pending.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
|
||||
|
||||
var versionTdo = btLock.VersionInfo;
|
||||
if (versionTdo != null)
|
||||
{
|
||||
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
|
||||
{
|
||||
FirmwareVersion = versionTdo.FirmwareVersion,
|
||||
HardwareVersion = versionTdo.HardwareVersion,
|
||||
LockVersion = versionTdo.LockVersion,
|
||||
}.Build();
|
||||
}
|
||||
IsConnected = IsConnectedDelegate();
|
||||
|
||||
try
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
@ -222,9 +222,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Unlock bike.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
|
||||
ILockService btLock;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
btLock = LockService[SelectedBike.LockInfo.Id];
|
||||
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -301,7 +303,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
|
||||
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -321,7 +323,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Lock list to avoid multiple taps while copri action is pending.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
|
||||
|
||||
var versionTdo = btLock.VersionInfo;
|
||||
if (versionTdo != null)
|
||||
{
|
||||
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
|
||||
{
|
||||
FirmwareVersion = versionTdo.FirmwareVersion,
|
||||
HardwareVersion = versionTdo.HardwareVersion,
|
||||
LockVersion = versionTdo.LockVersion,
|
||||
}.Build();
|
||||
}
|
||||
IsConnected = IsConnectedDelegate();
|
||||
|
||||
try
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
@ -246,7 +246,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext<BookedDisconnected>().Error("Lock can not be found. {Exception}", exception);
|
||||
Log.ForContext<ReservedDisconnected>().Error("Lock can not be found. {Exception}", exception);
|
||||
|
||||
string message;
|
||||
if (retryCount < 2)
|
||||
|
@ -384,9 +384,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Unlock bike.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
|
||||
ILockService btLock;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
btLock = LockService[SelectedBike.LockInfo.Id];
|
||||
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -463,7 +465,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
|
||||
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -483,7 +485,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Lock list to avoid multiple taps while copri action is pending.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
|
||||
|
||||
var versionTdo = btLock.VersionInfo;
|
||||
if (versionTdo != null)
|
||||
{
|
||||
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
|
||||
{
|
||||
FirmwareVersion = versionTdo.FirmwareVersion,
|
||||
HardwareVersion = versionTdo.HardwareVersion,
|
||||
LockVersion = versionTdo.LockVersion,
|
||||
}.Build();
|
||||
}
|
||||
IsConnected = IsConnectedDelegate();
|
||||
|
||||
try
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -65,9 +65,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
await ViewUpdateManager().StopUpdatePeridically();
|
||||
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
|
||||
ILockService btLock;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
btLock = LockService[SelectedBike.LockInfo.Id];
|
||||
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -136,7 +138,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
|
||||
try
|
||||
{
|
||||
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
|
||||
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -156,7 +158,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
// Lock list to avoid multiple taps while copri action is pending.
|
||||
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
|
||||
|
||||
var versionTdo = btLock.VersionInfo;
|
||||
if (versionTdo != null)
|
||||
{
|
||||
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
|
||||
{
|
||||
FirmwareVersion = versionTdo.FirmwareVersion,
|
||||
HardwareVersion = versionTdo.HardwareVersion,
|
||||
LockVersion = versionTdo.LockVersion,
|
||||
}.Build();
|
||||
}
|
||||
IsConnected = IsConnectedDelegate();
|
||||
|
||||
try
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
|
@ -258,7 +259,8 @@ namespace TestFramework.Repository
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryLevel)
|
||||
double batteryLevel,
|
||||
IVersionInfo versionInfo)
|
||||
=> null;
|
||||
|
||||
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
|
@ -59,7 +60,8 @@ namespace TestFramework.Repository
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryPercentage)
|
||||
double batteryPercentage,
|
||||
IVersionInfo versionInfo)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TestFramework.Repository;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository.Request;
|
||||
|
@ -79,7 +80,8 @@ namespace TestFramework.Services.CopriApi.Connector
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryPercentage)
|
||||
double batteryPercentage,
|
||||
IVersionInfo versionInfo)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using TINK.Repository.Exception;
|
||||
|
@ -185,7 +185,7 @@ namespace TestShareeLib.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", null /*UI language */, "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", lock_state.locked, null, 15.03),
|
||||
builder.UpateLockingState("12", lock_state.locked, null /* geolocaion */, 15.03, null /* version info */),
|
||||
Is.EqualTo("request=booking_update&bike=12&lock_state=locked&voltage=15.03&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ namespace TestShareeLib.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", null /*UI language */, "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", lock_state.locked, null, double.NaN),
|
||||
builder.UpateLockingState("12", lock_state.locked, null /* geolocaion */, double.NaN, null /* version info */),
|
||||
Is.EqualTo("request=booking_update&bike=12&lock_state=locked&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ namespace TestShareeLib.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", null /*UI language */, "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), 12),
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), 12, null /* version info */),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&voltage=12&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ namespace TestShareeLib.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", null /*UI language */, "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), double.NaN),
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), double.NaN, null /* version info */),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -221,10 +221,20 @@ namespace TestShareeLib.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", null /*UI language */, "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Accuracy = 5.7, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), 98),
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Accuracy = 5.7, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), 98, null /* version info */),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_accuracy=5.7&gps_age=0.07&lock_state=locked&voltage=98&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpateLockingStateVersionsInfo()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", null /*UI language */, "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", lock_state.locked, null /* geolocaion */, 15.03, new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.VersionInfo.Builder { FirmwareVersion=13, HardwareVersion=12, LockVersion=14}.Build()),
|
||||
Is.EqualTo("request=booking_update&bike=12&lock_state=locked&voltage=15.03&firmware=HW%2012;FW%2013;Lock%2014&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestDoReturnGeolocationIsNull()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
|
@ -84,7 +85,8 @@ namespace TestTINKLib.Mocks.Connector
|
|||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryPercentage)
|
||||
double batteryPercentage,
|
||||
IVersionInfo versionInfo)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
|
|
Loading…
Reference in a new issue