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 @@ <SubType>Code</SubType> </Compile> <Compile Include="$(MSBuildThisFileDirectory)Models\Logs.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Views\ViewLocationPage.xaml.cs"> - <DependentUpon>ViewLocationPage.xaml</DependentUpon> - <SubType>Code</SubType> - </Compile> + <Compile Include="$(MSBuildThisFileDirectory)Views\ViewLocationPage.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="$(MSBuildThisFileDirectory)MainShell.xaml"> @@ -131,6 +128,7 @@ </ItemGroup> <ItemGroup> <EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\IconSelectPage.xaml"> + <SubType>Designer</SubType> <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> </ItemGroup> @@ -139,26 +137,25 @@ </ItemGroup> <ItemGroup> <EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\CategoryPage.xaml"> + <SubType>Designer</SubType> <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> </ItemGroup> <ItemGroup> <EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\AddCategoryPage.xaml"> + <SubType>Designer</SubType> <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> </ItemGroup> <ItemGroup> <EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\CategorySelectPage.xaml"> + <SubType>Designer</SubType> <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> </ItemGroup> <ItemGroup> <EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\RankPage.xaml"> - <Generator>MSBuild:UpdateDesignTimeXaml</Generator> - </EmbeddedResource> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\ViewLocationPage.xaml"> + <SubType>Designer</SubType> <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> </ItemGroup> 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<Xamarin.Forms.PlatformConfiguration.iOS>().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 @@ -<?xml version="1.0" encoding="utf-8" ?> -<ui:BillingPage xmlns="http://xamarin.com/schemas/2014/forms" - xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:ui="clr-namespace:Billing.UI" - xmlns:v="clr-namespace:Billing.Views" - xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps" - x:Class="Billing.Views.ViewLocationPage" - x:Name="viewLocationPage" - x:DataType="v:ViewLocationPage" - BindingContext="{x:Reference viewLocationPage}"> - <ContentPage.Content> - <maps:Map x:Name="map" IsShowingUser="False" - MoveToLastRegionOnLayoutChange="False"/> - </ContentPage.Content> -</ui:BillingPage> \ 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 @@ </dict> </array> <key>CFBundleVersion</key> - <string>17</string> + <string>18</string> <key>CFBundleShortVersionString</key> <string>1.2.317</string> <key>LSApplicationQueriesSchemes</key>