Skip to content

Commit

Permalink
Merge pull request #50 from wrk-fmd/develop
Browse files Browse the repository at this point in the history
RELEASE: 1.1.4
  • Loading branch information
robo-w authored Mar 11, 2019
2 parents 48a5c8c + 1643c77 commit 3556b8d
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 16 deletions.
2 changes: 1 addition & 1 deletion GeoClient/GeoClient.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="30" android:versionName="1.1.4-RC1" package="at.wrk.fmd.cocemocl" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="35" android:versionName="1.1.4" package="at.wrk.fmd.cocemocl" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Expand Down
6 changes: 3 additions & 3 deletions GeoClient/GeoClient/GeoClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<Authors>Daniel Steiner, Robert Wittek</Authors>
<Copyright>MIT License</Copyright>
<Description>App to share the position data</Description>
<Version>1.1.2</Version>
<AssemblyVersion>1.1.4.0</AssemblyVersion>
<FileVersion>1.1.4.0</FileVersion>
<Version>1.1.4</Version>
<AssemblyVersion>1.1.4.1</AssemblyVersion>
<FileVersion>1.1.4.1</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
1 change: 1 addition & 0 deletions GeoClient/GeoClient/Models/Geobroker/GeobrokerConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static class GeobrokerConstants
public const string IncidentPriorityProperty = "priority";
public const string IncidentBlueProperty = "blue";
public const string IncidentLocationProperty = "location";
public const string IncidentDestinationProperty = "destination";
public const string IncidentAssignedUnitsProperty = "assignedUnits";

public const string UnitIdProperty = "id";
Expand Down
11 changes: 7 additions & 4 deletions GeoClient/GeoClient/Models/IncidentItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class IncidentItem : IComparable<IncidentItem>
public bool Priority { get; }
public bool Blue { get; }
public GeoPoint Location { get; }
public GeoPoint Destination { get; }

public List<UnitOfIncident> Units { get; }

Expand All @@ -36,6 +37,7 @@ public IncidentItem(
bool priority = false,
bool blue = false,
GeoPoint location = null,
GeoPoint destination = null,
List<UnitOfIncident> units = null)
{
Id = id;
Expand All @@ -44,6 +46,7 @@ public IncidentItem(
Priority = priority;
Blue = blue;
Location = location;
Destination = destination;
Units = units ?? new List<UnitOfIncident>();
}

Expand All @@ -55,6 +58,7 @@ protected bool Equals(IncidentItem other)
&& Priority == other.Priority
&& Blue == other.Blue
&& Equals(Location, other.Location)
&& Equals(Destination, other.Destination)
&& ListEquals(Units, other.Units);
}

Expand Down Expand Up @@ -85,6 +89,7 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ Priority.GetHashCode();
hashCode = (hashCode * 397) ^ Blue.GetHashCode();
hashCode = (hashCode * 397) ^ (Location != null ? Location.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Destination != null ? Destination.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Units != null ? Units.GetHashCode() : 0);
return hashCode;
}
Expand All @@ -93,7 +98,7 @@ public override int GetHashCode()
public override string ToString()
{
return
$"{nameof(Id)}: {Id}, {nameof(Type)}: {Type}, {nameof(Info)}: {Info}, {nameof(Priority)}: {Priority}, {nameof(Blue)}: {Blue}, {nameof(Location)}: {Location}, Units.Count: {Units.Count}";
$"{nameof(Id)}: {Id}, {nameof(Type)}: {Type}, {nameof(Info)}: {Info}, {nameof(Priority)}: {Priority}, {nameof(Blue)}: {Blue}, {nameof(Location)}: {Location}, {nameof(Destination)}: {Destination}, Units.Count: {Units.Count}";
}

private string GetDescriptiveType()
Expand Down Expand Up @@ -128,12 +133,10 @@ private IncidentTaskState GetOwnTaskState()
var registrationInfo = _registrationService.GetRegistrationInfo();
if (registrationInfo?.Id != null)
{
foreach (UnitOfIncident unit in Units)
foreach (var unit in Units)
{
if (unit.Id == registrationInfo.Id)
{
return unit.State;
}
}
}
else
Expand Down
1 change: 1 addition & 0 deletions GeoClient/GeoClient/Services/IncidentItemFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private static IncidentItem CreateIncidentItem(JObject incident, List<JObject> u
incident.Value<bool>(GeobrokerConstants.IncidentPriorityProperty),
incident.Value<bool>(GeobrokerConstants.IncidentBlueProperty),
CreateGeoPoint(incident[GeobrokerConstants.IncidentLocationProperty]),
CreateGeoPoint(incident[GeobrokerConstants.IncidentDestinationProperty]),
unitList);
}

Expand Down
20 changes: 19 additions & 1 deletion GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public class ItemDetailViewModel : BaseViewModel
public Color OpenLocationButtonColor => GetOpenLocationButtonColor();
public string OpenLocationButtonText => GetOpenLocationButtonText();

public Color OpenDestinationButtonColor => GetOpenDestinationButtonColor();
public string OpenDestinationButtonText => GetOpenDestinationButtonText();

public ItemDetailViewModel(IncidentItem incidentItem = null)
{
Title = incidentItem?.DescriptiveType;
Expand All @@ -26,12 +29,27 @@ private Color GetOpenLocationButtonColor()

private string GetOpenLocationButtonText()
{
return IsLocationAvailable() ? "Berufungsort auf Karte anzeigen" : "Berufungsort ist nicht verortet";
return IsLocationAvailable() ? "Berufungsort auf Karte anzeigen" : "Berufungsort nicht verfügbar";
}

private bool IsLocationAvailable()
{
return IncidentItem?.Location != null;
}

private Color GetOpenDestinationButtonColor()
{
return IsDestinationAvailable() ? ActiveButtonColor : DisableButtonColor;
}

private string GetOpenDestinationButtonText()
{
return IsDestinationAvailable() ? "Zielort auf Karte anzeigen" : "Zielort nicht verfügbar";
}

private bool IsDestinationAvailable()
{
return IncidentItem?.Destination != null;
}
}
}
2 changes: 1 addition & 1 deletion GeoClient/GeoClient/Views/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
FontAttributes="Bold"
FontSize="Large" />
<Span
Text="1.1.4-RC1"
Text="1.1.4"
FontSize="Large"
ForegroundColor="{StaticResource LightTextColor}" />
</FormattedString.Spans>
Expand Down
9 changes: 8 additions & 1 deletion GeoClient/GeoClient/Views/ItemDetailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,17 @@
<Button
x:Name="OpenLocationButton"
Text="{Binding OpenLocationButtonText}"
Clicked="openLocation_Clicked"
Clicked="OpenLocation_Clicked"
BackgroundColor="{Binding OpenLocationButtonColor}"
TextColor="White"
VerticalOptions="End" />
<Button
x:Name="OpenDestinationButton"
Text="{Binding OpenDestinationButtonText}"
Clicked="OpenDestination_Clicked"
BackgroundColor="{Binding OpenDestinationButtonColor}"
TextColor="White"
VerticalOptions="End" />

</StackLayout>
</ScrollView>
Expand Down
32 changes: 27 additions & 5 deletions GeoClient/GeoClient/Views/ItemDetailPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using GeoClient.ViewModels;
using GeoClient.Views.Utils;
using System;
using System.Threading.Tasks;
using GeoClient.Models;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
Expand Down Expand Up @@ -78,7 +79,7 @@ private static Label CreateUnitLabel()
return label;
}

private async void openLocation_Clicked(object sender, EventArgs e)
private async void OpenLocation_Clicked(object sender, EventArgs e)
{
var item = _viewModel.IncidentItem;

Expand All @@ -90,11 +91,32 @@ private async void openLocation_Clicked(object sender, EventArgs e)
}
else
{
await DisplayAlert(
"Adresse nicht verortet",
"Die Adresse konnte leider nicht automatisch verortet werden.",
"OK");
await ShowGeoUriNotAvailableError();
}
}

private async void OpenDestination_Clicked(object sender, EventArgs e)
{
var item = _viewModel.IncidentItem;

var geoUri = GeoPointUtil.CreateGeoUri(item.Destination, "GeoClient: Zielort");

if (geoUri != null)
{
Device.OpenUri(geoUri);
}
else
{
await ShowGeoUriNotAvailableError();
}
}

private async Task ShowGeoUriNotAvailableError()
{
await DisplayAlert(
"Adresse nicht verortet",
"Die Adresse konnte leider nicht automatisch verortet werden.",
"OK");
}
}
}
1 change: 1 addition & 0 deletions GeoClientTests/ServiceTests/IncidentItemFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ private static IncidentItem CreateExpectedItem1()
GeoIncidentType.Task,
"Info 1",
location: new GeoPoint(48, 16),
destination: new GeoPoint(19, 21),
units: new List<UnitOfIncident>
{
CreateUnit1(IncidentTaskState.Abo),
Expand Down
4 changes: 4 additions & 0 deletions GeoClientTests/TestResources/incidents1.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"latitude": 48,
"longitude": 16
},
"destination": {
"latitude": 19,
"longitude": 21
},
"assignedUnits": {
"unit-id-1": "ABO",
"unit-id-2": "Assigned"
Expand Down

0 comments on commit 3556b8d

Please sign in to comment.