Skip to content

Commit

Permalink
Merge pull request #29 from wrk-fmd/develop
Browse files Browse the repository at this point in the history
RELEASE: Version 1.1.1
  • Loading branch information
robo-w authored Feb 20, 2019
2 parents 356d821 + 77c1889 commit 56b0934
Show file tree
Hide file tree
Showing 27 changed files with 698 additions and 138 deletions.
3 changes: 0 additions & 3 deletions .bashrc

This file was deleted.

28 changes: 27 additions & 1 deletion GeoClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoClient.iOS", "GeoClient\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoClient.UWP", "GeoClient\GeoClient.UWP\GeoClient.UWP.csproj", "{FC79F765-A59D-4681-8326-82124E1BA340}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoClient", "GeoClient\GeoClient\GeoClient.csproj", "{FA8B858C-9662-4B4F-86B6-0F6515B5480D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeoClient", "GeoClient\GeoClient\GeoClient.csproj", "{FA8B858C-9662-4B4F-86B6-0F6515B5480D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoClientTests", "GeoClientTests\GeoClientTests.csproj", "{B19C892E-2628-4CA7-AD27-08D406A3B14B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -171,6 +173,30 @@ Global
{FA8B858C-9662-4B4F-86B6-0F6515B5480D}.Release|x86.ActiveCfg = Release|Any CPU
{FA8B858C-9662-4B4F-86B6-0F6515B5480D}.Release|x86.Build.0 = Release|Any CPU
{FA8B858C-9662-4B4F-86B6-0F6515B5480D}.Release|x86.Deploy.0 = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|ARM.Build.0 = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|iPhone.Build.0 = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|x64.ActiveCfg = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|x64.Build.0 = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|x86.ActiveCfg = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Debug|x86.Build.0 = Debug|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|Any CPU.Build.0 = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|ARM.ActiveCfg = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|ARM.Build.0 = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|iPhone.ActiveCfg = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|iPhone.Build.0 = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|x64.ActiveCfg = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|x64.Build.0 = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|x86.ActiveCfg = Release|Any CPU
{B19C892E-2628-4CA7-AD27-08D406A3B14B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion GeoClient/GeoClient.Android/GeoClient.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>false</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
Expand Down
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="10" android:versionName="1.1.0" package="at.wrk.fmd.cocemocl" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="15" android:versionName="1.1.1" 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
2 changes: 1 addition & 1 deletion GeoClient/GeoClient.iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<key>CFBundleIdentifier</key>
<string>com.companyname.GeoClient</string>
<key>CFBundleVersion</key>
<string>1.1.0</string>
<string>1.1.1</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
Expand Down
4 changes: 2 additions & 2 deletions GeoClient/GeoClient/GeoClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Authors>Daniel Steiner, Robert Wittek</Authors>
<Copyright>MIT License</Copyright>
<Description>App to share the position data</Description>
<Version>1.1.0</Version>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<Version>1.1.1</Version>
<AssemblyVersion>1.1.1.0</AssemblyVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
38 changes: 30 additions & 8 deletions GeoClient/GeoClient/Models/GeoPoint.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace GeoClient.Models
namespace GeoClient.Models
{
public class GeoPoint
{
public string Latitude { get; }
public string Longitude { get; }
public double Latitude { get; }
public double Longitude { get; }

public GeoPoint(string latitude, string longitude)
public GeoPoint(double latitude, double longitude)
{
Latitude = latitude;
Longitude = longitude;
}

protected bool Equals(GeoPoint other)
{
return Latitude.Equals(other.Latitude) && Longitude.Equals(other.Longitude);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((GeoPoint) obj);
}

public override int GetHashCode()
{
unchecked
{
return (Latitude.GetHashCode() * 397) ^ Longitude.GetHashCode();
}
}

public override string ToString()
{
return $"{nameof(Latitude)}: {Latitude}, {nameof(Longitude)}: {Longitude}";
}
}
}
110 changes: 102 additions & 8 deletions GeoClient/GeoClient/Models/IncidentItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,98 @@
using GeoClient.Services.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using GeoClient.Views.Utils;
using Xamarin.Forms;

namespace GeoClient.Models
{
public class IncidentItem
public class IncidentItem : IComparable<IncidentItem>
{
public string Id { get; }
public GeoIncidentType? Type { get; set; }
public string Info { get; set; }
public bool Priority { get; set; }
public bool Blue { get; set; }
public GeoPoint Location { get; set; }
public GeoIncidentType? Type { get; }
public string Info { get; }
public bool Priority { get; }
public bool Blue { get; }
public GeoPoint Location { get; }

public SortedSet<Unit> Units { get; set; }
public List<Unit> Units { get; }

public string DescriptiveType => GetDescriptiveType();
public Color BackgroundColor => GetBackgroundColor();
public Color ForegroundColor => GetForegroundColor();
public IncidentTaskState? OwnTaskState => GetOwnTaskState();
public string OwnTaskStateIcon => GetOwnTaskStateIcon();
public string OwnTaskStateDescription => OwnTaskState?.GetDescription();
public bool IsUnitAssignedToTask => GetIsUnitAssignedToTask();

RegistrationService _registrationService = RegistrationService.Instance;

public IncidentItem(string id)
public IncidentItem(
string id,
GeoIncidentType type = GeoIncidentType.Unknown,
string info = "",
bool priority = false,
bool blue = false,
GeoPoint location = null,
List<Unit> units = null)
{
Id = id;
Type = type;
Info = info;
Priority = priority;
Blue = blue;
Location = location;
Units = units ?? new List<Unit>();
}

protected bool Equals(IncidentItem other)
{
return string.Equals(Id, other.Id)
&& Type == other.Type
&& string.Equals(Info, other.Info)
&& Priority == other.Priority
&& Blue == other.Blue
&& Equals(Location, other.Location)
&& ListEquals(Units, other.Units);
}

private bool ListEquals(List<Unit> units, List<Unit> otherUnits)
{
if (units == null)
return otherUnits == null;
if (otherUnits == null)
return false;
return units.SequenceEqual(otherUnits);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((IncidentItem) obj);
}

public override int GetHashCode()
{
unchecked
{
var hashCode = (Id != null ? Id.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Type.GetHashCode();
hashCode = (hashCode * 397) ^ (Info != null ? Info.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Priority.GetHashCode();
hashCode = (hashCode * 397) ^ Blue.GetHashCode();
hashCode = (hashCode * 397) ^ (Location != null ? Location.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Units != null ? Units.GetHashCode() : 0);
return hashCode;
}
}

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}";
}

private string GetDescriptiveType()
Expand Down Expand Up @@ -82,5 +148,33 @@ private string GetOwnTaskStateIcon()
{
return StatusIconResolver.GetIconForTaskState(OwnTaskState);
}

private bool GetIsUnitAssignedToTask()
{
return OwnTaskState != IncidentTaskState.Unknown;
}

public int CompareTo(IncidentItem other)
{
if (ReferenceEquals(this, other)) return 0;
if (ReferenceEquals(null, other)) return 1;

var assignmentComparison = IsUnitAssignedToTask.CompareTo(other.IsUnitAssignedToTask);
if (assignmentComparison != 0)
return -assignmentComparison;

var blueComparison = Blue.CompareTo(other.Blue);
if (blueComparison != 0)
return -blueComparison;

var priorityComparison = Priority.CompareTo(other.Priority);
if (priorityComparison != 0)
return -priorityComparison;

var typeComparison = Nullable.Compare(Type, other.Type);
if (typeComparison != 0) return typeComparison;

return string.Compare(Info, other.Info, StringComparison.OrdinalIgnoreCase);
}
}
}
15 changes: 14 additions & 1 deletion GeoClient/GeoClient/Models/IncidentTaskState.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
namespace GeoClient.Models
using System.ComponentModel;

namespace GeoClient.Models
{
public enum IncidentTaskState
{
[Description("Alarmiert")]
Assigned,

[Description("Zum Berufungsort")]
Zbo,

[Description("Am Berufungsort")]
Abo,

[Description("Zum Abgabeort")]
Zao,

[Description("Am Abgabeort")]
Aao,

[Description("Unbekannt")]
Unknown
}
}
75 changes: 75 additions & 0 deletions GeoClient/GeoClient/Models/Unit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using GeoClient.Services.Utils;
using System;

namespace GeoClient.Models
{
public class Unit : IComparable<Unit>
{
public string Id { get; }
public string Name { get; }

// TODO: This is actually a position, not only a point. There is more detailed information available.
public GeoPoint LastPoint { get; }
public IncidentTaskState State { get; }

public string TaskStateIcon => GetTaskStateIcon();

public Unit(
string id,
string name,
GeoPoint lastPoint = null,
IncidentTaskState state = IncidentTaskState.Unknown)
{
Id = id;
Name = name;
LastPoint = lastPoint;
State = state;
}

public int CompareTo(Unit other)
{
if (ReferenceEquals(this, other)) return 0;
if (ReferenceEquals(null, other)) return 1;
return string.Compare(Name, other.Name, StringComparison.OrdinalIgnoreCase);
}

protected bool Equals(Unit other)
{
return string.Equals(Id, other.Id)
&& string.Equals(Name, other.Name)
&& Equals(LastPoint, other.LastPoint)
&& State == other.State;
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((Unit) obj);
}

public override int GetHashCode()
{
unchecked
{
var hashCode = (Id != null ? Id.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (LastPoint != null ? LastPoint.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (int) State;
return hashCode;
}
}

public override string ToString()
{
return
$"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}, {nameof(LastPoint)}: {LastPoint}, {nameof(State)}: {State}";
}

private string GetTaskStateIcon()
{
return StatusIconResolver.GetIconForTaskState(State);
}
}
}
Loading

0 comments on commit 56b0934

Please sign in to comment.