diff --git a/Billing.Shared/Billing.Shared.projitems b/Billing.Shared/Billing.Shared.projitems index c5c4ccf..3d02ec0 100644 --- a/Billing.Shared/Billing.Shared.projitems +++ b/Billing.Shared/Billing.Shared.projitems @@ -94,10 +94,7 @@ Code - - ViewLocationPage.xaml - Code - + @@ -131,6 +128,7 @@ + Designer MSBuild:UpdateDesignTimeXaml @@ -139,26 +137,25 @@ + Designer MSBuild:UpdateDesignTimeXaml + Designer MSBuild:UpdateDesignTimeXaml + Designer MSBuild:UpdateDesignTimeXaml - MSBuild:UpdateDesignTimeXaml - - - - + Designer MSBuild:UpdateDesignTimeXaml diff --git a/Billing.Shared/Views/AddBillPage.xaml.cs b/Billing.Shared/Views/AddBillPage.xaml.cs index ab913fe..2ae04be 100644 --- a/Billing.Shared/Views/AddBillPage.xaml.cs +++ b/Billing.Shared/Views/AddBillPage.xaml.cs @@ -134,10 +134,12 @@ namespace Billing.Views protected override void OnLoaded() { - editorAmount.SetFocus(); - + if (bill == null) + { + editorAmount.SetFocus(); + } if (bill == null && App.SaveLocation) - { + { _ = GetCurrentLocation(); } else diff --git a/Billing.Shared/Views/ViewLocationPage.cs b/Billing.Shared/Views/ViewLocationPage.cs new file mode 100644 index 0000000..edbded6 --- /dev/null +++ b/Billing.Shared/Views/ViewLocationPage.cs @@ -0,0 +1,35 @@ +using Billing.Models; +using Billing.UI; +using Xamarin.Forms.Maps; +using Xamarin.Forms.PlatformConfiguration.iOSSpecific; + +namespace Billing.Views +{ + public class ViewLocationPage : BillingPage + { + public ViewLocationPage(Bill bill) + { + On().SetUseSafeArea(false); + Title = bill.Name; + + if (bill.Latitude != null && bill.Longitude != null) + { + var position = new Position(bill.Latitude.Value, bill.Longitude.Value); + var mapSpan = new MapSpan(position, 0.01, 0.01); + Content = new Map(mapSpan) + { + Pins = + { + new Pin + { + Label = bill.Name, + Type = PinType.Generic, + Position = position, + Address = bill.Store + } + } + }; + } + } + } +} \ No newline at end of file diff --git a/Billing.Shared/Views/ViewLocationPage.xaml b/Billing.Shared/Views/ViewLocationPage.xaml deleted file mode 100644 index c29acad..0000000 --- a/Billing.Shared/Views/ViewLocationPage.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Billing.Shared/Views/ViewLocationPage.xaml.cs b/Billing.Shared/Views/ViewLocationPage.xaml.cs deleted file mode 100644 index 6d28a95..0000000 --- a/Billing.Shared/Views/ViewLocationPage.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Billing.Models; -using Billing.UI; -using Xamarin.Forms.Maps; - -namespace Billing.Views -{ - public partial class ViewLocationPage : BillingPage - { - //private readonly Bill bill; - - public ViewLocationPage(Bill bill) - { - //this.bill = bill; - Title = bill.Name; - - InitializeComponent(); - - if (bill.Latitude != null && bill.Longitude != null) - { - var address = $"({bill.Latitude}, {bill.Longitude})"; - map.Pins.Add(new Pin - { - Label = string.IsNullOrEmpty(bill.Store) ? address : bill.Store, - Type = PinType.Generic, - Position = new Position(bill.Latitude.Value, bill.Longitude.Value), - Address = address - }); - } - } - } -} \ No newline at end of file diff --git a/Billing/Billing.iOS/AppDelegate.cs b/Billing/Billing.iOS/AppDelegate.cs index a25ca1b..1967264 100644 --- a/Billing/Billing.iOS/AppDelegate.cs +++ b/Billing/Billing.iOS/AppDelegate.cs @@ -19,6 +19,7 @@ namespace Billing.iOS public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Xamarin.Forms.Forms.Init(); + Xamarin.FormsMaps.Init(); string action; if (options != null && options.TryGetValue(UIApplication.LaunchOptionsShortcutItemKey, out var obj) && obj is UIApplicationShortcutItem shortcut) { diff --git a/Billing/Billing.iOS/Info.plist b/Billing/Billing.iOS/Info.plist index 3b5d7bb..8c17c86 100644 --- a/Billing/Billing.iOS/Info.plist +++ b/Billing/Billing.iOS/Info.plist @@ -80,7 +80,7 @@ CFBundleVersion - 17 + 18 CFBundleShortVersionString 1.2.317 LSApplicationQueriesSchemes