diff --git a/GeoClient/GeoClient.Android/GeoClient.Android.csproj b/GeoClient/GeoClient.Android/GeoClient.Android.csproj index 1f61069..9fe6c30 100644 --- a/GeoClient/GeoClient.Android/GeoClient.Android.csproj +++ b/GeoClient/GeoClient.Android/GeoClient.Android.csproj @@ -49,8 +49,10 @@ - false + true d8 + aab + false @@ -79,7 +81,7 @@ - 29.0.0.2 + 71.1600.0 2.4.1 diff --git a/GeoClient/GeoClient.Android/MainActivity.cs b/GeoClient/GeoClient.Android/MainActivity.cs index 338335b..a0134d2 100644 --- a/GeoClient/GeoClient.Android/MainActivity.cs +++ b/GeoClient/GeoClient.Android/MainActivity.cs @@ -31,7 +31,7 @@ public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompa private static readonly int RequestLocationPermissionCode = 1000; private static readonly string[] RequiredLocationPermissions = { Manifest.Permission.AccessFineLocation }; - private static readonly int RequestCameraPermissionCode = 0; + private static readonly int RequestCameraPermissionCode = 1001; private static readonly string[] RequiredCameraPermissions = { Manifest.Permission.Camera }; private static readonly long CleanupTimeoutInMilliseconds = 24 * 60 * 60 * 1000; diff --git a/GeoClient/GeoClient.Android/Properties/AndroidManifest.xml b/GeoClient/GeoClient.Android/Properties/AndroidManifest.xml index 4ecf228..0910704 100644 --- a/GeoClient/GeoClient.Android/Properties/AndroidManifest.xml +++ b/GeoClient/GeoClient.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + @@ -7,5 +7,7 @@ + + \ No newline at end of file diff --git a/GeoClient/GeoClient.iOS/GeoClient.iOS.csproj b/GeoClient/GeoClient.iOS/GeoClient.iOS.csproj index 6fafd88..ced4380 100644 --- a/GeoClient/GeoClient.iOS/GeoClient.iOS.csproj +++ b/GeoClient/GeoClient.iOS/GeoClient.iOS.csproj @@ -62,6 +62,7 @@ ARM64 false Entitlements.plist + --optimize=experimental-xforms-product-type @@ -206,7 +207,7 @@ - + \ No newline at end of file diff --git a/GeoClient/GeoClient.iOS/Info.plist b/GeoClient/GeoClient.iOS/Info.plist index f52a1cf..0885fcc 100644 --- a/GeoClient/GeoClient.iOS/Info.plist +++ b/GeoClient/GeoClient.iOS/Info.plist @@ -28,7 +28,7 @@ CFBundleIdentifier at.wrk.fmd.cocemocl.geoclient CFBundleVersion - 1.2.0 + 1.2.1 UILaunchStoryboardName LaunchScreen CFBundleName @@ -48,7 +48,7 @@ NSLocationWhenInUseUsageDescription GeoClient needs access to the location data in the background to send correct location data CFBundleShortVersionString - 1.2.0 + 1.2.1 UIBackgroundModes location diff --git a/GeoClient/GeoClient.iOS/Properties/AssemblyInfo.cs b/GeoClient/GeoClient.iOS/Properties/AssemblyInfo.cs index 29736ba..832fa36 100644 --- a/GeoClient/GeoClient.iOS/Properties/AssemblyInfo.cs +++ b/GeoClient/GeoClient.iOS/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.2.1.0")] +[assembly: AssemblyFileVersion("1.2.1.0")] diff --git a/GeoClient/GeoClient/GeoClient.csproj b/GeoClient/GeoClient/GeoClient.csproj index ba00ed5..d62518c 100644 --- a/GeoClient/GeoClient/GeoClient.csproj +++ b/GeoClient/GeoClient/GeoClient.csproj @@ -6,9 +6,9 @@ Daniel Steiner, Robert Wittek MIT License App to share the position data - 1.2.0 - 1.2.0.0 - 1.2.0.0 + 1.2.1 + 1.2.1.0 + 1.2.1.0 diff --git a/GeoClient/GeoClient/Services/Location/LocationService.cs b/GeoClient/GeoClient/Services/Location/LocationService.cs deleted file mode 100644 index dcdade7..0000000 --- a/GeoClient/GeoClient/Services/Location/LocationService.cs +++ /dev/null @@ -1,64 +0,0 @@ -using GeoClient.Services.Registration; -using System; -using Xamarin.Essentials; -using Xamarin.Forms; - -namespace GeoClient.Services.Location -{ - public class LocationService - { - private readonly TimeSpan _timeoutToWaitForLocation = TimeSpan.FromSeconds(30); - - private readonly RegistrationService _registrationService; - private readonly LocationChangeRegistry _locationChangeRegistry; - - // Explicit static constructor to tell C# compiler - // not to mark type as beforefieldinit - static LocationService() - { - } - - private LocationService() - { - _registrationService = RegistrationService.Instance; - _locationChangeRegistry = LocationChangeRegistry.Instance; - } - - public static LocationService Instance { get; } = new LocationService(); - - public void TriggerLocationAsync() - { - if (!_registrationService.IsRegistered()) - { - Console.WriteLine("There is no unit registered. Reading location data is skipped."); - return; - } - - try - { - var request = new GeolocationRequest(GeolocationAccuracy.High, _timeoutToWaitForLocation); - Device.BeginInvokeOnMainThread(async () => - { - Console.WriteLine("Request location from device."); - - var location = await Geolocation.GetLocationAsync(request); - - if (location != null) - InformListeners(location); - else - Console.WriteLine("GeoLocation did not return a location."); - }); - - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - } - } - - private void InformListeners(Xamarin.Essentials.Location location) - { - _locationChangeRegistry.LocationUpdated(location); - } - } -} diff --git a/GeoClient/GeoClient/Services/Registration/RegistrationService.cs b/GeoClient/GeoClient/Services/Registration/RegistrationService.cs index 144d118..85e6c31 100644 --- a/GeoClient/GeoClient/Services/Registration/RegistrationService.cs +++ b/GeoClient/GeoClient/Services/Registration/RegistrationService.cs @@ -128,6 +128,7 @@ private void SetRegisteredUnitInformation(UnitInformation value) private void ParseRegistrationInfoFromUrl(string url) { + _registeredUnitInformation = null; var wasRegisteredBefore = IsRegistered(); _cachedRegistrationInfo = RegistrationInfoParser.ParseRegistrationInfo(url); var isRegisteredAfterUpdate = IsRegistered(); diff --git a/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs b/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs index a821284..98d732a 100644 --- a/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs +++ b/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs @@ -12,12 +12,14 @@ public class ItemDetailViewModel : BaseViewModel public Color OpenLocationButtonColor => GetOpenLocationButtonColor(); public string OpenLocationButtonText => GetOpenLocationButtonText(); + public bool IsOpenLocationButtonApplicable => IsOpenLocationApplicable(); public Color OpenDestinationButtonColor => GetOpenDestinationButtonColor(); public string OpenDestinationButtonText => GetOpenDestinationButtonText(); public Color SetNextStateButtonColor => GetSetNextStateButtonColor(); public string SetNextStateButtonText => GetSetNextStateButtonText(); + public bool IsNextStateButtonVisible => IsNextStateActionApplicable(); public ItemDetailViewModel(IncidentItem incidentItem = null) { @@ -40,6 +42,11 @@ private bool IsLocationAvailable() return IncidentItem?.Location != null; } + private bool IsOpenLocationApplicable() + { + return IncidentItem?.Type != GeoIncidentType.Relocation; + } + private Color GetOpenDestinationButtonColor() { return IsDestinationAvailable() ? ActiveButtonColor : DisableButtonColor; @@ -65,6 +72,11 @@ private string GetSetNextStateButtonText() return IsNextStateActionAvailable() ? GenerateNextStateButtonText() : "Statusänderung nicht möglich"; } + private bool IsNextStateActionApplicable() + { + return IncidentItem?.IsUnitAssignedToTask ?? false; + } + private string GenerateNextStateButtonText() { var plannedState = IncidentItem.NextStateAction.PlannedState; diff --git a/GeoClient/GeoClient/Views/AboutPage.xaml b/GeoClient/GeoClient/Views/AboutPage.xaml index 05cb7e4..4bfc7ab 100644 --- a/GeoClient/GeoClient/Views/AboutPage.xaml +++ b/GeoClient/GeoClient/Views/AboutPage.xaml @@ -26,7 +26,7 @@ FontAttributes="Bold" FontSize="Large" /> diff --git a/GeoClient/GeoClient/Views/AboutPage.xaml.cs b/GeoClient/GeoClient/Views/AboutPage.xaml.cs index af4b269..413f509 100644 --- a/GeoClient/GeoClient/Views/AboutPage.xaml.cs +++ b/GeoClient/GeoClient/Views/AboutPage.xaml.cs @@ -1,4 +1,5 @@ -using GeoClient.Services.Location; +using GeoClient.Services.Boundary; +using GeoClient.Services.Location; using GeoClient.Services.Registration; using System; using System.Collections.Generic; @@ -19,10 +20,12 @@ public partial class AboutPage : ContentPage, ILocationUpdateListener private static readonly CultureInfo GermanCultureInfo = new CultureInfo("de-DE"); private readonly RegistrationService _registrationService; + private readonly RestService _restService; public AboutPage() { _registrationService = RegistrationService.Instance; + _restService = RestService.Instance; InitializeComponent(); } @@ -109,11 +112,13 @@ private async Task UpdateRegistrationInformation(bool unregisteredOnPurpose) { if (_registrationService.IsRegistered()) { - DisplayRegistrationInfo(); + // Try to load scope the first time here to show the unit name afterwards. + _restService.GetScope(); await DisplayAlert( "Registrierung erfolgreich", "Dieses Gerät ist nun erfolgreich registriert und sendet den Standort.", "OK"); + DisplayRegistrationInfo(); } else if (unregisteredOnPurpose) { diff --git a/GeoClient/GeoClient/Views/ItemDetailPage.xaml b/GeoClient/GeoClient/Views/ItemDetailPage.xaml index 5ba4dc5..474d04c 100644 --- a/GeoClient/GeoClient/Views/ItemDetailPage.xaml +++ b/GeoClient/GeoClient/Views/ItemDetailPage.xaml @@ -35,7 +35,9 @@ Source="{Binding IncidentItem.OwnTaskStateIcon}" /> - + @@ -82,6 +84,7 @@